public class CompatibleRepositoryVersionResourceProvider extends ReadOnlyResourceProvider
AbstractResourceProvider.Command<T>
Modifier and Type | Field and Description |
---|---|
static String |
REPOSITORY_UPGRADES_SUPPORTED_TYPES_ID |
static String |
REPOSITORY_VERSION_DISPLAY_NAME_PROPERTY_ID |
static String |
REPOSITORY_VERSION_ID_PROPERTY_ID |
static String |
REPOSITORY_VERSION_REPOSITORY_VERSION_PROPERTY_ID |
static String |
REPOSITORY_VERSION_SERVICES |
static String |
REPOSITORY_VERSION_STACK_NAME_PROPERTY_ID |
static String |
REPOSITORY_VERSION_STACK_SERVICES |
static String |
REPOSITORY_VERSION_STACK_VERSION_PROPERTY_ID |
static String |
SUBRESOURCE_OPERATING_SYSTEMS_PROPERTY_ID |
PROPERTIES_ATTRIBUTES_REGEX
Constructor and Description |
---|
CompatibleRepositoryVersionResourceProvider(AmbariManagementController amc)
Create a new resource provider.
|
Modifier and Type | Method and Description |
---|---|
Predicate |
amendPredicate(Predicate predicate)
Identify the case where this is a top-level request, containing ONLY the stack name
and stack version.
|
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. |
protected StackId |
getStackInformationFromUrl(Map<String,Object> propertyMap)
Gets the stack id from the request map
|
createResources, deleteResources, updateResources
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 REPOSITORY_VERSION_ID_PROPERTY_ID
public static final String REPOSITORY_VERSION_STACK_NAME_PROPERTY_ID
public static final String REPOSITORY_VERSION_STACK_VERSION_PROPERTY_ID
public static final String REPOSITORY_VERSION_REPOSITORY_VERSION_PROPERTY_ID
public static final String REPOSITORY_VERSION_DISPLAY_NAME_PROPERTY_ID
public static final String REPOSITORY_UPGRADES_SUPPORTED_TYPES_ID
public static final String REPOSITORY_VERSION_SERVICES
public static final String REPOSITORY_VERSION_STACK_SERVICES
public static final String SUBRESOURCE_OPERATING_SYSTEMS_PROPERTY_ID
public CompatibleRepositoryVersionResourceProvider(AmbariManagementController amc)
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 ReadOnlyResourceProvider
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 existprotected Set<String> getPKPropertyIds()
AbstractResourceProvider
getPKPropertyIds
in class AbstractResourceProvider
protected StackId getStackInformationFromUrl(Map<String,Object> propertyMap)
propertyMap
- the request mapnull
if not found.public Predicate amendPredicate(Predicate predicate)
in -> AndPredicate([stack_name=STACK],[stack_version=2.2]) out-> OrPredicate( AndPredicate([stack_name=STACK],[stack_version=2.2]), AndPredicate([stack_name=STACK],[stack_version=2.3]), AndPredicate([stack_name=STACK],[stack_version=2.4]) )Any input predicate that does not conform to ONLY stack_name/stack_version will revert to the that predicate (return
null
).amendPredicate
in class ReadOnlyResourceProvider
predicate
- the predicate passed in the requestnull
to leave the predicate unchanged.Copyright © 2022 Apache Software Foundation. All rights reserved.