directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r470870 - /directory/branches/apacheds-schema/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
Date Fri, 03 Nov 2006 16:23:44 GMT
Author: elecharny
Date: Fri Nov  3 08:23:44 2006
New Revision: 470870

URL: http://svn.apache.org/viewvc?view=rev&rev=470870
Log:
Updated the class with general use of Java 5 generics

Modified:
    directory/branches/apacheds-schema/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java

Modified: directory/branches/apacheds-schema/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
URL: http://svn.apache.org/viewvc/directory/branches/apacheds-schema/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java?view=diff&rev=470870&r1=470869&r2=470870
==============================================================================
--- directory/branches/apacheds-schema/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
(original)
+++ directory/branches/apacheds-schema/apacheds/core/src/main/java/org/apache/directory/server/core/configuration/StartupConfiguration.java
Fri Nov  3 08:23:44 2006
@@ -21,7 +21,10 @@
 
 
 import java.io.File;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 import javax.naming.directory.Attributes;
 
@@ -67,13 +70,26 @@
     private int maxThreads = MAX_THREADS_DEFAULT; // set to default value
     private int maxSizeLimit = MAX_SIZE_LIMIT_DEFAULT; // set to default value
     private int maxTimeLimit = MAX_TIME_LIMIT_DEFAULT; // set to default value (milliseconds)
-    private Set authenticatorConfigurations; // Set<AuthenticatorConfiguration>
-    private List interceptorConfigurations; // Set<InterceptorConfiguration>
+    
+    /** The set of authentication configurations */
+    private Set<AuthenticatorConfiguration> authenticatorConfigurations;
+    
+    /** A list of interceptors in the chain */
+    private List<InterceptorConfiguration> interceptorConfigurations;
+    
     private PartitionConfiguration systemPartitionConfiguration;
-    private List schemaLoaders;
-    private Set bootstrapSchemas; // Set<BootstrapSchema>
-    private Set contextPartitionConfigurations = new HashSet(); // Set<ContextPartitionConfiguration>
-    private List testEntries = new ArrayList(); // List<Attributes>
+    
+    /** A list of schema loaders */
+    private List<SchemaLoader> schemaLoaders;
+    
+    /** A set of BootstrapSchema */
+    private Set<BootstrapSchema> bootstrapSchemas;
+    
+    /** A set of context partition configurations */
+    private Set<PartitionConfiguration> contextPartitionConfigurations = new HashSet<PartitionConfiguration>();

+    
+    /** A list of entries to load at startup */
+    private List<Attributes> testEntries = new ArrayList<Attributes>();
 
     /**
      * Creates a new instance with default settings.
@@ -98,13 +114,13 @@
         setInstanceId( instanceId );
     }
 
-
+    /**
+     * Define the default authenticator configuration.
+     */
     private void setDefaultAuthenticatorConfigurations()
     {
-        Set set;
-
         // Set default authenticator configurations
-        set = new HashSet();
+        Set<AuthenticatorConfiguration> set = new HashSet<AuthenticatorConfiguration>();
 
         MutableAuthenticatorConfiguration authCfg;
 
@@ -124,11 +140,13 @@
     }
 
 
+    /**
+     * Define the default schemas
+     */
     private void setDefaultBootstrapSchemas()
     {
-        Set set;
         // Set default bootstrap schemas
-        set = new HashSet();
+        Set<BootstrapSchema> set = new HashSet<BootstrapSchema>();
 
         set.add( new CoreSchema() );
         set.add( new CosineSchema() );
@@ -141,14 +159,15 @@
         setBootstrapSchemas( set );
     }
 
-
+    /**
+     * Set the default interceptors chain
+     */
     private void setDefaultInterceptorConfigurations()
     {
         // Set default interceptor chains
-        InterceptorConfiguration interceptorCfg;
-        List list = new ArrayList();
+        List<InterceptorConfiguration> list = new ArrayList<InterceptorConfiguration>();
 
-        interceptorCfg = new MutableInterceptorConfiguration();
+        InterceptorConfiguration interceptorCfg = new MutableInterceptorConfiguration();
         interceptorCfg.setName( "normalizationService" );
         interceptorCfg.setInterceptor( new NormalizationService() );
         list.add( interceptorCfg );
@@ -215,7 +234,7 @@
     /**
      * Returns {@link AuthenticatorConfiguration}s to use for authenticating clients.
      */
-    public Set getAuthenticatorConfigurations()
+    public Set<AuthenticatorConfiguration> getAuthenticatorConfigurations()
     {
         return ConfigurationUtil.getClonedSet( authenticatorConfigurations );
     }
@@ -224,22 +243,23 @@
     /**
      * Sets {@link AuthenticatorConfiguration}s to use for authenticating clients.
      */
-    protected void setAuthenticatorConfigurations( Set authenticatorConfigurations )
+    protected void setAuthenticatorConfigurations( Set<AuthenticatorConfiguration>
authenticatorConfigurations )
     {
-        Set newSet = ConfigurationUtil.getTypeSafeSet( authenticatorConfigurations, AuthenticatorConfiguration.class
);
+        Set<AuthenticatorConfiguration> newSet = ConfigurationUtil.getTypeSafeSet(
authenticatorConfigurations, AuthenticatorConfiguration.class );
 
-        Set names = new HashSet();
-        Iterator i = newSet.iterator();
-        while ( i.hasNext() )
+        Set<String> names = new HashSet<String>();
+        
+        for ( AuthenticatorConfiguration cfg:newSet )
         {
-            AuthenticatorConfiguration cfg = ( AuthenticatorConfiguration ) i.next();
             cfg.validate();
 
             String name = cfg.getName();
+
             if ( names.contains( name ) )
             {
                 throw new ConfigurationException( "Duplicate authenticator name: " + name
);
             }
+            
             names.add( name );
         }
 
@@ -251,12 +271,15 @@
      *
      * @return  The loader bean, if one has been configured.
      */
-    public List getSchemaLoaders()
+    public List<SchemaLoader> getSchemaLoaders()
     {
         return schemaLoaders;
     }
 
-    public void setSchemaLoaders(final List schemaLoaders)
+    /**
+     * @param schemaLoaders Set a list of schemaLoader elements
+     */
+    public void setSchemaLoaders( List<SchemaLoader> schemaLoaders )
     {
         this.schemaLoaders = schemaLoaders;
     }
@@ -264,7 +287,7 @@
     /**
      * Returns {@link BootstrapSchema}s to load while bootstrapping.
      */
-    public Set getBootstrapSchemas()
+    public Set<BootstrapSchema> getBootstrapSchemas()
     {
         return ConfigurationUtil.getClonedSet( bootstrapSchemas );
     }
@@ -273,7 +296,7 @@
     /**
      * Sets {@link BootstrapSchema}s to load while bootstrapping.
      */
-    protected void setBootstrapSchemas( Set bootstrapSchemas )
+    protected void setBootstrapSchemas( Set<BootstrapSchema> bootstrapSchemas )
     {
         this.bootstrapSchemas = ConfigurationUtil.getTypeSafeSet( bootstrapSchemas, BootstrapSchema.class
);
     }
@@ -291,23 +314,24 @@
     /**
      * Sets {@link PartitionConfiguration}s to configure context partitions.
      */
-    protected void setContextPartitionConfigurations( Set contextParitionConfigurations )
+    protected void setContextPartitionConfigurations( Set<PartitionConfiguration> contextPartitionConfigurations
)
     {
-        Set newSet = ConfigurationUtil.getTypeSafeSet( contextParitionConfigurations,
+        Set<PartitionConfiguration> newSet = ConfigurationUtil.getTypeSafeSet( contextPartitionConfigurations,
             PartitionConfiguration.class );
 
-        Set names = new HashSet();
-        Iterator i = newSet.iterator();
-        while ( i.hasNext() )
+        Set<String> names = new HashSet<String>();
+        
+        for ( PartitionConfiguration cfg:newSet )
         {
-            PartitionConfiguration cfg = ( PartitionConfiguration ) i.next();
             cfg.validate();
 
             String name = cfg.getName();
+
             if ( names.contains( name ) )
             {
                 throw new ConfigurationException( "Duplicate partition name: " + name );
             }
+            
             names.add( name );
         }
 
@@ -354,7 +378,7 @@
     /**
      * Returns interceptor chain.
      */
-    public List getInterceptorConfigurations()
+    public List<InterceptorConfiguration> getInterceptorConfigurations()
     {
         return ConfigurationUtil.getClonedList( interceptorConfigurations );
     }
@@ -363,22 +387,23 @@
     /**
      * Sets interceptor chain.
      */
-    protected void setInterceptorConfigurations( List interceptorConfigurations )
+    protected void setInterceptorConfigurations( List<InterceptorConfiguration> interceptorConfigurations
)
     {
-        List newList = ConfigurationUtil.getTypeSafeList( interceptorConfigurations, InterceptorConfiguration.class
);
+        List<InterceptorConfiguration> newList = ConfigurationUtil.getTypeSafeList(
interceptorConfigurations, InterceptorConfiguration.class );
+
+        Set<String> names = new HashSet<String>();
 
-        Set names = new HashSet();
-        Iterator i = newList.iterator();
-        while ( i.hasNext() )
+        for ( InterceptorConfiguration cfg:newList )
         {
-            InterceptorConfiguration cfg = ( InterceptorConfiguration ) i.next();
             cfg.validate();
 
             String name = cfg.getName();
+
             if ( names.contains( name ) )
             {
                 throw new ConfigurationException( "Duplicate interceptor name: " + name );
             }
+            
             names.add( name );
         }
 
@@ -390,7 +415,7 @@
      * Returns test directory entries({@link Attributes}) to be loaded while
      * bootstrapping.
      */
-    public List getTestEntries()
+    public List<Attributes> getTestEntries()
     {
     	try
     	{
@@ -407,7 +432,7 @@
      * Sets test directory entries({@link Attributes}) to be loaded while
      * bootstrapping.
      */
-    protected void setTestEntries( List testEntries )
+    protected void setTestEntries( List<Attributes> testEntries )
     {
     	try
     	{
@@ -474,6 +499,7 @@
     protected void setMaxThreads( int maxThreads )
     {
         this.maxThreads = maxThreads;
+        
         if ( maxThreads < 1 )
         {
             throw new IllegalArgumentException( "Number of max threads should be greater
than 0" );



Mime
View raw message