directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r486160 - in /directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration: ReplicationConfiguration.java ReplicationConfigurationException.java
Date Tue, 12 Dec 2006 14:23:14 GMT
Author: trustin
Date: Tue Dec 12 06:23:13 2006
New Revision: 486160

URL: http://svn.apache.org/viewvc?view=rev&rev=486160
Log:
Added JavaDoc for mitosis.configuration package

Modified:
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfiguration.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfigurationException.java

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfiguration.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfiguration.java?view=diff&rev=486160&r1=486159&r2=486160
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfiguration.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfiguration.java
Tue Dec 12 06:23:13 2006
@@ -29,69 +29,105 @@
 import java.util.Set;
 import java.util.TreeSet;
 
+import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.CSNFactory;
 import org.apache.directory.mitosis.common.Replica;
 import org.apache.directory.mitosis.common.ReplicaId;
 import org.apache.directory.mitosis.common.SimpleCSNFactory;
 import org.apache.directory.mitosis.common.SimpleUUIDFactory;
+import org.apache.directory.mitosis.common.UUID;
 import org.apache.directory.mitosis.common.UUIDFactory;
+import org.apache.directory.mitosis.service.ReplicationService;
 import org.apache.directory.mitosis.store.ReplicationStore;
 import org.apache.directory.mitosis.store.derby.DerbyReplicationStore;
 import org.apache.directory.shared.ldap.util.StringTools;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-
+/**
+ * A configuration for {@link ReplicationService}.  This configuration can be
+ * used by calling {@link ReplicationService#setConfiguration(ReplicationConfiguration)}.
+ * 
+ * @author The Apache Directory Project Team
+ */
 public class ReplicationConfiguration
 {
+    public static final int DEFAULT_LOG_MAX_AGE = 7;
+    public static final int DEFAULT_REPLICATION_INTERVAL = 5;
+    public static final int DEFAULT_RESPONSE_TIMEOUT = 60;
+    public static final int DEFAULT_SERVER_PORT = 7846;
+
     /** The logger */
     private static Logger log = LoggerFactory.getLogger( ReplicationConfiguration.class );
 
     private ReplicaId replicaId;
-    private int serverPort = 7846;
-    private int responseTimeout = 60;
-    private int replicationInterval = 5;
+    private int serverPort = DEFAULT_SERVER_PORT;
+    private int responseTimeout = DEFAULT_RESPONSE_TIMEOUT;
+    private int replicationInterval = DEFAULT_REPLICATION_INTERVAL;
 
     private final Set<Replica> peerReplicas = new HashSet<Replica>();
     
     private UUIDFactory uuidFactory = new SimpleUUIDFactory();
     private CSNFactory csnFactory = new SimpleCSNFactory();
     private ReplicationStore store = new DerbyReplicationStore();
-    private int logMaxAge = 7; // a week (days)
+    private int logMaxAge = DEFAULT_LOG_MAX_AGE; // a week (days)
 
 
+    /**
+     * Creates a new instance with default properties except for
+     * the {@link ReplicaId} of the service and the  the list of peer
+     * {@link Replica}s.  You can set these properties by calling
+     * {@link #setReplicaId(ReplicaId)} and {@link #setPeerReplicas(Set)}
+     * respectively.
+     */
     public ReplicationConfiguration()
     {
     }
 
-
+    /**
+     * Returns the TCP/IP port number that a {@link ReplicationService}
+     * listens to.  The default value is {@link #DEFAULT_SERVER_PORT}. 
+     */
     public int getServerPort()
     {
         return serverPort;
     }
 
 
+    /**
+     * Sets the TCP/IP port number that a {@link ReplicationService}
+     * listens to.  The default value is {@link #DEFAULT_SERVER_PORT}.
+     */
     public void setServerPort( int serverPort )
     {
         this.serverPort = serverPort;
     }
 
-
+    /**
+     * 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 {@link #DEFAULT_RESPONSE_TIMEOUT}.
+     */
     public int getResponseTimeout()
     {
         return 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 {@link #DEFAULT_RESPONSE_TIMEOUT}.
+     */
     public void setResponseTimeout( int responseTimeout )
     {
         this.responseTimeout = responseTimeout;
     }
 
     /**
-     * Returns the replication data exchange interval between two replicas in seconds.
-     * The default value is <tt>5</tt> seconds.
+     * Returns the replication data exchange interval (seconds) between two
+     * replicas. The default value is {@link #DEFAULT_REPLICATION_INTERVAL}.
      * 
      * @return <tt>0</tt> if automatic replication is disabled
      */
@@ -101,50 +137,69 @@
 
 
     /**
-     * Sets the replication data exchange interval between two replicas in seconds.
+     * Sets the replication data exchange interval (seconds) between two
+     * replicas. The default value is {@link #DEFAULT_REPLICATION_INTERVAL}.
      * 
      * @param replicationInterval <tt>0</tt> or below to disable automatic replication.
      */
-	public void setReplicationInterval(int replicationInterval) {
-		if( replicationInterval < 0 ) {
-			replicationInterval = 0;
-		}
-		this.replicationInterval = replicationInterval;
-	}
+    public void setReplicationInterval( int replicationInterval )
+    {
+        if( replicationInterval < 0 )
+        {
+            replicationInterval = 0;
+        }
+        this.replicationInterval = replicationInterval;
+    }
 
 
-	public CSNFactory getCsnFactory()
+    /**
+     * Returns the {@link CSNFactory} for generating {@link CSN}s.
+     * The default factory is {@link SimpleCSNFactory}.
+     */
+    public CSNFactory getCsnFactory()
     {
         return csnFactory;
     }
 
 
+    /**
+     * Sets the {@link CSNFactory} for generating {@link CSN}s.
+     * The default factory is {@link SimpleCSNFactory}.
+     */
     public void setCsnFactory( CSNFactory csnFactory )
     {
         this.csnFactory = csnFactory;
     }
 
-
+    /**
+     * Adds the specified {@link Replica} to the remote peer replica list.
+     */
     public void addPeerReplica( Replica peer )
     {
         assert peer != null;
         peerReplicas.add( peer );
     }
 
-
+    /**
+     * Removed the specified {@link Replica} from the remote peer replica list.
+     */
     public void removePeerReplica( Replica peer )
     {
         assert peer != null;
         peerReplicas.remove( peer );
     }
 
-
+    /**
+     * Clears the remote peer replica list.
+     */
     public void removeAllPeerReplicas()
     {
         peerReplicas.clear();
     }
 
-
+    /**
+     * Returns the remote peer replica list.
+     */
     public Set<Replica> getPeerReplicas()
     {
         Set<Replica> result = new HashSet<Replica>();
@@ -153,6 +208,9 @@
     }
 
 
+    /**
+     * Sets the remote peer replica list.
+     */
     public void setPeerReplicas( Set replicas )
     {
         assert replicas != null;
@@ -175,50 +233,80 @@
         this.peerReplicas.addAll( normalizedReplicas );
     }
 
-
+    /**
+     * Returns the ID of the replica this configuration is configuring.
+     */
     public ReplicaId getReplicaId()
     {
         return replicaId;
     }
 
-
+    /**
+     * Sets the ID of the replica this configuration is configuring.
+     */
     public void setReplicaId( ReplicaId replicaId )
     {
         assert replicaId != null;
         this.replicaId = replicaId;
     }
 
-
+    /**
+     * Returns the {@link ReplicationStore} which stores the change log
+     * of the replica this configuration is configuring.  The default
+     * implementation is {@link DerbyReplicationStore}.
+     */
     public ReplicationStore getStore()
     {
         return store;
     }
 
-
+    /**
+     * Sets the {@link ReplicationStore} which stores the change log
+     * of the replica this configuration is configuring.  The default
+     * implementation is {@link DerbyReplicationStore}.
+     */
     public void setStore( ReplicationStore store )
     {
         this.store = store;
     }
 
-
+    /**
+     * Returns the {@link UUIDFactory} which generates {@link UUID}s for
+     * new directory entries.  The default implementation is
+     * {@link SimpleUUIDFactory}.
+     */
     public UUIDFactory getUuidFactory()
     {
         return uuidFactory;
     }
 
-
+    /**
+     * Sets the {@link UUIDFactory} which generates {@link UUID}s for
+     * new directory entries.  The default implementation is
+     * {@link SimpleUUIDFactory}.
+     */
     public void setUuidFactory( UUIDFactory uuidFactory )
     {
         this.uuidFactory = uuidFactory;
     }
 
-
+    /**
+     * Returns the maximum age (days) of change logs stored in
+     * {@link ReplicationStore}.  Any change logs and deleted entries
+     * older than this value will be purged periodically.  The default value
+     * is {@link #DEFAULT_LOG_MAX_AGE}.
+     */
     public int getLogMaxAge()
     {
         return logMaxAge;
     }
 
-
+    /**
+     * Sets the maximum age (days) of change logs stored in
+     * {@link ReplicationStore}.  Any change logs and deleted entries
+     * older than this value will be purged periodically.  The default value
+     * is {@link #DEFAULT_LOG_MAX_AGE}.
+     */
     public void setLogMaxAge( int logMaxAge )
     {
         if ( logMaxAge <= 0 )

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfigurationException.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfigurationException.java?view=diff&rev=486160&r1=486159&r2=486160
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfigurationException.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfigurationException.java
Tue Dec 12 06:23:13 2006
@@ -23,6 +23,12 @@
 import org.apache.directory.mitosis.common.ReplicationException;
 
 
+/**
+ * A {@link ReplicationException} which is thrown when there's an error
+ * in {@link ReplicationConfiguration}.
+ * 
+ * @author The Apache Directory Project Team
+ */
 public class ReplicationConfigurationException extends ReplicationException
 {
     /**



Mime
View raw message