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

Field Summary
 
Fields inherited from interface org.apache.directory.server.ldap.replication.consumer.ReplicationConsumer
DIFFERED, NOW
 
Constructor Summary
ReplicationConsumerImpl()
           
 
Method Summary
 boolean connect()
          Connect to the remote server.
 boolean connect(boolean now)
          Connect the consumer, connection immediately or wait before reconnection
 void connectionClosed()
          
 SyncReplConfiguration getConfig()
           
 String getId()
          
 void init(org.apache.directory.server.core.api.DirectoryService directoryservice)
          Init the replication service
 void ping()
          Test the connection with the provider.
 void setConfig(ReplicationConsumerConfig config)
          Sets the configuration of the consumer
 ReplicationStatusEnum startSync()
          Starts the synchronization operation
 void stop()
          Stops the consumer
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, 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 - If the initialization failed

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.

connectionClosed

public void connectionClosed()

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

startSync

public ReplicationStatusEnum startSync()
Starts the synchronization operation

Specified by:
startSync in interface ReplicationConsumer

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

connect

public boolean connect(boolean now)
Connect the consumer, connection immediately or wait before reconnection

Specified by:
connect in interface ReplicationConsumer
Parameters:
now - A param that tells the consumer to connect immediately or not
Returns:
true if the consumer is connected, false otherwise

ping

public void ping()
Test the connection with the provider. It does connect to the provider, and tries to bind on it using the consumer credentials.

Specified by:
ping in interface ReplicationConsumer

stop

public void stop()
Stops the consumer

Specified by:
stop in interface ReplicationConsumer

getId

public String getId()

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

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()


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