org.apache.directory.mitosis.configuration
Class ReplicationConfiguration

java.lang.Object
  extended by org.apache.directory.mitosis.configuration.ReplicationConfiguration

public class ReplicationConfiguration
extends java.lang.Object

A configuration for ReplicationInterceptor. This configuration can be used by calling ReplicationInterceptor.setConfiguration(ReplicationConfiguration).

Author:
The Apache Directory Project Team
'XBean'

Field Summary
static int DEFAULT_LOG_MAX_AGE
           
static int DEFAULT_REPLICATION_INTERVAL
           
static int DEFAULT_RESPONSE_TIMEOUT
           
static int DEFAULT_SERVER_PORT
           
 
Constructor Summary
ReplicationConfiguration()
          Creates a new instance with default properties except for the ReplicaId of the service and the the list of peer Replicas.
 
Method Summary
 void addPeerReplica(Replica peer)
          Adds the specified Replica to the remote peer replica list.
 CSNFactory getCsnFactory()
          Returns the CSNFactory for generating CSNs.
 int getLogMaxAge()
          Returns the maximum age (days) of change logs stored in ReplicationStore.
 java.util.Set<Replica> getPeerReplicas()
          Returns the remote peer replica list.
 java.lang.String getReplicaId()
          Returns the ID of the replica this configuration is configuring.
 int getReplicationInterval()
          Returns the replication data exchange interval (seconds) between two replicas.
 int getResponseTimeout()
          Returns the response timeout value (seconds) for each sent message during the communication between replicas.
 int getServerPort()
          Returns the TCP/IP port number that a ReplicationInterceptor listens to.
 ReplicationStore getStore()
          Returns the ReplicationStore which stores the change log of the replica this configuration is configuring.
 void removeAllPeerReplicas()
          Clears the remote peer replica list.
 void removePeerReplica(Replica peer)
          Removed the specified Replica from the remote peer replica list.
 void setCsnFactory(CSNFactory csnFactory)
          + Sets the CSNFactory for generating CSNs.
 void setLogMaxAge(int logMaxAge)
          Sets the maximum age (days) of change logs stored in ReplicationStore.
 void setPeerReplicas(java.util.Set<java.lang.Object> replicas)
          Sets the remote peer replica list.
 void setReplicaId(java.lang.String replicaId)
          Sets the ID of the replica this configuration is configuring.
 void setReplicationInterval(int replicationInterval)
          Sets the replication data exchange interval (seconds) between two replicas.
 void setResponseTimeout(int responseTimeout)
          Sets the response timeout value (seconds) for each sent message during the communication between replicas.
 void setServerPort(int serverPort)
          Sets the TCP/IP port number that a ReplicationInterceptor listens to.
 void setStore(ReplicationStore store)
          Sets the ReplicationStore which stores the change log of the replica this configuration is configuring.
 void validate()
          Validate Mitosis configuration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LOG_MAX_AGE

public static final int DEFAULT_LOG_MAX_AGE
See Also:
Constant Field Values

DEFAULT_REPLICATION_INTERVAL

public static final int DEFAULT_REPLICATION_INTERVAL
See Also:
Constant Field Values

DEFAULT_RESPONSE_TIMEOUT

public static final int DEFAULT_RESPONSE_TIMEOUT
See Also:
Constant Field Values

DEFAULT_SERVER_PORT

public static final int DEFAULT_SERVER_PORT
See Also:
Constant Field Values
Constructor Detail

ReplicationConfiguration

public ReplicationConfiguration()
Creates a new instance with default properties except for the ReplicaId of the service and the the list of peer Replicas. You can set these properties by calling #setReplicaId(ReplicaId) and setPeerReplicas(Set) respectively.

Method Detail

getServerPort

public int getServerPort()
Returns the TCP/IP port number that a ReplicationInterceptor listens to. The default value is DEFAULT_SERVER_PORT.


setServerPort

public void setServerPort(int serverPort)
Sets the TCP/IP port number that a ReplicationInterceptor listens to. The default value is DEFAULT_SERVER_PORT.


getResponseTimeout

public int getResponseTimeout()
Returns the response timeout value (seconds) for each sent message during the communication between replicas. If any response message is not received within this timeout, the connection is closed and reestablished. The default value is DEFAULT_RESPONSE_TIMEOUT.


setResponseTimeout

public void setResponseTimeout(int responseTimeout)
Sets the response timeout value (seconds) for each sent message during the communication between replicas. If any response message is not received within this timeout, the connection is closed and reestablished. The default value is DEFAULT_RESPONSE_TIMEOUT.


getReplicationInterval

public int getReplicationInterval()
Returns the replication data exchange interval (seconds) between two replicas. The default value is DEFAULT_REPLICATION_INTERVAL.

Returns:
0 if automatic replication is disabled

setReplicationInterval

public void setReplicationInterval(int replicationInterval)
Sets the replication data exchange interval (seconds) between two replicas. The default value is DEFAULT_REPLICATION_INTERVAL.

Parameters:
replicationInterval - 0 or below to disable automatic replication.

getCsnFactory

public CSNFactory getCsnFactory()
Returns the CSNFactory for generating CSNs. The default factory is DefaultCSNFactory.


setCsnFactory

public void setCsnFactory(CSNFactory csnFactory)
+ Sets the CSNFactory for generating CSNs. The default factory is DefaultCSNFactory.


addPeerReplica

public void addPeerReplica(Replica peer)
Adds the specified Replica to the remote peer replica list.


removePeerReplica

public void removePeerReplica(Replica peer)
Removed the specified Replica from the remote peer replica list.


removeAllPeerReplicas

public void removeAllPeerReplicas()
Clears the remote peer replica list.


getPeerReplicas

public java.util.Set<Replica> getPeerReplicas()
Returns the remote peer replica list.


setPeerReplicas

public void setPeerReplicas(java.util.Set<java.lang.Object> replicas)
Sets the remote peer replica list.


getReplicaId

public java.lang.String getReplicaId()
Returns the ID of the replica this configuration is configuring.


setReplicaId

public void setReplicaId(java.lang.String replicaId)
Sets the ID of the replica this configuration is configuring.


getStore

public ReplicationStore getStore()
Returns the ReplicationStore which stores the change log of the replica this configuration is configuring. The default implementation is DerbyReplicationStore.


setStore

public void setStore(ReplicationStore store)
Sets the ReplicationStore which stores the change log of the replica this configuration is configuring. The default implementation is DerbyReplicationStore.


getLogMaxAge

public int getLogMaxAge()
Returns the maximum age (days) of change logs stored in ReplicationStore. Any change logs and deleted entries older than this value will be purged periodically. The default value is DEFAULT_LOG_MAX_AGE.


setLogMaxAge

public void setLogMaxAge(int logMaxAge)
Sets the maximum age (days) of change logs stored in ReplicationStore. Any change logs and deleted entries older than this value will be purged periodically. The default value is DEFAULT_LOG_MAX_AGE.


validate

public void validate()
              throws ReplicationConfigurationException
Validate Mitosis configuration. We check that the configuration file contains valid parameters :
- a replicaId
- a valid server port (between 0 and 65535)
- a valid response timeout ( > 0 )
- a uuidFactory
- a CSN factory
- a store (derby)
- a list of valid replica, none of them being equal to the replicaId

Throws:
ReplicationConfigurationException - If the configuration file is invalid


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