directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1419546 - in /directory/apacheds/trunk/server-config/src/main: java/org/apache/directory/server/config/ java/org/apache/directory/server/config/beans/ resources/
Date Mon, 10 Dec 2012 16:02:38 GMT
Author: pamarcelot
Date: Mon Dec 10 16:02:34 2012
New Revision: 1419546

URL: http://svn.apache.org/viewvc?rev=1419546&view=rev
Log:
Removed all attributes that maintained references to configuration sub-entries. Updated the configuration reader/writer to look for information on the fields in the annotations of the beans, rather than in the schema (where we can't store enough information).

Modified:
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigurationElement.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AdsBaseBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DSBasedServerBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DelegatingAuthenticatorBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/IndexBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmPartitionBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/KdcServerBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ReplConsumerBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/SaslMechHandlerBean.java
    directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ServerBean.java
    directory/apacheds/trunk/server-config/src/main/resources/config.ldif

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigPartitionReader.java Mon Dec 10 16:02:34 2012
@@ -55,7 +55,6 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.model.message.SearchScope;
 import org.apache.directory.shared.ldap.model.name.Dn;
 import org.apache.directory.shared.ldap.model.name.Rdn;
-import org.apache.directory.shared.ldap.model.schema.AttributeType;
 import org.apache.directory.shared.ldap.model.schema.ObjectClass;
 import org.apache.directory.shared.ldap.model.schema.SchemaManager;
 import org.slf4j.Logger;
@@ -88,10 +87,6 @@ public class ConfigPartitionReader
     /** The suffix for the bean */
     private static final String ADS_SUFFIX = "Bean";
 
-    /** Those two flags are used to tell the reader if an element of configuration is mandatory or not */
-    private static final boolean MANDATORY = true;
-    private static final boolean OPTIONNAL = false;
-
 
     /**
      * 
@@ -118,7 +113,7 @@ public class ConfigPartitionReader
 
 
     /**
-     * Fnd the upper objectclass in a hierarchy. All the inherited ObjectClasses
+     * Find the upper objectclass in a hierarchy. All the inherited ObjectClasses
      * will be removed.
      */
     private ObjectClass findObjectClass( Attribute objectClass ) throws Exception
@@ -142,7 +137,6 @@ public class ConfigPartitionReader
         }
         catch ( Exception e )
         {
-            e.printStackTrace();
             throw e;
         }
 
@@ -186,7 +180,7 @@ public class ConfigPartitionReader
         // The remaining OC in the candidates set is the one we are looking for
         String objectClassName = objectClass.getName();
 
-        // Now, let's instanciate the associated bean. Get rid of the 'ads-' in front of the name,
+        // Now, let's instantiate the associated bean. Get rid of the 'ads-' in front of the name,
         // and uppercase the first letter. Finally add "Bean" at the end and add the package.
         //String beanName = this.getClass().getPackage().getName() + "org.apache.directory.server.config.beans." + Character.toUpperCase( objectClassName.charAt( 4 ) ) + objectClassName.substring( 5 ) + "Bean";
         String beanName = this.getClass().getPackage().getName() + ".beans." +
@@ -235,7 +229,7 @@ public class ConfigPartitionReader
         }
         catch ( InstantiationException ie )
         {
-            String message = "Cannot instanciate the class " + beanName + ", " + ie.getMessage();
+            String message = "Cannot instantiate the class " + beanName + ", " + ie.getMessage();
             LOG.error( message );
             throw new ConfigurationException( message );
         }
@@ -243,41 +237,9 @@ public class ConfigPartitionReader
 
 
     /**
-     * Retrieve the Field associated with an AttributeType name, if any.
-     */
-    private static Field getField( Class<?> clazz, String attributeName, Class<?> originalClazz )
-        throws ConfigurationException
-    {
-        // We will check all the fields, as the AT name is case insentitive
-        // when the field is case sensitive
-        Field[] fields = clazz.getDeclaredFields();
-
-        for ( Field field : fields )
-        {
-            String fieldName = field.getName();
-
-            if ( fieldName.equalsIgnoreCase( attributeName ) )
-            {
-                return field;
-            }
-        }
-
-        // May be in the paren'ts class ?
-        if ( clazz.getSuperclass() != null )
-        {
-            return getField( clazz.getSuperclass(), attributeName, originalClazz );
-        }
-
-        String message = "Cannot find a field named " + attributeName + " in class " + originalClazz.getName();
-        LOG.error( message );
-        throw new ConfigurationException( message );
-    }
-
-
-    /**
      * Read the single entry value for an AttributeType, and feed the Bean field with this value
      */
-    private void readSingleValueField( AdsBaseBean bean, Field beanField, Attribute fieldAttr, boolean mandatory )
+    private void readSingleValueField( AdsBaseBean bean, Field beanField, Attribute fieldAttr )
         throws ConfigurationException
     {
         if ( fieldAttr == null )
@@ -294,7 +256,7 @@ public class ConfigPartitionReader
         {
             if ( type == String.class )
             {
-                beanField.set( bean, value.getString() );
+                beanField.set( bean, valueStr );
             }
             else if ( type == byte[].class )
             {
@@ -346,21 +308,21 @@ public class ConfigPartitionReader
     /**
      * Read the multiple entry value for an AttributeType, and feed the Bean field with this value
      */
-    private void readMultiValuedField( AdsBaseBean bean, Field beanField, Attribute fieldAttr, boolean mandatory )
+    private void readMultiValuedField( AdsBaseBean bean, Field field, Attribute attribute )
         throws ConfigurationException
     {
-        if ( fieldAttr == null )
+        if ( attribute == null )
         {
             return;
         }
 
-        Class<?> type = beanField.getType();
+        Class<?> type = field.getType();
 
-        String fieldName = beanField.getName();
+        String fieldName = field.getName();
         String addMethodName = "add" + Character.toUpperCase( fieldName.charAt( 0 ) ) + fieldName.substring( 1 );
 
         // loop on the values and inject them in the bean
-        for ( Value<?> value : fieldAttr )
+        for ( Value<?> value : attribute )
         {
             String valueStr = value.getString();
 
@@ -368,30 +330,30 @@ public class ConfigPartitionReader
             {
                 if ( type == String.class )
                 {
-                    beanField.set( bean, valueStr );
+                    field.set( bean, valueStr );
                 }
                 else if ( type == int.class )
                 {
-                    beanField.setInt( bean, Integer.parseInt( valueStr ) );
+                    field.setInt( bean, Integer.parseInt( valueStr ) );
                 }
                 else if ( type == long.class )
                 {
-                    beanField.setLong( bean, Long.parseLong( valueStr ) );
+                    field.setLong( bean, Long.parseLong( valueStr ) );
                 }
                 else if ( type == boolean.class )
                 {
-                    beanField.setBoolean( bean, Boolean.parseBoolean( valueStr ) );
+                    field.setBoolean( bean, Boolean.parseBoolean( valueStr ) );
                 }
                 else if ( type == Dn.class )
                 {
                     try
                     {
                         Dn dn = new Dn( valueStr );
-                        beanField.set( bean, dn );
+                        field.set( bean, dn );
                     }
                     catch ( LdapInvalidDnException lide )
                     {
-                        String message = "The Dn '" + valueStr + "' for attribute " + fieldAttr.getId()
+                        String message = "The Dn '" + valueStr + "' for attribute " + attribute.getId()
                             + " is not a valid Dn";
                         LOG.error( message );
                         throw new ConfigurationException( message );
@@ -399,7 +361,7 @@ public class ConfigPartitionReader
                 }
                 else if ( type == Set.class )
                 {
-                    Type genericFieldType = beanField.getGenericType();
+                    Type genericFieldType = field.getGenericType();
                     Class<?> fieldArgClass = null;
 
                     if ( genericFieldType instanceof ParameterizedType )
@@ -422,7 +384,7 @@ public class ConfigPartitionReader
                 }
                 else if ( type == List.class )
                 {
-                    Type genericFieldType = beanField.getGenericType();
+                    Type genericFieldType = field.getGenericType();
                     Class<?> fieldArgClass = null;
 
                     if ( genericFieldType instanceof ParameterizedType )
@@ -446,13 +408,13 @@ public class ConfigPartitionReader
             }
             catch ( IllegalArgumentException iae )
             {
-                String message = "Cannot store '" + valueStr + "' into attribute " + fieldAttr.getId();
+                String message = "Cannot store '" + valueStr + "' into attribute " + attribute.getId();
                 LOG.error( message );
                 throw new ConfigurationException( message );
             }
             catch ( IllegalAccessException e )
             {
-                String message = "Cannot store '" + valueStr + "' into attribute " + fieldAttr.getId();
+                String message = "Cannot store '" + valueStr + "' into attribute " + attribute.getId();
                 LOG.error( message );
                 throw new ConfigurationException( message );
             }
@@ -482,237 +444,34 @@ public class ConfigPartitionReader
     }
 
 
-    /**
-     * Read all the required fields (AttributeTypes) for a given Entry.
-     */
-    private void readFields( AdsBaseBean bean, Entry entry, Set<AttributeType> attributeTypes, boolean mandatory )
-        throws NoSuchFieldException, IllegalAccessException, Exception
-    {
-        for ( AttributeType attributeType : attributeTypes )
-        {
-            String fieldName = attributeType.getName();
-            String beanFieldName = fieldName;
-
-            // Remove the "ads-" from the beginning of the field name
-            if ( fieldName.startsWith( ADS_PREFIX ) )
-            {
-                beanFieldName = fieldName.substring( ADS_PREFIX.length() );
-            }
-
-            // Get the field
-            Field beanField = getField( bean.getClass(), beanFieldName, bean.getClass() );
-
-            // The field is private, we need to modify it to be able to access it.
-            beanField.setAccessible( true );
-
-            // Get the entry attribute for this field
-            Attribute fieldAttr = entry.get( fieldName );
-
-            if ( ( fieldAttr == null ) && ( mandatory ) )
-            {
-                String message = "Attribute " + fieldName + " is mandatory and is not present for the Entry "
-                    + entry.getDn();
-                LOG.error( message );
-                throw new ConfigurationException( message );
-            }
-
-            // Get the associated AttributeType
-            AttributeType beanAT = schemaManager.getAttributeType( fieldName );
-
-            // Check if this AT has the ads-compositeElement as a superior
-            AttributeType superior = beanAT.getSuperior();
-
-            if ( ( superior != null )
-                && superior.getOid().equals( ConfigSchemaConstants.ADS_COMPOSITE_ELEMENT_AT.getOid() ) )
-            {
-                // This is a composite element, we have to go one level down to read it.
-                // First, check if it's a SingleValued element
-                if ( beanAT.isSingleValued() )
-                {
-                    // Yes : get the first element
-                    List<AdsBaseBean> beans = read( entry.getDn(), fieldName, SearchScope.ONELEVEL, mandatory );
-
-                    // We may not have found an element, but if the attribute is mandatory,
-                    // this is an error
-                    if ( ( beans == null ) || ( beans.size() == 0 ) )
-                    {
-                        if ( mandatory )
-                        {
-                            // This is an error !
-                            String message = "The composite " + beanAT.getName()
-                                + " is mandatory, and was not found under the "
-                                + "configuration entry " + entry.getDn();
-                            LOG.error( message );
-                            throw new ConfigurationException( message );
-                        }
-                    }
-                    else
-                    {
-                        // We must take the first element
-                        AdsBaseBean readBean = beans.get( 0 );
-
-                        if ( beans.size() > 1 )
-                        {
-                            // Not allowed as the AT is singled-valued
-                            String message = "We have more than one entry for " + beanAT.getName() + " under "
-                                + entry.getDn();
-                            LOG.error( message );
-                            throw new ConfigurationException( message );
-                        }
-
-                        beanField.set( bean, readBean );
-                    }
-                }
-                else
-                {
-                    // No : we have to loop recursively on all the elements which are
-                    // under the ou=<element-name> branch
-                    Dn newBase = entry.getDn().add( "ou=" + beanFieldName );
-
-                    // We have to remove the 's' at the end of the field name
-                    String attributeName = fieldName.substring( 0, fieldName.length() - 1 );
-
-                    // Sometime, the plural of a noun takes 'es'
-                    if ( !schemaManager.getObjectClassRegistry().contains( attributeName ) )
-                    {
-                        // Try by removing 'es'
-                        attributeName = fieldName.substring( 0, fieldName.length() - 2 );
-
-                        // if not found try by removing 'ies' and adding 'y' , e.x ads-passwordPolicies
-                        if ( fieldName.endsWith( "ies" )
-                            && !schemaManager.getObjectClassRegistry().contains( attributeName ) )
-                        {
-                            attributeName = fieldName.substring( 0, fieldName.length() - 3 ) + "y";
-                        }
-
-                        if ( !schemaManager.getObjectClassRegistry().contains( attributeName ) )
-                        {
-                            String message = "Cannot find the ObjectClass named " + attributeName + " in the schema";
-                            LOG.error( message );
-                            throw new ConfigurationException( message );
-                        }
-                    }
-
-                    // This is a multi-valued element, it can be a Set or a List
-                    Collection<AdsBaseBean> beans = read( newBase, attributeName, SearchScope.ONELEVEL, mandatory );
-
-                    if ( ( beans == null ) || ( beans.size() == 0 ) )
-                    {
-                        // If the element is mandatory, this is an error
-                        if ( mandatory )
-                        {
-                            String message = "The composite " + beanAT.getName()
-                                + " is mandatory, and was not found under the "
-                                + "configuration entry " + entry.getDn();
-                            LOG.error( message );
-                            throw new ConfigurationException( message );
-                        }
-                    }
-                    else
-                    {
-                        // Update the field
-                        beanField.set( bean, beans );
-                    }
-                }
-            }
-            else
-            // A standard AttributeType (ie, boolean, long, int or String)
-            {
-                // Process the field accordingly to its cardinality
-                if ( beanAT.isSingleValued() )
-                {
-                    readSingleValueField( bean, beanField, fieldAttr, mandatory );
-                }
-                else
-                {
-                    readMultiValuedField( bean, beanField, fieldAttr, mandatory );
-                }
-            }
-        }
-    }
-
-
-    /**
-     * Get the list of MUST AttributeTypes for an objectClass
-     */
-    private Set<AttributeType> getAllMusts( ObjectClass objectClass )
+    private void readFieldValue( AdsBaseBean bean, Field field, Entry entry, String attributeTypeName, boolean mandatory )
+        throws ConfigurationException
     {
-        Set<AttributeType> musts = new HashSet<AttributeType>();
-
-        // First, gets the direct MUST
-        musts.addAll( objectClass.getMustAttributeTypes() );
-
-        // then add all the superiors MUST (recursively)
-        List<ObjectClass> superiors = objectClass.getSuperiors();
+        // Get the entry attribute for this attribute type
+        Attribute attribute = entry.get( attributeTypeName );
 
-        if ( superiors != null )
+        if ( ( attribute != null ) && attribute.size() > 0 )
         {
-            for ( ObjectClass superior : superiors )
+            if ( isMultiple( field.getClass() ) )
             {
-                musts.addAll( getAllMusts( superior ) );
+                readSingleValueField( bean, field, attribute );
             }
-        }
-
-        return musts;
-    }
-
-
-    /**
-     * Get the list of MAY AttributeTypes for an objectClass
-     */
-    private Set<AttributeType> getAllMays( ObjectClass objectClass )
-    {
-        Set<AttributeType> mays = new HashSet<AttributeType>();
-
-        // First, gets the direct MAY
-        mays.addAll( objectClass.getMayAttributeTypes() );
-
-        // then add all the superiors MAY (recursively)
-        List<ObjectClass> superiors = objectClass.getSuperiors();
-
-        if ( superiors != null )
-        {
-            for ( ObjectClass superior : superiors )
+            else
             {
-                mays.addAll( getAllMays( superior ) );
+                readMultiValuedField( bean, field, attribute );
             }
         }
-
-        return mays;
-    }
-
-
-    /**
-     * Helper method to print a list of AT's names.
-     */
-    private String dumpATs( Set<AttributeType> attributeTypes )
-    {
-        if ( ( attributeTypes == null ) || ( attributeTypes.size() == 0 ) )
-        {
-            return "";
-        }
-
-        StringBuilder sb = new StringBuilder();
-        boolean isFirst = true;
-        sb.append( '{' );
-
-        for ( AttributeType attributeType : attributeTypes )
+        else
         {
-            if ( isFirst )
-            {
-                isFirst = false;
-            }
-            else
+            if ( mandatory )
             {
-                sb.append( ", " );
+                // the requested element is mandatory so let's throw an exception
+                String message = "No value was configured for entry with DN '"
+                    + entry.getDn() + "' and attribute type '" + attributeTypeName + "'.";
+                LOG.error( message );
+                throw new ConfigurationException( message );
             }
-
-            sb.append( attributeType.getName() );
         }
-
-        sb.append( '}' );
-
-        return sb.toString();
     }
 
 
@@ -722,16 +481,16 @@ public class ConfigPartitionReader
     private List<AdsBaseBean> read( Dn baseDn, String name, SearchScope scope, boolean mandatory )
         throws ConfigurationException
     {
-        LOG.debug( "Reading from '{}', entry {}", baseDn, name );
+        LOG.debug( "Reading from '{}', objectClass '{}'", baseDn, name );
 
         // Search for the element starting at some point in the DIT
         // Prepare the search request
-        AttributeType adsdAt = schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT );
-        EqualityNode<?> filter = new EqualityNode( adsdAt, new StringValue( name ) );
+        EqualityNode<String> filter = new EqualityNode<String>(
+            schemaManager.getAttributeType( SchemaConstants.OBJECT_CLASS_AT ), new StringValue( name ) );
         Cursor<IndexEntry<String, String>> cursor = null;
 
         // Create a container for all the read beans
-        List<AdsBaseBean> beans = new ArrayList<AdsBaseBean>();
+        List<AdsBaseBean> beansList = new ArrayList<AdsBaseBean>();
 
         try
         {
@@ -753,8 +512,8 @@ public class ConfigPartitionReader
                     cursor.close();
 
                     // the requested element is mandatory so let's throw an exception
-                    String message = "No directoryService instance was configured under the Dn "
-                        + configPartition.getSuffixDn();
+                    String message = "No instance was configured under the DN '"
+                        + baseDn + "' for the objectClass '" + name + "'.";
                     LOG.error( message );
                     throw new ConfigurationException( message );
                 }
@@ -767,46 +526,117 @@ public class ConfigPartitionReader
             // Loop on all the found elements
             do
             {
-                IndexEntry<String, String> forwardEntry = cursor
-                    .get();
+                IndexEntry<String, String> forwardEntry = cursor.get();
 
                 // Now, get the entry
                 Entry entry = configPartition.lookup( forwardEntry.getId() );
                 LOG.debug( "Entry read : {}", entry );
 
-                // Let's instanciate the bean we need. The upper ObjectClass's name
+                // Let's instantiate the bean we need. The upper ObjectClass's name
                 // will be used to do that
-                Attribute objectClassAttr = entry.get( SchemaConstants.OBJECT_CLASS_AT );
+                ObjectClass objectClass = findObjectClass( entry.get( SchemaConstants.OBJECT_CLASS_AT ) );
 
-                ObjectClass objectClass = findObjectClass( objectClassAttr );
+                // Instantiating the bean
                 AdsBaseBean bean = createBean( objectClass );
 
-                // Now, read the AttributeTypes and store the values into the bean fields
-                // The MAY
-                Set<AttributeType> mays = getAllMays( objectClass );
-                LOG.debug( "Fetching the following MAY attributes : {}", dumpATs( mays ) );
-                readFields( bean, entry, mays, OPTIONNAL );
-
-                // The MUST
-                Set<AttributeType> musts = getAllMusts( objectClass );
-                LOG.debug( "Fetching the following MAY attributes : {}", dumpATs( musts ) );
-                readFields( bean, entry, musts, MANDATORY );
-
+                // Setting its DN
                 bean.setDn( entry.getDn() );
 
-                // Done, we can add the bean into the list
-                beans.add( bean );
+                // Adding the bean to the list
+                beansList.add( bean );
+
+                // Getting the class of the bean
+                Class<?> beanClass = bean.getClass();
+
+                // A flag to know when we reached the 'AdsBaseBean' class when 
+                // looping on the class hierarchy of the bean
+                boolean adsBaseBeanClassFound = false;
+
+                // Looping until the 'AdsBaseBean' class has been found
+                while ( !adsBaseBeanClassFound )
+                {
+                    // Checking if we reached the 'AdsBaseBean' class
+                    if ( beanClass == AdsBaseBean.class )
+                    {
+                        adsBaseBeanClassFound = true;
+                    }
+
+                    // Looping on all fields of the bean
+                    Field[] fields = beanClass.getDeclaredFields();
+                    for ( Field field : fields )
+                    {
+                        // Making the field accessible (we get an exception if we don't do that)
+                        field.setAccessible( true );
+
+                        // Getting the class of the field
+                        Class<?> fieldClass = field.getType();
+
+                        // Looking for the @ConfigurationElement annotation
+                        ConfigurationElement configurationElement = field.getAnnotation( ConfigurationElement.class );
+                        if ( configurationElement != null )
+                        {
+                            // Getting the annotation's values
+                            String fieldAttributeType = configurationElement.attributeType();
+                            String fieldObjectClass = configurationElement.objectClass();
+                            String container = configurationElement.container();
+                            boolean isOptional = configurationElement.isOptional();
+
+                            // Checking if we have a value for the attribute type
+                            if ( ( fieldAttributeType != null ) && ( !"".equals( fieldAttributeType ) ) )
+                            {
+                                readFieldValue( bean, field, entry, fieldAttributeType, !isOptional );
+                            }
+                            // Checking if we have a value for the object class
+                            else if ( ( fieldObjectClass != null ) && ( !"".equals( fieldObjectClass ) ) )
+                            {
+                                // Checking if this is a multi-valued field (which values are stored in a container)
+                                if ( isMultiple( fieldClass ) && ( container != null )
+                                    && ( !"".equals( container ) ) )
+                                {
+                                    // Creating the DN of the container
+                                    Dn newBase = entry.getDn().add( "ou=" + container );
+
+                                    // Looking for the field values
+                                    Collection<AdsBaseBean> fieldValues = read( newBase, fieldObjectClass,
+                                        SearchScope.ONELEVEL, !isOptional );
+
+                                    // Setting the values to the field
+                                    if ( ( fieldValues != null ) && ( fieldValues.size() > 0 ) )
+                                    {
+                                        field.set( bean, fieldValues );
+                                    }
+                                }
+                                // This is a single-value field
+                                else
+                                {
+                                    // Looking for the field values
+                                    List<AdsBaseBean> fieldValues = read( entry.getDn(), fieldObjectClass,
+                                        SearchScope.ONELEVEL, !isOptional );
+
+                                    // Setting the value to the field
+                                    if ( ( fieldValues != null ) && ( fieldValues.size() > 0 ) )
+                                    {
+                                        field.set( bean, fieldValues.get( 0 ) );
+                                    }
+                                }
+                            }
+                        }
+                    }
+
+                    // Moving to the upper class in the class hierarchy
+                    beanClass = beanClass.getSuperclass();
+                }
             }
             while ( cursor.next() );
         }
         catch ( ConfigurationException ce )
         {
-            ce.printStackTrace();
             throw ce;
         }
         catch ( Exception e )
         {
-            String message = "Cannot open a cursor to read the configuration on " + baseDn;
+            String message = "An error occured while reading the configuration DN '"
+                + baseDn + "' for the objectClass '" + name + "':\n" + e.getMessage();
             LOG.error( message );
             throw new ConfigurationException( message );
         }
@@ -827,8 +657,22 @@ public class ConfigPartitionReader
             }
         }
 
-        return beans;
+        return beansList;
+    }
+
 
+    /**
+     * Indicates the given type is multiple.
+     *
+     * @param clazz
+     *      the class
+     * @return
+     *      <code>true</code> if the given is multiple,
+     *      <code>false</code> if not.
+     */
+    private boolean isMultiple( Class<?> clazz )
+    {
+        return Collection.class.isAssignableFrom( clazz );
     }
 
 
@@ -857,7 +701,7 @@ public class ConfigPartitionReader
     public ConfigBean readConfig( String baseDn ) throws LdapException
     {
         // The starting point is the DirectoryService element
-        return readConfig( new Dn( baseDn ), ConfigSchemaConstants.ADS_DIRECTORY_SERVICE_OC.getValue() );
+        return readConfig( new Dn( baseDn ) );
     }
 
 
@@ -907,7 +751,7 @@ public class ConfigPartitionReader
             baseDn = configPartition.getSuffixDn();
         }
 
-        List<AdsBaseBean> beans = read( baseDn, objectClass, SearchScope.ONELEVEL, MANDATORY );
+        List<AdsBaseBean> beans = read( baseDn, objectClass, SearchScope.ONELEVEL, true );
 
         if ( LOG.isDebugEnabled() )
         {

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java Mon Dec 10 16:02:34 2012
@@ -110,6 +110,7 @@ public class ConfigWriter
         }
         catch ( Exception e )
         {
+            e.printStackTrace(); // TODO REMOVE THIS
             throw new ConfigurationException( "Unable to convert the configuration bean to LDIF entries", e );
         }
     }
@@ -351,12 +352,36 @@ public class ConfigWriter
                     ConfigurationElement configurationElement = field.getAnnotation( ConfigurationElement.class );
                     if ( configurationElement != null )
                     {
-                        // Checking if we have a value for the attribute type
+                        // Getting the annotation's values
                         String attributeType = configurationElement.attributeType();
+                        String objectClass = configurationElement.objectClass();
+                        String container = configurationElement.container();
+                        boolean isOptional = configurationElement.isOptional();
+                        String defaultValue = configurationElement.defaultValue();
+
+                        // Checking if we have a value for the attribute type
                         if ( ( attributeType != null ) && ( !"".equals( attributeType ) ) )
                         {
+                            // Checking if the field is optional and if the default value matches
+                            if ( isOptional )
+                            {
+                                if ( ( defaultValue != null ) && ( fieldValue != null )
+                                    && ( defaultValue.equalsIgnoreCase( fieldValue.toString() ) ) )
+                                {
+                                    // Skipping the addition of the value
+                                    continue;
+                                }
+                            }
+
+                            // Adding values to the entry
+                            addAttributeTypeValues( configurationElement.attributeType(), fieldValue, entry );
+
+                            continue;
+                        }
+                        // Checking if we have a value for the object class
+                        else if ( ( objectClass != null ) && ( !"".equals( objectClass ) ) )
+                        {
                             // Checking if we're dealing with a container
-                            String container = configurationElement.container();
                             if ( ( container != null ) && ( !"".equals( container ) ) )
                             {
                                 // Creating the entry for the container and adding it to the list
@@ -370,21 +395,25 @@ public class ConfigWriter
                                 if ( Collection.class.isAssignableFrom( fieldClass ) )
                                 {
                                     // Looping on the Collection's objects
+                                    @SuppressWarnings("unchecked")
                                     Collection<Object> collection = ( Collection<Object> ) fieldValue;
-                                    for ( Object object : collection )
+                                    if ( collection != null )
                                     {
-                                        if ( object instanceof AdsBaseBean )
-                                        {
-                                            // Adding the bean
-                                            addBean( containerEntry.getDn(), schemaManager, ( AdsBaseBean ) object,
-                                                entries, entry, attributeType );
-
-                                            continue;
-                                        }
-                                        else
+                                        for ( Object object : collection )
                                         {
-                                            // TODO throw an error, if we have a container, the type must be a subtype of AdsBaseBean
-                                            throw new Exception();
+                                            if ( object instanceof AdsBaseBean )
+                                            {
+                                                // Adding the bean
+                                                addBean( containerEntry.getDn(), schemaManager, ( AdsBaseBean ) object,
+                                                    entries, entry, attributeType );
+
+                                                continue;
+                                            }
+                                            else
+                                            {
+                                                // TODO throw an error, if we have a container, the type must be a subtype of AdsBaseBean
+                                                throw new Exception();
+                                            }
                                         }
                                     }
                                 }
@@ -396,37 +425,11 @@ public class ConfigWriter
                             }
                             else
                             {
-                                // Is it the field value used as Rdn and do we need to insert a value in the parent entry?
-                                if ( ( configurationElement.isRdn() ) && ( parentEntry != null )
-                                    && ( attributeTypeForParentEntry != null ) )
-                                {
-                                    // Adding the field value to the parent entry
-                                    addAttributeTypeValues( attributeTypeForParentEntry, fieldValue, parentEntry );
-                                }
-
-                                // Checking if the field is optional and if the default value matches
-                                if ( configurationElement.isOptional() )
-                                {
-                                    if ( configurationElement.defaultValue().equalsIgnoreCase( fieldValue.toString() ) )
-                                    {
-                                        // Skipping the addition of the value
-                                        continue;
-                                    }
-                                }
-
-                                // Adding values to the entry
-                                addAttributeTypeValues( configurationElement.attributeType(), fieldValue, entry );
-
-                                continue;
+                                // Adding the bean
+                                addBean( entry.getDn(), schemaManager, ( AdsBaseBean ) fieldValue, entries, entry,
+                                    attributeType );
                             }
                         }
-
-                        // Checking if we're dealing with a AdsBaseBean subclass type
-                        if ( AdsBaseBean.class.isAssignableFrom( fieldClass ) )
-                        {
-                            addBean( entry.getDn(), schemaManager, ( AdsBaseBean ) fieldValue, entries );
-                            continue;
-                        }
                     }
                 }
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigurationElement.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigurationElement.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigurationElement.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/ConfigurationElement.java Mon Dec 10 16:02:34 2012
@@ -42,20 +42,26 @@ public @interface ConfigurationElement
     /**
      * Returns the attribute type.
      *
-     * @return
-     *      the attribute type
+     * @return the attribute type
      */
     String attributeType() default "";
 
 
     /**
+     * Returns the object class.
+     *
+     * @return the object class
+     */
+    String objectClass() default "";
+
+
+    /**
      * Returns true if of the qualified field (attribute type and value) 
      * is the Rdn of the entry.
      *
-     * @return
-     *      <code>true</code> if of the qualified field (attribute type and value) 
+     * @return <code>true</code> if of the qualified field (attribute type and value) 
      * is the Rdn of the entry,
-     *      <code>false</code> if not.
+     *         <code>false</code> if not.
      */
     boolean isRdn() default false;
 
@@ -63,8 +69,7 @@ public @interface ConfigurationElement
     /**
      * Returns the string value of the Dn of the container.
      *
-     * @return
-     *      the string value of the Dn of the container.
+     * @return the string value of the Dn of the container.
      */
     String container() default "";
 
@@ -72,9 +77,8 @@ public @interface ConfigurationElement
     /**
      * Returns true if the qualified field is optional.
      *
-     * @return
-     *      <code>true</code> if the qualified field is optional,
-     *      <code>false</code> if not.
+     * @return <code>true</code> if the qualified field is optional,
+     *         <code>false</code> if not.
      */
     boolean isOptional() default false;
 
@@ -82,8 +86,7 @@ public @interface ConfigurationElement
     /**
      * Returns the string value of the default value.
      *
-     * @return
-     *      the string value of the default value
+     * @return the string value of the default value
      */
     String defaultValue() default "";
 }

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AdsBaseBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AdsBaseBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AdsBaseBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AdsBaseBean.java Mon Dec 10 16:02:34 2012
@@ -41,11 +41,11 @@ public abstract class AdsBaseBean
      * 
      * Note: the value true/false is case <b>insensitive</b>
      */
-    @ConfigurationElement(attributeType = "ads-enabled")
+    @ConfigurationElement(attributeType = "ads-enabled", isOptional = true)
     private boolean enabled = true;
 
     /** The description */
-    @ConfigurationElement(attributeType = "description")
+    @ConfigurationElement(attributeType = "description", isOptional = true)
     private String description;
 
     /** the DN of the entry with which this bean is associated */

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/AuthenticationInterceptorBean.java Mon Dec 10 16:02:34 2012
@@ -34,11 +34,11 @@ import org.apache.directory.server.confi
 public class AuthenticationInterceptorBean extends InterceptorBean
 {
     /** The list of authenticators */
-    @ConfigurationElement(attributeType = "ads-authenticators", container = "authenticators")
+    @ConfigurationElement(objectClass = "ads-authenticator", container = "authenticators")
     private List<AuthenticatorBean> authenticators = new ArrayList<AuthenticatorBean>();
 
     /** The reference to the Password Policy component */
-    @ConfigurationElement(attributeType = "ads-passwordPolicies", container = "passwordPolicies")
+    @ConfigurationElement(objectClass = "ads-passwordPolicy", container = "passwordPolicies")
     private List<PasswordPolicyBean> passwordPolicies = new ArrayList<PasswordPolicyBean>();
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ChangePasswordServerBean.java Mon Dec 10 16:02:34 2012
@@ -33,37 +33,37 @@ import org.apache.directory.server.confi
  */
 public class ChangePasswordServerBean extends DSBasedServerBean
 {
-    /** The allowable clock skew. */
-    @ConfigurationElement(attributeType = "ads-krbAllowableClockSkew")
-    private long krbAllowableClockSkew;
-
-    /** Whether empty addresses are allowed. */
-    @ConfigurationElement(attributeType = "ads-krbEmptyAddressesAllowed")
-    private boolean krbEmptyAddressesAllowed;
-
-    /** The encryption types. */
-    @ConfigurationElement(attributeType = "ads-krbEncryptionTypes")
-    private List<String> krbEncryptionTypes = new ArrayList<String>();
-
-    /** The primary realm. */
-    @ConfigurationElement(attributeType = "ads-krbPrimaryRealm")
-    private String krbPrimaryRealm;
-
     /** The policy for category count. */
-    @ConfigurationElement(attributeType = "ads-chgPwdPolicyCategoryCount")
+    @ConfigurationElement(attributeType = "ads-chgPwdPolicyCategoryCount", isOptional = true)
     private int chgPwdPolicyCategoryCount;
 
     /** The policy for password length. */
-    @ConfigurationElement(attributeType = "ads-chgPwdPolicyPasswordLength")
+    @ConfigurationElement(attributeType = "ads-chgPwdPolicyPasswordLength", isOptional = true)
     private int chgPwdPolicyPasswordLength;
 
     /** The policy for token size. */
-    @ConfigurationElement(attributeType = "ads-chgPwdPolicyTokenSize")
+    @ConfigurationElement(attributeType = "ads-chgPwdPolicyTokenSize", isOptional = true)
     private int chgPwdPolicyTokenSize;
 
     /** The service principal name. */
-    @ConfigurationElement(attributeType = "ads-chgPwdServicePrincipal")
+    @ConfigurationElement(attributeType = "ads-chgPwdServicePrincipal", isOptional = true)
     private String chgPwdServicePrincipal;
+    
+    /** The allowable clock skew. */
+    @ConfigurationElement(attributeType = "ads-krbAllowableClockSkew", isOptional = true)
+    private long krbAllowableClockSkew;
+
+    /** Whether empty addresses are allowed. */
+    @ConfigurationElement(attributeType = "ads-krbEmptyAddressesAllowed", isOptional = true)
+    private boolean krbEmptyAddressesAllowed;
+
+    /** The encryption types. */
+    @ConfigurationElement(attributeType = "ads-krbEncryptionTypes", isOptional = true)
+    private List<String> krbEncryptionTypes = new ArrayList<String>();
+    
+    /** The primary realm. */
+    @ConfigurationElement(attributeType = "ads-krbPrimaryRealm", isOptional = true)
+    private String krbPrimaryRealm;
 
 
     /**

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DSBasedServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DSBasedServerBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DSBasedServerBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DSBasedServerBean.java Mon Dec 10 16:02:34 2012
@@ -38,7 +38,7 @@ public class DSBasedServerBean extends S
      * configuration for catalog entries.  Otherwise it will use this
      * search base as a single point of searching the DIT.
      */
-    @ConfigurationElement(attributeType = SchemaConstants.ADS_SEARCH_BASE_DN)
+    @ConfigurationElement(attributeType = SchemaConstants.ADS_SEARCH_BASE_DN, isOptional = true)
     private Dn searchBaseDn;
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DelegatingAuthenticatorBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DelegatingAuthenticatorBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DelegatingAuthenticatorBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DelegatingAuthenticatorBean.java Mon Dec 10 16:02:34 2012
@@ -30,7 +30,6 @@ import org.apache.directory.server.confi
  */
 public class DelegatingAuthenticatorBean extends AuthenticatorBean
 {
-
     /** The delegate host */
     @ConfigurationElement(attributeType = "ads-delegateHost")
     private String delegateHost;

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java Mon Dec 10 16:02:34 2012
@@ -55,7 +55,7 @@ public class DirectoryServiceBean extend
     private boolean dsDenormalizeOpAttrsEnabled = true;
 
     /** The flag that tells if the password should be returned as a normal attribute or not */
-    @ConfigurationElement(attributeType = "ads-dsPasswordHidden", isOptional = true, defaultValue = "false")
+    @ConfigurationElement(attributeType = "ads-dsPasswordHidden")
     private boolean dsPasswordHidden = false;
 
     /** The delay between two flushes on disk */
@@ -63,27 +63,27 @@ public class DirectoryServiceBean extend
     private long dsSyncPeriodMillis = 15000L;
 
     /** The ldif entries to inject into the server at startup */
-    @ConfigurationElement(attributeType = "dsTestEntries")
+    @ConfigurationElement(attributeType = "ads-dsTestEntries", isOptional = true)
     private String dsTestEntries;
 
     /** The ChangeLog component */
-    @ConfigurationElement
+    @ConfigurationElement( objectClass= "ads-changelog")
     private ChangeLogBean changeLog;
 
     /** The journal component */
-    @ConfigurationElement
+    @ConfigurationElement( objectClass= "ads-journal")
     private JournalBean journal;
 
     /** The servers */
-    @ConfigurationElement(attributeType = "ads-servers", container = "servers")
+    @ConfigurationElement(objectClass = "ads-server", container = "servers")
     private List<ServerBean> servers = new ArrayList<ServerBean>();
 
     /** The list of declared interceptors */
-    @ConfigurationElement(attributeType = "ads-interceptors", container = "interceptors")
+    @ConfigurationElement(objectClass = "ads-interceptor", container = "interceptors")
     private List<InterceptorBean> interceptors = new ArrayList<InterceptorBean>();
 
     /** The set of associated partitions */
-    @ConfigurationElement(attributeType = "ads-partitions", container = "partitions")
+    @ConfigurationElement(objectClass = "ads-partition", container = "partitions")
     private List<PartitionBean> partitions = new ArrayList<PartitionBean>();
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java Mon Dec 10 16:02:34 2012
@@ -34,11 +34,11 @@ import org.apache.directory.server.confi
 public class HttpServerBean extends ServerBean
 {
     /** The configuration file */
-    @ConfigurationElement(attributeType = "ads-httpConfFile")
+    @ConfigurationElement(attributeType = "ads-httpConfFile", isOptional = true)
     private String httpConfFile;
 
     /** The list of supported web apps */
-    @ConfigurationElement(attributeType = "ads-httpWebApps", container = "httpWebApps")
+    @ConfigurationElement(objectClass = "ads-httpWebApp", container = "httpWebApps")
     private List<HttpWebAppBean> httpWebApps = new ArrayList<HttpWebAppBean>();
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/IndexBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/IndexBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/IndexBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/IndexBean.java Mon Dec 10 16:02:34 2012
@@ -34,7 +34,7 @@ public abstract class IndexBean extends 
     @ConfigurationElement(attributeType = "ads-indexAttributeId", isRdn = true)
     private String indexAttributeId;
 
-    @ConfigurationElement(attributeType = "ads-indexHasReverse", isRdn = true)
+    @ConfigurationElement(attributeType = "ads-indexHasReverse")
     private boolean indexHasReverse;
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmIndexBean.java Mon Dec 10 16:02:34 2012
@@ -37,7 +37,7 @@ public class JdbmIndexBean<K, E> extends
     private static final int DEFAULT_DUPLICATE_LIMIT = 512;
 
     /** the size (number of index entries) for the cache */
-    @ConfigurationElement(attributeType = "ads-indexCacheSize")
+    @ConfigurationElement(attributeType = "ads-indexCacheSize", isOptional = true, defaultValue = "100")
     private int indexCacheSize = DEFAULT_INDEX_CACHE_SIZE;
 
     /** duplicate limit before duplicate keys switch to using a btree for values */
@@ -45,11 +45,11 @@ public class JdbmIndexBean<K, E> extends
     private int indexNumDupLimit = DEFAULT_DUPLICATE_LIMIT;
 
     /** The index file name */
-    @ConfigurationElement(attributeType = "ads-indexFileName")
+    @ConfigurationElement(attributeType = "ads-indexFileName", isOptional = true)
     private String indexFileName;
 
     /** The index working directory */
-    @ConfigurationElement(attributeType = "ads-indexWorkingDir")
+    @ConfigurationElement(attributeType = "ads-indexWorkingDir", isOptional = true)
     private String indexWorkingDir;
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmPartitionBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmPartitionBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmPartitionBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/JdbmPartitionBean.java Mon Dec 10 16:02:34 2012
@@ -31,11 +31,11 @@ import org.apache.directory.server.confi
 public class JdbmPartitionBean extends PartitionBean
 {
     /** The Entry cache size for this partition */
-    @ConfigurationElement(attributeType = "ads-partitionCacheSize")
+    @ConfigurationElement(attributeType = "ads-partitionCacheSize", isOptional = true, defaultValue = "-1")
     private int partitionCacheSize = -1;
 
     /** Tells if the optimizer is enabled or not */
-    @ConfigurationElement(attributeType = "ads-jdbmPartitionOptimizerEnabled")
+    @ConfigurationElement(attributeType = "ads-jdbmPartitionOptimizerEnabled", isOptional = true, defaultValue = "true")
     private boolean jdbmPartitionOptimizerEnabled = true;
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/KdcServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/KdcServerBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/KdcServerBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/KdcServerBean.java Mon Dec 10 16:02:34 2012
@@ -72,55 +72,55 @@ public class KdcServerBean extends DSBas
     private static final String DEFAULT_PRINCIPAL = "krbtgt/EXAMPLE.COM@EXAMPLE.COM";
 
     /** The allowable clock skew. */
-    @ConfigurationElement(attributeType = "ads-krbAllowableClockSkew")
+    @ConfigurationElement(attributeType = "ads-krbAllowableClockSkew", isOptional = true)
     private long krbAllowableClockSkew = DEFAULT_ALLOWABLE_CLOCKSKEW;
 
     /** Whether empty addresses are allowed. */
-    @ConfigurationElement(attributeType = "ads-krbEmptyAddressesAllowed")
+    @ConfigurationElement(attributeType = "ads-krbEmptyAddressesAllowed", isOptional = true)
     private boolean krbEmptyAddressesAllowed = DEFAULT_EMPTY_ADDRESSES_ALLOWED;
 
     /** Whether forwardable addresses are allowed. */
-    @ConfigurationElement(attributeType = "ads-krbForwardableAllowed")
+    @ConfigurationElement(attributeType = "ads-krbForwardableAllowed", isOptional = true)
     private boolean krbForwardableAllowed = DEFAULT_TGS_FORWARDABLE_ALLOWED;
 
     /** Whether pre-authentication by encrypted timestamp is required. */
-    @ConfigurationElement(attributeType = "ads-krbPAEncTimestampRequired")
+    @ConfigurationElement(attributeType = "ads-krbPAEncTimestampRequired", isOptional = true)
     private boolean krbPAEncTimestampRequired = DEFAULT_PA_ENC_TIMESTAMP_REQUIRED;
 
     /** Whether postdated tickets are allowed. */
-    @ConfigurationElement(attributeType = "ads-krbPostdatedAllowed")
+    @ConfigurationElement(attributeType = "ads-krbPostdatedAllowed", isOptional = true)
     private boolean krbPostdatedAllowed = DEFAULT_TGS_POSTDATED_ALLOWED;
 
     /** Whether proxiable addresses are allowed. */
-    @ConfigurationElement(attributeType = "ads-krbProxiableAllowed")
+    @ConfigurationElement(attributeType = "ads-krbProxiableAllowed", isOptional = true)
     private boolean krbProxiableAllowed = DEFAULT_TGS_PROXIABLE_ALLOWED;
 
     /** Whether renewable tickets are allowed. */
-    @ConfigurationElement(attributeType = "ads-krbRenewableAllowed")
+    @ConfigurationElement(attributeType = "ads-krbRenewableAllowed", isOptional = true)
     private boolean krbRenewableAllowed = DEFAULT_TGS_RENEWABLE_ALLOWED;
 
     /** The maximum renewable lifetime. */
-    @ConfigurationElement(attributeType = "ads-krbMaximumRenewableLifetime")
+    @ConfigurationElement(attributeType = "ads-krbMaximumRenewableLifetime", isOptional = true)
     private long krbMaximumRenewableLifetime = DEFAULT_TGS_MAXIMUM_RENEWABLE_LIFETIME;
 
     /** The maximum ticket lifetime. */
-    @ConfigurationElement(attributeType = "ads-krbMaximumTicketLifetime")
+    @ConfigurationElement(attributeType = "ads-krbMaximumTicketLifetime", isOptional = true)
     private long krbMaximumTicketLifetime = DEFAULT_TGS_MAXIMUM_TICKET_LIFETIME;
 
     /** The primary realm */
-    @ConfigurationElement(attributeType = "ads-krbPrimaryRealm")
+    @ConfigurationElement(attributeType = "ads-krbPrimaryRealm", isOptional = true)
     private String krbPrimaryRealm = DEFAULT_REALM;
 
     /** Whether to verify the body checksum. */
-    @ConfigurationElement(attributeType = "ads-krbBodyChecksumVerified")
+    @ConfigurationElement(attributeType = "ads-krbBodyChecksumVerified", isOptional = true)
     private boolean krbBodyChecksumVerified = DEFAULT_VERIFY_BODY_CHECKSUM;
 
     /** The encryption types. */
-    @ConfigurationElement(attributeType = "ads-krbEncryptionTypes")
+    @ConfigurationElement(attributeType = "ads-krbEncryptionTypes", isOptional = true)
     private List<String> krbEncryptionTypes = new ArrayList<String>();
 
     /** The service principal name. */
-    @ConfigurationElement(attributeType = "ads-krbKdcPrincipal")
+    @ConfigurationElement(attributeType = "ads-krbKdcPrincipal", isOptional = true)
     private String krbKdcPrincipal = DEFAULT_PRINCIPAL;
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java Mon Dec 10 16:02:34 2012
@@ -49,7 +49,7 @@ public class LdapServerBean extends DSBa
     /** The maximum size of an incoming PDU */
     @ConfigurationElement(attributeType = "ads-maxPDUSize")
     private int maxPDUSize = 2048;
-    
+
     /** The SASL host */
     @ConfigurationElement(attributeType = "ads-saslHost")
     private String saslHost;
@@ -63,31 +63,31 @@ public class LdapServerBean extends DSBa
     private List<String> saslRealms = new ArrayList<String>();
 
     /** The keystore file */
-    @ConfigurationElement(attributeType = "ads-keystoreFile")
+    @ConfigurationElement(attributeType = "ads-keystoreFile", isOptional = true)
     private String keystoreFile;
 
     /** The certificate password */
-    @ConfigurationElement(attributeType = "ads-certificatePassword")
+    @ConfigurationElement(attributeType = "ads-certificatePassword", isOptional = true)
     private String certificatePassword;
 
     /** A flag telling if the replication is enabled */
-    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_ENABLED )
+    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_ENABLED)
     private boolean replEnabled = false;
-    
+
     /** the replication request handler, server will be in replication provider/master mode if a valid FQCN is given */
-    @ConfigurationElement(attributeType = "ads-replReqHandler")
+    @ConfigurationElement(attributeType = "ads-replReqHandler", isOptional = true)
     private String replReqHandler;
 
     /** The replication consumer Bean */
-    @ConfigurationElement(attributeType = "ads-replConsumers", container = "replConsumers")
+    @ConfigurationElement(objectClass = "ads-replConsumer", container = "replConsumers", isOptional = true)
     private List<ReplConsumerBean> replConsumers = new ArrayList<ReplConsumerBean>();
 
     /** The list of supported mechanisms */
-    @ConfigurationElement(attributeType = "ads-saslMechHandlers", container = "saslMechHandlers")
+    @ConfigurationElement(objectClass = "ads-saslMechHandler", container = "saslMechHandlers", isOptional = true)
     private List<SaslMechHandlerBean> saslMechHandlers = new ArrayList<SaslMechHandlerBean>();
 
     /** The list of supported extended operation handlers */
-    @ConfigurationElement(attributeType = "ads-extendedOpHandlers", container = "extendedOpHandlers")
+    @ConfigurationElement(objectClass = "ads-extendedOpHandler", container = "extendedOpHandlers", isOptional = true)
     private List<ExtendedOpHandlerBean> extendedOpHandlers = new ArrayList<ExtendedOpHandlerBean>();
 
 
@@ -365,7 +365,7 @@ public class LdapServerBean extends DSBa
             this.replConsumers.add( bean );
         }
     }
-    
+
 
     /**
      * @return the maxPDUSize
@@ -446,8 +446,8 @@ public class LdapServerBean extends DSBa
 
         return sb.toString();
     }
-    
-    
+
+
     /**
      * @return True if the replication service should be enabled
      */
@@ -456,7 +456,7 @@ public class LdapServerBean extends DSBa
         return replEnabled;
     }
 
-    
+
     /**
      * Enable or disable the replication
      * @param replEnabled The new value
@@ -466,6 +466,7 @@ public class LdapServerBean extends DSBa
         this.replEnabled = replEnabled;
     }
 
+
     /**
      * {@inheritDoc}
      */

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java Mon Dec 10 16:02:34 2012
@@ -43,15 +43,15 @@ public abstract class PartitionBean exte
     private Dn partitionSuffix;
 
     /** Tells if the data should be flushed to disk immediately */
-    @ConfigurationElement(attributeType = "ads-partitionSyncOnWrite")
+    @ConfigurationElement(attributeType = "ads-partitionSyncOnWrite", isOptional = true)
     private boolean partitionSyncOnWrite;
 
     /** The partition's ContextEntry */
-    @ConfigurationElement(attributeType = "ads-contextEntry")
+    @ConfigurationElement(attributeType = "ads-contextEntry", isOptional = true)
     private String contextEntry;
 
     /** The list of declared indexes */
-    @ConfigurationElement(attributeType = "ads-indexes", container = "indexes")
+    @ConfigurationElement(objectClass = "ads-index", container = "indexes")
     private List<IndexBean> indexes = new ArrayList<IndexBean>();
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ReplConsumerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ReplConsumerBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ReplConsumerBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ReplConsumerBean.java Mon Dec 10 16:02:34 2012
@@ -91,23 +91,23 @@ public class ReplConsumerBean extends Ad
     private byte[] replUserPassword;
 
     /** The replication cookie */
-    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_COOKIE)
+    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_COOKIE, isOptional = true)
     private String replCookie;
 
     /** Tells if TLS should be used during replication */
-    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_USE_TLS)
+    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_USE_TLS, isOptional = true)
     private boolean replUseTls;
 
     /** Tells if the certificate validation should be strict or not */
-    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_STRICT_CERT_VALIDATION)
+    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_STRICT_CERT_VALIDATION, isOptional = true)
     private boolean replStrictCertValidation;
 
     /** The peer certificate */
-    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_PEER_CERTIFICATE)
+    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_PEER_CERTIFICATE, isOptional = true)
     private byte[] replPeerCertificate;
 
     /** The FQCN of replication client implementation */
-    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_CONSUMER_IMPL)
+    @ConfigurationElement(attributeType = SchemaConstants.ADS_REPL_CONSUMER_IMPL, isOptional = true)
     private String replConsumerImpl;
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/SaslMechHandlerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/SaslMechHandlerBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/SaslMechHandlerBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/SaslMechHandlerBean.java Mon Dec 10 16:02:34 2012
@@ -39,7 +39,7 @@ public class SaslMechHandlerBean extends
     private String saslMechClassName;
 
     /** The NTLM provider */
-    @ConfigurationElement(attributeType = "ads-ntlmMechProvider")
+    @ConfigurationElement(attributeType = "ads-ntlmMechProvider", isOptional = true)
     private String ntlmMechProvider;
 
 

Modified: directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ServerBean.java?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ServerBean.java (original)
+++ directory/apacheds/trunk/server-config/src/main/java/org/apache/directory/server/config/beans/ServerBean.java Mon Dec 10 16:02:34 2012
@@ -38,7 +38,7 @@ public abstract class ServerBean extends
     private String serverId;
 
     /** The set of transports to use for this server */
-    @ConfigurationElement(attributeType = "ads-transports", container = "transports")
+    @ConfigurationElement(objectClass = "ads-transport", container = "transports")
     private List<TransportBean> transports = new ArrayList<TransportBean>();
 
 

Modified: directory/apacheds/trunk/server-config/src/main/resources/config.ldif
URL: http://svn.apache.org/viewvc/directory/apacheds/trunk/server-config/src/main/resources/config.ldif?rev=1419546&r1=1419545&r2=1419546&view=diff
==============================================================================
--- directory/apacheds/trunk/server-config/src/main/resources/config.ldif (original)
+++ directory/apacheds/trunk/server-config/src/main/resources/config.ldif Mon Dec 10 16:02:34 2012
@@ -511,8 +511,6 @@ ads-krbEmptyAddressesAllowed: TRUE
 ads-krbEncryptionTypes: des-cbc-md5
 ads-krbPrimaryRealm: EXAMPLE.COM
 ads-searchBaseDN: ou=users,dc=example,dc=com
-ads-transports: tcp
-ads-transports: udp
 
 dn: ou=transports,ads-serverId=changePasswordServer,ou=servers,ads-directoryServiceId=default,ou=config
 ou: transports
@@ -610,8 +608,6 @@ ads-krbPrimaryRealm: EXAMPLE.COM
 ads-krbProxiableAllowed: TRUE
 ads-krbRenewableAllowed: TRUE
 ads-searchBaseDN: ou=users,dc=example,dc=com
-ads-transports: tcp
-ads-transports: udp
 
 dn: ou=transports,ads-serverId=kerberosServer,ou=servers,ads-directoryServiceId=default,ou=config
 ou: transports
@@ -657,9 +653,6 @@ ads-saslRealms: example.com
 ads-saslRealms: apache.org
 ads-searchBaseDN: ou=users,ou=system
 ads-enabled: TRUE
-ads-extendedophandlers: gracefulShutdownHandler
-ads-extendedophandlers: starttlshandler
-ads-extendedophandlers: storedprochandler
 ads-replEnabled: true
 
 dn: ou=replConsumers,ads-serverId=ldapServer,ou=servers,ads-directoryServiceId=default,ou=config



Mime
View raw message