public class BlueprintResourceProvider extends AbstractControllerResourceProvider
Modifier and Type | Class and Description |
---|---|
protected static class |
BlueprintResourceProvider.BlueprintConfigPopulationStrategy
The structure of blueprints is evolving where multiple resource
structures are to be supported.
|
protected static class |
BlueprintResourceProvider.BlueprintConfigPopulationStrategyV1
Original blueprint configuration format where configs were a map
of strings.
|
protected static class |
BlueprintResourceProvider.BlueprintConfigPopulationStrategyV2
New blueprint configuration format where configs are a map from 'properties' and
'properties_attributes' to a map of strings.
|
AbstractResourceProvider.Command<T>
Modifier and Type | Field and Description |
---|---|
static String |
BLUEPRINT_NAME_PROPERTY_ID |
static String |
BLUEPRINT_SECURITY_PROPERTY_ID |
static String |
BLUEPRINTS_PROPERTY_ID |
static String |
COMPONENT_NAME_PROPERTY_ID |
static String |
COMPONENT_PROPERTY_ID |
static String |
COMPONENT_PROVISION_ACTION_PROPERTY_ID |
static String |
CONFIGURATION_LIST_CHECK_ERROR_MESSAGE |
static String |
CONFIGURATION_MAP_CHECK_ERROR_MESSAGE |
static String |
CONFIGURATION_MAP_SIZE_CHECK_ERROR_MESSAGE |
static String |
CONFIGURATION_PROPERTY_ID |
static String |
HOST_GROUP_CARDINALITY_PROPERTY_ID |
static String |
HOST_GROUP_NAME_PROPERTY_ID |
static String |
HOST_GROUP_PROPERTY_ID |
static String |
PROPERTIES_ATTRIBUTES_PROPERTY_ID |
static String |
PROPERTIES_PROPERTY_ID |
static String |
REQUEST_BODY_EMPTY_ERROR_MESSAGE |
static String |
SCHEMA_IS_NOT_SUPPORTED_MESSAGE |
static String |
SETTING_PROPERTY_ID |
static String |
STACK_NAME_PROPERTY_ID |
static String |
STACK_VERSION_PROPERTY_ID |
PROPERTIES_ATTRIBUTES_REGEX
Modifier and Type | Method and Description |
---|---|
RequestStatus |
createResources(Request request)
Create the resources defined by the properties in the given request object.
|
RequestStatus |
deleteResources(Request request,
Predicate predicate)
Delete the resources selected by the given predicate.
|
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. |
static void |
init(BlueprintFactory factory,
BlueprintDAO bpDao,
TopologyRequestDAO trDao,
SecurityConfigurationFactory securityFactory,
com.google.gson.Gson gson,
AmbariMetaInfo metaInfo)
Static initialization.
|
static List<Map<String,Object>> |
populateSettingList(Collection<? extends BlueprintSettingEntity> settings)
Populate a list of setting property maps from a collection of setting entities.
|
protected Resource |
toResource(BlueprintEntity entity,
Set<String> requestedIds)
Create a resource instance from a blueprint entity.
|
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
createResourcesAuthorized, deleteResourcesAuthorized, 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, checkPropertyIds, containsArguments, getCategoryIds, getPropertyIds, getRegexEntry, getRegexGroups, getRequestPropertyIds, isPatternKey, isPropertyCategoryRequested, isPropertyEntryRequested, isPropertyRequested, setResourceProperty
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
checkPropertyIds
public static final String BLUEPRINT_NAME_PROPERTY_ID
public static final String STACK_NAME_PROPERTY_ID
public static final String STACK_VERSION_PROPERTY_ID
public static final String BLUEPRINT_SECURITY_PROPERTY_ID
public static final String BLUEPRINTS_PROPERTY_ID
public static final String HOST_GROUP_PROPERTY_ID
public static final String HOST_GROUP_NAME_PROPERTY_ID
public static final String HOST_GROUP_CARDINALITY_PROPERTY_ID
public static final String COMPONENT_PROPERTY_ID
public static final String COMPONENT_NAME_PROPERTY_ID
public static final String COMPONENT_PROVISION_ACTION_PROPERTY_ID
public static final String CONFIGURATION_PROPERTY_ID
public static final String SETTING_PROPERTY_ID
public static final String PROPERTIES_PROPERTY_ID
public static final String PROPERTIES_ATTRIBUTES_PROPERTY_ID
public static final String SCHEMA_IS_NOT_SUPPORTED_MESSAGE
public static final String REQUEST_BODY_EMPTY_ERROR_MESSAGE
public static final String CONFIGURATION_LIST_CHECK_ERROR_MESSAGE
public static final String CONFIGURATION_MAP_CHECK_ERROR_MESSAGE
public static final String CONFIGURATION_MAP_SIZE_CHECK_ERROR_MESSAGE
public static void init(BlueprintFactory factory, BlueprintDAO bpDao, TopologyRequestDAO trDao, SecurityConfigurationFactory securityFactory, com.google.gson.Gson gson, AmbariMetaInfo metaInfo)
factory
- blueprint factorybpDao
- blueprint data access objectgson
- json serializerprotected Set<String> getPKPropertyIds()
AbstractResourceProvider
getPKPropertyIds
in class AbstractResourceProvider
public RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
createResources
in interface ResourceProvider
createResources
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 existpublic 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 existpublic RequestStatus deleteResources(Request request, Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException
AbstractAuthorizedResourceProvider
deleteResources
in interface ResourceProvider
deleteResources
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 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 existprotected Resource toResource(BlueprintEntity entity, Set<String> requestedIds) throws NoSuchResourceException
entity
- blueprint entityrequestedIds
- requested id'sNoSuchResourceException
public static List<Map<String,Object>> populateSettingList(Collection<? extends BlueprintSettingEntity> settings) throws NoSuchResourceException
settings
- collection of setting entitiesNoSuchResourceException
Copyright © 2022 Apache Software Foundation. All rights reserved.