directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r1043118 - in /directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config: ./ beans/
Date Tue, 07 Dec 2010 16:34:28 GMT
Author: pamarcelot
Date: Tue Dec  7 16:34:28 2010
New Revision: 1043118

URL: http://svn.apache.org/viewvc?rev=1043118&view=rev
Log:
Fixed a bug in the writer where the container entries were not created in the final LDIF.

Modified:
    directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java
    directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
    directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
    directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
    directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java
    directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/ServerBean.java

Modified: directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java?rev=1043118&r1=1043117&r2=1043118&view=diff
==============================================================================
--- directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java
(original)
+++ directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/ConfigWriter.java
Tue Dec  7 16:34:28 2010
@@ -20,6 +20,7 @@
 package org.apache.directory.server.config;
 
 
+import java.io.FileWriter;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -36,6 +37,7 @@ import org.apache.directory.shared.ldap.
 import org.apache.directory.shared.ldap.exception.LdapInvalidDnException;
 import org.apache.directory.shared.ldap.ldif.LdifEntry;
 import org.apache.directory.shared.ldap.name.DN;
+import org.apache.directory.shared.ldap.name.RDN;
 import org.apache.directory.shared.ldap.schema.ObjectClass;
 import org.apache.directory.shared.ldap.schema.SchemaManager;
 
@@ -67,7 +69,14 @@ public class ConfigWriter
             addBean( configRootEntry.getDn(), schemaManager, adsBaseBean, entries );
         }
 
-        System.out.println( entries );
+        // Writing the file to disk
+        FileWriter writer = new FileWriter( file );
+        for ( LdifEntry entry : entries )
+        {
+            writer.append( entry.toString() );
+        }
+        writer.close();
+
         System.out.println( entries.size() );
     }
 
@@ -215,7 +224,12 @@ public class ConfigWriter
                         String container = configurationElement.container();
                         if ( ( container != null ) && ( !"".equals( container ) )
)
                         {
-                            DN containerDN = entry.getDn().add( container );
+                            // Creating the entry for the container and adding it to the
list
+                            LdifEntry containerEntry = new LdifEntry();
+                            containerEntry.setDn( entry.getDn().add( new RDN( SchemaConstants.OU_AT,
container ) ) );
+                            addObjectClassAttribute( schemaManager, containerEntry,
+                                SchemaConstants.ORGANIZATIONAL_UNIT_OC );
+                            entries.add( containerEntry );
 
                             if ( Collection.class.isAssignableFrom( fieldClass ) )
                             {
@@ -225,7 +239,7 @@ public class ConfigWriter
                                 {
                                     if ( object instanceof AdsBaseBean )
                                     {
-                                        addBean( containerDN, schemaManager, ( AdsBaseBean
) object, entries );
+                                        addBean( containerEntry.getDn(), schemaManager, (
AdsBaseBean ) object, entries );
                                         continue;
                                     }
                                     else
@@ -352,8 +366,7 @@ public class ConfigWriter
                 ConfigurationElement configurationElement = field.getAnnotation( ConfigurationElement.class
);
                 if ( ( configurationElement != null ) && ( configurationElement.isRDN()
) )
                 {
-                    return baseDN.add( new org.apache.directory.shared.ldap.name.RDN(
-                        configurationElement.attributeType(), field.get( bean ).toString()
) );
+                    return baseDN.add( new RDN( configurationElement.attributeType(), field.get(
bean ).toString() ) );
                 }
             }
 

Modified: directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java?rev=1043118&r1=1043117&r2=1043118&view=diff
==============================================================================
--- directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
(original)
+++ directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/DirectoryServiceBean.java
Tue Dec  7 16:34:28 2010
@@ -78,15 +78,15 @@ public class DirectoryServiceBean extend
     private JournalBean journal;
 
     /** The servers */
-    @ConfigurationElement(container = "ou=servers")
+    @ConfigurationElement(container = "servers")
     private List<ServerBean> servers = new ArrayList<ServerBean>();
 
     /** The list of declared interceptors */
-    @ConfigurationElement(container = "ou=interceptors")
+    @ConfigurationElement(container = "interceptors")
     private List<InterceptorBean> interceptors = new ArrayList<InterceptorBean>();
 
     /** The set of associated partitions */
-    @ConfigurationElement(container = "ou=partitions")
+    @ConfigurationElement(container = "partitions")
     private List<PartitionBean> partitions = new ArrayList<PartitionBean>();
 
     /** The reference to the Password Policy component */

Modified: directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java?rev=1043118&r1=1043117&r2=1043118&view=diff
==============================================================================
--- directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
(original)
+++ directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/HttpServerBean.java
Tue Dec  7 16:34:28 2010
@@ -38,7 +38,7 @@ public class HttpServerBean extends Serv
     private String httpConfFile;
 
     /** The list of supported web apps */
-    @ConfigurationElement(container = "ou=httpWebApps")
+    @ConfigurationElement(container = "httpWebApps")
     private List<HttpWebAppBean> httpWebApps = new ArrayList<HttpWebAppBean>();
 
 

Modified: directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java?rev=1043118&r1=1043117&r2=1043118&view=diff
==============================================================================
--- directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
(original)
+++ directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/LdapServerBean.java
Tue Dec  7 16:34:28 2010
@@ -78,11 +78,11 @@ public class LdapServerBean extends DSBa
     private ReplProviderBean replProvider;
 
     /** The list of supported mechanisms */
-    @ConfigurationElement(container="ou=saslMechHandlers")
+    @ConfigurationElement(container = "saslMechHandlers")
     private List<SaslMechHandlerBean> saslMechHandlers = new ArrayList<SaslMechHandlerBean>();
 
     /** The list of supported extended operation handlers */
-    @ConfigurationElement(container="ou=extendedOpHandlers")
+    @ConfigurationElement(container = "extendedOpHandlers")
     private List<ExtendedOpHandlerBean> extendedOpHandlers = new ArrayList<ExtendedOpHandlerBean>();
 
 

Modified: directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java?rev=1043118&r1=1043117&r2=1043118&view=diff
==============================================================================
--- directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java
(original)
+++ directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/PartitionBean.java
Tue Dec  7 16:34:28 2010
@@ -51,7 +51,7 @@ public abstract class PartitionBean exte
     private String contextEntry;
 
     /** The list of declared indexes */
-    @ConfigurationElement(container="ou=indexes")
+    @ConfigurationElement(container = "indexes")
     private List<IndexBean> indexes = new ArrayList<IndexBean>();
 
 

Modified: directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/ServerBean.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/ServerBean.java?rev=1043118&r1=1043117&r2=1043118&view=diff
==============================================================================
--- directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/ServerBean.java
(original)
+++ directory/apacheds/branches/server-config-annotations/server-config/src/main/java/org/apache/directory/server/config/beans/ServerBean.java
Tue Dec  7 16:34:28 2010
@@ -38,7 +38,7 @@ public abstract class ServerBean extends
     private String serverId;
 
     /** The set of transports to use for this server */
-    @ConfigurationElement(container="ou=transports")
+    @ConfigurationElement(container = "transports")
     private List<TransportBean> transports = new ArrayList<TransportBean>();
 
 



Mime
View raw message