Interface BaseResourceName<T,E extends Exception>
- Type Parameters:
T
- The type that the compare method is going to return instances of.E
- The exception type thrown by the canonicalize method.
- All Known Subinterfaces:
ResourceName
,ResourceName
The interface
ResourceName
provides
methods to determine the hierarchy of resource names.
It provides methods to compare resources, get sub resources etc.
Also it provides an interface to determine the service
type to which it be used. Service developers could
provide an implementation of this interface that will
determine its hierarchy during policy evaluation and
also its display in the GUI. A class that implements
this interface must have a empty constructor.-
Method Summary
Modifier and TypeMethodDescriptionAppends sub-resource to super-resource.canonicalize
(String res) Gets the canonicalized form of a resource string.Compares two resources.Returns the service type names for which the resource name object can be used.getSubResource
(String res, String superRes) Gets sub-resource from an original resource minus a super resource.void
initialize
(Map configParams) Initializes the resource name with configuration information, usually set by the administrators.String[]
Method to split a resource into the smallest necessary sub resource units.
-
Method Details
-
getServiceTypeNames
Returns the service type names for which the resource name object can be used.- Returns:
- service type names for which the resource comparator can be used
-
initialize
Initializes the resource name with configuration information, usually set by the administrators.- Parameters:
configParams
- configuration parameters as a map. The keys of the map are the configuration parameters. Each key is corresponding to oneString
value which specifies the configuration parameter value.
-
compare
Compares two resources.- Parameters:
origRes
- name of the resource which will be comparedcompRes
- name of the resource which will be compared withwildcardCompare
- flag for wildcard comparison- Returns:
- returns
ResourceMatch
that specifies if the resources are exact match, or otherwise.ResourceMatch.NO_MATCH
means two resources do not matchResourceMatch.EXACT_MATCH
means two resources matchResourceMatch.SUB_RESOURCE_MATCH
meanscompRes
is the sub resource of theorigRes
ResourceMatch.SUPER_RESOURCE_MATCH
meanscompRes
is the super resource of theorigRes
ResourceMatch.WILDCARD_MATCH
means two resources match with respect to the wildcard
-
append
Appends sub-resource to super-resource.- Parameters:
superResource
- name of the super-resource to be appended to.subResource
- name of the sub-resource to be appended.- Returns:
- returns the combination resource.
-
getSubResource
Gets sub-resource from an original resource minus a super resource. This is the complementary method of append().- Parameters:
res
- name of the original resource consisting of the second parametersuperRes
and the returned valuesuperRes
- name of the super-resource which the first parameter begins with.- Returns:
- returns the sub-resource which the first parameter ends with. If the first parameter does not begin with the the first parameter, then the return value is null.
-
canonicalize
Gets the canonicalized form of a resource string.- Parameters:
res
- the resource string to be canonicalized- Returns:
- the resource string in its canonicalized form.
- Throws:
E
- if resource string is invalid
-
split
Method to split a resource into the smallest necessary sub resource units.- Parameters:
res
- name of the resource to be split- Returns:
- returns the array of sub-resources, with the first element being what the original resource begins with, and the last one being what it ends with
-