org.apache.directory.server.ldap.replication.consumer
Class ReplicationConsumerImpl

java.lang.Object
  extended by org.apache.directory.server.ldap.replication.consumer.ReplicationConsumerImpl
All Implemented Interfaces:
org.apache.directory.ldap.client.api.ConnectionClosedEventListener, ReplicationConsumer

public class ReplicationConsumerImpl
extends Object
implements org.apache.directory.ldap.client.api.ConnectionClosedEventListener, ReplicationConsumer

Implementation of syncrepl slave a.k.a consumer.

Author:
Apache Directory Project

Constructor Summary
ReplicationConsumerImpl()
           
 
Method Summary
 boolean connect()
          Connect to the remote server.
 void connectionClosed()
          
 void deleteEntries(List<byte[]> uuidList, boolean isRefreshPresent)
          deletes the entries having the UUID given in the list
 void disconnect()
           
 SyncreplConfiguration getConfig()
           
 String getId()
          the identifier of this consumer instance
 org.apache.directory.shared.ldap.model.message.ResultCodeEnum handleSearchDone(org.apache.directory.shared.ldap.model.message.SearchResultDone searchDone)
           
 void handleSearchReference(org.apache.directory.shared.ldap.model.message.SearchResultReference searchRef)
           
 void handleSearchResult(org.apache.directory.shared.ldap.model.message.SearchResultEntry syncResult)
           
 void handleSyncInfo(org.apache.directory.shared.ldap.model.message.IntermediateResponse syncInfoResp)
          
 void init(org.apache.directory.server.core.api.DirectoryService directoryservice)
          Init the replication service
 void prepareSyncSearchRequest()
          prepares a SearchRequest for syncing DIT content.
 void removeCookie()
          deletes the cookie and resets the syncCookie to null
 void setConfig(ReplicationConsumerConfig config)
          sets the configuration of the consumer
 void start()
          starts the consumer
 void startSync()
          starts the synchronization operation
 void stop()
          stops the consumer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReplicationConsumerImpl

public ReplicationConsumerImpl()
Method Detail

getConfig

public SyncreplConfiguration getConfig()
Specified by:
getConfig in interface ReplicationConsumer
Returns:
the config

init

public void init(org.apache.directory.server.core.api.DirectoryService directoryservice)
          throws Exception
Init the replication service

Specified by:
init in interface ReplicationConsumer
Parameters:
directoryservice - The directory service
Throws:
Exception

connect

public boolean connect()
Connect to the remote server. Note that a SyncRepl consumer will be connected to only one remote server

Returns:
true if the connections have been successful.

prepareSyncSearchRequest

public void prepareSyncSearchRequest()
                              throws org.apache.directory.shared.ldap.model.exception.LdapException
prepares a SearchRequest for syncing DIT content.

Throws:
org.apache.directory.shared.ldap.model.exception.LdapException

handleSearchDone

public org.apache.directory.shared.ldap.model.message.ResultCodeEnum handleSearchDone(org.apache.directory.shared.ldap.model.message.SearchResultDone searchDone)

handleSearchReference

public void handleSearchReference(org.apache.directory.shared.ldap.model.message.SearchResultReference searchRef)

handleSearchResult

public void handleSearchResult(org.apache.directory.shared.ldap.model.message.SearchResultEntry syncResult)

handleSyncInfo

public void handleSyncInfo(org.apache.directory.shared.ldap.model.message.IntermediateResponse syncInfoResp)


connectionClosed

public void connectionClosed()

Specified by:
connectionClosed in interface org.apache.directory.ldap.client.api.ConnectionClosedEventListener

startSync

public void startSync()
starts the synchronization operation


setConfig

public void setConfig(ReplicationConsumerConfig config)
sets the configuration of the consumer

Specified by:
setConfig in interface ReplicationConsumer
Parameters:
config - the configuration of the consumer

start

public void start()
starts the consumer

Specified by:
start in interface ReplicationConsumer

stop

public void stop()
stops the consumer

Specified by:
stop in interface ReplicationConsumer

getId

public String getId()
the identifier of this consumer instance

Specified by:
getId in interface ReplicationConsumer
Returns:
the identifier of the consumer instance

disconnect

public void disconnect()

removeCookie

public void removeCookie()
deletes the cookie and resets the syncCookie to null


deleteEntries

public void deleteEntries(List<byte[]> uuidList,
                          boolean isRefreshPresent)
                   throws Exception
deletes the entries having the UUID given in the list

Parameters:
uuidList - the list of UUIDs
Throws:
Exception - in case of any problems while deleting the entries


Copyright © 2003-2012 The Apache Software Foundation. All Rights Reserved.