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>
ThePathBasedHolder
provides the basic abstraction for managing authentication handler and authentication requirements in theSlingAuthenticator
with the following base functionality:- Provide location of control through its path fields
- Support orderability of instances by being
Comparable
and ordering according to thefullPath
and theServiceReference
of the provider service - Support
equals(Object)
andhashCode()
compatible with theComparable
implementation.
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
PathBasedHolder(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 int
compareTo(PathBasedHolder other)
Compares this instance to theother
PathBasedHolder instance.boolean
equals(Object obj)
Returnstrue
if 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
).int
hashCode()
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
serviceReference
may benull
which means the configuration is created by theSlingAuthenticator
itself. Instances whose service reference isnull
are always ordered behind instances with non-null
service 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 theother
PathBasedHolder instance. Comparison takes into account thepath
first. If they are not equal the result is returned: If theother
path is lexicographically sorted behind thispath
a 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
other
service 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
other
is the same object as this.If this service reference is
null
,-1
is always returned; if theother
service reference isnull
,+1
is returned.- Specified by:
compareTo
in interfaceComparable<PathBasedHolder>
-
hashCode
public int hashCode()
Returns the hash code of the full path.
-
-