org.apache.directory.server.core
Class ReferralManagerImpl

java.lang.Object
  extended by org.apache.directory.server.core.ReferralManagerImpl
All Implemented Interfaces:
ReferralManager

public class ReferralManagerImpl
extends java.lang.Object
implements ReferralManager

Implement a referral Manager, handling the requests from the LDAP protocol.
Referrals are stored in a tree, where leaves are the referrals. We are using the very same structure than for the partition manager.

Version:
$Rev$, $Date$
Author:
Apache Directory Project

Constructor Summary
ReferralManagerImpl(DirectoryService directoryService)
          Creates a new instance of ReferralManagerImpl.
 
Method Summary
 void addReferral(org.apache.directory.shared.ldap.entry.ServerEntry entry)
          Add a referral to the manager.
 org.apache.directory.shared.ldap.entry.ServerEntry getParentReferral(org.apache.directory.shared.ldap.name.DN dn)
          Get the DN of the parent referral for a specific DN
 boolean hasParentReferral(org.apache.directory.shared.ldap.name.DN dn)
          Tells if this DN has a parent which is a referral.
 void init(DirectoryService directoryService, java.lang.String... suffixes)
          Initialize the manager, reading all the referrals from the base.
 boolean isReferral(org.apache.directory.shared.ldap.name.DN dn)
          Tells if a DN is a referral (its associated entry contains the Referral ObjectClass).
 void lockRead()
          Get a read-lock on the referralManager.
 void lockWrite()
          Get a write-lock on the referralManager.
 void remove(DirectoryService directoryService, org.apache.directory.shared.ldap.name.DN suffix)
          Remove a partition from the manager, reading all the referrals from the base.
 void removeReferral(org.apache.directory.shared.ldap.entry.ServerEntry entry)
          Remove a referral from the manager.
 void unlock()
          Release the read-write lock on the referralManager.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReferralManagerImpl

public ReferralManagerImpl(DirectoryService directoryService)
                    throws java.lang.Exception
Creates a new instance of ReferralManagerImpl.

Parameters:
directoryService - The directory service
Throws:
java.lang.Exception - If we can't initialize the manager
Method Detail

lockRead

public void lockRead()
Get a read-lock on the referralManager. No read operation can be done on the referralManager if this method is not called before.

Specified by:
lockRead in interface ReferralManager

lockWrite

public void lockWrite()
Get a write-lock on the referralManager. No write operation can be done on the referralManager if this method is not called before.

Specified by:
lockWrite in interface ReferralManager

unlock

public void unlock()
Release the read-write lock on the referralManager. This method must be called after having read or modified the ReferralManager

Specified by:
unlock in interface ReferralManager

addReferral

public void addReferral(org.apache.directory.shared.ldap.entry.ServerEntry entry)
Add a referral to the manager.

Specified by:
addReferral in interface ReferralManager

init

public void init(DirectoryService directoryService,
                 java.lang.String... suffixes)
          throws java.lang.Exception
Initialize the manager, reading all the referrals from the base. The manager will search for every entries having a Referral ObjectClass.

Specified by:
init in interface ReferralManager
Parameters:
directoryService - The associated LDAP service
suffixes - The partition list
Throws:
java.lang.Exception

remove

public void remove(DirectoryService directoryService,
                   org.apache.directory.shared.ldap.name.DN suffix)
            throws java.lang.Exception
Remove a partition from the manager, reading all the referrals from the base. The manager will search for every entries having a Referral ObjectClass, and will remove them from the referrals table.

Specified by:
remove in interface ReferralManager
Parameters:
directoryService - The associated LDAP service
Throws:
java.lang.Exception

hasParentReferral

public boolean hasParentReferral(org.apache.directory.shared.ldap.name.DN dn)
Tells if this DN has a parent which is a referral.
For instance, if cn=example, dc=acme, dc=org is the DN to check, and if dc=acme, dc=org is a referral, this this method will return true.

Specified by:
hasParentReferral in interface ReferralManager
Parameters:
dn - The DN we want to check for a referral in its partents
Returns:
true if there is a parent referral

getParentReferral

public org.apache.directory.shared.ldap.entry.ServerEntry getParentReferral(org.apache.directory.shared.ldap.name.DN dn)
Get the DN of the parent referral for a specific DN

Specified by:
getParentReferral in interface ReferralManager
Parameters:
dn - The DN from which we want to get the parent referral
Returns:
The parent referral of null if none is found

isReferral

public boolean isReferral(org.apache.directory.shared.ldap.name.DN dn)
Tells if a DN is a referral (its associated entry contains the Referral ObjectClass). It does not check that the associated entry inherits from a referral.

Specified by:
isReferral in interface ReferralManager
Parameters:
dn - The entry's DN we want to check
Returns:
true if the DN is associated with a referral

removeReferral

public void removeReferral(org.apache.directory.shared.ldap.entry.ServerEntry entry)
Remove a referral from the manager.

Specified by:
removeReferral in interface ReferralManager


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.