Package org.apache.sling.auth.core.impl
Class PathBasedHolder
- java.lang.Object
-
- org.apache.sling.auth.core.impl.PathBasedHolder
-
- All Implemented Interfaces:
Comparable<PathBasedHolder>
- Direct Known Subclasses:
AbstractAuthenticationHandlerHolder
public abstract class PathBasedHolder extends Object implements Comparable<PathBasedHolder>
ThePathBasedHolderprovides the basic abstraction for managing authentication handler and authentication requirements in theSlingAuthenticatorwith the following base functionality:- Provide location of control through its path fields
- Support orderability of instances by being
Comparableand ordering according to thefullPathand theServiceReferenceof the provider service - Support
equals(Object)andhashCode()compatible with theComparableimplementation.
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedPathBasedHolder(String url, org.osgi.framework.ServiceReference<?> serviceReference)Sets up this instance with the given configuration URL provided by the givenserviceReference.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(PathBasedHolder other)Compares this instance to theotherPathBasedHolder instance.booleanequals(Object obj)Returnstrueif the other object is the same as this or if it is an instance of the same class with the same full path and the same provider (ServiceReference).inthashCode()Returns the hash code of the full path.
-
-
-
Field Detail
-
fullPath
protected final String fullPath
The full registration path of this instance. This is the actual URL with which this instance has been created.
-
-
Constructor Detail
-
PathBasedHolder
protected PathBasedHolder(String url, org.osgi.framework.ServiceReference<?> serviceReference)
Sets up this instance with the given configuration URL provided by the givenserviceReference.The
serviceReferencemay benullwhich means the configuration is created by theSlingAuthenticatoritself. Instances whose service reference isnullare always ordered behind instances with non-nullservice references (provided their path is equal.- Parameters:
url- The configuration URL to setup this instance withserviceReference- The reference to the service providing the configuration for this instance.
-
-
Method Detail
-
compareTo
public int compareTo(PathBasedHolder other)
Compares this instance to theotherPathBasedHolder instance. Comparison takes into account thepathfirst. If they are not equal the result is returned: If theotherpath is lexicographically sorted behind thispatha value larger than zero is returned; otherwise a value smaller than zero is returned.If the paths are the same, a positive number is returned if the
otherservice reference is ordered after this service reference. If the service reference is the same, zero is returned.As a special case, zero is returned if
otheris the same object as this.If this service reference is
null,-1is always returned; if theotherservice reference isnull,+1is returned.- Specified by:
compareToin interfaceComparable<PathBasedHolder>
-
hashCode
public int hashCode()
Returns the hash code of the full path.
-
-