Package com.sun.identity.entitlement
Class ExactMatchResourceName
- java.lang.Object
-
- com.sun.identity.entitlement.ExactMatchResourceName
-
- All Implemented Interfaces:
ResourceName,Comparator,BaseResourceName<ResourceMatch,EntitlementException>
public class ExactMatchResourceName extends Object implements Comparator, ResourceName
This plugin extends the functionality provided inPrefixResourceNameto provide special handling to URL type prefix resource names incanonicalizemethod like validating port, assigning default port of 80, if port absent etc.
-
-
Constructor Summary
Constructors Constructor Description ExactMatchResourceName()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Stringappend(String superResource, String subResource)Appends sub-resource to super-resource.Stringcanonicalize(String str)Canonicalizes a string.intcompare(Object o1, Object o2)This method is used to compare two url query parameter strings.ResourceMatchcompare(String requestResource, String targetResource, boolean wildcardCompare)Compares two resources.Set<String>getServiceTypeNames()Returns the service type names for which the resource name object can be used.StringgetSubResource(String resource, String superResource)Gets sub-resource from an original resource minus a super resource.voidinitialize(Map configParams)Initializes the resource name with configuration information, usually set by the administrators.booleanmatches(String s, String p)String[]split(String res)Method to split a resource into the smallest necessary sub resource units.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
-
-
-
Method Detail
-
initialize
public void initialize(Map configParams)
Description copied from interface:BaseResourceNameInitializes the resource name with configuration information, usually set by the administrators.- Specified by:
initializein interfaceBaseResourceName<ResourceMatch,EntitlementException>- Parameters:
configParams- configuration parameters as a map. The keys of the map are the configuration parameters. Each key is corresponding to oneStringvalue which specifies the configuration parameter value.
-
canonicalize
public String canonicalize(String str) throws EntitlementException
Canonicalizes a string.- Specified by:
canonicalizein interfaceBaseResourceName<ResourceMatch,EntitlementException>- Parameters:
str- the url string to be canonicalized- Returns:
- the url string in its canonicalized form.
- Throws:
EntitlementException- if the url string is invalid
-
compare
public int compare(Object o1, Object o2)
This method is used to compare two url query parameter strings. A query parameter string is in the form of variablename=value.- Specified by:
comparein interfaceComparator- Parameters:
o1- a url query parameter to be comparedo2- a url query parameter to be compared- Returns:
- -1 if o1 < o2; 0 if o1 = o2; 1 if o1 > o2
-
getSubResource
public String getSubResource(String resource, String superResource)
Description copied from interface:BaseResourceNameGets sub-resource from an original resource minus a super resource. This is the complementary method of append().- Specified by:
getSubResourcein interfaceBaseResourceName<ResourceMatch,EntitlementException>- Parameters:
resource- name of the original resource consisting of the second parametersuperResand the returned valuesuperResource- 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.
-
append
public String append(String superResource, String subResource)
Description copied from interface:BaseResourceNameAppends sub-resource to super-resource.- Specified by:
appendin interfaceBaseResourceName<ResourceMatch,EntitlementException>- 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.
-
compare
public ResourceMatch compare(String requestResource, String targetResource, boolean wildcardCompare)
Description copied from interface:BaseResourceNameCompares two resources.- Specified by:
comparein interfaceBaseResourceName<ResourceMatch,EntitlementException>- Parameters:
requestResource- name of the resource which will be comparedtargetResource- name of the resource which will be compared withwildcardCompare- flag for wildcard comparison- Returns:
- returns
ResourceMatchthat specifies if the resources are exact match, or otherwise.ResourceMatch.NO_MATCHmeans two resources do not matchResourceMatch.EXACT_MATCHmeans two resources matchResourceMatch.SUB_RESOURCE_MATCHmeanscompResis the sub resource of theorigResResourceMatch.SUPER_RESOURCE_MATCHmeanscompResis the super resource of theorigResResourceMatch.WILDCARD_MATCHmeans two resources match with respect to the wildcard
-
getServiceTypeNames
public Set<String> getServiceTypeNames()
Description copied from interface:BaseResourceNameReturns the service type names for which the resource name object can be used.- Specified by:
getServiceTypeNamesin interfaceBaseResourceName<ResourceMatch,EntitlementException>- Returns:
- service type names for which the resource comparator can be used
-
split
public String[] split(String res)
Description copied from interface:BaseResourceNameMethod to split a resource into the smallest necessary sub resource units.- Specified by:
splitin interfaceBaseResourceName<ResourceMatch,EntitlementException>- 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
-
-