directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akaras...@apache.org
Subject svn commit: r426830 - in /directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid: impl/ impl/src/main/java/org/apache/directory/server2/schema/registries/oid/impl/ service/src/main/java/org/apache/directory/server2/schema/registries/oid/
Date Sat, 29 Jul 2006 18:24:23 GMT
Author: akarasulu
Date: Sat Jul 29 11:24:22 2006
New Revision: 426830

URL: http://svn.apache.org/viewvc?rev=426830&view=rev
Log:
fix breakage

Modified:
    directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/impl/pom.xml
    directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/impl/src/main/java/org/apache/directory/server2/schema/registries/oid/impl/DefaultOidRegistry.java
    directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/service/src/main/java/org/apache/directory/server2/schema/registries/oid/OidRegistry.java

Modified: directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/impl/pom.xml
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/impl/pom.xml?rev=426830&r1=426829&r2=426830&view=diff
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/impl/pom.xml (original)
+++ directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/impl/pom.xml Sat Jul 29
11:24:22 2006
@@ -7,8 +7,13 @@
   <modelVersion>4.0.0</modelVersion>
   <packaging>osgi-bundle</packaging>
   <name>ApacheDS 2.0: Default Oid Registry Impl</name>
-  <artifactId>oid-registry-default</artifactId>
+  <artifactId>oid-registry-impl</artifactId>
   <dependencies>
+    <dependency>
+      <artifactId>oid-registry-service</artifactId>
+      <groupId>${pom.groupId}</groupId>
+      <version>${pom.version}</version>
+    </dependency>
   </dependencies>
   <build>
     <plugins>

Modified: directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/impl/src/main/java/org/apache/directory/server2/schema/registries/oid/impl/DefaultOidRegistry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/impl/src/main/java/org/apache/directory/server2/schema/registries/oid/impl/DefaultOidRegistry.java?rev=426830&r1=426829&r2=426830&view=diff
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/impl/src/main/java/org/apache/directory/server2/schema/registries/oid/impl/DefaultOidRegistry.java
(original)
+++ directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/impl/src/main/java/org/apache/directory/server2/schema/registries/oid/impl/DefaultOidRegistry.java
Sat Jul 29 11:24:22 2006
@@ -14,7 +14,7 @@
  *   limitations under the License.
  *
  */
-package org.apache.directory.server2.schema.registries.oid.default;
+package org.apache.directory.server2.schema.registries.oid.impl;
 
 
 import java.util.ArrayList;
@@ -26,10 +26,7 @@
 
 import javax.naming.NamingException;
 
-import org.apache.directory.server.core.schema.OidRegistry;
-import org.apache.directory.server.core.schema.OidRegistryMonitor;
-import org.apache.directory.server.core.schema.OidRegistryMonitorAdapter;
-import org.apache.directory.shared.ldap.util.StringTools;
+import org.apache.directory.server2.schema.registries.oid.OidRegistry;
 
 
 /**
@@ -41,11 +38,11 @@
  */
 public class DefaultOidRegistry implements OidRegistry
 {
-    /** Maps OID to a name or a list of names if more than one name exists */
-    private Map byOid = new HashMap();
+    /** Maps OID to a name or a list of names */
+    private Map<String,List<String>> byOid = new HashMap<String,List<String>>();
 
     /** Maps several names to an OID */
-    private Map byName = new HashMap();
+    private Map<String,String> byName = new HashMap<String,String>();
 
 
     /**
@@ -114,9 +111,6 @@
     }
 
 
-    /**
-     * @see org.apache.directory.server.core.schema.OidRegistry#getPrimaryName(java.lang.String)
-     */
     public String getPrimaryName( String oid ) throws NamingException
     {
         Object value = byOid.get( oid );
@@ -137,33 +131,13 @@
     }
 
 
-    /**
-     * @see org.apache.directory.server.core.schema.OidRegistry#getNameSet(java.lang.String)
-     */
-    public List getNameSet( String oid ) throws NamingException
+    public List<String> getAliases( String oid ) throws NamingException
     {
-        Object value = byOid.get( oid );
-
-        if ( null == value )
-        {
-            NamingException fault = new NamingException( "OID '" + oid + "' was not found
within the OID registry" );
-            throw fault;
-        }
-
-        if ( value instanceof String )
-        {
-            List list = Collections.singletonList( value );
-            return list;
-        }
-
-        return ( List ) value;
+        return byOid.get( oid );
     }
 
 
-    /**
-     * @see org.apache.directory.server.core.schema.OidRegistry#list()
-     */
-    public Iterator list()
+    public Iterator<String> iterator()
     {
         return Collections.unmodifiableSet( byOid.keySet() ).iterator();
     }
@@ -173,7 +147,7 @@
      * Get the map of all the oids by their name
      * @return The Map that contains all the oids
      */
-    public Map getOidByName()
+    public Map<String,String> getOidByName()
     {
         return byName;
     }
@@ -183,15 +157,12 @@
      * Get the map of all the oids by their name
      * @return The Map that contains all the oids
      */
-    public Map getNameByOid()
+    public Map<String, List<String>> getNameByOid()
     {
         return byOid;
     }
 
 
-    /**
-     * @see org.apache.directory.server.core.schema.OidRegistry#register(String, String)
-     */
     public void register( String name, String oid )
     {
         if ( !Character.isDigit( oid.charAt( 0 ) ) )
@@ -217,25 +188,24 @@
          * Update OID Map
          * 
          * 1). Check if we already have a value[s] stored
-         *      1a). Value is a single value and is a String
+         *      1a). Value is a single value and is a singleton list (immutable)
          *          Replace value with list containing old and new values
          *      1b). More than one value stored in a list
          *          Add new value to the list
          * 2). If we do not have a value then we just add it as a String
          */
-        Object value;
+        List<String> value;
         if ( !byOid.containsKey( oid ) )
         {
-            value = name;
+            value = Collections.singletonList( name );
         }
         else
         {
-            ArrayList list;
             value = byOid.get( oid );
 
-            if ( value instanceof String )
+            if ( value.size() == 1 )
             {
-                String existingName = ( String ) value;
+                String existingName = value.get( 0 );
 
                 // if the existing name is already there we don't readd it
                 if ( existingName.equalsIgnoreCase( name ) )
@@ -243,25 +213,22 @@
                     return;
                 }
 
-                list = new ArrayList();
-                list.add( name );
-                list.add( value );
-                value = list;
+                value = new ArrayList<String>();
+                value.add( name );
+                value.add( value.get( 0 ) );
             }
-            else if ( value instanceof ArrayList )
+            else 
             {
-                list = ( ArrayList ) value;
-
-                for ( int ii = 0; ii < list.size(); ii++ )
+                for ( int ii = 0; ii < value.size(); ii++ )
                 {
                     // One form or another of the name already exists in list
-                    if ( !name.equalsIgnoreCase( ( String ) list.get( ii ) ) )
+                    if ( !name.equalsIgnoreCase( value.get( ii ) ) )
                     {
                         return;
                     }
                 }
 
-                list.add( name );
+                value.add( name );
             }
         }
 

Modified: directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/service/src/main/java/org/apache/directory/server2/schema/registries/oid/OidRegistry.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/service/src/main/java/org/apache/directory/server2/schema/registries/oid/OidRegistry.java?rev=426830&r1=426829&r2=426830&view=diff
==============================================================================
--- directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/service/src/main/java/org/apache/directory/server2/schema/registries/oid/OidRegistry.java
(original)
+++ directory/sandbox/akarasulu/apacheds-2.0/schema/registries/oid/service/src/main/java/org/apache/directory/server2/schema/registries/oid/OidRegistry.java
Sat Jul 29 11:24:22 2006
@@ -107,5 +107,5 @@
      * Get the map of all the oids by their name
      * @return The Map that contains all the oids
      */
-    public Map<String,String> getNameByOid();
+    public Map<String,List<String>> getNameByOid();
 }



Mime
View raw message