directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r576193 [1/6] - in /directory/apacheds/trunk/mitosis/src: main/java/org/apache/directory/mitosis/common/ main/java/org/apache/directory/mitosis/configuration/ main/java/org/apache/directory/mitosis/service/ main/java/org/apache/directory/mi...
Date Sun, 16 Sep 2007 22:12:09 GMT
Author: elecharny
Date: Sun Sep 16 15:12:06 2007
New Revision: 576193

URL: http://svn.apache.org/viewvc?rev=576193&view=rev
Log:
removed ^M from files

Modified:
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNVector.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/MutableReplicationInterceptorConfiguration.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationInterceptorConfiguration.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/DefaultReplicationContext.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationContext.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationService.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationServiceException.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/Constants.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BaseMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BaseMessageEncoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesAckMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesAckMessageEncoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesMessageEncoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesAckMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesAckMessageEncoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesMessageEncoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryAckMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryAckMessageEncoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageEncoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginAckMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginAckMessageEncoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/LoginMessageEncoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/ReplicationClientProtocolCodecFactory.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/ReplicationServerProtocolCodecFactory.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/ResponseMessageDecoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/codec/ResponseMessageEncoder.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationClientProtocolHandler.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationContextHandler.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationProtocolHandler.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/handler/ReplicationServerProtocolHandler.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/message/BaseMessage.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/message/BeginLogEntriesAckMessage.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/message/LogEntryAckMessage.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/message/LogEntryMessage.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/message/LoginAckMessage.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/message/LoginMessage.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/protocol/message/ResponseMessage.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationLogIterator.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationStore.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationStoreException.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationLogIterator.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStore.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/SQLUtil.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/common/DefaultCSNFactoryTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/AbstractReplicationServiceTestCase.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/AbstractMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesAckMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesAckMessageCodecTest2.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/BeginLogEntriesMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesAckMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/EndLogEntriesMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryAckMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LogEntryMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LoginAckMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/service/protocol/codec/LoginMessageCodecTest.java
    directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNVector.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNVector.java?rev=576193&r1=576192&r2=576193&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNVector.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNVector.java Sun Sep 16 15:12:06 2007
@@ -1,173 +1,173 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.directory.mitosis.common;
-
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientContextHandler;
-import org.apache.directory.shared.ldap.util.EqualsBuilder;
-import org.apache.directory.shared.ldap.util.HashCodeBuilder;
-
-
-/**
- * Creates a set of {@link CSN}s, which is defined in LDUP specification.
- * Each {@link CSN} in the same {@link CSNVector} has different
- * {@link ReplicaId} component from each other.  Its data structure is 
- * similar to a {@link Map} whose key is {@link ReplicaId}.
- * <p>
- * {@link CSNVector} is usually used to represent 'Update Vector (UV)' and
- * 'Purge Vector (PV)'.  Please refer to the LDUP specification and other 
- * Mitosis classes such as {@link ReplicationClientContextHandler}.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- */
-public class CSNVector
-{
-    /**
-     * Declares the Serial Version Uid.
-     *
-     * @see <a
-     *      href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always
-     *      Declare Serial Version Uid</a>
-     */
-    private static final long serialVersionUID = 1L;
-
-    private final Map<ReplicaId,CSN> csns = new HashMap<ReplicaId,CSN>();
-
-    /**
-     * Creates a new empty instance.
-     */
-    public CSNVector()
-    {
-    }
-
-    /**
-     * Adds the specified <tt>csn</tt> to this vector.  If there's a
-     * {@link CSN} with the same {@link ReplicaId}, it is replaced by
-     * the specified <tt>csn</tt>.
-     */
-    public void setCSN( CSN csn )
-    {
-        csns.put( csn.getReplicaId(), csn );
-    }
-
-
-    /**
-     * Adds all {@link CSN}s that the specified <tt>vector</tt> contains to
-     * this vector.  If there's a {@link CSN} with the same {@link ReplicaId}
-     * in this vector, it is replaced by the {@link CSN} in the specified
-     * <tt>vector</tt>.
-     */
-    public void setAllCSN( CSNVector vector )
-    {
-        Iterator<CSN> i = vector.csns.values().iterator();
-        while ( i.hasNext() )
-        {
-            setCSN( i.next() );
-        }
-    }
-
-    /**
-     * Returns the {@link CSN} whith the specified <tt>replicaId</tt> from
-     * this vector.
-     * 
-     * @return <tt>null</tt> if there's no match
-     */
-    public CSN getCSN( ReplicaId replicaId )
-    {
-        return csns.get( replicaId );
-    }
-
-
-    /**
-     * Removed the {@link CSN} whith the specified <tt>replicaId</tt> from
-     * this vector and returns the removed {@link CSN}.
-     * 
-     * @return <tt>null</tt> if there's no match
-     */
-    public CSN removeCSN( ReplicaId replicaId )
-    {
-        return csns.remove( replicaId );
-    }
-
-
-    /**
-     * Returns the {@link Set} of the {@link ReplicaId}s extracted from
-     * the {@link CSN}s in this vector.
-     */
-    public Set<ReplicaId> getReplicaIds()
-    {
-        return csns.keySet();
-    }
-
-    /**
-     * Returns the number of {@link CSN}s that this vector contains.
-     */
-    public int size()
-    {
-        return csns.size();
-    }
-
-    /**
-     * Returns <tt>true</tt> if and if only the specified <tt>object</tt> is
-     * a {@link CSNVector} and contains the {@link CSN}s with the same values.
-     */
-    public boolean equals( Object object )
-    {
-        if ( object == this )
-        {
-            return true;
-        }
-        if ( !( object instanceof CSNVector ) )
-        {
-            return false;
-        }
-        CSNVector rhs = ( CSNVector ) object;
-        return new EqualsBuilder().append( this.csns, rhs.csns ).isEquals();
-    }
-
-    /**
-     * Returns the hash code of this vector, calculated from each {@link CSN}
-     * element. 
-     */
-    public int hashCode()
-    {
-        return new HashCodeBuilder( -33446267, -459427867 ).append( this.csns ).toHashCode();
-    }
-
-    /**
-     * Creates a deep copy of this vector and returns it.
-     */
-    public CSNVector clone()
-    {
-        CSNVector result = new CSNVector();
-        result.csns.putAll( this.csns );
-        return result;
-    }
-
-    public String toString()
-    {
-        return csns.toString();
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.mitosis.common;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientContextHandler;
+import org.apache.directory.shared.ldap.util.EqualsBuilder;
+import org.apache.directory.shared.ldap.util.HashCodeBuilder;
+
+
+/**
+ * Creates a set of {@link CSN}s, which is defined in LDUP specification.
+ * Each {@link CSN} in the same {@link CSNVector} has different
+ * {@link ReplicaId} component from each other.  Its data structure is 
+ * similar to a {@link Map} whose key is {@link ReplicaId}.
+ * <p>
+ * {@link CSNVector} is usually used to represent 'Update Vector (UV)' and
+ * 'Purge Vector (PV)'.  Please refer to the LDUP specification and other 
+ * Mitosis classes such as {@link ReplicationClientContextHandler}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class CSNVector
+{
+    /**
+     * Declares the Serial Version Uid.
+     *
+     * @see <a
+     *      href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always
+     *      Declare Serial Version Uid</a>
+     */
+    private static final long serialVersionUID = 1L;
+
+    private final Map<ReplicaId,CSN> csns = new HashMap<ReplicaId,CSN>();
+
+    /**
+     * Creates a new empty instance.
+     */
+    public CSNVector()
+    {
+    }
+
+    /**
+     * Adds the specified <tt>csn</tt> to this vector.  If there's a
+     * {@link CSN} with the same {@link ReplicaId}, it is replaced by
+     * the specified <tt>csn</tt>.
+     */
+    public void setCSN( CSN csn )
+    {
+        csns.put( csn.getReplicaId(), csn );
+    }
+
+
+    /**
+     * Adds all {@link CSN}s that the specified <tt>vector</tt> contains to
+     * this vector.  If there's a {@link CSN} with the same {@link ReplicaId}
+     * in this vector, it is replaced by the {@link CSN} in the specified
+     * <tt>vector</tt>.
+     */
+    public void setAllCSN( CSNVector vector )
+    {
+        Iterator<CSN> i = vector.csns.values().iterator();
+        while ( i.hasNext() )
+        {
+            setCSN( i.next() );
+        }
+    }
+
+    /**
+     * Returns the {@link CSN} whith the specified <tt>replicaId</tt> from
+     * this vector.
+     * 
+     * @return <tt>null</tt> if there's no match
+     */
+    public CSN getCSN( ReplicaId replicaId )
+    {
+        return csns.get( replicaId );
+    }
+
+
+    /**
+     * Removed the {@link CSN} whith the specified <tt>replicaId</tt> from
+     * this vector and returns the removed {@link CSN}.
+     * 
+     * @return <tt>null</tt> if there's no match
+     */
+    public CSN removeCSN( ReplicaId replicaId )
+    {
+        return csns.remove( replicaId );
+    }
+
+
+    /**
+     * Returns the {@link Set} of the {@link ReplicaId}s extracted from
+     * the {@link CSN}s in this vector.
+     */
+    public Set<ReplicaId> getReplicaIds()
+    {
+        return csns.keySet();
+    }
+
+    /**
+     * Returns the number of {@link CSN}s that this vector contains.
+     */
+    public int size()
+    {
+        return csns.size();
+    }
+
+    /**
+     * Returns <tt>true</tt> if and if only the specified <tt>object</tt> is
+     * a {@link CSNVector} and contains the {@link CSN}s with the same values.
+     */
+    public boolean equals( Object object )
+    {
+        if ( object == this )
+        {
+            return true;
+        }
+        if ( !( object instanceof CSNVector ) )
+        {
+            return false;
+        }
+        CSNVector rhs = ( CSNVector ) object;
+        return new EqualsBuilder().append( this.csns, rhs.csns ).isEquals();
+    }
+
+    /**
+     * Returns the hash code of this vector, calculated from each {@link CSN}
+     * element. 
+     */
+    public int hashCode()
+    {
+        return new HashCodeBuilder( -33446267, -459427867 ).append( this.csns ).toHashCode();
+    }
+
+    /**
+     * Creates a deep copy of this vector and returns it.
+     */
+    public CSNVector clone()
+    {
+        CSNVector result = new CSNVector();
+        result.csns.putAll( this.csns );
+        return result;
+    }
+
+    public String toString()
+    {
+        return csns.toString();
+    }
+}

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/MutableReplicationInterceptorConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/MutableReplicationInterceptorConfiguration.java?rev=576193&r1=576192&r2=576193&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/MutableReplicationInterceptorConfiguration.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/MutableReplicationInterceptorConfiguration.java Sun Sep 16 15:12:06 2007
@@ -1,49 +1,49 @@
-/*
- *   Licensed to the Apache Software Foundation (ASF) under one
- *   or more contributor license agreements.  See the NOTICE file
- *   distributed with this work for additional information
- *   regarding copyright ownership.  The ASF licenses this file
- *   to you under the Apache License, Version 2.0 (the
- *   "License"); you may not use this file except in compliance
- *   with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing,
- *   software distributed under the License is distributed on an
- *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *   KIND, either express or implied.  See the License for the
- *   specific language governing permissions and limitations
- *   under the License.
- *
- */
-package org.apache.directory.mitosis.configuration;
-
-
-/**
- * A specialized mutable version of the InterceptorConfiguration for the 
- * replication service which contains all the parameters to configure 
- * this service.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class MutableReplicationInterceptorConfiguration extends ReplicationInterceptorConfiguration
-{
-    public void setReplicationConfiguration( ReplicationConfiguration replicationConfiguration )
-    {
-        super.setReplicationConfiguration( replicationConfiguration );
-    }
-
-
-    public void setInterceptorClassName( String interceptorClassName )
-    {
-        super.setInterceptorClassName( interceptorClassName );
-    }
-
-
-    public void setName( String name )
-    {
-        super.setName( name );
-    }
-}
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.mitosis.configuration;
+
+
+/**
+ * A specialized mutable version of the InterceptorConfiguration for the 
+ * replication service which contains all the parameters to configure 
+ * this service.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MutableReplicationInterceptorConfiguration extends ReplicationInterceptorConfiguration
+{
+    public void setReplicationConfiguration( ReplicationConfiguration replicationConfiguration )
+    {
+        super.setReplicationConfiguration( replicationConfiguration );
+    }
+
+
+    public void setInterceptorClassName( String interceptorClassName )
+    {
+        super.setInterceptorClassName( interceptorClassName );
+    }
+
+
+    public void setName( String name )
+    {
+        super.setName( name );
+    }
+}

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationInterceptorConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationInterceptorConfiguration.java?rev=576193&r1=576192&r2=576193&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationInterceptorConfiguration.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationInterceptorConfiguration.java Sun Sep 16 15:12:06 2007
@@ -1,48 +1,48 @@
-/*
- *   Licensed to the Apache Software Foundation (ASF) under one
- *   or more contributor license agreements.  See the NOTICE file
- *   distributed with this work for additional information
- *   regarding copyright ownership.  The ASF licenses this file
- *   to you under the Apache License, Version 2.0 (the
- *   "License"); you may not use this file except in compliance
- *   with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- *   Unless required by applicable law or agreed to in writing,
- *   software distributed under the License is distributed on an
- *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *   KIND, either express or implied.  See the License for the
- *   specific language governing permissions and limitations
- *   under the License.
- *
- */
-package org.apache.directory.mitosis.configuration;
-
-
-import org.apache.directory.server.core.configuration.InterceptorConfiguration;
-
-
-/**
- * A specialized InterceptorConfiguration for the replication service which
- * contains all the parameters to configure this service.
- *
- * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
- * @version $Rev$, $Date$
- */
-public class ReplicationInterceptorConfiguration extends InterceptorConfiguration
-{
-    private ReplicationConfiguration replicationConfiguration;
-    
-    
-    public ReplicationConfiguration getReplicationConfiguration()
-    {
-        return replicationConfiguration;
-    }
-    
-    
-    protected void setReplicationConfiguration( ReplicationConfiguration replicationConfiguration )
-    {
-        this.replicationConfiguration = replicationConfiguration;
-    }
-}
+/*
+ *   Licensed to the Apache Software Foundation (ASF) under one
+ *   or more contributor license agreements.  See the NOTICE file
+ *   distributed with this work for additional information
+ *   regarding copyright ownership.  The ASF licenses this file
+ *   to you under the Apache License, Version 2.0 (the
+ *   "License"); you may not use this file except in compliance
+ *   with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing,
+ *   software distributed under the License is distributed on an
+ *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *   KIND, either express or implied.  See the License for the
+ *   specific language governing permissions and limitations
+ *   under the License.
+ *
+ */
+package org.apache.directory.mitosis.configuration;
+
+
+import org.apache.directory.server.core.configuration.InterceptorConfiguration;
+
+
+/**
+ * A specialized InterceptorConfiguration for the replication service which
+ * contains all the parameters to configure this service.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ReplicationInterceptorConfiguration extends InterceptorConfiguration
+{
+    private ReplicationConfiguration replicationConfiguration;
+    
+    
+    public ReplicationConfiguration getReplicationConfiguration()
+    {
+        return replicationConfiguration;
+    }
+    
+    
+    protected void setReplicationConfiguration( ReplicationConfiguration replicationConfiguration )
+    {
+        this.replicationConfiguration = replicationConfiguration;
+    }
+}

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/DefaultReplicationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/DefaultReplicationContext.java?rev=576193&r1=576192&r2=576193&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/DefaultReplicationContext.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/DefaultReplicationContext.java Sun Sep 16 15:12:06 2007
@@ -1,217 +1,217 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.directory.mitosis.service;
-
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Timer;
-import java.util.TimerTask;
-
-import org.apache.directory.mitosis.common.Replica;
-import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
-import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientContextHandler;
-import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientProtocolHandler;
-import org.apache.directory.mitosis.service.protocol.handler.ReplicationContextHandler;
-import org.apache.directory.mitosis.service.protocol.handler.ReplicationProtocolHandler;
-import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.mina.common.IoSession;
-import org.apache.mina.util.SessionLog;
-
-/**
- * The default implementation of {@link ReplicationContext}
- * 
- * @author The Apache Directory Project Team
- */
-public class DefaultReplicationContext implements ReplicationContext
-{
-    private static final Timer expirationTimer = new Timer( "ReplicationMessageExpirer" );
-
-    private final ReplicationService service;
-    private final ReplicationConfiguration configuration;
-    private final DirectoryServiceConfiguration serviceConfiguration;
-    private final IoSession session;
-    private final Map<Integer,ExpirationTask> expirableMessages = new HashMap<Integer,ExpirationTask>();
-    private int nextSequence;
-    private Replica peer;
-    private State state = State.INIT;
-
-
-    public DefaultReplicationContext( ReplicationService service, DirectoryServiceConfiguration serviceCfg,
-        ReplicationConfiguration configuration, IoSession session )
-    {
-        this.service = service;
-        this.configuration = configuration;
-        this.serviceConfiguration = serviceCfg;
-        this.session = session;
-    }
-
-
-    public ReplicationService getService()
-    {
-        return service;
-    }
-
-
-    public ReplicationConfiguration getConfiguration()
-    {
-        return configuration;
-    }
-
-
-    public DirectoryServiceConfiguration getServiceConfiguration()
-    {
-        return serviceConfiguration;
-    }
-
-
-    public IoSession getSession()
-    {
-        return session;
-    }
-
-
-    public int getNextSequence()
-    {
-        return nextSequence++;
-    }
-
-
-    public Replica getPeer()
-    {
-        return peer;
-    }
-
-
-    public void setPeer( Replica peer )
-    {
-        assert peer != null;
-        this.peer = peer;
-    }
-
-
-    public State getState()
-    {
-        return state;
-    }
-
-
-    public void setState( State state )
-    {
-        this.state = state;
-    }
-
-
-    public void scheduleExpiration( Object message )
-    {
-        BaseMessage bm = ( BaseMessage ) message;
-        ExpirationTask task = new ExpirationTask( bm );
-        synchronized ( expirableMessages )
-        {
-            expirableMessages.put( new Integer( bm.getSequence() ), task );
-        }
-
-        expirationTimer.schedule( task, configuration.getResponseTimeout() * 1000L );
-    }
-
-
-    public Object cancelExpiration( int sequence )
-    {
-        ExpirationTask task = removeTask( sequence );
-        if ( task == null )
-        {
-            return null;
-        }
-
-        task.cancel();
-        return task.message;
-    }
-    
-    public boolean replicate()
-    {
-        ReplicationProtocolHandler handler =
-            ( ReplicationProtocolHandler ) this.session.getHandler();
-        if( !( handler instanceof ReplicationClientProtocolHandler ) )
-        {
-            throw new UnsupportedOperationException(
-                    "Only clients can begin replication." );
-        }
-        
-        ReplicationContextHandler contextHandler = handler.getContextHandler();
-        return ( ( ReplicationClientContextHandler ) contextHandler ).beginReplication( this );
-    }
-
-
-    public void cancelAllExpirations()
-    {
-        synchronized ( expirableMessages )
-        {
-            Iterator i = expirableMessages.values().iterator();
-            while ( i.hasNext() )
-            {
-                ( ( ExpirationTask ) i.next() ).cancel();
-            }
-        }
-    }
-
-
-    public int getScheduledExpirations()
-    {
-        synchronized ( expirableMessages )
-        {
-            return expirableMessages.size();
-        }
-    }
-
-
-    private ExpirationTask removeTask( int sequence )
-    {
-        ExpirationTask task;
-        synchronized ( expirableMessages )
-        {
-            task = expirableMessages.remove( new Integer( sequence ) );
-        }
-        return task;
-    }
-
-    private class ExpirationTask extends TimerTask
-    {
-        private final BaseMessage message;
-
-
-        private ExpirationTask( Object message )
-        {
-            this.message = ( BaseMessage ) message;
-        }
-
-
-        public void run()
-        {
-            if ( removeTask( message.getSequence() ) == this )
-            {
-                SessionLog.warn( getSession(), "No response within " + configuration.getResponseTimeout()
-                    + " second(s) for message #" + message.getSequence() );
-                getSession().close();
-            }
-        }
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.mitosis.service;
+
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.Timer;
+import java.util.TimerTask;
+
+import org.apache.directory.mitosis.common.Replica;
+import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
+import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientContextHandler;
+import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientProtocolHandler;
+import org.apache.directory.mitosis.service.protocol.handler.ReplicationContextHandler;
+import org.apache.directory.mitosis.service.protocol.handler.ReplicationProtocolHandler;
+import org.apache.directory.mitosis.service.protocol.message.BaseMessage;
+import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.mina.common.IoSession;
+import org.apache.mina.util.SessionLog;
+
+/**
+ * The default implementation of {@link ReplicationContext}
+ * 
+ * @author The Apache Directory Project Team
+ */
+public class DefaultReplicationContext implements ReplicationContext
+{
+    private static final Timer expirationTimer = new Timer( "ReplicationMessageExpirer" );
+
+    private final ReplicationService service;
+    private final ReplicationConfiguration configuration;
+    private final DirectoryServiceConfiguration serviceConfiguration;
+    private final IoSession session;
+    private final Map<Integer,ExpirationTask> expirableMessages = new HashMap<Integer,ExpirationTask>();
+    private int nextSequence;
+    private Replica peer;
+    private State state = State.INIT;
+
+
+    public DefaultReplicationContext( ReplicationService service, DirectoryServiceConfiguration serviceCfg,
+        ReplicationConfiguration configuration, IoSession session )
+    {
+        this.service = service;
+        this.configuration = configuration;
+        this.serviceConfiguration = serviceCfg;
+        this.session = session;
+    }
+
+
+    public ReplicationService getService()
+    {
+        return service;
+    }
+
+
+    public ReplicationConfiguration getConfiguration()
+    {
+        return configuration;
+    }
+
+
+    public DirectoryServiceConfiguration getServiceConfiguration()
+    {
+        return serviceConfiguration;
+    }
+
+
+    public IoSession getSession()
+    {
+        return session;
+    }
+
+
+    public int getNextSequence()
+    {
+        return nextSequence++;
+    }
+
+
+    public Replica getPeer()
+    {
+        return peer;
+    }
+
+
+    public void setPeer( Replica peer )
+    {
+        assert peer != null;
+        this.peer = peer;
+    }
+
+
+    public State getState()
+    {
+        return state;
+    }
+
+
+    public void setState( State state )
+    {
+        this.state = state;
+    }
+
+
+    public void scheduleExpiration( Object message )
+    {
+        BaseMessage bm = ( BaseMessage ) message;
+        ExpirationTask task = new ExpirationTask( bm );
+        synchronized ( expirableMessages )
+        {
+            expirableMessages.put( new Integer( bm.getSequence() ), task );
+        }
+
+        expirationTimer.schedule( task, configuration.getResponseTimeout() * 1000L );
+    }
+
+
+    public Object cancelExpiration( int sequence )
+    {
+        ExpirationTask task = removeTask( sequence );
+        if ( task == null )
+        {
+            return null;
+        }
+
+        task.cancel();
+        return task.message;
+    }
+    
+    public boolean replicate()
+    {
+        ReplicationProtocolHandler handler =
+            ( ReplicationProtocolHandler ) this.session.getHandler();
+        if( !( handler instanceof ReplicationClientProtocolHandler ) )
+        {
+            throw new UnsupportedOperationException(
+                    "Only clients can begin replication." );
+        }
+        
+        ReplicationContextHandler contextHandler = handler.getContextHandler();
+        return ( ( ReplicationClientContextHandler ) contextHandler ).beginReplication( this );
+    }
+
+
+    public void cancelAllExpirations()
+    {
+        synchronized ( expirableMessages )
+        {
+            Iterator i = expirableMessages.values().iterator();
+            while ( i.hasNext() )
+            {
+                ( ( ExpirationTask ) i.next() ).cancel();
+            }
+        }
+    }
+
+
+    public int getScheduledExpirations()
+    {
+        synchronized ( expirableMessages )
+        {
+            return expirableMessages.size();
+        }
+    }
+
+
+    private ExpirationTask removeTask( int sequence )
+    {
+        ExpirationTask task;
+        synchronized ( expirableMessages )
+        {
+            task = expirableMessages.remove( new Integer( sequence ) );
+        }
+        return task;
+    }
+
+    private class ExpirationTask extends TimerTask
+    {
+        private final BaseMessage message;
+
+
+        private ExpirationTask( Object message )
+        {
+            this.message = ( BaseMessage ) message;
+        }
+
+
+        public void run()
+        {
+            if ( removeTask( message.getSequence() ) == this )
+            {
+                SessionLog.warn( getSession(), "No response within " + configuration.getResponseTimeout()
+                    + " second(s) for message #" + message.getSequence() );
+                getSession().close();
+            }
+        }
+    }
+}

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationContext.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationContext.java?rev=576193&r1=576192&r2=576193&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationContext.java (original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/service/ReplicationContext.java Sun Sep 16 15:12:06 2007
@@ -1,167 +1,167 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *  
- *    http://www.apache.org/licenses/LICENSE-2.0
- *  
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License. 
- *  
- */
-package org.apache.directory.mitosis.service;
-
-
-import org.apache.directory.mitosis.common.Replica;
-import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
-import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientContextHandler;
-import org.apache.directory.mitosis.service.protocol.handler.ReplicationContextHandler;
-import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerContextHandler;
-import org.apache.directory.server.core.DirectoryServiceConfiguration;
-import org.apache.mina.common.IoSession;
-
-
-/**
- * A <a href="http://www.corej2eepatterns.com/Patterns2ndEd/ContextObject.htm">context object</a>
- * that provides the functions required for a client or a server to implement
- * networking code related with replication communication.  This is provided
- * to and used by {@link ReplicationClientContextHandler} and
- * {@link ReplicationServerContextHandler}.
- *   
- * @author The Apache Directory Project Team
- */
-public interface ReplicationContext
-{
-    /**
-     * Returns <a href="http://mina.apache.org/">MINA</a> {@link IoSession}
-     * instance that is associated with the current connection to
-     * the remote {@link Replica}.
-     */
-    IoSession getSession();
-
-    /**
-     * Returns the current {@link ReplicationConfiguration} of the
-     * {@link Replica} which is managing this context.
-     */
-    ReplicationConfiguration getConfiguration();
-
-    /**
-     * Returns the {@link ReplicationService} which is managing this
-     * context.
-     */
-    ReplicationService getService();
-
-
-    /**
-     * Returns the {@link DirectoryServiceConfiguration} which owns the
-     * {@link ReplicationService} which is managing this context.
-     */
-    DirectoryServiceConfiguration getServiceConfiguration();
-
-
-    /**
-     * Generates a new and unique sequence number of protocol message.
-     * @return the new sequence number.
-     */
-    int getNextSequence();
-
-
-    /**
-     * Returns the remote peer {@link Replica} that this context is connected
-     * to. 
-     */
-    Replica getPeer();
-
-
-    /**
-     * Sets the remote peer {@link Replica} that this context is connected
-     * to.  A user has authenticate the remote peer first and call this method
-     * manually to prevent unauthorized access.
-     */
-    void setPeer( Replica peer );
-
-    /**
-     * Returns the current state of the {@link Replica} this context is
-     * managing.
-     */
-    State getState();
-
-    /**
-     * Sets the current state of the {@link Replica} this context is
-     * managing.
-     */
-    void setState( State state );
-
-
-    /**
-     * Schedules an expiration of the specified <tt>message</tt>.  A user of
-     * this context could call this method with the message it has written out
-     * to the remote peer.  If {@link #cancelExpiration(int)} method is not
-     * invoked within a certain timeout, an exception will be raised to
-     * {@link ReplicationContextHandler#exceptionCaught(ReplicationContext, Throwable)}.
-     */
-    void scheduleExpiration( Object message );
-
-    /**
-     * Cancels the expiration scheduled by calling
-     * {@link #scheduleExpiration(Object)}.  A user of this context could
-     * call this method when the response message has been received to
-     * stop the expiration for the message with the specified
-     * <tt>sequence</tt> number.
-     * 
-     * @return the request message with the specified <tt>sequence</tt> number
-     */
-    Object cancelExpiration( int sequence );
-
-    /**
-     * Cancells all scheduled expirations.  A user of this context could
-     * call this method when the current connection is closed.
-     */
-    void cancelAllExpirations();
-
-    /**
-     * Returns the number of the scheduled experations.  A user of this
-     * contexst could check this value before sending a new message to the
-     * remote peer to prevent {@link OutOfMemoryError} by limiting the number
-     * of the messages which didn't get their responses.
-     */
-    int getScheduledExpirations();
-    
-    
-    /**
-     * Forces this context to send replication data to the peer replica immediately.
-     * 
-     * @return <tt>true</tt> if the replication has been started,
-     *         <tt>false</tt> if the replication didn't start because
-     *         the replication process is already in progress or
-     *         the client is currently logging in to the server yet.
-     */
-    boolean replicate();
-
-    /**
-     * Represents the state of the connection between two {@link Replica}s.
-     * 
-     * @author The Apache Directory Project Team
-     */
-    public enum State
-    {
-        /**
-         * Connection is established.
-         */
-        INIT,
-
-        /**
-         * Client has logged in and is ready to exchange information.
-         */
-        READY,
-        ;
-    }
-}
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.mitosis.service;
+
+
+import org.apache.directory.mitosis.common.Replica;
+import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
+import org.apache.directory.mitosis.service.protocol.handler.ReplicationClientContextHandler;
+import org.apache.directory.mitosis.service.protocol.handler.ReplicationContextHandler;
+import org.apache.directory.mitosis.service.protocol.handler.ReplicationServerContextHandler;
+import org.apache.directory.server.core.DirectoryServiceConfiguration;
+import org.apache.mina.common.IoSession;
+
+
+/**
+ * A <a href="http://www.corej2eepatterns.com/Patterns2ndEd/ContextObject.htm">context object</a>
+ * that provides the functions required for a client or a server to implement
+ * networking code related with replication communication.  This is provided
+ * to and used by {@link ReplicationClientContextHandler} and
+ * {@link ReplicationServerContextHandler}.
+ *   
+ * @author The Apache Directory Project Team
+ */
+public interface ReplicationContext
+{
+    /**
+     * Returns <a href="http://mina.apache.org/">MINA</a> {@link IoSession}
+     * instance that is associated with the current connection to
+     * the remote {@link Replica}.
+     */
+    IoSession getSession();
+
+    /**
+     * Returns the current {@link ReplicationConfiguration} of the
+     * {@link Replica} which is managing this context.
+     */
+    ReplicationConfiguration getConfiguration();
+
+    /**
+     * Returns the {@link ReplicationService} which is managing this
+     * context.
+     */
+    ReplicationService getService();
+
+
+    /**
+     * Returns the {@link DirectoryServiceConfiguration} which owns the
+     * {@link ReplicationService} which is managing this context.
+     */
+    DirectoryServiceConfiguration getServiceConfiguration();
+
+
+    /**
+     * Generates a new and unique sequence number of protocol message.
+     * @return the new sequence number.
+     */
+    int getNextSequence();
+
+
+    /**
+     * Returns the remote peer {@link Replica} that this context is connected
+     * to. 
+     */
+    Replica getPeer();
+
+
+    /**
+     * Sets the remote peer {@link Replica} that this context is connected
+     * to.  A user has authenticate the remote peer first and call this method
+     * manually to prevent unauthorized access.
+     */
+    void setPeer( Replica peer );
+
+    /**
+     * Returns the current state of the {@link Replica} this context is
+     * managing.
+     */
+    State getState();
+
+    /**
+     * Sets the current state of the {@link Replica} this context is
+     * managing.
+     */
+    void setState( State state );
+
+
+    /**
+     * Schedules an expiration of the specified <tt>message</tt>.  A user of
+     * this context could call this method with the message it has written out
+     * to the remote peer.  If {@link #cancelExpiration(int)} method is not
+     * invoked within a certain timeout, an exception will be raised to
+     * {@link ReplicationContextHandler#exceptionCaught(ReplicationContext, Throwable)}.
+     */
+    void scheduleExpiration( Object message );
+
+    /**
+     * Cancels the expiration scheduled by calling
+     * {@link #scheduleExpiration(Object)}.  A user of this context could
+     * call this method when the response message has been received to
+     * stop the expiration for the message with the specified
+     * <tt>sequence</tt> number.
+     * 
+     * @return the request message with the specified <tt>sequence</tt> number
+     */
+    Object cancelExpiration( int sequence );
+
+    /**
+     * Cancells all scheduled expirations.  A user of this context could
+     * call this method when the current connection is closed.
+     */
+    void cancelAllExpirations();
+
+    /**
+     * Returns the number of the scheduled experations.  A user of this
+     * contexst could check this value before sending a new message to the
+     * remote peer to prevent {@link OutOfMemoryError} by limiting the number
+     * of the messages which didn't get their responses.
+     */
+    int getScheduledExpirations();
+    
+    
+    /**
+     * Forces this context to send replication data to the peer replica immediately.
+     * 
+     * @return <tt>true</tt> if the replication has been started,
+     *         <tt>false</tt> if the replication didn't start because
+     *         the replication process is already in progress or
+     *         the client is currently logging in to the server yet.
+     */
+    boolean replicate();
+
+    /**
+     * Represents the state of the connection between two {@link Replica}s.
+     * 
+     * @author The Apache Directory Project Team
+     */
+    public enum State
+    {
+        /**
+         * Connection is established.
+         */
+        INIT,
+
+        /**
+         * Client has logged in and is ready to exchange information.
+         */
+        READY,
+        ;
+    }
+}



Mime
View raw message