directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r471319 - /directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/
Date Sun, 05 Nov 2006 01:28:01 GMT
Author: akarasulu
Date: Sat Nov  4 17:28:00 2006
New Revision: 471319

URL: http://svn.apache.org/viewvc?view=rev&rev=471319
Log:
reformatting and getting rid of eclipse warning

Modified:
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSN.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNFactory.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNVector.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/InvalidCSNException.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Replica.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/ReplicaId.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/ReplicationException.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleCSN.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleCSNFactory.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleUUID.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleUUIDFactory.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/UUID.java
    directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/UUIDFactory.java

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSN.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSN.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSN.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSN.java
Sat Nov  4 17:28:00 2006
@@ -19,8 +19,10 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 import java.io.Serializable;
 
+
 /**
  * Represents 'Change Sequence Number' in LDUP specification.
  * 
@@ -39,22 +41,26 @@
      * Returns GMT timestamp of modification.
      */
     long getTimestamp();
-    
+
+
     /**
      * Returns replica ID.
      */
     ReplicaId getReplicaId();
-    
+
+
     /**
      * Returns sequence number of modification.
      */
     int getOperationSequence();
-    
+
+
     /**
      * Returns octet-string representation of this CSN. 
      */
     String toOctetString();
-    
+
+
     /**
      * Returns a byte array representing the CSN
      */

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNFactory.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNFactory.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNFactory.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNFactory.java
Sat Nov  4 17:28:00 2006
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 /**
  * Generates a new {@link CSN}.
  * 
@@ -34,7 +35,8 @@
      *        string.
      */
     CSN newInstance( String replicaId );
-    
+
+
     /**
      * Returns a new {@link CSN}.
      * Generated CSN can be duplicate if user generates CSNs more than 2G 

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNVector.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNVector.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNVector.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/CSNVector.java
Sat Nov  4 17:28:00 2006
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
@@ -27,8 +28,8 @@
 import org.apache.directory.shared.ldap.util.EqualsBuilder;
 import org.apache.directory.shared.ldap.util.HashCodeBuilder;
 
+
 /**
- * 
  * TODO CSNVector.
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
@@ -43,71 +44,84 @@
      *      Declare Serial Version Uid</a>
      */
     private static final long serialVersionUID = 1L;
-    
-    private final Map csns = new HashMap();
-    
+
+    private final Map<ReplicaId,CSN> csns = new HashMap<ReplicaId,CSN>();
+
+
     public CSNVector()
     {
     }
-    
+
+
     public void setCSN( CSN csn )
     {
         csns.put( csn.getReplicaId(), csn );
     }
-    
+
+
     public void setAllCSN( CSNVector uv )
     {
         Iterator i = uv.csns.values().iterator();
-        while( i.hasNext() )
+        while ( i.hasNext() )
         {
             setCSN( ( CSN ) i.next() );
         }
     }
-    
-    public CSN  getCSN( ReplicaId replicaId )
+
+
+    public CSN getCSN( ReplicaId replicaId )
     {
         return ( CSN ) csns.get( replicaId );
     }
-    
-    public CSN  removeCSN( ReplicaId replicaId )
+
+
+    public CSN removeCSN( ReplicaId replicaId )
     {
         return ( CSN ) csns.remove( replicaId );
     }
-    
-    public Set  getReplicaIds()
+
+
+    public Set getReplicaIds()
     {
         return csns.keySet();
     }
-    
+
+
     public int size()
     {
         return csns.size();
     }
 
-    public boolean equals(Object object) {
-        if (object == this) {
+
+    public boolean equals( Object object )
+    {
+        if ( object == this )
+        {
             return true;
         }
-        if (!(object instanceof CSNVector)) {
+        if ( !( object instanceof CSNVector ) )
+        {
             return false;
         }
-        CSNVector rhs = (CSNVector) object;
-        return new EqualsBuilder().append(
-                this.csns, rhs.csns).isEquals();
+        CSNVector rhs = ( CSNVector ) object;
+        return new EqualsBuilder().append( this.csns, rhs.csns ).isEquals();
     }
 
-    public int hashCode() {
-        return new HashCodeBuilder(-33446267, -459427867).append(
-                this.csns).toHashCode();
+
+    public int hashCode()
+    {
+        return new HashCodeBuilder( -33446267, -459427867 ).append( this.csns ).toHashCode();
     }
-    
+
+
     public Object clone()
     {
         CSNVector result = new CSNVector();
         result.csns.putAll( this.csns );
         return result;
     }
-    
+
+
     public String toString()
     {
         return csns.toString();

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Constants.java
Sat Nov  4 17:28:00 2006
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 import javax.naming.NamingException;
 import javax.naming.directory.Attribute;
 import javax.naming.directory.Attributes;
@@ -28,6 +29,7 @@
 import org.apache.directory.server.core.enumeration.SearchResultFilter;
 import org.apache.directory.server.core.invocation.Invocation;
 
+
 /**
  * 
  * TODO Constants.
@@ -39,25 +41,26 @@
     public static final String ENTRY_UUID = "entryUUID";
     public static final String ENTRY_CSN = "entryCSN";
     public static final String ENTRY_DELETED = "entryDeleted";
+    public static final String OBJECT_CLASS_OID = "2.5.4.0";
 
+    
     public static final SearchResultFilter DELETED_ENTRIES_FILTER = new SearchResultFilter()
     {
         public boolean accept( Invocation invocation, SearchResult result, SearchControls
controls )
-                throws NamingException
+            throws NamingException
         {
             if ( controls.getReturningAttributes() == null )
             {
                 Attributes entry = result.getAttributes();
                 Attribute deleted = entry.get( ENTRY_DELETED );
-                Object value = deleted == null? null : deleted.get();
+                Object value = deleted == null ? null : deleted.get();
                 return ( value == null || !"true".equals( value.toString() ) );
             }
 
             return true;
         }
     };
-    
-    public static final String OBJECT_CLASS_OID = "2.5.4.0";
+
 
     private Constants()
     {

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/InvalidCSNException.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/InvalidCSNException.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/InvalidCSNException.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/InvalidCSNException.java
Sat Nov  4 17:28:00 2006
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 /**
  * 
  * InvalidCSNException is thrown when trying to create an invalid CSN.
@@ -36,20 +37,24 @@
      */
     private static final long serialVersionUID = 1L;
 
+
     public InvalidCSNException()
     {
         super();
     }
 
+
     public InvalidCSNException( String message, Throwable cause )
     {
         super( message, cause );
     }
 
+
     public InvalidCSNException( String message )
     {
         super( message );
     }
+
 
     public InvalidCSNException( Throwable cause )
     {

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Replica.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Replica.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Replica.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/Replica.java
Sat Nov  4 17:28:00 2006
@@ -19,12 +19,14 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 import java.net.InetSocketAddress;
 
 import org.apache.directory.shared.ldap.util.StringTools;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+
 /**
  * The class stores a Replica, which is composed of an Id, a server and a port.
  *
@@ -40,10 +42,11 @@
 
     /** The replicaId */
     private final ReplicaId id;
-    
+
     /** The server address */
     private final InetSocketAddress address;
-    
+
+
     /**
      * Creates a new instance of Replica, from a String.
      * 
@@ -60,56 +63,57 @@
             log.error( "Null or empty replica are not allowed" );
             throw new IllegalArgumentException( "Null or empty Replica " );
         }
-        
+
         replica = replica.trim();
-        
+
         int atPos = replica.indexOf( '@' );
-        
+
         if ( atPos <= 0 )
         {
             log.error( "The ReplicaId '@' element is missing in {}", replica );
             throw new IllegalArgumentException( "Replica ID not found: " + replica );
         }
-        
+
         int colonPos = replica.indexOf( ':', atPos );
-        
+
         if ( colonPos < 0 )
         {
             log.error( "Replica port not found in {}", replica );
             throw new IllegalArgumentException( "Port number not found in replica : " + replica
);
         }
-        
+
         id = new ReplicaId( replica.substring( 0, atPos ) );
         String server = replica.substring( atPos + 1, colonPos );
         int port = -1;
-        
+
         try
         {
-            port = Integer.parseInt( replica.substring( colonPos + 1 ) ) ;
+            port = Integer.parseInt( replica.substring( colonPos + 1 ) );
         }
         catch ( NumberFormatException nfe )
         {
             log.error( "The port value should be a value between 1 and 65535, port  : {}",
new Integer( port ) );
             throw new IllegalArgumentException( "Bad port number : " + port );
         }
-        
+
         try
         {
             address = new InetSocketAddress( server, port );
         }
         catch ( IllegalArgumentException iae )
         {
-            log.error(  "The server address/name is invalid ({}) in replica {}", server,
replica );
-            throw new IllegalArgumentException( "The server address/name is invalid in replica
" + replica 
+            log.error( "The server address/name is invalid ({}) in replica {}", server, replica
);
+            throw new IllegalArgumentException( "The server address/name is invalid in replica
" + replica
                 + ", error : " + iae.getMessage() );
         }
-        
+
         if ( IS_DEBUG )
         {
             log.debug( "Created a replica {} on server {}", id, server + ':' + port );
         }
     }
 
+
     /**
      * Creates a new instance of Replica, from a valid Id and a valid address.
      *
@@ -125,6 +129,7 @@
         this.address = address;
     }
 
+
     /**
      * @return the replica address
      */
@@ -133,6 +138,7 @@
         return address;
     }
 
+
     /**
      * @return the replica Id
      */
@@ -140,25 +146,27 @@
     {
         return id;
     }
-    
+
+
     public int hashCode()
     {
         return id.hashCode();
     }
-    
+
+
     public boolean equals( Object o )
     {
-        if( o == null )
+        if ( o == null )
         {
             return false;
         }
-        
-        if( o == this )
+
+        if ( o == this )
         {
             return true;
         }
-        
-        if( o instanceof Replica )
+
+        if ( o instanceof Replica )
         {
             return this.id.equals( ( ( Replica ) o ).id );
         }
@@ -167,16 +175,13 @@
             return false;
         }
     }
-    
+
+
     /**
      * @return The replica. The format is &lt;replica id> '@' &lt;server> ':'
&lt;port>
      */
     public String toString()
     {
-        return getId().toString() +
-                '@' +
-                getAddress().getAddress().getHostAddress() +
-                ':' +
-                getAddress().getPort();
+        return getId().toString() + '@' + getAddress().getAddress().getHostAddress() + ':'
+ getAddress().getPort();
     }
 }

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/ReplicaId.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/ReplicaId.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/ReplicaId.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/ReplicaId.java
Sat Nov  4 17:28:00 2006
@@ -19,11 +19,13 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 import java.io.Serializable;
 import java.util.regex.Pattern;
 
 import org.apache.directory.shared.ldap.util.StringTools;
 
+
 /**
  * Store a replica ID after having normalized it.
  * 
@@ -50,6 +52,7 @@
     /** The formated replicaId */
     private String id;
 
+
     /**
      * Creates a new instance of ReplicaId. The id must be a String 
      * which respect the pattern :
@@ -68,15 +71,16 @@
         }
 
         String tmpId = id.trim().toUpperCase();
-        
-        if( !REPLICA_ID_PATTERN.matcher( tmpId ).matches() )
+
+        if ( !REPLICA_ID_PATTERN.matcher( tmpId ).matches() )
         {
             throw new IllegalArgumentException( "Invalid replica ID: " + id );
         }
-        
+
         this.id = id;
     }
 
+
     /**
      * @return The replicaId
      */
@@ -84,7 +88,8 @@
     {
         return id;
     }
-    
+
+
     /**
      * Returns a hash code value for the object.
      * 
@@ -94,7 +99,8 @@
     {
         return id.hashCode();
     }
-    
+
+
     /**
      * Indicates whether some other object is "equal to" this one
      * 
@@ -104,17 +110,17 @@
      */
     public boolean equals( Object o )
     {
-        if( o == null )
+        if ( o == null )
         {
             return false;
         }
-        
-        if( o == this )
+
+        if ( o == this )
         {
             return true;
         }
-        
-        if( o instanceof ReplicaId )
+
+        if ( o instanceof ReplicaId )
         {
             return this.id.equals( ( ( ReplicaId ) o ).id );
         }
@@ -123,7 +129,8 @@
             return false;
         }
     }
-    
+
+
     /**
      * Compares this object with the specified object for order.  Returns a
      * negative integer, zero, or a positive integer as this object is less
@@ -137,7 +144,8 @@
     {
         return this.id.compareTo( ( ( ReplicaId ) o ).id );
     }
-    
+
+
     /**
      * @return the Replica Id
      */

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/ReplicationException.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/ReplicationException.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/ReplicationException.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/ReplicationException.java
Sat Nov  4 17:28:00 2006
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 /**
  * 
  * TODO ReplicationException.
@@ -29,20 +30,24 @@
 {
     private static final long serialVersionUID = -347196060295426926L;
 
+
     public ReplicationException()
     {
         super();
     }
 
+
     public ReplicationException( String message, Throwable cause )
     {
         super( message, cause );
     }
 
+
     public ReplicationException( String message )
     {
         super( message );
     }
+
 
     public ReplicationException( Throwable cause )
     {

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleCSN.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleCSN.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleCSN.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleCSN.java
Sat Nov  4 17:28:00 2006
@@ -19,10 +19,12 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 import java.io.Serializable;
 
 import org.apache.directory.mitosis.util.OctetString;
 
+
 /**
  * Basic implementation of {@link CSN}.
  * 
@@ -38,22 +40,23 @@
      *      Declare Serial Version Uid</a>
      */
     private static final long serialVersionUID = 1L;
-    
+
     /** The timeStamp of this operation */
     private final long timestamp;
 
     /** The server identification */
     private final ReplicaId replicaId;
-    
+
     /** The operation number in the same timestamp */
     private final int operationSequence;
-    
+
     /** Stores the String representation of the CSN */
     private transient String octetString;
 
     /** Stores the byte array representation of the CSN */
     private transient byte[] bytes;
 
+
     /**
      * Creates a new instance.
      * 
@@ -67,7 +70,8 @@
         this.replicaId = replicaId;
         this.operationSequence = operationSequence;
     }
-    
+
+
     /**
      * Creates a new instance of SimpleCSN from a String.
      * 
@@ -79,18 +83,18 @@
     public SimpleCSN( String value ) throws InvalidCSNException
     {
         assert value != null;
-        
+
         int sepTS = value.indexOf( ':' );
-        
+
         assert sepTS > 0;
-        
+
         int sepID = value.lastIndexOf( ':' );
-        
+
         if ( ( sepID == -1 ) || ( sepID == sepTS ) | ( sepID - sepTS < 2 ) )
         {
             throw new InvalidCSNException();
         }
-        
+
         try
         {
             timestamp = Long.parseLong( value.substring( 0, sepTS ), 16 );
@@ -99,10 +103,10 @@
         {
             throw new InvalidCSNException();
         }
-        
+
         try
         {
-            replicaId = new ReplicaId( value.substring(  sepTS + 1, sepID ) );
+            replicaId = new ReplicaId( value.substring( sepTS + 1, sepID ) );
         }
         catch ( IllegalArgumentException iae )
         {
@@ -119,6 +123,7 @@
         }
     }
 
+
     /**
      * Creates a new instance of SimpleCSN from the serialized data
      *
@@ -126,31 +131,26 @@
      */
     public SimpleCSN( byte[] value )
     {
-        timestamp =  ((long)(value[0] & 0x00FF) << 56) |
-                ((long)(value[1] & 0x00FF) << 48) |
-                ((long)(value[2] & 0x00FF) << 40) |
-                ((long)(value[3] & 0x00FF) << 32) |
-                ((value[4] << 24) & 0x00000000FF000000L) |
-                ((value[5] << 16) & 0x0000000000FF0000L) |
-                ((value[6] << 8) & 0x000000000000FF00L) |
-                (value[7] & 0x00000000000000FFL);
-        
-        operationSequence = ((value[8] & 0x00FF) << 24) +
-            ((value[9] & 0x00FF) << 16) +
-            ((value[10] & 0x00FF) << 8) +
-            (value[11] & 0x00FF);
-        
+        timestamp = ( ( long ) ( value[0] & 0x00FF ) << 56 ) | ( ( long ) ( value[1]
& 0x00FF ) << 48 )
+            | ( ( long ) ( value[2] & 0x00FF ) << 40 ) | ( ( long ) ( value[3]
& 0x00FF ) << 32 )
+            | ( ( value[4] << 24 ) & 0x00000000FF000000L ) | ( ( value[5] <<
16 ) & 0x0000000000FF0000L )
+            | ( ( value[6] << 8 ) & 0x000000000000FF00L ) | ( value[7] & 0x00000000000000FFL
);
+
+        operationSequence = ( ( value[8] & 0x00FF ) << 24 ) + ( ( value[9] &
0x00FF ) << 16 )
+            + ( ( value[10] & 0x00FF ) << 8 ) + ( value[11] & 0x00FF );
+
         char[] chars = new char[value.length - 12];
-                                
+
         for ( int i = 12; i < value.length; i++ )
         {
-            chars[i - 12] = (char)(value[i] & 0x00FF);
+            chars[i - 12] = ( char ) ( value[i] & 0x00FF );
         }
-        
+
         replicaId = new ReplicaId( new String( chars ) );
         bytes = value;
     }
 
+
     /**
      * Return the CSN as a formated string. The used format is :
      * &lt;timestamp> ':' &lt;replicaId> ':' &lt;operation sequence>
@@ -159,7 +159,7 @@
      */
     public String toOctetString()
     {
-        if( octetString == null )
+        if ( octetString == null )
         {
             StringBuffer buf = new StringBuffer( 40 );
             OctetString.append( buf, timestamp );
@@ -172,7 +172,8 @@
 
         return octetString;
     }
-    
+
+
     /**
      * Get the CSN as a byte array. The data are stored as :
      * bytes 1 to 8  : timestamp, big-endian
@@ -187,31 +188,32 @@
         {
             String id = replicaId.getId();
             byte[] bb = new byte[8 + id.length() + 4];
-            
-            bb[0] = (byte)(timestamp >> 56 );
-            bb[1] = (byte)(timestamp >> 48 );
-            bb[2] = (byte)(timestamp >> 40 );
-            bb[3] = (byte)(timestamp >> 32 );
-            bb[4] = (byte)(timestamp >> 24 );
-            bb[5] = (byte)(timestamp >> 16 );
-            bb[6] = (byte)(timestamp >> 8 );
-            bb[7] = (byte)timestamp;
-            bb[8] = (byte)((operationSequence >> 24 ) );
-            bb[9] = (byte)((operationSequence >> 16 ) );
-            bb[10] = (byte)((operationSequence >> 8 ) );
-            bb[11] = (byte)(operationSequence );
-            
+
+            bb[0] = ( byte ) ( timestamp >> 56 );
+            bb[1] = ( byte ) ( timestamp >> 48 );
+            bb[2] = ( byte ) ( timestamp >> 40 );
+            bb[3] = ( byte ) ( timestamp >> 32 );
+            bb[4] = ( byte ) ( timestamp >> 24 );
+            bb[5] = ( byte ) ( timestamp >> 16 );
+            bb[6] = ( byte ) ( timestamp >> 8 );
+            bb[7] = ( byte ) timestamp;
+            bb[8] = ( byte ) ( ( operationSequence >> 24 ) );
+            bb[9] = ( byte ) ( ( operationSequence >> 16 ) );
+            bb[10] = ( byte ) ( ( operationSequence >> 8 ) );
+            bb[11] = ( byte ) ( operationSequence );
+
             for ( int i = 0; i < id.length(); i++ )
             {
-                bb[12+i] =(byte)id.charAt( i );
+                bb[12 + i] = ( byte ) id.charAt( i );
             }
-            
+
             bytes = bb;
         }
-        
+
         return bytes;
     }
-    
+
+
     /**
      * @return The timestamp
      */
@@ -219,7 +221,8 @@
     {
         return timestamp;
     }
-    
+
+
     /**
      * @return The replicaId
      */
@@ -228,6 +231,7 @@
         return replicaId;
     }
 
+
     /**
      * @return The operation sequence
      */
@@ -236,6 +240,7 @@
         return operationSequence;
     }
 
+
     /**
      * @return The CSN as a String
      */
@@ -243,7 +248,8 @@
     {
         return toOctetString();
     }
-    
+
+
     /**
      * Returns a hash code value for the object.
      * 
@@ -254,6 +260,7 @@
         return replicaId.hashCode() ^ ( int ) timestamp ^ operationSequence;
     }
 
+
     /**
      * Indicates whether some other object is "equal to" this one
      * 
@@ -263,28 +270,28 @@
      */
     public boolean equals( Object o )
     {
-        if( o == null )
+        if ( o == null )
         {
             return false;
         }
-        
-        if( this == o )
+
+        if ( this == o )
         {
             return true;
         }
-        
-        if( !( o instanceof CSN ) )
+
+        if ( !( o instanceof CSN ) )
         {
             return false;
         }
-        
+
         CSN that = ( CSN ) o;
-        
-        return timestamp == that.getTimestamp() &&
-               replicaId.equals( that.getReplicaId() ) &&
-               operationSequence == that.getOperationSequence();
+
+        return timestamp == that.getTimestamp() && replicaId.equals( that.getReplicaId()
)
+            && operationSequence == that.getOperationSequence();
     }
-    
+
+
     /**
      * Compares this object with the specified object for order.  Returns a
      * negative integer, zero, or a positive integer as this object is less
@@ -299,29 +306,29 @@
         CSN that = ( CSN ) o;
         long thatTimestamp = that.getTimestamp();
 
-        if( this.timestamp < thatTimestamp )
+        if ( this.timestamp < thatTimestamp )
         {
             return -1;
         }
-        else if( this.timestamp > thatTimestamp )
+        else if ( this.timestamp > thatTimestamp )
         {
             return 1;
         }
-        
+
         int replicaIdCompareResult = this.replicaId.compareTo( that.getReplicaId() );
-        
-        if( replicaIdCompareResult != 0 )
+
+        if ( replicaIdCompareResult != 0 )
         {
             return replicaIdCompareResult;
         }
-        
+
         int thatSequence = that.getOperationSequence();
 
-        if( this.operationSequence < thatSequence )
+        if ( this.operationSequence < thatSequence )
         {
             return -1;
         }
-        else if( this.operationSequence > thatSequence )
+        else if ( this.operationSequence > thatSequence )
         {
             return 1;
         }

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleCSNFactory.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleCSNFactory.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleCSNFactory.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleCSNFactory.java
Sat Nov  4 17:28:00 2006
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 /**
  * Generates a new {@link CSN}.
  * 
@@ -29,10 +30,12 @@
     private static int operationSequence;
     private static long lastTimestamp = System.currentTimeMillis();
 
+
     public SimpleCSNFactory()
     {
     }
 
+
     /**
      * Returns a new {@link CSN}.
      * Generated CSN can be duplicate if user generates CSNs more than 2G 
@@ -46,16 +49,16 @@
         return newInstance( new ReplicaId( replicaId ) );
     }
 
+
     public synchronized CSN newInstance( ReplicaId replicaId )
     {
         long newTimestamp = System.currentTimeMillis();
-        if( lastTimestamp == newTimestamp )
+        if ( lastTimestamp == newTimestamp )
         {
             operationSequence = 0;
         }
-        
-        CSN newCSN = new SimpleCSN( newTimestamp, replicaId,
-                                    operationSequence ++ );
+
+        CSN newCSN = new SimpleCSN( newTimestamp, replicaId, operationSequence++ );
         lastTimestamp = newTimestamp;
         return newCSN;
     }

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleUUID.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleUUID.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleUUID.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleUUID.java
Sat Nov  4 17:28:00 2006
@@ -19,8 +19,10 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 import org.apache.directory.mitosis.util.OctetString;
 
+
 /**
  * 
  * TODO SimpleUUID.
@@ -30,63 +32,69 @@
 public class SimpleUUID implements UUID
 {
     private static final long serialVersionUID = 3256721788405953846L;
-    
+
     private final String uuid;
 
+
     public SimpleUUID( byte[] uuid )
     {
-        if( uuid.length != 16 )
+        if ( uuid.length != 16 )
         {
             throw new IllegalArgumentException( "UUID must be 128-bits long." );
         }
-        
+
         this.uuid = OctetString.toString( uuid );
     }
-    
+
+
     public SimpleUUID( String uuid )
     {
         String newUUID = uuid.replaceAll( "[^0-9A-Za-z]", "" );
-        
-        if( newUUID.length() != 32 )
+
+        if ( newUUID.length() != 32 )
         {
             throw new IllegalArgumentException( "UUID: " + uuid );
         }
-        
+
         this.uuid = newUUID;
     }
-    
+
+
     public int hashCode()
     {
         return uuid.hashCode();
     }
-    
+
+
     public boolean equals( Object o )
     {
-        if( o == null )
+        if ( o == null )
         {
             return false;
         }
-        
-        if( this == o )
+
+        if ( this == o )
         {
             return true;
         }
-        
-        if( !( o instanceof UUID ) )
+
+        if ( !( o instanceof UUID ) )
         {
             return false;
         }
-        
+
         return uuid.equals( ( ( UUID ) o ).toOctetString() );
     }
 
+
     public String toOctetString()
     {
         return uuid;
     }
 
+
     public int compareTo( Object o )
     {
-        return uuid.compareTo( ( ( UUID ) o ).toOctetString() ); 
+        return uuid.compareTo( ( ( UUID ) o ).toOctetString() );
     }
 }

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleUUIDFactory.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleUUIDFactory.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleUUIDFactory.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/SimpleUUIDFactory.java
Sat Nov  4 17:28:00 2006
@@ -19,8 +19,10 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 import org.safehaus.uuid.UUIDGenerator;
 
+
 /**
  * Generates {@link UUID}.
  * 
@@ -30,9 +32,11 @@
 {
     private static final UUIDGenerator generator = UUIDGenerator.getInstance();
 
+
     public SimpleUUIDFactory()
     {
     }
+
 
     /**
      * Generates a new type-1 (time-based) {@link UUID}.

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/UUID.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/UUID.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/UUID.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/UUID.java
Sat Nov  4 17:28:00 2006
@@ -19,7 +19,9 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 import java.io.Serializable;
+
 
 /**
  * Represents UUID (Unversally Unique IDentifier).

Modified: directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/UUIDFactory.java
URL: http://svn.apache.org/viewvc/directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/UUIDFactory.java?view=diff&rev=471319&r1=471318&r2=471319
==============================================================================
--- directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/UUIDFactory.java
(original)
+++ directory/trunks/apacheds/mitosis/src/main/java/org/apache/directory/mitosis/common/UUIDFactory.java
Sat Nov  4 17:28:00 2006
@@ -19,6 +19,7 @@
  */
 package org.apache.directory.mitosis.common;
 
+
 /**
  * Generates {@link UUID}.
  * 



Mime
View raw message