org.apache.sling.auth.core.impl
Class PathBasedHolder

java.lang.Object
  extended by 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>

The PathBasedHolder provides the basic abstraction for managing authentication handler and authentication requirements in the SlingAuthenticator with the following base functionality:


Field Summary
protected  String fullPath
          The full registration path of this instance.
 
Constructor Summary
protected PathBasedHolder(String url, org.osgi.framework.ServiceReference serviceReference)
          Sets up this instance with the given configuration URL provided by the given serviceReference.
 
Method Summary
 int compareTo(PathBasedHolder other)
          Compares this instance to the other PathBasedHolder instance.
 boolean equals(Object obj)
          Returns true 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.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

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 given serviceReference.

The serviceReference may be null which means the configuration is created by the SlingAuthenticator itself. Instances whose service reference is null are always ordered behind instances with non-null service references (provided their path is equal.

Parameters:
url - The configuration URL to setup this instance with
serviceReference - The reference to the service providing the configuration for this instance.
Method Detail

compareTo

public final int compareTo(PathBasedHolder other)
Compares this instance to the other PathBasedHolder instance. Comparison takes into account the path first. If they are not equal the result is returned: If the other path is lexicographically sorted behind this path 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 the other service reference is null, +1 is returned.

Specified by:
compareTo in interface Comparable<PathBasedHolder>

hashCode

public int hashCode()
Returns the hash code of the full path.

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Returns true 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).

Overrides:
equals in class Object


Copyright © 2007-2013 The Apache Software Foundation. All Rights Reserved.