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 2007/08/27 21:03:57 UTC

svn commit: r570224 - /directory/sandbox/akarasulu/refactoring-apacheds-trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java

Author: akarasulu
Date: Mon Aug 27 12:03:53 2007
New Revision: 570224

URL: http://svn.apache.org/viewvc?rev=570224&view=rev
Log:
cleanup some warnings

Modified:
    directory/sandbox/akarasulu/refactoring-apacheds-trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java

Modified: directory/sandbox/akarasulu/refactoring-apacheds-trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java
URL: http://svn.apache.org/viewvc/directory/sandbox/akarasulu/refactoring-apacheds-trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java?rev=570224&r1=570223&r2=570224&view=diff
==============================================================================
--- directory/sandbox/akarasulu/refactoring-apacheds-trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java (original)
+++ directory/sandbox/akarasulu/refactoring-apacheds-trunk/bootstrap-plugin/src/main/java/org/apache/directory/server/core/bootstrap/plugin/BootstrapPlugin.java Mon Aug 27 12:03:53 2007
@@ -103,7 +103,7 @@
      * @required
      * @readonly
      */
-    private List classpathElements;
+    private List<String> classpathElements;
 
     /**
      * The package to put the db file entry listing info as well as the partition.
@@ -167,7 +167,7 @@
     /**
      * Map of schemas by name
      */
-    private Map schemas = new HashMap();
+    private Map<String, Schema> schemas = new HashMap<String, Schema>();
 
 
     /**
@@ -294,11 +294,11 @@
     private static final String[] OTHER_SCHEMA_DEPENDENCIES = new String[] { "system", "core", "apache", "apachemeta" };
     private void createSchemasAndContainers() throws NamingException
     {
-        Map schemaMap = this.registries.getLoadedSchemas();
-        Iterator schemas = schemaMap.values().iterator();
+        Map<String,Schema> schemaMap = this.registries.getLoadedSchemas();
+        Iterator<Schema> schemas = schemaMap.values().iterator();
         while ( schemas.hasNext() )
         {
-            Schema schema = ( Schema ) schemas.next();
+            Schema schema = schemas.next();
             createSchemaAndContainers( schema );
         }
         
@@ -407,10 +407,10 @@
         getLog().info( "" );
 
         AttributeTypeRegistry attributeTypeRegistry = registries.getAttributeTypeRegistry();
-        Iterator ii = attributeTypeRegistry.iterator();
+        Iterator<AttributeType> ii = attributeTypeRegistry.iterator();
         while ( ii.hasNext() )
         {
-            AttributeType at = ( AttributeType ) ii.next();
+            AttributeType at = ii.next();
             String schemaName = attributeTypeRegistry.getSchemaName( at.getOid() );
             Schema schema = ( Schema ) registries.getLoadedSchemas().get( schemaName );
             getLog().info( "\t\t o [" + schemaName + "] - " + getNameOrNumericoid( at ) );
@@ -435,10 +435,10 @@
         getLog().info( "" );
 
         ObjectClassRegistry objectClassRegistry = registries.getObjectClassRegistry();
-        Iterator ii = objectClassRegistry.iterator();
+        Iterator<ObjectClass> ii = objectClassRegistry.iterator();
         while ( ii.hasNext() )
         {
-            ObjectClass oc = ( ObjectClass ) ii.next();
+            ObjectClass oc = ii.next();
             String schemaName = objectClassRegistry.getSchemaName( oc.getOid() );
             Schema schema = ( Schema ) registries.getLoadedSchemas().get( schemaName );
             getLog().info( "\t\t o [" + schemaName + "] - " + getNameOrNumericoid( oc ) );
@@ -463,10 +463,10 @@
         getLog().info( "" );
 
         MatchingRuleRegistry matchingRuleRegistry = registries.getMatchingRuleRegistry();
-        Iterator ii = matchingRuleRegistry.iterator();
+        Iterator<MatchingRule> ii = matchingRuleRegistry.iterator();
         while ( ii.hasNext() )
         {
-            MatchingRule mr = ( MatchingRule ) ii.next();
+            MatchingRule mr = ii.next();
             String schemaName = matchingRuleRegistry.getSchemaName( mr.getOid() );
             Schema schema = ( Schema ) registries.getLoadedSchemas().get( schemaName );
             getLog().info( "\t\t o [" + schemaName + "] - " + getNameOrNumericoid( mr ) );
@@ -491,10 +491,10 @@
         getLog().info( "" );
 
         ComparatorRegistry comparatorRegistry = registries.getComparatorRegistry();
-        Iterator ii = comparatorRegistry.oidIterator();
+        Iterator<String> ii = comparatorRegistry.oidIterator();
         while ( ii.hasNext() )
         {
-            String oid = ( String ) ii.next();
+            String oid = ii.next();
             String schemaName = comparatorRegistry.getSchemaName( oid );
             Schema schema = ( Schema ) registries.getLoadedSchemas().get( schemaName );
             getLog().info( "\t\t o [" + schemaName + "] - " + oid );
@@ -519,10 +519,10 @@
         getLog().info( "" );
 
         NormalizerRegistry normalizerRegistry = registries.getNormalizerRegistry();
-        Iterator ii = normalizerRegistry.oidIterator();
+        Iterator<String> ii = normalizerRegistry.oidIterator();
         while ( ii.hasNext() )
         {
-            String oid = ( String ) ii.next();
+            String oid = ii.next();
             String schemaName = normalizerRegistry.getSchemaName( oid );
             Schema schema = ( Schema ) registries.getLoadedSchemas().get( schemaName );
             getLog().info( "\t\t o [" + schemaName + "] - " + oid );
@@ -547,10 +547,10 @@
         getLog().info( "" );
 
         SyntaxRegistry syntaxRegistry = registries.getSyntaxRegistry();
-        Iterator ii = syntaxRegistry.iterator();
+        Iterator<Syntax> ii = syntaxRegistry.iterator();
         while ( ii.hasNext() )
         {
-            Syntax syntax = ( Syntax ) ii.next();
+            Syntax syntax = ii.next();
             getLog().info( "\t\t o [" + syntax.getSchema() + "] - " + getNameOrNumericoid( syntax ) );
             LdapDN dn = checkCreateSchema( syntax.getSchema() );
             Schema schema = ( Schema ) registries.getLoadedSchemas().get( syntax.getSchema() );
@@ -574,10 +574,10 @@
         getLog().info( "" );
 
         SyntaxCheckerRegistry syntaxCheckerRegistry = registries.getSyntaxCheckerRegistry();
-        Iterator ii = syntaxCheckerRegistry.iterator();
+        Iterator<SyntaxChecker> ii = syntaxCheckerRegistry.iterator();
         while ( ii.hasNext() )
         {
-            SyntaxChecker syntaxChecker = ( SyntaxChecker ) ii.next();
+            SyntaxChecker syntaxChecker = ii.next();
             String schemaName = syntaxCheckerRegistry.getSchemaName( syntaxChecker.getSyntaxOid() );
             Schema schema = ( Schema ) registries.getLoadedSchemas().get( schemaName );
             getLog().info( "\t\t o [" + schemaName + "] - " + syntaxChecker.getSyntaxOid() );
@@ -613,7 +613,7 @@
         storeConfig.setWorkingDirectory( workingDirectory );
 
         // add the indices
-        Set indexSet = new HashSet();
+        Set<String> indexSet = new HashSet<String>();
         for ( int ii = 0; ii < indexedAttributes.length; ii++ )
         {
             indexSet.add( indexedAttributes[ii] );
@@ -676,6 +676,7 @@
      *
      * @throws MojoFailureException
      */
+    @SuppressWarnings({ "deprecation", "unchecked" })
     private void initializeSchemas() throws MojoFailureException
     {
         // -------------------------------------------------------------------
@@ -704,11 +705,11 @@
         ClassLoader parent = getClass().getClassLoader();
         URL[] urls = new URL[classpathElements.size()];
         int i = 0;
-        for ( Iterator it = classpathElements.iterator(); it.hasNext(); )
+        for ( Iterator<String> it = classpathElements.iterator(); it.hasNext(); )
         {
             try
             {
-                urls[i++] = new File( ( String ) it.next() ).toURL();
+                urls[i++] = new File( it.next() ).toURL();
             } catch ( MalformedURLException e )
             {
                 throw ( MojoFailureException ) new MojoFailureException( "Could not construct classloader: " ).initCause( e );
@@ -719,7 +720,7 @@
         {
             try
             {
-                Class schemaClass = cl.loadClass( bootstrapSchemaClasses[ii] );
+                Class<BootstrapSchema> schemaClass = ( Class<BootstrapSchema> ) cl.loadClass( bootstrapSchemaClasses[ii] );
                 schema = ( BootstrapSchema ) schemaClass.newInstance();
                 schemas.put( schema.getSchemaName(), schema );
             }
@@ -781,7 +782,7 @@
 
     private LdapDN checkCreateSchema( String schemaName ) throws NamingException
     {
-        Schema schema = ( Schema ) schemas.get( schemaName );
+        Schema schema = schemas.get( schemaName );
         LdapDN dn = new LdapDN( SchemaConstants.CN_AT + "="
                 + schemaName + "," + SchemaConstants.OU_AT + "=schema" );
         dn.normalize( registries.getAttributeTypeRegistry().getNormalizerMapping() );
@@ -837,10 +838,10 @@
         StringBuffer buf = new StringBuffer();
         buf.append( "schema/master.db\n" );
 
-        Iterator systemIndices = store.getSystemIndices();
+        Iterator<String> systemIndices = store.getSystemIndices();
         while ( systemIndices.hasNext() )
         {
-            Index index = store.getSystemIndex( ( String ) systemIndices.next() );
+            Index index = store.getSystemIndex( systemIndices.next() );
             buf.append( "schema/" );
             buf.append( index.getAttribute().getName() );
             buf.append( ".db\n" );