directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From trus...@apache.org
Subject svn commit: r189948 - in /directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration: AuthenticatorConfiguration.java ContextPartitionConfiguration.java MutableAuthenticatorConfiguration.java MutableStartupConfiguration.java StartupConfiguration.java
Date Fri, 10 Jun 2005 12:43:29 GMT
Author: trustin
Date: Fri Jun 10 05:43:28 2005
New Revision: 189948

URL: http://svn.apache.org/viewcvs?rev=189948&view=rev
Log:
* Added AuthenticatorConfiguration
* Added ContextPartitionConfiguration.name property (replaces legacy ID property)

Added:
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/AuthenticatorConfiguration.java
  (with props)
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableAuthenticatorConfiguration.java
  (with props)
Modified:
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/ContextPartitionConfiguration.java
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java
    directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java

Added: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/AuthenticatorConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/AuthenticatorConfiguration.java?rev=189948&view=auto
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/AuthenticatorConfiguration.java
(added)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/AuthenticatorConfiguration.java
Fri Jun 10 05:43:28 2005
@@ -0,0 +1,70 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.server.configuration;
+
+import org.apache.ldap.server.authn.Authenticator;
+
+/**
+ * A configuration for {@link Authenticator}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class AuthenticatorConfiguration
+{
+    private String name;
+    private Authenticator authenticator;
+
+    protected AuthenticatorConfiguration()
+    {
+    }
+
+    public Authenticator getAuthenticator()
+    {
+        return authenticator;
+    }
+
+    protected void setAuthenticator( Authenticator authenticator )
+    {
+        this.authenticator = authenticator;
+    }
+
+    public String getName()
+    {
+        return name;
+    }
+
+    protected void setName( String name )
+    {
+        this.name = name.trim();
+    }
+
+    public void validate()
+    {
+        if( name == null )
+        {
+            throw new ConfigurationException( "Name is not specified." );
+        }
+        
+        if( authenticator == null )
+        {
+            throw new ConfigurationException( "Authenticator is not specified." );
+        }
+    }
+}

Propchange: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/AuthenticatorConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/ContextPartitionConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/ContextPartitionConfiguration.java?rev=189948&r1=189947&r2=189948&view=diff
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/ContextPartitionConfiguration.java
(original)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/ContextPartitionConfiguration.java
Fri Jun 10 05:43:28 2005
@@ -37,6 +37,7 @@
  */
 public class ContextPartitionConfiguration
 {
+    private String name;
     private String suffix;
     private Set indexedAttributes = new HashSet(); // Set<String>
     private Attributes rootEntry = new BasicAttributes();
@@ -48,6 +49,17 @@
     protected ContextPartitionConfiguration()
     {
     }
+    
+    public String getName()
+    {
+        return name;
+    }
+    
+    public void setName( String name )
+    {
+        // TODO name can be a directory name.
+        this.name = name.trim();
+    }
 
     public Set getIndexedAttributes()
     {
@@ -108,6 +120,11 @@
      */
     public void validate()
     {
+        if( getName() == null )
+        {
+            throw new ConfigurationException( "Name is not specified." );
+        }
+
         if( getSuffix() == null )
         {
             throw new ConfigurationException( "Suffix is not specified." );

Added: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableAuthenticatorConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableAuthenticatorConfiguration.java?rev=189948&view=auto
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableAuthenticatorConfiguration.java
(added)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableAuthenticatorConfiguration.java
Fri Jun 10 05:43:28 2005
@@ -0,0 +1,46 @@
+/*
+ *   @(#) $Id$
+ *
+ *   Copyright 2004 The Apache Software Foundation
+ *
+ *   Licensed under the Apache License, Version 2.0 (the "License");
+ *   you may not use this file except in compliance with the License.
+ *   You may obtain a copy of the License at
+ *
+ *       http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *   Unless required by applicable law or agreed to in writing, software
+ *   distributed under the License is distributed on an "AS IS" BASIS,
+ *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *   See the License for the specific language governing permissions and
+ *   limitations under the License.
+ *
+ */
+package org.apache.ldap.server.configuration;
+
+import org.apache.ldap.server.authn.Authenticator;
+
+/**
+ * A mutable version of {@link AuthenticatorConfiguration}.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class MutableAuthenticatorConfiguration extends
+        AuthenticatorConfiguration
+{
+
+    public MutableAuthenticatorConfiguration()
+    {
+    }
+
+    public void setAuthenticator( Authenticator authenticator )
+    {
+        super.setAuthenticator( authenticator );
+    }
+
+    public void setName( String name )
+    {
+        super.setName( name );
+    }
+}

Propchange: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableAuthenticatorConfiguration.java
------------------------------------------------------------------------------
    svn:keywords = HeadURL Id LastChangedBy LastChangedDate LastChangedRevision

Modified: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java?rev=189948&r1=189947&r2=189948&view=diff
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java
(original)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/MutableStartupConfiguration.java
Fri Jun 10 05:43:28 2005
@@ -38,9 +38,9 @@
     {
     }
 
-    public void setAuthenticators( Set authenticators )
+    public void setAuthenticatorConfigurations( Set authenticators )
     {
-        super.setAuthenticators( authenticators );
+        super.setAuthenticatorConfigurations( authenticators );
     }
 
     public void setBootstrapSchemas( Set bootstrapSchemas )

Modified: directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
URL: http://svn.apache.org/viewcvs/directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java?rev=189948&r1=189947&r2=189948&view=diff
==============================================================================
--- directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
(original)
+++ directory/apacheds/branches/direve-158/core/src/main/java/org/apache/ldap/server/configuration/StartupConfiguration.java
Fri Jun 10 05:43:28 2005
@@ -25,7 +25,6 @@
 
 import javax.naming.directory.Attributes;
 
-import org.apache.ldap.server.authn.Authenticator;
 import org.apache.ldap.server.authn.SimpleAuthenticator;
 import org.apache.ldap.server.interceptor.InterceptorChain;
 import org.apache.ldap.server.schema.bootstrap.ApacheSchema;
@@ -48,48 +47,69 @@
 {
     private static final long serialVersionUID = 4826762196566871677L;
 
-    protected File workingDirectory;
+    protected File workingDirectory = new File( "server-work" );
     protected boolean allowAnonymousAccess;
-    protected Set authenticators = new HashSet(); // Set<Authenticator> and their properties>?
+    protected Set authenticatorConfigurations; // Set<AuthenticatorConfiguration>
     protected InterceptorChain interceptors = InterceptorChain.newDefaultChain();
     protected ServiceRegistry minaServiceRegistry = new SimpleServiceRegistry();
     protected int ldapPort = 389;
     protected int ldapsPort = 636;
     protected boolean enableKerberos;
     
-    protected Set bootstrapSchemas = new HashSet(); // Set<BootstrapSchema>
+    protected Set bootstrapSchemas; // Set<BootstrapSchema>
     protected Set contextPartitionConfigurations; // Set<ContextPartitionConfiguration>
     protected Set testEntries = new HashSet(); // Set<Attributes>
     
     protected StartupConfiguration()
     {
-        // Set default authenticators
-        authenticators.add( new SimpleAuthenticator() );
+        Set set; 
+        
+        // Set default authenticator configurations
+        set = new HashSet();
+        
+        MutableAuthenticatorConfiguration authCfg = new MutableAuthenticatorConfiguration();
+        authCfg.setName( "Simple" );
+        authCfg.setAuthenticator( new SimpleAuthenticator() );
+        set.add( authCfg );
+        
+        setAuthenticatorConfigurations( set );
         
         // Set default bootstrap schemas
-        bootstrapSchemas.add( new CoreSchema() );
-        bootstrapSchemas.add( new CosineSchema() );        
-        bootstrapSchemas.add( new ApacheSchema() );        
-        bootstrapSchemas.add( new InetorgpersonSchema() );        
-        bootstrapSchemas.add( new JavaSchema() );        
-        bootstrapSchemas.add( new SystemSchema() );        
+        set = new HashSet();
+        
+        set.add( new CoreSchema() );
+        set.add( new CosineSchema() );        
+        set.add( new ApacheSchema() );        
+        set.add( new InetorgpersonSchema() );        
+        set.add( new JavaSchema() );        
+        set.add( new SystemSchema() );
+        
+        setBootstrapSchemas( set );
     }
 
     /**
-     * Returns {@link Authenticator}s to use for authenticating clients.
+     * Returns {@link AuthenticatorConfiguration}s to use for authenticating clients.
      */
-    public Set getAuthenticators()
+    public Set getAuthenticatorConfigurations()
     {
-        return ConfigurationUtil.getClonedSet( authenticators );
+        return ConfigurationUtil.getClonedSet( authenticatorConfigurations );
     }
 
     /**
-     * Sets {@link Authenticator}s to use for authenticating clients.
+     * Sets {@link AuthenticatorConfiguration}s to use for authenticating clients.
      */
-    protected void setAuthenticators( Set authenticators )
+    protected void setAuthenticatorConfigurations( Set authenticatorConfigurations )
     {
-        this.authenticators = ConfigurationUtil.getTypeSafeSet(
-                authenticators, Authenticator.class );
+        Set newSet = ConfigurationUtil.getTypeSafeSet(
+                authenticatorConfigurations, AuthenticatorConfiguration.class );
+        
+        Iterator i = newSet.iterator();
+        while( i.hasNext() )
+        {
+            ( ( AuthenticatorConfiguration ) i.next() ).validate();
+        }
+        
+        this.authenticatorConfigurations = newSet;
     }
 
     /**
@@ -289,10 +309,7 @@
     
     public void validate()
     {
-        if( workingDirectory == null )
-        {
-            throw new ConfigurationException( "WorkingDirectory is not specified." );
-        }
+        setWorkingDirectory( workingDirectory );
         
         if( contextPartitionConfigurations == null || contextPartitionConfigurations.size()
== 0 )
         {



Mime
View raw message