public class HostComponentResourceProvider extends AbstractControllerResourceProvider
AbstractResourceProvider.Command<T>
PROPERTIES_ATTRIBUTES_REGEX
Constructor and Description |
---|
HostComponentResourceProvider(AmbariManagementController managementController)
Create a new resource provider for the given management controller.
|
Modifier and Type | Method and Description |
---|---|
Set<String> |
checkPropertyIds(Set<String> propertyIds)
Check whether the set of given property ids is supported by this resource
provider.
|
protected RequestStatus |
createResourcesAuthorized(Request request)
Create the resources defined by the properties in the given request object if authorization was
granted to the authenticated user.
|
protected RequestStatus |
deleteResourcesAuthorized(Request request,
Predicate predicate)
Delete the resources selected by the given predicate if the authenticated user is authorized
to do so.
|
RequestStageContainer |
doUpdateResources(RequestStageContainer stages,
Request request,
Predicate predicate,
boolean performQueryEvaluation,
boolean useGeneratedConfigs,
boolean useClusterHostInfo)
Update resources.
|
protected Set<String> |
getPKPropertyIds()
Get the set of property ids that uniquely identify the resources
of this provider.
|
Set<Resource> |
getResources(Request request,
Predicate predicate)
Get a set of
resources based on the given request and predicate
information. |
RequestStatusResponse |
install(String cluster,
String hostname,
Collection<String> skipInstallForComponents,
Collection<String> dontSkipInstallForComponents,
boolean skipFailure,
boolean useClusterHostInfo) |
boolean |
isDirectTransition(State oldState,
State newState)
Checks if assigning new state does not require performing
any additional actions
|
static String |
joinComponentList(Collection<String> components) |
static boolean |
shouldSkipInstallTaskForComponent(String componentName,
boolean isClientComponent,
Map<String,String> requestProperties) |
RequestStatusResponse |
start(String cluster,
String hostName) |
RequestStatusResponse |
start(String cluster,
String hostName,
Collection<String> installOnlyComponents,
boolean skipFailure,
boolean useClusterHostInfo) |
protected RequestStageContainer |
updateHostComponents(RequestStageContainer stages,
Set<ServiceComponentHostRequest> requests,
Map<String,String> requestProperties,
boolean runSmokeTest,
boolean useGeneratedConfigs,
boolean useClusterHostInfo)
Update the host component identified by the given request object with the
values carried by the given request object.
|
RequestStatus |
updateResources(Request request,
Predicate predicate)
Update the resources selected by the given predicate with the properties
from the given request object.
|
getClusterId, getClusterResourceId, getClusterResourceId, getManagementController, getResourceProvider, getResourceProvider, init
createResources, deleteResources, getRequiredCreateAuthorizations, getRequiredDeleteAuthorizations, getRequiredGetAuthorizations, getRequiredUpdateAuthorizations, getResourceId, getResourcesAuthorized, getResourceType, isAuthorizedToCreateResources, isAuthorizedToDeleteResources, isAuthorizedToGetResources, isAuthorizedToUpdateResources, setRequiredCreateAuthorizations, setRequiredDeleteAuthorizations, setRequiredGetAuthorizations, setRequiredUpdateAuthorizations, updateResourcesAuthorized
addObserver, createResources, getConfigurationRequests, getKeyPropertyIds, getPropertyMaps, getPropertyMaps, getQueryParameterValue, getRequestStatus, getRequestStatus, getRequestStatus, getResources, modifyResources, notifyCreate, notifyDelete, notifyUpdate, parseProperties, updateObservers
checkCategory, checkConfigPropertyIds, containsArguments, getCategoryIds, getPropertyIds, getRegexEntry, getRegexGroups, getRequestPropertyIds, isPatternKey, isPropertyCategoryRequested, isPropertyEntryRequested, isPropertyRequested, setResourceProperty
public static final String HOST_ROLES
public static final String HOST
public static final String SERVICE_COMPONENT_INFO
public static final String ROLE_ID_PROPERTY_ID
public static final String CLUSTER_NAME_PROPERTY_ID
public static final String SERVICE_NAME_PROPERTY_ID
public static final String COMPONENT_NAME_PROPERTY_ID
public static final String DISPLAY_NAME_PROPERTY_ID
public static final String HOST_NAME_PROPERTY_ID
public static final String PUBLIC_HOST_NAME_PROPERTY_ID
public static final String STATE_PROPERTY_ID
public static final String DESIRED_STATE_PROPERTY_ID
public static final String VERSION_PROPERTY_ID
public static final String DESIRED_STACK_ID_PROPERTY_ID
public static final String DESIRED_REPOSITORY_VERSION_PROPERTY_ID
public static final String ACTUAL_CONFIGS_PROPERTY_ID
public static final String STALE_CONFIGS_PROPERTY_ID
public static final String RELOAD_CONFIGS_PROPERTY_ID
public static final String DESIRED_ADMIN_STATE_PROPERTY_ID
public static final String MAINTENANCE_STATE_PROPERTY_ID
public static final String UPGRADE_STATE_PROPERTY_ID
public static final String HOST_PROPERTY_ID
public static final String HREF_PROPERTY_ID
public static final String COMPONENT_PROPERTY_ID
public static final String METRICS_PROPERTY_ID
public static final String PROCESSES_PROPERTY_ID
public static final String ROLE_ID
public static final String CLUSTER_NAME
public static final String SERVICE_NAME
public static final String COMPONENT_NAME
public static final String DISPLAY_NAME
public static final String HOST_NAME
public static final String PUBLIC_HOST_NAME
public static final String STATE
public static final String DESIRED_STATE
public static final String VERSION
public static final String DESIRED_STACK_ID
public static final String DESIRED_REPOSITORY_VERSION
public static final String ACTUAL_CONFIGS
public static final String STALE_CONFIGS
public static final String RELOAD_CONFIGS
public static final String DESIRED_ADMIN_STATE
public static final String MAINTENANCE_STATE
public static final String UPGRADE_STATE
public static final Map<Resource.Type,String> keyPropertyIds
protected static final Set<String> propertyIds
public static final String SKIP_INSTALL_FOR_COMPONENTS
public static final String DO_NOT_SKIP_INSTALL_FOR_COMPONENTS
public static final String ALL_COMPONENTS
public static final String FOR_ALL_COMPONENTS
public static final String FOR_NO_COMPONENTS
public HostComponentResourceProvider(AmbariManagementController managementController)
managementController
- the management controllerprotected RequestStatus createResourcesAuthorized(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
AbstractAuthorizedResourceProvider.createResources(Request)
is not overwritten.createResourcesAuthorized
in class AbstractAuthorizedResourceProvider
request
- the request object which defines the set of properties for the resources to be createdSystemException
- an internal system exception occurredAuthorizationException
- if the authenticated user is not authorized to perform this operationUnsupportedPropertyException
- the request contains unsupported property idsResourceAlreadyExistsException
- attempted to create a resource which already existsNoSuchParentResourceException
- a parent resource of the resource to create doesn't existAbstractAuthorizedResourceProvider.createResources(Request)
public Set<Resource> getResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
resources
based on the given request and predicate
information.
Note that it is not required for this resource provider to completely filter
the set of resources based on the given predicate. It may not be possible
since some of the properties involved may be provided by another
provider
. This partial filtering is allowed because
the predicate will always be applied by the calling cluster controller. The
predicate is made available at this level so that some pre-filtering can be done
as an optimization.
A simple implementation of a resource provider may choose to just return all of
the resources of a given type and allow the calling cluster controller to filter
based on the predicate.
This implementation attempts to authorize the authenticated user before performing the requested
operation. If authorization fails, an AuthorizationException will be thrown.
This method may be overwritten by implementing classes to avoid performing authorization checks
to get resources.getResources
in interface ResourceProvider
getResources
in class AbstractAuthorizedResourceProvider
request
- the request object which defines the desired set of propertiespredicate
- the predicate object which can be used to filter which
resources are returnedSystemException
- an internal system exception occurredAuthorizationException
- if the authenticated user is not authorized to perform this operationUnsupportedPropertyException
- the request contains unsupported property idsNoSuchResourceException
- the requested resource instance doesn't existNoSuchParentResourceException
- a parent resource of the requested resource doesn't existpublic RequestStatus updateResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
updateResources
in interface ResourceProvider
updateResources
in class AbstractAuthorizedResourceProvider
request
- the request object which defines the set of properties
for the resources to be updatedpredicate
- the predicate object which can be used to filter which
resources are updatedSystemException
- an internal system exception occurredAuthorizationException
- if the authenticated user is not authorized to perform this operationUnsupportedPropertyException
- the request contains unsupported property idsNoSuchResourceException
- the resource instance to be updated doesn't existNoSuchParentResourceException
- a parent resource of the resource doesn't existprotected RequestStatus deleteResourcesAuthorized(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
ResourceProvider.deleteResources(Request, Predicate)
is not overwritten.deleteResourcesAuthorized
in class AbstractAuthorizedResourceProvider
predicate
- the predicate object which can be used to filter which resources are deletedSystemException
- an internal system exception occurredAuthorizationException
- if the authenticated user is not authorized to perform this operationUnsupportedPropertyException
- the request contains unsupported property idsNoSuchResourceException
- the resource instance to be deleted doesn't existNoSuchParentResourceException
- a parent resource of the resource doesn't existResourceProvider.deleteResources(Request, Predicate)
public Set<String> checkPropertyIds(Set<String> propertyIds)
ResourceProvider
checkPropertyIds
in interface ResourceProvider
checkPropertyIds
in class BaseProvider
public RequestStatusResponse install(String cluster, String hostname, Collection<String> skipInstallForComponents, Collection<String> dontSkipInstallForComponents, boolean skipFailure, boolean useClusterHostInfo) throws SystemException, UnsupportedPropertyException, NoSuchParentResourceException
public static String joinComponentList(Collection<String> components)
public static boolean shouldSkipInstallTaskForComponent(String componentName, boolean isClientComponent, Map<String,String> requestProperties)
public RequestStatusResponse start(String cluster, String hostName) throws SystemException, UnsupportedPropertyException, NoSuchParentResourceException
public RequestStatusResponse start(String cluster, String hostName, Collection<String> installOnlyComponents, boolean skipFailure, boolean useClusterHostInfo) throws SystemException, UnsupportedPropertyException, NoSuchParentResourceException
protected RequestStageContainer updateHostComponents(RequestStageContainer stages, Set<ServiceComponentHostRequest> requests, Map<String,String> requestProperties, boolean runSmokeTest, boolean useGeneratedConfigs, boolean useClusterHostInfo) throws org.apache.ambari.server.AmbariException, AuthorizationException
stages
- stages of the associated requestrequests
- the request object which defines which host component to
update and the values to setrequestProperties
- the request propertiesrunSmokeTest
- indicates whether or not to run a smoke testorg.apache.ambari.server.AmbariException
- thrown if the resource cannot be updatedAuthorizationException
protected Set<String> getPKPropertyIds()
AbstractResourceProvider
getPKPropertyIds
in class AbstractResourceProvider
public RequestStageContainer doUpdateResources(RequestStageContainer stages, Request request, Predicate predicate, boolean performQueryEvaluation, boolean useGeneratedConfigs, boolean useClusterHostInfo) throws UnsupportedPropertyException, SystemException, NoSuchResourceException, NoSuchParentResourceException
stages
- request stage containerrequest
- requestpredicate
- request predicateperformQueryEvaluation
- should query be evaluated for matching resource setuseGeneratedConfigs
- should update request contains actual configsuseClusterHostInfo
- should update request contain cluster topology infoUnsupportedPropertyException
- an unsupported property was specified in the requestSystemException
- an unknown exception occurredNoSuchResourceException
- the query didn't match any resourcesNoSuchParentResourceException
- a specified parent resource doesn't existCopyright © 2022 Apache Software Foundation. All rights reserved.