public abstract class GSInstallerResourceProvider extends Object implements ResourceProvider
Constructor and Description |
---|
GSInstallerResourceProvider(Resource.Type type,
ClusterDefinition clusterDefinition)
Construct a resource provider based on the given cluster definition.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addResource(Resource resource)
Add a resource to the set of resources provided by this provider.
|
Set<String> |
checkPropertyIds(Set<String> propertyIds)
Check whether the set of given property ids is supported by this resource
provider.
|
protected static boolean |
contains(Set<String> ids,
String propertyId)
Check to see if the given set contains a property or category id that matches the given property id.
|
RequestStatus |
createResources(Request request)
Create the resources defined by the properties in the given request object.
|
RequestStatus |
deleteResources(Predicate predicate)
Delete the resources selected by the given predicate.
|
protected ClusterDefinition |
getClusterDefinition()
Get the configuration provider.
|
Map<Resource.Type,String> |
getKeyPropertyIds()
Get the key property ids for the resource type associated with this resource
provider.
|
protected Set<String> |
getRequestPropertyIds(Request request,
Predicate predicate)
Get the set of property ids required to satisfy the given request.
|
static ResourceProvider |
getResourceProvider(Resource.Type type,
ClusterDefinition clusterDefinition)
Factory method for obtaining a resource provider based on a given type.
|
Set<Resource> |
getResources(Request request,
Predicate predicate)
Get a set of
resources based on the given request and predicate
information. |
Resource.Type |
getType()
Get the resource provider type.
|
abstract void |
updateProperties(Resource resource,
Request request,
Predicate predicate)
Update the resource with any properties handled by the resource provider.
|
RequestStatus |
updateResources(Request request,
Predicate predicate)
Update the resources selected by the given predicate with the properties
from the given request object.
|
public GSInstallerResourceProvider(Resource.Type type, ClusterDefinition clusterDefinition)
clusterDefinition
- the cluster definitionpublic RequestStatus createResources(Request request) throws SystemException, UnsupportedPropertyException, ResourceAlreadyExistsException, NoSuchParentResourceException
ResourceProvider
createResources
in interface ResourceProvider
request
- the request object which defines the set of properties
for the resources to be createdSystemException
- an internal system exception occurredUnsupportedPropertyException
- 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
ResourceProvider
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.getResources
in interface ResourceProvider
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 occurredUnsupportedPropertyException
- 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
ResourceProvider
updateResources
in interface ResourceProvider
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 occurredUnsupportedPropertyException
- 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(Predicate predicate) throws SystemException, UnsupportedPropertyException, NoSuchResourceException, NoSuchParentResourceException
ResourceProvider
deleteResources
in interface ResourceProvider
predicate
- the predicate object which can be used to filter which
resources are deletedSystemException
- an internal system exception occurredUnsupportedPropertyException
- the request contains unsupported property idsNoSuchResourceException
- the resource instance to be deleted doesn't existNoSuchParentResourceException
- a parent resource of the resource doesn't existpublic Map<Resource.Type,String> getKeyPropertyIds()
ResourceProvider
getKeyPropertyIds
in interface ResourceProvider
public Set<String> checkPropertyIds(Set<String> propertyIds)
ResourceProvider
checkPropertyIds
in interface ResourceProvider
public abstract void updateProperties(Resource resource, Request request, Predicate predicate)
resource
- the resource to updaterequest
- the requestpredicate
- the predicateprotected ClusterDefinition getClusterDefinition()
public Resource.Type getType()
protected Set<String> getRequestPropertyIds(Request request, Predicate predicate)
request
- the requestpredicate
- the predicateprotected static boolean contains(Set<String> ids, String propertyId)
ids
- the set of property/category idspropertyId
- the property idprotected void addResource(Resource resource)
resource
- the resource to addpublic static ResourceProvider getResourceProvider(Resource.Type type, ClusterDefinition clusterDefinition)
type
- the resource typeclusterDefinition
- the cluster definitionCopyright © 2017. All rights reserved.