directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r688907 - 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/operation/ main/java/org/apache/directory/mitosi...
Date Mon, 25 Aug 2008 22:33:09 GMT
Author: elecharny
Date: Mon Aug 25 15:33:09 2008
New Revision: 688907

URL: http://svn.apache.org/viewvc?rev=688907&view=rev
Log:
o Removed the UUID, DefaultUUID, UUIDFactory and DefaultUUIDfactory, and replaced them by
java.util.UUID

Removed:
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/DefaultUUID.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/DefaultUUIDFactory.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/UUID.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/common/UUIDFactory.java
Modified:
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfiguration.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.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/derby/DerbyReplicationStore.java
    directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.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/configuration/ReplicationConfiguration.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfiguration.java?rev=688907&r1=688906&r2=688907&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfiguration.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/configuration/ReplicationConfiguration.java
Mon Aug 25 15:33:09 2008
@@ -32,9 +32,6 @@
 import org.apache.directory.mitosis.common.CSNFactory;
 import org.apache.directory.mitosis.common.Replica;
 import org.apache.directory.mitosis.common.DefaultCSNFactory;
-import org.apache.directory.mitosis.common.DefaultUUIDFactory;
-import org.apache.directory.mitosis.common.UUID;
-import org.apache.directory.mitosis.common.UUIDFactory;
 import org.apache.directory.mitosis.service.ReplicationInterceptor;
 import org.apache.directory.mitosis.store.ReplicationStore;
 import org.apache.directory.mitosis.store.derby.DerbyReplicationStore;
@@ -72,7 +69,6 @@
     private final Set<Replica> peerReplicas = new HashSet<Replica>();
     
     /** Factories */
-    private UUIDFactory uuidFactory = new DefaultUUIDFactory();
     private CSNFactory csnFactory = new DefaultCSNFactory();
     private ReplicationStore store = new DerbyReplicationStore();
     
@@ -278,26 +274,6 @@
     }
 
     /**
-     * Returns the {@link UUIDFactory} which generates {@link UUID}s for
-     * new directory entries.  The default implementation is
-     * {@link DefaultUUIDFactory}.
-     */
-    public UUIDFactory getUuidFactory()
-    {
-        return uuidFactory;
-    }
-
-    /**
-     * Sets the {@link UUIDFactory} which generates {@link UUID}s for
-     * new directory entries.  The default implementation is
-     * {@link DefaultUUIDFactory}.
-     */
-    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
@@ -361,12 +337,6 @@
             throw new ReplicationConfigurationException( "Invalid response timeout: " + responseTimeout
);
         }
 
-        if ( uuidFactory == null )
-        {
-            log.error( "The UUID factory has not been declared" );
-            throw new ReplicationConfigurationException( "UUID factory is not specified."
);
-        }
-
         if ( csnFactory == null )
         {
             log.error( "The CSN factory has not been declared" );

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java?rev=688907&r1=688906&r2=688907&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/CompositeOperation.java
Mon Aug 25 15:33:09 2008
@@ -22,7 +22,6 @@
 
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.CSNVector;
-import org.apache.directory.mitosis.common.UUID;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.store.ReplicationLogIterator;
 import org.apache.directory.mitosis.store.ReplicationStore;
@@ -34,6 +33,7 @@
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Set;
+import java.util.UUID;
 
 
 /**

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java?rev=688907&r1=688906&r2=688907&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/operation/OperationFactory.java
Mon Aug 25 15:33:09 2008
@@ -23,7 +23,6 @@
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.CSNFactory;
 import org.apache.directory.mitosis.common.Constants;
-import org.apache.directory.mitosis.common.UUIDFactory;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.server.constants.ServerDNConstants;
 import org.apache.directory.server.core.CoreSession;
@@ -57,6 +56,7 @@
 import javax.naming.directory.SearchControls;
 
 import java.util.List;
+import java.util.UUID;
 
 
 /**
@@ -87,7 +87,6 @@
 {
     private final String replicaId;
     private final PartitionNexus nexus;
-    private final UUIDFactory uuidFactory;
     private final CSNFactory csnFactory;
     
     /** The attributeType registry */
@@ -104,7 +103,6 @@
     {
         replicaId = cfg.getReplicaId();
         nexus = directoryService.getPartitionNexus();
-        uuidFactory = cfg.getUuidFactory();
         csnFactory = cfg.getCsnFactory();
         registries = directoryService.getRegistries();
         attributeRegistry = registries.getAttributeTypeRegistry();
@@ -137,7 +135,7 @@
         ServerEntry cloneEntry = ( ServerEntry ) entry.clone();
         cloneEntry.removeAttributes( Constants.ENTRY_UUID );
         cloneEntry.removeAttributes( Constants.ENTRY_DELETED );
-        cloneEntry.put( Constants.ENTRY_UUID, uuidFactory.newInstance().toOctetString() );
+        cloneEntry.put( Constants.ENTRY_UUID, UUID.randomUUID().toString() );
         cloneEntry.put( Constants.ENTRY_DELETED, "FALSE" );
 
         // NOTE: We inlined addDefaultOperations() because ApacheDS currently

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationStore.java?rev=688907&r1=688906&r2=688907&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationStore.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/ReplicationStore.java
Mon Aug 25 15:33:09 2008
@@ -22,7 +22,6 @@
 
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.CSNVector;
-import org.apache.directory.mitosis.common.UUID;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.operation.Operation;
 import org.apache.directory.server.core.DirectoryService;
@@ -30,6 +29,7 @@
 
 import javax.naming.Name;
 import java.util.Set;
+import java.util.UUID;
 
 /**
  * Provides an abstract storage that stores data required to perform

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStore.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStore.java?rev=688907&r1=688906&r2=688907&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStore.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStore.java
Mon Aug 25 15:33:09 2008
@@ -24,7 +24,6 @@
 import org.apache.directory.mitosis.common.CSN;
 import org.apache.directory.mitosis.common.CSNVector;
 import org.apache.directory.mitosis.common.DefaultCSN;
-import org.apache.directory.mitosis.common.UUID;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.operation.Operation;
 import org.apache.directory.mitosis.operation.OperationCodec;
@@ -46,6 +45,7 @@
 import java.sql.Statement;
 import java.util.HashSet;
 import java.util.Set;
+import java.util.UUID;
 
 
 public class DerbyReplicationStore implements ReplicationStore
@@ -316,7 +316,7 @@
             con.setTransactionIsolation( Connection.TRANSACTION_READ_COMMITTED );
             con.setReadOnly( true );
             ps = con.prepareStatement( "SELECT DN FROM " + uuidTableName + " WHERE UUID=?"
);
-            ps.setString( 1, uuid.toOctetString() );
+            ps.setString( 1, uuid.toString() );
             rs = ps.executeQuery();
             if ( rs.next() )
             {
@@ -340,7 +340,7 @@
 
     public boolean putUUID( UUID uuid, Name dn )
     {
-        String uuidString = uuid.toOctetString();
+        String uuidString = uuid.toString();
         Connection con = null;
         PreparedStatement ps = null;
         ResultSet rs = null;
@@ -396,7 +396,7 @@
 
     public boolean removeUUID( UUID uuid )
     {
-        String uuidString = uuid.toOctetString();
+        String uuidString = uuid.toString();
         Connection con = null;
         PreparedStatement ps = null;
 

Modified: directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.java?rev=688907&r1=688906&r2=688907&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.java
(original)
+++ directory/apacheds/trunk/mitosis/src/main/java/org/apache/directory/mitosis/util/OctetString.java
Mon Aug 25 15:33:09 2008
@@ -116,62 +116,6 @@
         destination.append( highDigits[v] );
         destination.append( lowDigits[v] );
     }
-
-    /**
-     * Converts the specified binary data into an octet string and returns it.
-     */
-    public static String toString( byte[] src )
-    {
-        final int end = src.length;
-        StringBuffer dst = new StringBuffer( src.length << 1 );
-        for ( int i = 0; i < end; i++ )
-        {
-            dst.append( highDigits[src[i] & 0xff] );
-            dst.append( lowDigits[src[i] & 0xff] );
-        }
-
-        return dst.toString();
-    }
-
-    /**
-     * Converts the specified value into an octet string and returns it.
-     */
-    public static String toString( long value )
-    {
-        StringBuffer dst = new StringBuffer( 16 );
-        append( dst, value );
-        return dst.toString();
-    }
-
-    /**
-     * Converts the specified value into an octet string and returns it.
-     */
-    public static String toString( int value )
-    {
-        StringBuffer dst = new StringBuffer( 8 );
-        append( dst, value );
-        return dst.toString();
-    }
-
-    /**
-     * Converts the specified octet string value into an integer and returns
-     * it.
-     */
-    public static int parseInt( String value )
-    {
-        return Integer.parseInt( value, 16 );
-    }
-
-    /**
-     * Converts the specified octet string value into a long integer and
-     * returns it.
-     */
-    public static long parseLong( String value )
-    {
-        return Long.parseLong( value, 16 );
-    }
-
-
     private OctetString()
     {
     }

Modified: directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java?rev=688907&r1=688906&r2=688907&view=diff
==============================================================================
--- directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
(original)
+++ directory/apacheds/trunk/mitosis/src/test/java/org/apache/directory/mitosis/store/derby/DerbyReplicationStoreTest.java
Mon Aug 25 15:33:09 2008
@@ -29,6 +29,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.UUID;
 
 import javax.naming.Name;
 import javax.naming.ldap.LdapName;
@@ -49,9 +50,6 @@
 import org.apache.directory.mitosis.common.CSNVector;
 import org.apache.directory.mitosis.common.DefaultCSN;
 import org.apache.directory.mitosis.common.DefaultCSNFactory;
-import org.apache.directory.mitosis.common.DefaultUUIDFactory;
-import org.apache.directory.mitosis.common.UUID;
-import org.apache.directory.mitosis.common.UUIDFactory;
 import org.apache.directory.mitosis.configuration.ReplicationConfiguration;
 import org.apache.directory.mitosis.operation.AddAttributeOperation;
 import org.apache.directory.mitosis.operation.AddEntryOperation;
@@ -70,7 +68,6 @@
     private static final String OTHER_REPLICA_ID_2 = "OTHER_REPLICA_2";
     private static final File DB_PATH = new File( "target/testDB" );
 
-    private final UUIDFactory uuidFactory = new DefaultUUIDFactory();
     private final CSNFactory csnFactory = new DefaultCSNFactory();
     private DerbyReplicationStore store;
     private int testCount;
@@ -153,7 +150,7 @@
 
     private void subTestUUID() throws Exception
     {
-        UUID uuid = uuidFactory.newInstance();
+        UUID uuid = UUID.randomUUID();
         Name name = new LdapName( "ou=a, ou=b" );
         Assert.assertTrue( store.putUUID( uuid, name ) );
         Assert.assertEquals( name, store.getDN( uuid ) );



Mime
View raw message