You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2006/12/15 13:07:29 UTC

svn commit: r487527 - in /directory/branches/trunks/schema/apacheds: core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/

Author: akarasulu
Date: Fri Dec 15 04:07:28 2006
New Revision: 487527

URL: http://svn.apache.org/viewvc?view=rev&rev=487527
Log:
some code cleanup with generics warnings

Modified:
    directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/AttributeTypes.template
    directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ObjectClasses.template
    directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/Schema.template
    directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapDitContentRuleRegistry.java
    directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapDitStructureRuleRegistry.java
    directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapMatchingRuleUseRegistry.java
    directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapNameFormRegistry.java
    directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapOidRegistry.java
    directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapRegistries.java
    directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapSchemaLoader.java

Modified: directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/AttributeTypes.template
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/AttributeTypes.template?view=diff&rev=487527&r1=487526&r2=487527
==============================================================================
--- directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/AttributeTypes.template (original)
+++ directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/AttributeTypes.template Fri Dec 15 04:07:28 2006
@@ -58,7 +58,7 @@
     public void produce( BootstrapRegistries registries, ProducerCallback cb )
         throws NamingException
     {
-        ArrayList names = new ArrayList();
+        ArrayList<String> names = new ArrayList<String>();
         BootstrapAttributeType attributeType;
 
         #foreach ( $attrType in $attrTypes )

Modified: directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ObjectClasses.template
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ObjectClasses.template?view=diff&rev=487527&r1=487526&r2=487527
==============================================================================
--- directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ObjectClasses.template (original)
+++ directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/ObjectClasses.template Fri Dec 15 04:07:28 2006
@@ -57,7 +57,7 @@
     public void produce( BootstrapRegistries registries, ProducerCallback cb )
         throws NamingException
     {
-        ArrayList array = new ArrayList();
+        ArrayList<String> array = new ArrayList<String>();
         BootstrapObjectClass objectClass;
 
         #foreach ( $objectClass in $objectClasses )

Modified: directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/Schema.template
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/Schema.template?view=diff&rev=487527&r1=487526&r2=487527
==============================================================================
--- directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/Schema.template (original)
+++ directory/branches/trunks/schema/apacheds/core-plugin/src/main/resources/org/apache/directory/server/core/tools/schema/Schema.template Fri Dec 15 04:07:28 2006
@@ -41,7 +41,7 @@
     {
         super( "$owner", "$schema", "$package" );
 
-        ArrayList list = new ArrayList();
+        ArrayList<String> list = new ArrayList<String>();
         #if ( $deps )
 list.clear();
        #foreach ( $name in $deps ) list.add( "$name" );

Modified: directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapDitContentRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapDitContentRuleRegistry.java?view=diff&rev=487527&r1=487526&r2=487527
==============================================================================
--- directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapDitContentRuleRegistry.java (original)
+++ directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapDitContentRuleRegistry.java Fri Dec 15 04:07:28 2006
@@ -44,9 +44,9 @@
     /** static class logger */
     private final static Logger log = LoggerFactory.getLogger( BootstrapDitContentRuleRegistry.class );
     /** maps an OID to an DITContentRule */
-    private final Map byOid;
+    private final Map<String,DITContentRule> byOid;
     /** maps an OID to a schema name*/
-    private final Map oidToSchema;
+    private final Map<String,String> oidToSchema;
     /** the registry used to resolve names to OIDs */
     private final OidRegistry oidRegistry;
 
@@ -60,8 +60,8 @@
      */
     public BootstrapDitContentRuleRegistry(OidRegistry oidRegistry)
     {
-        this.byOid = new HashMap();
-        this.oidToSchema = new HashMap();
+        this.byOid = new HashMap<String,DITContentRule>();
+        this.oidToSchema = new HashMap<String,String>();
         this.oidRegistry = oidRegistry;
     }
 
@@ -100,7 +100,7 @@
             throw e;
         }
 
-        DITContentRule dITContentRule = ( DITContentRule ) byOid.get( id );
+        DITContentRule dITContentRule = byOid.get( id );
         if ( log.isDebugEnabled() )
         {
             log.debug( "lookup with id '" + id + "' of dITContentRule: " + dITContentRule );

Modified: directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapDitStructureRuleRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapDitStructureRuleRegistry.java?view=diff&rev=487527&r1=487526&r2=487527
==============================================================================
--- directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapDitStructureRuleRegistry.java (original)
+++ directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapDitStructureRuleRegistry.java Fri Dec 15 04:07:28 2006
@@ -44,9 +44,9 @@
     /** static class logger */
     private final static Logger log = LoggerFactory.getLogger( BootstrapDitStructureRuleRegistry.class );
     /** maps an OID to an DITStructureRule */
-    private final Map byOid;
+    private final Map<String,DITStructureRule> byOid;
     /** maps an OID to a schema name*/
-    private final Map oidToSchema;
+    private final Map<String,String> oidToSchema;
     /** the registry used to resolve names to OIDs */
     private final OidRegistry oidRegistry;
 
@@ -61,8 +61,8 @@
      */
     public BootstrapDitStructureRuleRegistry(OidRegistry oidRegistry)
     {
-        this.byOid = new HashMap();
-        this.oidToSchema = new HashMap();
+        this.byOid = new HashMap<String,DITStructureRule>();
+        this.oidToSchema = new HashMap<String,String>();
         this.oidRegistry = oidRegistry;
     }
 

Modified: directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapMatchingRuleUseRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapMatchingRuleUseRegistry.java?view=diff&rev=487527&r1=487526&r2=487527
==============================================================================
--- directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapMatchingRuleUseRegistry.java (original)
+++ directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapMatchingRuleUseRegistry.java Fri Dec 15 04:07:28 2006
@@ -44,9 +44,9 @@
     /** static class logger */
     private final static Logger log = LoggerFactory.getLogger( BootstrapMatchingRuleUseRegistry.class );
     /** maps a name to an MatchingRuleUse */
-    private final Map byName;
+    private final Map<String,MatchingRuleUse> byName;
     /** maps a MatchingRuleUse name to a schema name*/
-    private final Map nameToSchema;
+    private final Map<String,String> nameToSchema;
 
 
     // ------------------------------------------------------------------------
@@ -59,8 +59,8 @@
      */
     public BootstrapMatchingRuleUseRegistry()
     {
-        this.byName = new HashMap();
-        this.nameToSchema = new HashMap();
+        this.byName = new HashMap<String,MatchingRuleUse>();
+        this.nameToSchema = new HashMap<String,String>();
     }
 
 
@@ -95,7 +95,7 @@
             throw e;
         }
 
-        MatchingRuleUse matchingRuleUse = ( MatchingRuleUse ) byName.get( name );
+        MatchingRuleUse matchingRuleUse = byName.get( name );
         if ( log.isDebugEnabled() )
         {
             log.debug( "lookup with name '"+ name + "' of matchingRuleUse: " + matchingRuleUse );

Modified: directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapNameFormRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapNameFormRegistry.java?view=diff&rev=487527&r1=487526&r2=487527
==============================================================================
--- directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapNameFormRegistry.java (original)
+++ directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapNameFormRegistry.java Fri Dec 15 04:07:28 2006
@@ -44,9 +44,9 @@
     /** static class logger */
     private final static Logger log = LoggerFactory.getLogger( BootstrapNameFormRegistry.class );
     /** maps an OID to an NameForm */
-    private final Map byOid;
+    private final Map<String,NameForm> byOid;
     /** maps an OID to a schema name*/
-    private final Map oidToSchema;
+    private final Map<String,String> oidToSchema;
     /** the registry used to resolve names to OIDs */
     private final OidRegistry oidRegistry;
 
@@ -60,8 +60,8 @@
      */
     public BootstrapNameFormRegistry(OidRegistry oidRegistry)
     {
-        this.byOid = new HashMap();
-        this.oidToSchema = new HashMap();
+        this.byOid = new HashMap<String,NameForm>();
+        this.oidToSchema = new HashMap<String,String>();
         this.oidRegistry = oidRegistry;
     }
 

Modified: directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapOidRegistry.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapOidRegistry.java?view=diff&rev=487527&r1=487526&r2=487527
==============================================================================
--- directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapOidRegistry.java (original)
+++ directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapOidRegistry.java Fri Dec 15 04:07:28 2006
@@ -49,7 +49,7 @@
     /** Maps OID to a name or a list of names if more than one name exists */
     private Map byOid = new HashMap();
     /** Maps several names to an OID */
-    private Map byName = new HashMap();
+    private Map<String,String> byName = new HashMap<String,String>();
 
 
     /**
@@ -188,6 +188,7 @@
     /**
      * @see org.apache.directory.server.core.schema.OidRegistry#list()
      */
+    @SuppressWarnings("unchecked")
     public Iterator list()
     {
         return Collections.unmodifiableSet( byOid.keySet() ).iterator();
@@ -217,6 +218,7 @@
     /**
      * @see org.apache.directory.server.core.schema.OidRegistry#register(String, String)
      */
+    @SuppressWarnings("unchecked")
     public void register( String name, String oid )
     {
         if ( !Character.isDigit( oid.charAt( 0 ) ) )

Modified: directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapRegistries.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapRegistries.java?view=diff&rev=487527&r1=487526&r2=487527
==============================================================================
--- directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapRegistries.java (original)
+++ directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapRegistries.java Fri Dec 15 04:07:28 2006
@@ -169,7 +169,7 @@
      */
     public List checkRefInteg()
     {
-        ArrayList errors = new ArrayList();
+        ArrayList<Throwable> errors = new ArrayList<Throwable>();
 
         Iterator list = objectClassRegistry.iterator();
         while ( list.hasNext() )
@@ -210,7 +210,7 @@
      * @param errors the list of errors to add exceptions to
      * @return true if it succeeds, false otherwise
      */
-    private boolean resolve( Syntax syntax, List errors )
+    private boolean resolve( Syntax syntax, List<Throwable> errors )
     {
         if ( syntax == null )
         {
@@ -230,7 +230,7 @@
     }
 
 
-    private boolean resolve( MatchingRule mr, List errors )
+    private boolean resolve( MatchingRule mr, List<Throwable> errors )
     {
         boolean isSuccess = true;
 
@@ -293,7 +293,7 @@
     }
 
 
-    private boolean resolve( AttributeType at, List errors )
+    private boolean resolve( AttributeType at, List<Throwable> errors )
     {
         boolean isSuccess = true;
 
@@ -405,7 +405,7 @@
     }
 
 
-    private boolean resolve( ObjectClass oc, List errors )
+    private boolean resolve( ObjectClass oc, List<Throwable> errors )
     {
         boolean isSuccess = true;
 

Modified: directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapSchemaLoader.java
URL: http://svn.apache.org/viewvc/directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapSchemaLoader.java?view=diff&rev=487527&r1=487526&r2=487527
==============================================================================
--- directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapSchemaLoader.java (original)
+++ directory/branches/trunks/schema/apacheds/schema-bootstrap/src/main/java/org/apache/directory/server/core/schema/bootstrap/BootstrapSchemaLoader.java Fri Dec 15 04:07:28 2006
@@ -66,9 +66,9 @@
     private static final Logger log = LoggerFactory.getLogger( BootstrapSchemaLoader.class );
 
     /** stores schemas of producers for callback access */
-    private ThreadLocal schemas;
+    private ThreadLocal<BootstrapSchema> schemas;
     /** stores registries associated with producers for callback access */
-    private ThreadLocal registries;
+    private ThreadLocal<BootstrapRegistries> registries;
     /** the callback that just calls register() */
     private final ProducerCallback cb = new ProducerCallback()
     {
@@ -85,8 +85,8 @@
      */
     public BootstrapSchemaLoader()
     {
-        schemas = new ThreadLocal();
-        registries = new ThreadLocal();
+        schemas = new ThreadLocal<BootstrapSchema>();
+        registries = new ThreadLocal<BootstrapRegistries>();
     }
 
 
@@ -98,12 +98,12 @@
      * @param registries the registries to fill with producer created objects
      * @throws NamingException if there are any failures during this process
      */
-    public final void load( Collection bootstrapSchemas, BootstrapRegistries registries ) throws NamingException
+    public final void load( Collection<BootstrapSchema> bootstrapSchemas, BootstrapRegistries registries ) throws NamingException
     {
         BootstrapSchema[] schemas = new BootstrapSchema[bootstrapSchemas.size()];
         schemas = ( BootstrapSchema[] ) bootstrapSchemas.toArray( schemas );
-        HashMap loaded = new HashMap();
-        HashMap notLoaded = new HashMap();
+        HashMap<String,BootstrapSchema> loaded = new HashMap<String,BootstrapSchema>();
+        HashMap<String,BootstrapSchema> notLoaded = new HashMap<String,BootstrapSchema>();
 
         for ( int ii = 0; ii < schemas.length; ii++ )
         {
@@ -123,7 +123,7 @@
         while ( list.hasNext() )
         {
             schema = ( BootstrapSchema ) list.next();
-            loadDepsFirst( new Stack(), notLoaded, schema, registries );
+            loadDepsFirst( new Stack<String>(), notLoaded, schema, registries );
             list = notLoaded.values().iterator();
         }
     }
@@ -141,7 +141,7 @@
      * @throws NamingException if there is a cycle detected and/or another
      * failure results while loading, producing and or registering schema objects
      */
-    public final void loadDepsFirst( Stack beenthere, HashMap notLoaded, BootstrapSchema schema,
+    public final void loadDepsFirst( Stack<String> beenthere, HashMap notLoaded, BootstrapSchema schema,
         BootstrapRegistries registries ) throws NamingException
     {
         beenthere.push( schema.getSchemaName() );