T - The type that the compare method is going to return instances of.E - The exception type thrown by the canonicalize method.public abstract class BasePrefixResourceName<T,E extends Exception> extends Object implements BaseResourceName<T,E>
BaseResourceName| Modifier and Type | Field and Description |
|---|---|
protected boolean |
caseSensitive
Whether matching is case sensitive.
|
protected Debug |
debug
Debug instance.
|
protected String |
delimiter
Delimiter.
|
protected T |
exactMatch
The object to return on an exact match.
|
protected T |
noMatch
The object to return on no match.
|
protected String |
oneLevelWildcard
String indicating default one level wild card pattern.
|
protected boolean |
oneLevelWildcardEmbedded
boolean indicating if the one level wild card pattern is embedded
in the wild card pattern eg.
|
protected int |
oneLevelWildcardLength
String indicating default one level wild card pattern length.
|
protected T |
subResourceMatch
The object to return on a sub-resource match.
|
protected T |
superResourceMatch
The object to return on a super-resource match.
|
protected String |
wildcard
String indicating default wild card pattern.
|
protected boolean |
wildcardEmbedded
boolean indicating if the wild card pattern is embedded
in the one level wild card pattern eg.
|
protected int |
wildcardLength
String indicating default wild card pattern length.
|
protected T |
wildcardMatch
The object to return on a wildcard match.
|
| Modifier | Constructor and Description |
|---|---|
protected |
BasePrefixResourceName(Debug debug,
T exactMatch,
T noMatch,
T subResourceMatch,
T superResourceMatch,
T wildcardMatch)
Constructs a new BasePrefixResourceName instance.
|
| Modifier and Type | Method and Description |
|---|---|
String |
append(String superResource,
String subResource)
Appends sub-resource to super-resource.
|
String |
canonicalize(String res)
This method is used to canonicalize a prefix resource
It throws an Exception if both regular multi wildcard and
one level wild card appears is same resource String.
|
T |
compare(String requestResource,
String targetResource,
boolean wildcardCompare)
Compares two resources.
|
protected abstract E |
constructResourceInvalidException(Object[] args)
Construct the exception that will be thrown if the resource is invalid during canonicalize.
|
Set<String> |
getServiceTypeNames()
Returns the service type names for which the resource name
object can be used.
|
String |
getSubResource(String resource,
String superResource)
Gets sub-resource from an original resource minus
a super resource.
|
void |
initialize(Map configParams)
Initializes the resource name with configuration information,
usally set by the administrators.
|
protected String |
normalizeRequestResource(String requestResource)
If further normalization of
requestResource is required during comparison, it can be added here. |
protected String |
normalizeTargetResource(String targetResource)
If further normalization of
targetResource is required during comparison, it can be added here. |
T |
oneLevelWildcardCompare(String requestResource,
String targetResource,
boolean wildcardCompare)
Compares two resources containing one level wild card(s).
|
String[] |
split(String res)
Splits the given resource name.
|
protected final T wildcardMatch
protected final T superResourceMatch
protected final T subResourceMatch
protected final T noMatch
protected final T exactMatch
protected String delimiter
protected boolean caseSensitive
protected String wildcard
protected int wildcardLength
protected String oneLevelWildcard
protected int oneLevelWildcardLength
protected boolean wildcardEmbedded
protected boolean oneLevelWildcardEmbedded
protected Debug debug
protected BasePrefixResourceName(Debug debug, T exactMatch, T noMatch, T subResourceMatch, T superResourceMatch, T wildcardMatch)
debug - The debug instance.exactMatch - The object to return on an exact match.noMatch - The object to return on no match.subResourceMatch - The object to return on a sub-resource match.superResourceMatch - The object to return on a super-resource match.wildcardMatch - The object to return on a wildcard match.public void initialize(Map configParams)
delimitercaseSensitivewildcardoneLevelWildcardoneLevelWildcardLengthwildcardLengthwildcardEmbeddedoneLevelWildcardEmbeddedinitialize in interface BaseResourceName<T,E extends Exception>configParams - configuration parameters as a map.
The keys of the map are the configuration paramaters.
Each key is corresponding to one String value
which specifies the configuration paramater value.public Set<String> getServiceTypeNames()
BaseResourceNamegetServiceTypeNames in interface BaseResourceName<T,E extends Exception>public T compare(String requestResource, String targetResource, boolean wildcardCompare)
compare in interface BaseResourceName<T,E extends Exception>requestResource - name of the resource which will be comparedtargetResource - name of the resource which will be compared withwildcardCompare - flag for wildcard comparisonResourceMatch that
specifies if the resources are exact match, or
otherwise.protected String normalizeTargetResource(String targetResource)
targetResource is required during comparison, it can be added here.targetResource - The target resource from the compare method.protected String normalizeRequestResource(String requestResource)
requestResource is required during comparison, it can be added here.requestResource - The target resource from the compare method.public T oneLevelWildcardCompare(String requestResource, String targetResource, boolean wildcardCompare)
requestResource - name of the resource which will be comparedtargetResource - name of the resource which will be compared withwildcardCompare - flag for wildcard comparisonResourceMatch that
specifies if the resources are exact match, or
otherwise.public String append(String superResource, String subResource)
append in interface BaseResourceName<T,E extends Exception>superResource - name of the super-resource to be appended tosubResource - name of the sub-resource to be appendedpublic String getSubResource(String resource, String superResource)
getSubResource in interface BaseResourceName<T,E extends Exception>resource - name of the original resource consisting of
the second parameter superResource and the returned valuesuperResource - name of the super-resource which the first
parameter begins with.public String[] split(String res)
split in interface BaseResourceName<T,E extends Exception>res - the resource name to be splitpublic String canonicalize(String res) throws E extends Exception
canonicalize in interface BaseResourceName<T,E extends Exception>res - the prefix resource string to be canonicalizedE - if resource is invalidE extends ExceptionCopyright © 2010–2023 Open Identity Platform Community. All rights reserved.