org.apache.directory.mitosis.service
Class ReplicationService

java.lang.Object
  extended by org.apache.directory.server.core.interceptor.BaseInterceptor
      extended by org.apache.directory.mitosis.service.ReplicationService
All Implemented Interfaces:
Interceptor

public class ReplicationService
extends BaseInterceptor

An Interceptor that intercepts LDAP operations and propagates the changes occurred by the operations into other Replicas so the DIT of each Replica in the cluster has the same content without any conflict.

Once an operation is invoked, this interceptor transforms it into one or more operations that makes the requested operation more proper and robust for replication. The transformation process is actually just calling a respective factory method in OperationFactory. The methods in OperationFactory returns a new Operation instance.

The newly created Operation is used for three purposes.

The first two actions (modifying the local DIT and storing the Operation to ReplicationStore) are performed automatically when Operation.execute(PartitionNexus, ReplicationStore, AttributeTypeRegistry) method is invoked. ReplicationService always call it instead of forwarding the requested operation to the next Interceptor.

The last action takes place by ReplicationClientContextHandler, which handles TCP/IP connection managed by ClientConnectionManager.

There are two special attributes in the entries to be replicated:


Constructor Summary
ReplicationService()
           
 
Method Summary
 void add(NextInterceptor nextInterceptor, LdapDN normalizedName, javax.naming.directory.Attributes entry)
          Filters Partition.add(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.Attributes) call.
 void delete(NextInterceptor nextInterceptor, LdapDN name)
          Filters Partition.delete(org.apache.directory.shared.ldap.name.LdapDN) call.
 void destroy()
          This method does nothing by default.
 ReplicationConfiguration getConfiguration()
           
 DirectoryServiceConfiguration getFactoryConfiguration()
           
 boolean hasEntry(NextInterceptor nextInterceptor, LdapDN name)
          Filters Partition.lookup(org.apache.directory.shared.ldap.name.LdapDN,String[]) call.
 void init(DirectoryServiceConfiguration serviceCfg, InterceptorConfiguration cfg)
          This method does nothing by default.
 javax.naming.NamingEnumeration list(NextInterceptor nextInterceptor, LdapDN baseName)
          Filters Partition.list(org.apache.directory.shared.ldap.name.LdapDN) call.
 javax.naming.directory.Attributes lookup(NextInterceptor nextInterceptor, LdapDN name)
          Filters Partition.lookup(org.apache.directory.shared.ldap.name.LdapDN) call.
 javax.naming.directory.Attributes lookup(NextInterceptor nextInterceptor, LdapDN name, java.lang.String[] attrIds)
          Filters Partition.lookup(org.apache.directory.shared.ldap.name.LdapDN,String[]) call.
 void modify(NextInterceptor next, LdapDN name, int modOp, javax.naming.directory.Attributes attrs)
          Filters Partition.modify(org.apache.directory.shared.ldap.name.LdapDN,int,javax.naming.directory.Attributes) call.
 void modify(NextInterceptor next, LdapDN name, javax.naming.directory.ModificationItem[] items)
          Filters Partition.modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[]) call.
 void modifyRn(NextInterceptor next, LdapDN oldName, java.lang.String newRDN, boolean deleteOldRDN)
          Filters Partition.modifyRn(org.apache.directory.shared.ldap.name.LdapDN,String,boolean) call.
 void move(NextInterceptor next, LdapDN oldName, LdapDN newParentName)
          Filters Partition.move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN) call.
 void move(NextInterceptor next, LdapDN oldName, LdapDN newParentName, java.lang.String newRDN, boolean deleteOldRDN)
          Filters Partition.move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN,String,boolean) call.
 void purgeAgedData()
          Purges old replication logs and the old entries marked as 'deleted' (i.e.
 void replicate()
          Forces this context to send replication data to the peer replica immediately.
 javax.naming.NamingEnumeration search(NextInterceptor nextInterceptor, LdapDN baseName, java.util.Map environment, ExprNode filter, javax.naming.directory.SearchControls searchControls)
          Filters Partition.search(org.apache.directory.shared.ldap.name.LdapDN,java.util.Map,org.apache.directory.shared.ldap.filter.ExprNode,javax.naming.directory.SearchControls) call.
 void setConfiguration(ReplicationConfiguration cfg)
           
 
Methods inherited from class org.apache.directory.server.core.interceptor.BaseInterceptor
addContextPartition, bind, compare, getContext, getMatchedName, getPrincipal, getRootDSE, getSuffix, isSuffix, listSuffixes, removeContextPartition, unbind
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationService

public ReplicationService()
Method Detail

getConfiguration

public ReplicationConfiguration getConfiguration()

setConfiguration

public void setConfiguration(ReplicationConfiguration cfg)

getFactoryConfiguration

public DirectoryServiceConfiguration getFactoryConfiguration()

init

public void init(DirectoryServiceConfiguration serviceCfg,
                 InterceptorConfiguration cfg)
          throws javax.naming.NamingException
Description copied from class: BaseInterceptor
This method does nothing by default.

Specified by:
init in interface Interceptor
Overrides:
init in class BaseInterceptor
Throws:
javax.naming.NamingException

destroy

public void destroy()
Description copied from class: BaseInterceptor
This method does nothing by default.

Specified by:
destroy in interface Interceptor
Overrides:
destroy in class BaseInterceptor

replicate

public void replicate()
Forces this context to send replication data to the peer replica immediately.


purgeAgedData

public void purgeAgedData()
                   throws javax.naming.NamingException
Purges old replication logs and the old entries marked as 'deleted' (i.e. Constants.ENTRY_DELETED is true). This method should be called periodically to make sure the size of the DIT and ReplicationStore increase limitlessly.

Throws:
javax.naming.NamingException
See Also:
ReplicationConfiguration.setLogMaxAge(int), ReplicationLogCleanJob

add

public void add(NextInterceptor nextInterceptor,
                LdapDN normalizedName,
                javax.naming.directory.Attributes entry)
         throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.add(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.Attributes) call.

Specified by:
add in interface Interceptor
Overrides:
add in class BaseInterceptor
Throws:
javax.naming.NamingException

delete

public void delete(NextInterceptor nextInterceptor,
                   LdapDN name)
            throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.delete(org.apache.directory.shared.ldap.name.LdapDN) call.

Specified by:
delete in interface Interceptor
Overrides:
delete in class BaseInterceptor
Throws:
javax.naming.NamingException

modify

public void modify(NextInterceptor next,
                   LdapDN name,
                   int modOp,
                   javax.naming.directory.Attributes attrs)
            throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.modify(org.apache.directory.shared.ldap.name.LdapDN,int,javax.naming.directory.Attributes) call.

Specified by:
modify in interface Interceptor
Overrides:
modify in class BaseInterceptor
Throws:
javax.naming.NamingException

modify

public void modify(NextInterceptor next,
                   LdapDN name,
                   javax.naming.directory.ModificationItem[] items)
            throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.modify(org.apache.directory.shared.ldap.name.LdapDN,javax.naming.directory.ModificationItem[]) call.

Specified by:
modify in interface Interceptor
Overrides:
modify in class BaseInterceptor
Throws:
javax.naming.NamingException

modifyRn

public void modifyRn(NextInterceptor next,
                     LdapDN oldName,
                     java.lang.String newRDN,
                     boolean deleteOldRDN)
              throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.modifyRn(org.apache.directory.shared.ldap.name.LdapDN,String,boolean) call.

Specified by:
modifyRn in interface Interceptor
Overrides:
modifyRn in class BaseInterceptor
Throws:
javax.naming.NamingException

move

public void move(NextInterceptor next,
                 LdapDN oldName,
                 LdapDN newParentName,
                 java.lang.String newRDN,
                 boolean deleteOldRDN)
          throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN,String,boolean) call.

Specified by:
move in interface Interceptor
Overrides:
move in class BaseInterceptor
Throws:
javax.naming.NamingException

move

public void move(NextInterceptor next,
                 LdapDN oldName,
                 LdapDN newParentName)
          throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.move(org.apache.directory.shared.ldap.name.LdapDN,org.apache.directory.shared.ldap.name.LdapDN) call.

Specified by:
move in interface Interceptor
Overrides:
move in class BaseInterceptor
Throws:
javax.naming.NamingException

hasEntry

public boolean hasEntry(NextInterceptor nextInterceptor,
                        LdapDN name)
                 throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.lookup(org.apache.directory.shared.ldap.name.LdapDN,String[]) call.

Specified by:
hasEntry in interface Interceptor
Overrides:
hasEntry in class BaseInterceptor
Throws:
javax.naming.NamingException

lookup

public javax.naming.directory.Attributes lookup(NextInterceptor nextInterceptor,
                                                LdapDN name)
                                         throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.lookup(org.apache.directory.shared.ldap.name.LdapDN) call.

Specified by:
lookup in interface Interceptor
Overrides:
lookup in class BaseInterceptor
Throws:
javax.naming.NamingException

lookup

public javax.naming.directory.Attributes lookup(NextInterceptor nextInterceptor,
                                                LdapDN name,
                                                java.lang.String[] attrIds)
                                         throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.lookup(org.apache.directory.shared.ldap.name.LdapDN,String[]) call.

Specified by:
lookup in interface Interceptor
Overrides:
lookup in class BaseInterceptor
Throws:
javax.naming.NamingException

list

public javax.naming.NamingEnumeration list(NextInterceptor nextInterceptor,
                                           LdapDN baseName)
                                    throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.list(org.apache.directory.shared.ldap.name.LdapDN) call.

Specified by:
list in interface Interceptor
Overrides:
list in class BaseInterceptor
Throws:
javax.naming.NamingException

search

public javax.naming.NamingEnumeration search(NextInterceptor nextInterceptor,
                                             LdapDN baseName,
                                             java.util.Map environment,
                                             ExprNode filter,
                                             javax.naming.directory.SearchControls searchControls)
                                      throws javax.naming.NamingException
Description copied from interface: Interceptor
Filters Partition.search(org.apache.directory.shared.ldap.name.LdapDN,java.util.Map,org.apache.directory.shared.ldap.filter.ExprNode,javax.naming.directory.SearchControls) call.

Specified by:
search in interface Interceptor
Overrides:
search in class BaseInterceptor
Throws:
javax.naming.NamingException