directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elecha...@apache.org
Subject svn commit: r1027126 - in /directory: apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ apacheds/bra...
Date Mon, 25 Oct 2010 14:05:48 GMT
Author: elecharny
Date: Mon Oct 25 14:05:47 2010
New Revision: 1027126

URL: http://svn.apache.org/viewvc?rev=1027126&view=rev
Log:
Made the DS config reader be almost happy

Modified:
    directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
    directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java
    directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
    directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/InterceptorBean.java
    directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmPartitionBean.java
    directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java
    directory/apacheds/branches/apacheds-config/server-config/src/main/resources/config.ldif
    directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
    directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=objectclasses/m-oid=1.3.6.1.4.1.18060.0.4.1.3.250.ldif

Modified: directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=1027126&r1=1027125&r2=1027126&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
Mon Oct 25 14:05:47 2010
@@ -31,6 +31,7 @@ import java.lang.reflect.Method;
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -852,6 +853,12 @@ public class ConfigPartitionReader
             // Get the entry attribute for this field
             EntryAttribute fieldAttr = entry.get( fieldName );
             
+            if ( ( fieldAttr == null ) && ( mandatory ) )
+            {
+                System.out.println( "!!! Attribute " + fieldName + " is mandatory and is
not present for the Entry " + entry.getDn() );
+                continue;
+            }
+            
             AttributeType beanAT = schemaManager.getAttributeType( fieldName );
             
             // Check if this AT has the ads-compositeElement as a superior
@@ -892,7 +899,7 @@ public class ConfigPartitionReader
                     // We have to remove the 's' at the end of the field name
                     String attributeName = fieldName.substring( 0, fieldName.length() - 1
);
                     
-                    List<AdsBaseBean> beans = read( newBase, attributeName, SearchScope.ONELEVEL,
mandatory );
+                    Collection<AdsBaseBean> beans = read( newBase, attributeName, SearchScope.ONELEVEL,
mandatory );
                     beanField.set( bean, beans );
                 }
             }

Modified: directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java?rev=1027126&r1=1027125&r2=1027126&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java
Mon Oct 25 14:05:47 2010
@@ -228,7 +228,7 @@ public class ChangePasswordServerBean ex
         StringBuilder sb = new StringBuilder();
         
         sb.append( tabs ).append( "ChangePasswordServer :\n" );
-        sb.append( super.toString( tabs ) );
+        sb.append( super.toString( tabs + "  " ) );
         sb.append( toString( tabs, "  change password service principal", chgpwdserviceprincipal
) );
         sb.append( toString( tabs, "  KRB primary realm", krbprimaryrealm ) );
         

Modified: directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java?rev=1027126&r1=1027125&r2=1027126&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
Mon Oct 25 14:05:47 2010
@@ -20,8 +20,8 @@
 package org.apache.directory.server.config.beans;
 
 
+import java.util.ArrayList;
 import java.util.List;
-import java.util.Set;
 
 import org.apache.directory.server.core.authn.PasswordPolicyConfiguration;
 
@@ -67,13 +67,13 @@ public class DirectoryServiceBean extend
     private JournalBean journal;
 
     /** The servers */
-    private Set<ServerBean> servers;
+    private List<ServerBean> servers = new ArrayList<ServerBean>();
 
     /** The list of declared interceptors */
-    private List<InterceptorBean> interceptors;
+    private List<InterceptorBean> interceptors = new ArrayList<InterceptorBean>();
 
     /** The set of associated partitions */
-    private List<PartitionBean> partitions;
+    private List<PartitionBean> partitions = new ArrayList<PartitionBean>();
 
     /** The reference to the Password Policy component */
     private PasswordPolicyConfiguration passwordpolicy;
@@ -157,6 +157,20 @@ public class DirectoryServiceBean extend
 
 
     /**
+     * Adds the interceptors in the server.
+     *
+     * @param interceptors the interceptors to be added in the server.
+     */
+    public void addinterceptors( InterceptorBean... interceptors )
+    {
+        for ( InterceptorBean interceptor : interceptors )
+        {
+            this.interceptors.add( interceptor );
+        }
+    }
+
+
+    /**
      * @return the dsAccessControlEnabled
      */
     public boolean isDsAccessControlEnabled()
@@ -337,6 +351,48 @@ public class DirectoryServiceBean extend
 
 
     /**
+     * @param partitions the partitions to add
+     */
+    public void addpartitions( PartitionBean... partitions )
+    {
+        for ( PartitionBean partition : partitions )
+        {
+            this.partitions.add( partition );
+        }
+    }
+
+
+    /**
+     * @return the servers
+     */
+    public List<ServerBean> getServers()
+    {
+        return servers;
+    }
+
+
+    /**
+     * @param servers the servers to set
+     */
+    public void setServers( List<ServerBean> servers )
+    {
+        this.servers = servers;
+    }
+
+
+    /**
+     * @param servers the servers to add
+     */
+    public void addservers( ServerBean... servers )
+    {
+        for ( ServerBean server : servers )
+        {
+            this.servers.add( server );
+        }
+    }
+
+    
+    /**
      * @return the passwordPolicy
      */
     public PasswordPolicyConfiguration getPasswordPolicy()
@@ -386,9 +442,17 @@ public class DirectoryServiceBean extend
         sb.append( "  directoryService ID : " ).append( directoryserviceid ).append( '\n'
);
         sb.append( "  replica ID : " ).append( dsreplicaid ).append( '\n' );
         sb.append( "  working directory : " ).append( dsworkingdirectory ).append( '\n' );
+        sb.append( toString( "  ", "accessControl enabled", dsaccesscontrolenabled ) );
+        sb.append( toString( "  ", "allow anonymous access", dsallowanonymousaccess ) );
+        sb.append( toString( "  ", "denormalized attributes enabled", dsdenormalizeopattrsenabled
) );
+        sb.append( toString( "  ", "password hidden", dspasswordhidden ) );
+        sb.append( "  max PDU size : " ).append( dsmaxpdusize ).append( '\n' );
+        sb.append( "  sync period millisecond : " ).append( dssyncperiodmillis ).append(
'\n' );
+        sb.append( toString( "  ", "test entries", dstestentries ) );
+        
         sb.append( "  interceptors : \n" );
         
-        if ( interceptors != null )
+        if ( ( interceptors != null ) && ( interceptors.size() > 0 ) )
         {
             for ( InterceptorBean interceptor : interceptors )
             {
@@ -398,33 +462,14 @@ public class DirectoryServiceBean extend
         
         sb.append( "  partitions : \n" );
         
-        if ( partitions != null )
+        if ( ( partitions != null ) && ( partitions.size() > 0 ) )
         {
             for ( PartitionBean partition : partitions )
             {
                 sb.append( partition.toString( "    " ) );
             }
         }
-        
-        
-        sb.append( "  servers : \n" );
-        
-        if ( servers != null )
-        {
-            for ( ServerBean server : servers )
-            {
-                sb.append( server.toString( "    " ) );
-            }
-        }
 
-        sb.append( toString( "  ", "accessControl enabled", dsaccesscontrolenabled ) );
-        sb.append( toString( "  ", "allow anonymous access", dsallowanonymousaccess ) );
-        sb.append( toString( "  ", "denormalized attributes enabled", dsdenormalizeopattrsenabled
) );
-        sb.append( toString( "  ", "password hidden", dspasswordhidden ) );
-        sb.append( "  max PDU size : " ).append( dsmaxpdusize ).append( '\n' );
-        sb.append( "  sync period millisecond : " ).append( dssyncperiodmillis ).append(
'\n' );
-        sb.append( "  test entries : " ).append( dstestentries ).append( '\n' );
-        
         if ( journal != null )
         {
             sb.append( "  journal : \n" );
@@ -441,6 +486,16 @@ public class DirectoryServiceBean extend
             sb.append( passwordpolicy.toString( "    " ) );
         }
         
+        sb.append( "  servers : \n" );
+        
+        if ( ( servers != null ) && ( servers.size() > 0 ) )
+        {
+            for ( ServerBean server : servers )
+            {
+                sb.append( server.toString( "    " ) );
+            }
+        }
+
         sb.append( '\n' );
 
         return sb.toString();

Modified: directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/InterceptorBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/InterceptorBean.java?rev=1027126&r1=1027125&r2=1027126&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/InterceptorBean.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/InterceptorBean.java
Mon Oct 25 14:05:47 2010
@@ -26,7 +26,7 @@ package org.apache.directory.server.conf
  *
  * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
  */
-public class InterceptorBean implements Comparable<InterceptorBean>
+public class InterceptorBean extends AdsBaseBean implements Comparable<InterceptorBean>
 {
     /** The Interceptor ID */
     private String interceptorid;
@@ -128,9 +128,9 @@ public class InterceptorBean implements 
     {
         StringBuilder sb = new StringBuilder();
         
-        sb.append( tabs ).append( "interceptor[" );
-        sb.append( interceptorid ).append( "] ID : " ).append(  interceptorid ).append( '\n'
);
-        sb.append( tabs ).append( "class name : " ).append(  interceptorclassname ).append(
'\n' );
+        sb.append( tabs ).append( "interceptor[" ).append( interceptororder ).append( "]
: " ).append( '\n' );
+        sb.append( tabs ).append( "  interceptor id : " ).append( interceptorid ).append(
'\n' );
+        sb.append( tabs ).append( "  class name : " ).append(  interceptorclassname ).append(
'\n' );
         
         return sb.toString();
     }

Modified: directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmPartitionBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmPartitionBean.java?rev=1027126&r1=1027125&r2=1027126&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmPartitionBean.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmPartitionBean.java
Mon Oct 25 14:05:47 2010
@@ -94,8 +94,8 @@ public class JdbmPartitionBean extends P
         StringBuilder sb = new StringBuilder();
         
         sb.append( tabs ).append( "JdbmPartitionBean :\n" );
-        sb.append( super.toString( tabs + "  " ) );
-        sb.append( tabs ).append( "  partition cache size" ).append( partitioncachesize ).append(
'\n' );
+        sb.append( super.toString( tabs ) );
+        sb.append( tabs ).append( "  partition cache size : " ).append( partitioncachesize
).append( '\n' );
         sb.append( toString( tabs, "  jdbm partition optimizer enabled", jdbmpartitionoptimizerenabled
) );
         
         return sb.toString();

Modified: directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java?rev=1027126&r1=1027125&r2=1027126&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java
Mon Oct 25 14:05:47 2010
@@ -21,8 +21,6 @@ package org.apache.directory.server.conf
 
 import java.util.List;
 
-import org.apache.directory.shared.ldap.name.DN;
-
 /**
  * A class used to store the Partition configuration. It can't be instanciated
  *
@@ -34,7 +32,7 @@ public abstract class PartitionBean exte
     private String partitionid;
     
     /** The Partition suffix */
-    private DN partitionsuffix;
+    private String partitionsuffix;
     
     /** Tells if the data should be flushed to disk immediately */
     private boolean partitionsynconwrite;
@@ -71,7 +69,7 @@ public abstract class PartitionBean exte
     /**
      * @return the partitionSuffix
      */
-    public DN getPartitionSuffix()
+    public String getPartitionSuffix()
     {
         return partitionsuffix;
     }
@@ -80,7 +78,7 @@ public abstract class PartitionBean exte
     /**
      * @param partitionSuffix the partitionSuffix to set
      */
-    public void setPartitionSuffix( DN partitionSuffix )
+    public void setPartitionSuffix( String partitionSuffix )
     {
         this.partitionsuffix = partitionSuffix;
     }
@@ -130,7 +128,7 @@ public abstract class PartitionBean exte
         StringBuilder sb = new StringBuilder();
         
         sb.append( super.toString( tabs + "  " ) );
-        sb.append( tabs ).append( "  partition ID" ).append( partitionid ).append( '\n' );
+        sb.append( tabs ).append( "  partition ID : " ).append( partitionid ).append( '\n'
);
         sb.append( tabs ).append( "  suffix : " ).append( partitionsuffix ).append( '\n'
);
         sb.append( toString( tabs, "  sync on write", partitionsynconwrite ) );
         

Modified: directory/apacheds/branches/apacheds-config/server-config/src/main/resources/config.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/main/resources/config.ldif?rev=1027126&r1=1027125&r2=1027126&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/main/resources/config.ldif
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/main/resources/config.ldif
Mon Oct 25 14:05:47 2010
@@ -19,6 +19,7 @@ ads-dsmaxpdusize: 2000000
 ads-dsallowanonymousaccess: true
 ads-dsaccesscontrolenabled: false
 ads-dsdenormalizeopattrsenabled: false
+ads-dsWorkingDirectory: /tmp
 ads-servers: changepasswordserver
 ads-servers: dns
 ads-servers: httpserver
@@ -188,7 +189,7 @@ objectclass: organizationalUnit
 objectclass: top
 
 dn: ads-partitionId=system,ou=partitions,ads-directoryServiceId=default,ou=config
-ads-partitionsuffix: ou=system
+ads-partitionSuffix: ou=system
 ads-jdbmpartitionoptimizerenabled: true
 ads-partitioncachesize: 100
 ads-partitionsynconwrite: true
@@ -284,7 +285,7 @@ objectclass: top
 ads-enabled: true
 
 dn: ads-partitionId=example,ou=partitions,ads-directoryServiceId=default,ou=config
-ads-partitionsuffix: dc=example,dc=com
+ads-partitionSuffix: dc=example,dc=com
 ads-jdbmpartitionoptimizerenabled: true
 ads-partitioncachesize: 100
 ads-partitionsynconwrite: true

Modified: directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java?rev=1027126&r1=1027125&r2=1027126&view=diff
==============================================================================
--- directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
(original)
+++ directory/apacheds/branches/apacheds-config/server-config/src/test/java/org/apache/directory/server/config/ConfigPartitionReaderTest.java
Mon Oct 25 14:05:47 2010
@@ -22,6 +22,7 @@ package org.apache.directory.server.conf
 
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 
 import java.io.File;
@@ -31,6 +32,7 @@ import org.apache.commons.io.FileUtils;
 import org.apache.directory.junit.tools.Concurrent;
 import org.apache.directory.junit.tools.ConcurrentJunitRunner;
 import org.apache.directory.server.config.beans.ConfigBean;
+import org.apache.directory.server.config.beans.DirectoryServiceBean;
 import org.apache.directory.server.core.DirectoryService;
 import org.apache.directory.server.core.partition.ldif.SingleFileLdifPartition;
 import org.apache.directory.server.ldap.LdapServer;
@@ -64,6 +66,8 @@ public class ConfigPartitionReaderTest
 
     private static SchemaManager schemaManager;
 
+    private static File workDir = new File( System.getProperty( "java.io.tmpdir" ) + "/server-work"
);
+
 
     @BeforeClass
     public static void readConfig() throws Exception
@@ -99,9 +103,23 @@ public class ConfigPartitionReaderTest
             throw new Exception( "Schema load failed : " + LdapExceptionUtils.printErrors(
errors ) );
         }
 
+    }
+
+
+    @AfterClass
+    public static void cleanup() throws Exception
+    {
+        server.stop();
+        dirService.shutdown();
+    }
+
+
+    @Test
+    public void testDirService() throws Exception
+    {
         File configDir = new File( workDir, "config" ); // could be any directory, cause
the config is now in a single file
         
-        String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, true
);
+        String configFile = LdifConfigExtractor.extractSingleFileConfig( configDir, "config.ldif",
true );
 
         SingleFileLdifPartition configPartition = new SingleFileLdifPartition( configFile
);
         configPartition.setId( "config" );
@@ -113,6 +131,10 @@ public class ConfigPartitionReaderTest
         ConfigPartitionReader cpReader = new ConfigPartitionReader( configPartition, workDir
);
         
         ConfigBean configBean = cpReader.readConfig( new DN( "ou=config" ), ConfigSchemaConstants.ADS_DIRECTORY_SERVICE_OC.getValue()
);
+
+        assertNotNull( configBean );
+        DirectoryServiceBean directoryServiceBean = (DirectoryServiceBean)configBean.getDirectoryServiceBeans().get(
0 );
+        assertNotNull( directoryServiceBean );
         /*
         dirService = createDirectoryService( configBean );
 
@@ -146,20 +168,7 @@ public class ConfigPartitionReaderTest
 
         server.start();
         */
-    }
 
-
-    @AfterClass
-    public static void cleanup() throws Exception
-    {
-        server.stop();
-        dirService.shutdown();
-    }
-
-
-    @Test
-    public void testDirService()
-    {
         assertTrue( dirService.isStarted() );
         assertEquals( "default", dirService.getInstanceId() );
     }

Modified: directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=objectclasses/m-oid=1.3.6.1.4.1.18060.0.4.1.3.250.ldif
URL: http://svn.apache.org/viewvc/directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou%3Dschema/cn%3Dadsconfig/ou%3Dobjectclasses/m-oid%3D1.3.6.1.4.1.18060.0.4.1.3.250.ldif?rev=1027126&r1=1027125&r2=1027126&view=diff
==============================================================================
--- directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=objectclasses/m-oid=1.3.6.1.4.1.18060.0.4.1.3.250.ldif
(original)
+++ directory/shared/branches/shared-config/ldap-schema/src/main/resources/schema/ou=schema/cn=adsconfig/ou=objectclasses/m-oid=1.3.6.1.4.1.18060.0.4.1.3.250.ldif
Mon Oct 25 14:05:47 2010
@@ -13,4 +13,4 @@ createtimestamp: 20100111145218Z
 creatorsname: 0.9.2342.19200300.100.1.1=admin,2.5.4.11=system
 entrycsn: 20100111202218.063000Z#000000#000#000000
 m-must: ads-serverId
-m-must: ads-transports
+m-may: ads-transports



Mime
View raw message