directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r529280 - in /directory/ldapstudio/trunk/ldapstudio-apacheds-configuration: ./ META-INF/ src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/ src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/edit...
Date Mon, 16 Apr 2007 15:08:39 GMT
Author: pamarcelot
Date: Mon Apr 16 08:08:36 2007
New Revision: 529280

URL: http://svn.apache.org/viewvc?view=rev&rev=529280
Log:
Added Server Configuration Parser. Added a new Action that reads a server.xml file on the disk and opens it in the editor.

Added:
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/OpenServerConfigurationAction.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationParser.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationParserException.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationWriter.java
Modified:
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/.classpath
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/META-INF/MANIFEST.MF
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/build.properties
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/ivy.xml
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/plugin.xml
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/OpenEditorAction.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsPage.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/GeneralPage.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorDetailsPage.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsPage.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionDetailsPage.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionsMasterDetailsBlock.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionsPage.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ServerConfigurationEditor.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ServerConfigurationEditorInput.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/Partition.java
    directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfiguration.java

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/.classpath
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/.classpath?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/.classpath (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/.classpath Mon Apr 16 08:08:36 2007
@@ -4,5 +4,24 @@
 	<classpathentry kind="src" output="target/test-classes" path="src/test/java"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+	<classpathentry kind="lib" path="lib/apacheds-btree-base-1.5.1-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/apacheds-core-1.5.1-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/apacheds-jdbm-store-1.5.1-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/apacheds-protocol-ldap-1.5.1-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/apacheds-schema-registries-1.5.1-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/apacheds-server-jndi-1.5.1-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/commons-collections-3.2.jar"/>
+	<classpathentry kind="lib" path="lib/commons-logging-1.1.jar"/>
+	<classpathentry kind="lib" path="lib/dom4j-1.6.1.jar"/>
+	<classpathentry kind="lib" path="lib/jdbm-1.0.jar"/>
+	<classpathentry kind="lib" path="lib/mina-core-1.0.2.jar"/>
+	<classpathentry kind="lib" path="lib/nlog4j-1.2.25.jar"/>
+	<classpathentry kind="lib" path="lib/shared-asn1-0.9.7-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/shared-asn1-codec-0.9.7-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/shared-ldap-0.9.7-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/shared-ldap-constants-0.9.7-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="lib/spring-beans-1.2.8.jar"/>
+	<classpathentry kind="lib" path="lib/spring-context-1.2.8.jar"/>
+	<classpathentry kind="lib" path="lib/spring-core-1.2.8.jar"/>
 	<classpathentry kind="output" path="target/classes"/>
 </classpath>

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/META-INF/MANIFEST.MF?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/META-INF/MANIFEST.MF (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/META-INF/MANIFEST.MF Mon Apr 16 08:08:36 2007
@@ -7,7 +7,26 @@
 Bundle-Vendor: Apache Software Foundation
 Bundle-Localization: plugin
 Eclipse-LazyStart: true
-Bundle-ClassPath: .
+Bundle-ClassPath: .,
+ lib/apacheds-btree-base-1.5.1-SNAPSHOT.jar,
+ lib/apacheds-core-1.5.1-SNAPSHOT.jar,
+ lib/apacheds-jdbm-store-1.5.1-SNAPSHOT.jar,
+ lib/apacheds-protocol-ldap-1.5.1-SNAPSHOT.jar,
+ lib/apacheds-schema-registries-1.5.1-SNAPSHOT.jar,
+ lib/apacheds-server-jndi-1.5.1-SNAPSHOT.jar,
+ lib/commons-collections-3.2.jar,
+ lib/commons-logging-1.1.jar,
+ lib/dom4j-1.6.1.jar,
+ lib/jdbm-1.0.jar,
+ lib/mina-core-1.0.2.jar,
+ lib/nlog4j-1.2.25.jar,
+ lib/shared-asn1-0.9.7-SNAPSHOT.jar,
+ lib/shared-asn1-codec-0.9.7-SNAPSHOT.jar,
+ lib/shared-ldap-0.9.7-SNAPSHOT.jar,
+ lib/shared-ldap-constants-0.9.7-SNAPSHOT.jar,
+ lib/spring-beans-1.2.8.jar,
+ lib/spring-context-1.2.8.jar,
+ lib/spring-core-1.2.8.jar
 Require-Bundle: org.eclipse.core.runtime,
  org.eclipse.ui,
  org.eclipse.ui.forms

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/build.properties
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/build.properties?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/build.properties (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/build.properties Mon Apr 16 08:08:36 2007
@@ -2,6 +2,25 @@
                plugin.xml,\
                src/main/java/,\
                .,\
-               icons/
+               icons/,\
+               lib/apacheds-btree-base-1.5.1-SNAPSHOT.jar,\
+               lib/apacheds-core-1.5.1-SNAPSHOT.jar,\
+               lib/apacheds-jdbm-store-1.5.1-SNAPSHOT.jar,\
+               lib/apacheds-protocol-ldap-1.5.1-SNAPSHOT.jar,\
+               lib/apacheds-schema-registries-1.5.1-SNAPSHOT.jar,\
+               lib/apacheds-server-jndi-1.5.1-SNAPSHOT.jar,\
+               lib/commons-collections-3.2.jar,\
+               lib/commons-logging-1.1.jar,\
+               lib/dom4j-1.6.1.jar,\
+               lib/jdbm-1.0.jar,\
+               lib/mina-core-1.0.2.jar,\
+               lib/nlog4j-1.2.25.jar,\
+               lib/shared-asn1-0.9.7-SNAPSHOT.jar,\
+               lib/shared-asn1-codec-0.9.7-SNAPSHOT.jar,\
+               lib/shared-ldap-0.9.7-SNAPSHOT.jar,\
+               lib/shared-ldap-constants-0.9.7-SNAPSHOT.jar,\
+               lib/spring-beans-1.2.8.jar,\
+               lib/spring-context-1.2.8.jar,\
+               lib/spring-core-1.2.8.jar
 source.. = src/main/java/,\
            src/test/java/

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/ivy.xml
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/ivy.xml?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/ivy.xml (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/ivy.xml Mon Apr 16 08:08:36 2007
@@ -18,4 +18,21 @@
 -->
 <ivy-module version="1.0">
     <info organisation="org.apache.directory.ldapstudio" module="ldapdtudio-apacheds-configuration"/>
+    <dependencies>
+		<!-- <dependency org="commons-configuration" name="commons-configuration" rev="1.2"/> -->
+		<dependency org="org.springframework" name="spring-context" rev="1.2.8"/>
+		<dependency org="org.apache.directory.server" name="apacheds-core" rev="1.5.1-SNAPSHOT"/>
+		<dependency org="org.apache.directory.server" name="apacheds-schema-registries" rev="1.5.1-SNAPSHOT"/>
+		<dependency org="org.apache.directory.server" name="apacheds-jdbm-store" rev="1.5.1-SNAPSHOT"/>
+		<dependency org="org.apache.directory.server" name="apacheds-btree-base" rev="1.5.1-SNAPSHOT"/>
+		<dependency org="org.apache.directory.server" name="apacheds-server-jndi" rev="1.5.1-SNAPSHOT"/>
+		<dependency org="org.apache.directory.server" name="apacheds-protocol-ldap" rev="1.5.1-SNAPSHOT"/>
+		<dependency org="org.apache.directory.shared" name="shared-ldap" rev="0.9.7-SNAPSHOT"/>
+		<dependency org="org.apache.directory.shared" name="shared-ldap-constants" rev="0.9.7-SNAPSHOT"/>
+		<dependency org="org.apache.directory.shared" name="shared-asn1" rev="0.9.7-SNAPSHOT"/>
+		<dependency org="org.apache.directory.shared" name="shared-asn1-codec" rev="0.9.7-SNAPSHOT"/>
+		<dependency org="org.apache.mina" name="mina-core" rev="1.0.2"/>
+		<dependency org="jdbm" name="jdbm" rev="1.0"/>
+		<dependency org="org.dom4j" name="dom4j" rev="1.6.1"/>
+    </dependencies>
 </ivy-module>

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/plugin.xml
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/plugin.xml?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/plugin.xml (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/plugin.xml Mon Apr 16 08:08:36 2007
@@ -34,6 +34,12 @@
                label="Open Editor"
                menubarPath="org.apache.directory.ldapstudio.apacheds.configuration.actionset.menu/open"
                style="push"/>
+         <action
+               class="org.apache.directory.ldapstudio.apacheds.configuration.actions.OpenServerConfigurationAction"
+               id="org.apache.directory.ldapstudio.apacheds.configuration.openServerConfiguration"
+               label="Open..."
+               menubarPath="org.apache.directory.ldapstudio.apacheds.configuration.actionset.menu/open"
+               style="push"/>
       </actionSet>
    </extension>
    <extension

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/OpenEditorAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/OpenEditorAction.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/OpenEditorAction.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/OpenEditorAction.java Mon Apr 16 08:08:36 2007
@@ -6,6 +6,7 @@
 import javax.naming.directory.BasicAttribute;
 import javax.naming.directory.BasicAttributes;
 
+import org.apache.directory.ldapstudio.apacheds.configuration.Activator;
 import org.apache.directory.ldapstudio.apacheds.configuration.editor.ServerConfigurationEditor;
 import org.apache.directory.ldapstudio.apacheds.configuration.editor.ServerConfigurationEditorInput;
 import org.apache.directory.ldapstudio.apacheds.configuration.model.ExtendedOperation;
@@ -13,6 +14,7 @@
 import org.apache.directory.ldapstudio.apacheds.configuration.model.Interceptor;
 import org.apache.directory.ldapstudio.apacheds.configuration.model.Partition;
 import org.apache.directory.ldapstudio.apacheds.configuration.model.ServerConfiguration;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.viewers.ISelection;
@@ -95,8 +97,8 @@
         }
         catch ( PartInitException e )
         {
-            // TODO ADD A LOGGER
-            e.printStackTrace();
+            Activator.getDefault().getLog().log(
+                new Status( Status.ERROR, Activator.PLUGIN_ID, Status.OK, e.getMessage(), e.getCause() ) );
         }
     }
 

Added: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/OpenServerConfigurationAction.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/OpenServerConfigurationAction.java?view=auto&rev=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/OpenServerConfigurationAction.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/actions/OpenServerConfigurationAction.java Mon Apr 16 08:08:36 2007
@@ -0,0 +1,101 @@
+package org.apache.directory.ldapstudio.apacheds.configuration.actions;
+
+
+import org.apache.directory.ldapstudio.apacheds.configuration.Activator;
+import org.apache.directory.ldapstudio.apacheds.configuration.editor.ServerConfigurationEditor;
+import org.apache.directory.ldapstudio.apacheds.configuration.editor.ServerConfigurationEditorInput;
+import org.apache.directory.ldapstudio.apacheds.configuration.model.ServerConfiguration;
+import org.apache.directory.ldapstudio.apacheds.configuration.model.ServerConfigurationParser;
+import org.apache.directory.ldapstudio.apacheds.configuration.model.ServerConfigurationParserException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+
+/**
+ * This class implements the Open Editor Action.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class OpenServerConfigurationAction extends Action implements IWorkbenchWindowActionDelegate
+{
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+     */
+    public void run( IAction action )
+    {
+        FileDialog fd = new FileDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), SWT.OPEN );
+        fd.setText( "Open a Server Configuration file" );
+        fd.setFilterExtensions( new String[]
+            { "*.xml", "*.*" } );
+        fd.setFilterNames( new String[]
+            { "XML files", "All files" } );
+        String selectedFile = fd.open();
+        // selected == null if 'cancel' has been pushed
+        if ( selectedFile == null || "".equals( selectedFile ) )
+        {
+            return;
+        }
+
+        ServerConfigurationParser parser = new ServerConfigurationParser();
+        ServerConfiguration serverConfiguration = null;
+
+        try
+        {
+            serverConfiguration = parser.parse( selectedFile );
+        }
+        catch ( ServerConfigurationParserException e )
+        {
+            MessageBox messageBox = new MessageBox( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
+                SWT.OK | SWT.ICON_ERROR );
+            messageBox.setText( "Error!" );
+            messageBox.setMessage( "An error occurred when reading the file." + "\n" + e.getMessage() );
+            messageBox.open();
+        }
+
+        IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+        try
+        {
+            page.openEditor( new ServerConfigurationEditorInput( serverConfiguration ), ServerConfigurationEditor.ID );
+        }
+        catch ( PartInitException e )
+        {
+            Activator.getDefault().getLog().log(
+                new Status( Status.ERROR, Activator.PLUGIN_ID, Status.OK, e.getMessage(), e.getCause() ) );
+        }
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
+     */
+    public void selectionChanged( IAction action, ISelection selection )
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#dispose()
+     */
+    public void dispose()
+    {
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.ui.IWorkbenchWindowActionDelegate#init(org.eclipse.ui.IWorkbenchWindow)
+     */
+    public void init( IWorkbenchWindow window )
+    {
+    }
+}

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationDetailsPage.java Mon Apr 16 08:08:36 2007
@@ -56,6 +56,9 @@
     /** The input Interceptor */
     private ExtendedOperation input;
 
+    /** The dirty flag */
+    private boolean dirty = false;
+
     // UI fields
     private Text classTypeText;
 
@@ -66,6 +69,7 @@
         public void modifyText( ModifyEvent e )
         {
             masterDetailsBlock.setEditorDirty();
+            dirty = true;
         }
     };
 
@@ -181,8 +185,6 @@
      */
     public void dispose()
     {
-        // TODO Auto-generated method stub
-
     }
 
 
@@ -200,8 +202,7 @@
      */
     public boolean isDirty()
     {
-        // TODO Auto-generated method stub
-        return true;
+        return dirty;
     }
 
 
@@ -210,7 +211,6 @@
      */
     public boolean isStale()
     {
-        // TODO Auto-generated method stub
         return false;
     }
 

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsMasterDetailsBlock.java Mon Apr 16 08:08:36 2007
@@ -25,6 +25,7 @@
 import org.apache.directory.ldapstudio.apacheds.configuration.Activator;
 import org.apache.directory.ldapstudio.apacheds.configuration.PluginConstants;
 import org.apache.directory.ldapstudio.apacheds.configuration.model.ExtendedOperation;
+import org.apache.directory.ldapstudio.apacheds.configuration.model.ServerConfiguration;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -63,8 +64,8 @@
     /** The associated page */
     private FormPage page;
 
-    /** The editor input */
-    private ServerConfigurationEditorInput input;
+    /** The input Server Configuration */
+    private ServerConfiguration serverConfiguration;
 
     /** The Extended Operations List */
     private List<ExtendedOperation> extendedOperations;
@@ -85,8 +86,8 @@
     public ExtendedOperationsMasterDetailsBlock( FormPage page )
     {
         this.page = page;
-        input = ( ServerConfigurationEditorInput ) page.getEditorInput();
-        extendedOperations = input.getServerConfiguration().getExtendedOperations();
+        serverConfiguration = ( ( ServerConfigurationEditorInput ) page.getEditorInput() ).getServerConfiguration();
+        extendedOperations = serverConfiguration.getExtendedOperations();
     }
 
 
@@ -229,7 +230,7 @@
                     ok = false;
                 }
             }
-            
+
             counter++;
         }
 
@@ -290,5 +291,18 @@
     public void setEditorDirty()
     {
         ( ( ServerConfigurationEditor ) page.getEditor() ).setDirty( true );
+    }
+
+
+    /**
+     * Saves the necessary elements to the input model.
+     */
+    public void save()
+    {
+        serverConfiguration.clearExtendedOperations();
+        for ( ExtendedOperation extendedOperation : extendedOperations )
+        {
+            serverConfiguration.addExtendedOperation( extendedOperation );
+        }
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsPage.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ExtendedOperationsPage.java Mon Apr 16 08:08:36 2007
@@ -66,4 +66,16 @@
         masterDetailsBlock = new ExtendedOperationsMasterDetailsBlock( this );
         masterDetailsBlock.createContent( managedForm );
     }
+
+
+    /**
+     * Saves the necessary elements to the input model.
+     */
+    public void save()
+    {
+        if ( masterDetailsBlock != null )
+        {
+            masterDetailsBlock.save();
+        }
+    }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/GeneralPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/GeneralPage.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/GeneralPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/GeneralPage.java Mon Apr 16 08:08:36 2007
@@ -493,4 +493,27 @@
     {
         ( ( ServerConfigurationEditor ) getEditor() ).setDirty( true );
     }
+
+
+    /**
+     * Saves the necessary elements to the input model.
+     */
+    public void save()
+    {
+        ServerConfiguration serverConfiguration = ( ( ServerConfigurationEditorInput ) getEditorInput() )
+            .getServerConfiguration();
+
+        serverConfiguration.setPort( Integer.parseInt( portText.getText() ) );
+        serverConfiguration.setPrincipal( principalText.getText() );
+        serverConfiguration.setPassword( passwordText.getText() );
+        serverConfiguration.setAllowAnonymousAccess( allowAnonymousAccessCheckbox.getSelection() );
+        serverConfiguration.setMaxTimeLimit( Integer.parseInt( maxTimeLimitText.getText() ) );
+        serverConfiguration.setMaxSizeLimit( Integer.parseInt( maxSizeLimitText.getText() ) );
+        serverConfiguration.setSynchronizationPeriod( Long.parseLong( synchPeriodText.getText() ) );
+        serverConfiguration.setMaxThreads( Integer.parseInt( maxThreadsText.getText() ) );
+        serverConfiguration.setEnableAccessControl( enableAccesControlCheckbox.getSelection() );
+        serverConfiguration.setEnableNTP( enableNTPCheckbox.getSelection() );
+        serverConfiguration.setEnableKerberos( enableKerberosCheckbox.getSelection() );
+        serverConfiguration.setEnableChangePassword( enableChangePasswordCheckbox.getSelection() );
+    }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorDetailsPage.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorDetailsPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorDetailsPage.java Mon Apr 16 08:08:36 2007
@@ -56,10 +56,13 @@
     /** The input Interceptor */
     private Interceptor input;
 
+    /** The dirty flag */
+    private boolean dirty = false;
+
     // UI fields
     private Text nameText;
     private Text classText;
-    
+
     // Listeners
     /** The Modify Listener for Text Widgets */
     private ModifyListener textModifyListener = new ModifyListener()
@@ -67,6 +70,7 @@
         public void modifyText( ModifyEvent e )
         {
             masterDetailsBlock.setEditorDirty();
+            dirty = true;
         }
     };
 
@@ -133,7 +137,8 @@
         classText = toolkit.createText( client, "" );
         classText.setLayoutData( new GridData( SWT.FILL, SWT.NONE, true, false, 2, 1 ) );
     }
-    
+
+
     /**
      * Adds listeners to UI fields.
      */
@@ -176,7 +181,7 @@
      * @see org.eclipse.ui.forms.IFormPart#commit(boolean)
      */
     public void commit( boolean onSave )
-    {        
+    {
         input.setName( nameText.getText() );
         input.setClassType( classText.getText() );
     }
@@ -187,8 +192,6 @@
      */
     public void dispose()
     {
-        // TODO Auto-generated method stub
-
     }
 
 
@@ -206,8 +209,7 @@
      */
     public boolean isDirty()
     {
-        // TODO Auto-generated method stub
-        return true;
+        return dirty;
     }
 
 
@@ -216,7 +218,6 @@
      */
     public boolean isStale()
     {
-        // TODO Auto-generated method stub
         return false;
     }
 
@@ -227,7 +228,7 @@
     public void refresh()
     {
         removeListeners();
-        
+
         // Name
         String name = input.getName();
         nameText.setText( ( name == null ) ? "" : name );
@@ -235,7 +236,7 @@
         // Class
         String classType = input.getClassType();
         classText.setText( ( classType == null ) ? "" : classType );
-        
+
         addListeners();
     }
 

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsMasterDetailsBlock.java Mon Apr 16 08:08:36 2007
@@ -25,6 +25,7 @@
 import org.apache.directory.ldapstudio.apacheds.configuration.Activator;
 import org.apache.directory.ldapstudio.apacheds.configuration.PluginConstants;
 import org.apache.directory.ldapstudio.apacheds.configuration.model.Interceptor;
+import org.apache.directory.ldapstudio.apacheds.configuration.model.ServerConfiguration;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -63,8 +64,8 @@
     /** The associated page */
     private FormPage page;
 
-    /** The editor input */
-    private ServerConfigurationEditorInput input;
+    /** The input Server Configuration */
+    private ServerConfiguration serverConfiguration;
 
     /** The Interceptors List */
     private List<Interceptor> interceptors;
@@ -87,8 +88,8 @@
     public InterceptorsMasterDetailsBlock( FormPage page )
     {
         this.page = page;
-        input = ( ServerConfigurationEditorInput ) page.getEditorInput();
-        interceptors = input.getServerConfiguration().getInterceptors();
+        serverConfiguration = ( ( ServerConfigurationEditorInput ) page.getEditorInput() ).getServerConfiguration();
+        interceptors = serverConfiguration.getInterceptors();
     }
 
 
@@ -376,5 +377,18 @@
     public void setEditorDirty()
     {
         ( ( ServerConfigurationEditor ) page.getEditor() ).setDirty( true );
+    }
+
+
+    /**
+     * Saves the necessary elements to the input model.
+     */
+    public void save()
+    {
+        serverConfiguration.clearInterceptors();
+        for ( Interceptor interceptor : interceptors )
+        {
+            serverConfiguration.addInterceptor( interceptor );
+        }
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsPage.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/InterceptorsPage.java Mon Apr 16 08:08:36 2007
@@ -66,4 +66,16 @@
         masterDetailsBlock = new InterceptorsMasterDetailsBlock( this );
         masterDetailsBlock.createContent( managedForm );
     }
+
+
+    /**
+     * Saves the necessary elements to the input model.
+     */
+    public void save()
+    {
+        if ( masterDetailsBlock != null )
+        {
+            masterDetailsBlock.save();
+        }
+    }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionDetailsPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionDetailsPage.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionDetailsPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionDetailsPage.java Mon Apr 16 08:08:36 2007
@@ -97,6 +97,9 @@
     /** The Indexed Attributes List */
     private List<IndexedAttribute> indexedAttributes;
 
+    /** The dirty flag */
+    private boolean dirty = false;
+
     // UI fields
     private Text nameText;
     private Text cacheSizeText;
@@ -120,6 +123,7 @@
         public void modifyText( ModifyEvent e )
         {
             masterDetailsBlock.setEditorDirty();
+            dirty = true;
         }
     };
 
@@ -129,6 +133,7 @@
         public void widgetSelected( SelectionEvent e )
         {
             masterDetailsBlock.setEditorDirty();
+            dirty = true;
         }
     };
 
@@ -174,6 +179,7 @@
                 contextEntryTableViewer.refresh();
                 resizeContextEntryTableColumnsToFit();
                 masterDetailsBlock.setEditorDirty();
+                dirty = true;
             }
         }
     };
@@ -204,6 +210,7 @@
                     contextEntryTableViewer.refresh();
                     resizeContextEntryTableColumnsToFit();
                     masterDetailsBlock.setEditorDirty();
+                    dirty = true;
                 }
             }
         }
@@ -239,6 +246,7 @@
                 indexedAttributes.add( dialog.getIndexedAttribute() );
                 indexedAttributesTableViewer.refresh();
                 masterDetailsBlock.setEditorDirty();
+                dirty = true;
             }
         }
     };
@@ -265,6 +273,7 @@
                 indexedAttributes.remove( indexedAttribute );
                 indexedAttributesTableViewer.refresh();
                 masterDetailsBlock.setEditorDirty();
+                dirty = true;
             }
         }
     };
@@ -619,8 +628,6 @@
      */
     public void dispose()
     {
-        // TODO Auto-generated method stub
-
     }
 
 
@@ -638,8 +645,7 @@
      */
     public boolean isDirty()
     {
-        // TODO Auto-generated method stub
-        return true;
+        return dirty;
     }
 
 
@@ -648,7 +654,6 @@
      */
     public boolean isStale()
     {
-        // TODO Auto-generated method stub
         return false;
     }
 
@@ -738,6 +743,7 @@
             {
                 indexedAttributesTableViewer.refresh();
                 masterDetailsBlock.setEditorDirty();
+                dirty = true;
             }
         }
     }
@@ -781,6 +787,7 @@
                 contextEntryTableViewer.refresh();
                 resizeContextEntryTableColumnsToFit();
                 masterDetailsBlock.setEditorDirty();
+                dirty = true;
             }
         }
     }

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionsMasterDetailsBlock.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionsMasterDetailsBlock.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionsMasterDetailsBlock.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionsMasterDetailsBlock.java Mon Apr 16 08:08:36 2007
@@ -25,6 +25,7 @@
 import org.apache.directory.ldapstudio.apacheds.configuration.Activator;
 import org.apache.directory.ldapstudio.apacheds.configuration.PluginConstants;
 import org.apache.directory.ldapstudio.apacheds.configuration.model.Partition;
+import org.apache.directory.ldapstudio.apacheds.configuration.model.ServerConfiguration;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -63,8 +64,8 @@
     /** The associated page */
     private FormPage page;
 
-    /** The editor input */
-    private ServerConfigurationEditorInput input;
+    /** The input Server Configuration */
+    private ServerConfiguration serverConfiguration;
 
     /** The Interceptors List */
     private List<Partition> partitions;
@@ -86,8 +87,8 @@
     public PartitionsMasterDetailsBlock( FormPage page )
     {
         this.page = page;
-        input = ( ServerConfigurationEditorInput ) page.getEditorInput();
-        partitions = input.getServerConfiguration().getPartitions();
+        serverConfiguration = ( ( ServerConfigurationEditorInput ) page.getEditorInput() ).getServerConfiguration();
+        partitions = serverConfiguration.getPartitions();
     }
 
 
@@ -304,5 +305,18 @@
     public void setEditorDirty()
     {
         ( ( ServerConfigurationEditor ) page.getEditor() ).setDirty( true );
+    }
+
+
+    /**
+     * Saves the necessary elements to the input model.
+     */
+    public void save()
+    {
+        serverConfiguration.clearPartitions();
+        for ( Partition partition : partitions )
+        {
+            serverConfiguration.addPartition( partition );
+        }
     }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionsPage.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionsPage.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionsPage.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/PartitionsPage.java Mon Apr 16 08:08:36 2007
@@ -66,4 +66,16 @@
         masterDetailsBlock = new PartitionsMasterDetailsBlock( this );
         masterDetailsBlock.createContent( managedForm );
     }
+
+
+    /**
+     * Saves the necessary elements to the input model.
+     */
+    public void save()
+    {
+        if ( masterDetailsBlock != null )
+        {
+            masterDetailsBlock.save();
+        }
+    }
 }

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ServerConfigurationEditor.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ServerConfigurationEditor.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ServerConfigurationEditor.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ServerConfigurationEditor.java Mon Apr 16 08:08:36 2007
@@ -20,12 +20,14 @@
 package org.apache.directory.ldapstudio.apacheds.configuration.editor;
 
 
+import org.apache.directory.ldapstudio.apacheds.configuration.Activator;
+import org.apache.directory.ldapstudio.apacheds.configuration.model.ServerConfigurationWriter;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.ui.IEditorInput;
 import org.eclipse.ui.IEditorSite;
 import org.eclipse.ui.PartInitException;
 import org.eclipse.ui.forms.editor.FormEditor;
-import org.eclipse.ui.forms.editor.FormPage;
 
 
 /**
@@ -43,10 +45,10 @@
     private boolean dirty = false;
 
     // The Pages
-    private FormPage generalPage;
-    private FormPage partitionsPage;
-    private FormPage interceptorsPage;
-    private FormPage extendedOperationsPage;
+    private GeneralPage generalPage;
+    private PartitionsPage partitionsPage;
+    private InterceptorsPage interceptorsPage;
+    private ExtendedOperationsPage extendedOperationsPage;
 
 
     /* (non-Javadoc)
@@ -81,7 +83,8 @@
         }
         catch ( PartInitException e )
         {
-            // TODO Add an eclipse logger.
+            Activator.getDefault().getLog().log(
+                new Status( Status.ERROR, Activator.PLUGIN_ID, Status.OK, e.getMessage(), e.getCause() ) );
         }
     }
 
@@ -91,7 +94,20 @@
      */
     public void doSave( IProgressMonitor monitor )
     {
-        // TODO Auto-generated method stub
+        monitor.beginTask( "Saving the Server Configuration", 5 );
+        generalPage.save();
+        monitor.worked( 1 );
+        partitionsPage.save();
+        monitor.worked( 1 );
+        interceptorsPage.save();
+        monitor.worked( 1 );
+        extendedOperationsPage.save();
+        monitor.worked( 1 );
+        ServerConfigurationWriter writer = new ServerConfigurationWriter();
+        writer.write( ( ( ServerConfigurationEditorInput ) getEditorInput() ).getServerConfiguration() );
+        monitor.worked( 1 );
+        setDirty( false );
+        monitor.done();
     }
 
 

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ServerConfigurationEditorInput.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ServerConfigurationEditorInput.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ServerConfigurationEditorInput.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/editor/ServerConfigurationEditorInput.java Mon Apr 16 08:08:36 2007
@@ -67,7 +67,16 @@
      */
     public String getToolTipText()
     {
-        return serverConfiguration.getPath();
+        String path = serverConfiguration.getPath();
+        if ( path == null )
+        {
+            return "Unsaved Editor";
+        }
+        else
+        {
+            return path;
+        }
+
     }
 
 

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/Partition.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/Partition.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/Partition.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/Partition.java Mon Apr 16 08:08:36 2007
@@ -57,7 +57,7 @@
     private List<IndexedAttribute> indexedAttributes;
 
     /** The System Partition flag */
-    private boolean systemPartition;
+    private boolean systemPartition = false;
 
 
     /**
@@ -76,7 +76,7 @@
      * @param name
      *      the name of the partition
      */
-   public Partition( String name )
+    public Partition( String name )
     {
         indexedAttributes = new ArrayList<IndexedAttribute>();
         contextEntry = new BasicAttributes( true );

Modified: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfiguration.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfiguration.java?view=diff&rev=529280&r1=529279&r2=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfiguration.java (original)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfiguration.java Mon Apr 16 08:08:36 2007
@@ -54,7 +54,7 @@
     private int maxSizeLimit;
 
     /** The Synchonization Period */
-    private int synchronizationPeriod;
+    private long synchronizationPeriod;
 
     /** The Maximum number of Threads */
     private int maxThreads;
@@ -265,6 +265,15 @@
 
 
     /**
+     * Removes all ExtendedOperations.
+     */
+    public void clearExtendedOperations()
+    {
+        extendedOperations.clear();
+    }
+
+
+    /**
      * Gets the Interceptors List.
      *
      * @return
@@ -317,6 +326,15 @@
 
 
     /**
+     * Removes all interceptors.
+     */
+    public void clearInterceptors()
+    {
+        interceptors.clear();
+    }
+
+
+    /**
      * Gets the Maximum Size Limit.
      *
      * @return
@@ -441,6 +459,15 @@
 
 
     /**
+     * Removes all partitions.
+     */
+    public void clearPartitions()
+    {
+        partitions.clear();
+    }
+
+
+    /**
      * Gets the password.
      *
      * @return
@@ -542,7 +569,7 @@
      * @return
      *      the Synchronization Period
      */
-    public int getSynchronizationPeriod()
+    public long getSynchronizationPeriod()
     {
         return synchronizationPeriod;
     }
@@ -554,7 +581,7 @@
      * @param synchronizationPeriod
      *      the new value
      */
-    public void setSynchronizationPeriod( int synchronizationPeriod )
+    public void setSynchronizationPeriod( long synchronizationPeriod )
     {
         this.synchronizationPeriod = synchronizationPeriod;
     }

Added: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationParser.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationParser.java?view=auto&rev=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationParser.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationParser.java Mon Apr 16 08:08:36 2007
@@ -0,0 +1,156 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.apacheds.configuration.model;
+
+
+import java.util.Collection;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.directory.server.configuration.MutableServerStartupConfiguration;
+import org.apache.directory.server.core.configuration.MutableInterceptorConfiguration;
+import org.apache.directory.server.core.configuration.PartitionConfiguration;
+import org.apache.directory.server.core.partition.impl.btree.MutableIndexConfiguration;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.FileSystemXmlApplicationContext;
+
+
+/**
+ * This class represents the Server Configuration Parser. It can be used to parse a 'server.xml' file 
+ * and get Server Configuration Object from it.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ServerConfigurationParser
+{
+    /**
+     * Parses a 'server.xml' file located at the given path and returns 
+     * the corresponding ServerConfiguration Object.
+     *
+     * @param path
+     *      the path of the file to parse
+     * @return
+     *      the corresponding ServerConfiguration Object
+     * @throws ServerConfigurationParserException
+     *      if an error occurrs when reading the Server Configuration file
+     */
+    public ServerConfiguration parse( String path ) throws ServerConfigurationParserException
+    {
+        try
+        {
+            ApplicationContext ac = new FileSystemXmlApplicationContext( "file:" + path );
+            MutableServerStartupConfiguration config = ( MutableServerStartupConfiguration ) ac
+                .getBean( "configuration" );
+            Properties environment = ( Properties ) ac.getBean( "environment" );
+
+            ServerConfiguration serverConfiguration = new ServerConfiguration();
+            serverConfiguration.setPath( path );
+            serverConfiguration.setAllowAnonymousAccess( config.isAllowAnonymousAccess() );
+            serverConfiguration.setEnableAccessControl( config.isAccessControlEnabled() );
+            serverConfiguration.setEnableChangePassword( config.isEnableChangePassword() );
+            serverConfiguration.setEnableKerberos( config.isEnableKerberos() );
+            serverConfiguration.setEnableNTP( config.isEnableNtp() );
+            serverConfiguration.setMaxSizeLimit( config.getMaxSizeLimit() );
+            serverConfiguration.setMaxThreads( config.getMaxThreads() );
+            serverConfiguration.setMaxTimeLimit( config.getMaxTimeLimit() );
+            serverConfiguration.setPassword( environment.getProperty( "java.naming.security.credentials", "" ) );
+            serverConfiguration.setPort( config.getLdapPort() );
+            serverConfiguration.setPrincipal( environment.getProperty( "java.naming.security.principal", "" ) );
+            serverConfiguration.setSynchronizationPeriod( config.getSynchPeriodMillis() );
+
+            // System Partition
+            Partition systemPartition = createPartition( config.getSystemPartitionConfiguration(), true );
+            serverConfiguration.addPartition( systemPartition );
+
+            // Other Partitions
+            Set<PartitionConfiguration> partitionConfigurations = config.getPartitionConfigurations();
+            for ( PartitionConfiguration partitionConfiguration : partitionConfigurations )
+            {
+                Partition partition = createPartition( partitionConfiguration, false );
+                serverConfiguration.addPartition( partition );
+            }
+
+            // Interceptors
+            List interceptorConfigurations = config.getInterceptorConfigurations();
+            for ( Object interceptorConfiguration : interceptorConfigurations )
+            {
+                MutableInterceptorConfiguration interceptor = ( MutableInterceptorConfiguration ) interceptorConfiguration;
+                Interceptor newInterceptor = new Interceptor( interceptor.getName() );
+                newInterceptor.setClassType( interceptor.getInterceptor().getClass().getName() );
+                serverConfiguration.addInterceptor( newInterceptor );
+            }
+
+            // Extended Operations
+            Collection extendedOperationHandlers = config.getExtendedOperationHandlers();
+            for ( Object extendedOperationHandler : extendedOperationHandlers )
+            {
+                ExtendedOperation extendedOperation = new ExtendedOperation( extendedOperationHandler.getClass()
+                    .getName() );
+                serverConfiguration.addExtendedOperation( extendedOperation );
+            }
+
+            return serverConfiguration;
+
+        }
+        catch ( Exception e )
+        {
+            ServerConfigurationParserException exception = new ServerConfigurationParserException( e.getMessage(), e
+                .getCause() );
+            exception.setStackTrace( e.getStackTrace() );
+            throw exception;
+        }
+    }
+
+
+    /**
+     * Creates a Partition from the given Partition Configuration.
+     *
+     * @param partitionConfiguration
+     *      the Partition Configuration
+     * @param isSystemPartition
+     *      a flag to indicate if the created partition must be the system partition
+     * @return
+     *      the corresponding Partition
+     * @throws Exception
+     *      if an error occurrs
+     */
+    private Partition createPartition( PartitionConfiguration partitionConfiguration, boolean isSystemPartition )
+        throws Exception
+    {
+        Partition partition = new Partition();
+        partition.setSystemPartition( isSystemPartition );
+        partition.setName( partitionConfiguration.getName() );
+        partition.setCacheSize( partitionConfiguration.getCacheSize() );
+        partition.setContextEntry( partitionConfiguration.getContextEntry() );
+        partition.setSuffix( partitionConfiguration.getSuffix() );
+
+        for ( Object indexedAt : partitionConfiguration.getIndexedAttributes() )
+        {
+            MutableIndexConfiguration indexConfiguration = ( MutableIndexConfiguration ) indexedAt;
+            IndexedAttribute indexedAttribute = new IndexedAttribute( indexConfiguration.getAttributeId(),
+                indexConfiguration.getCacheSize() );
+            partition.addIndexedAttribute( indexedAttribute );
+        }
+
+        return partition;
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationParserException.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationParserException.java?view=auto&rev=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationParserException.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationParserException.java Mon Apr 16 08:08:36 2007
@@ -0,0 +1,51 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.apacheds.configuration.model;
+
+
+/**
+ * This class represents the Server Configuration Parser Exception, that can be thrown
+ * when an error is detected when reading the Server Configuration file.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ServerConfigurationParserException extends Exception
+{
+    /** The Serial Version UID */
+    private static final long serialVersionUID = 7274953743060751973L;
+
+
+    /**
+     * Creates a new instance of ServerConfigurationParserException.
+     *
+     * @param message
+     *      the detail message (which is saved for later retrieval by the 
+     *      getMessage() method).
+     * @param cause
+     *      the cause (which is saved for later retrieval by the getCause() 
+     *      method). (A null value is permitted, and indicates that the cause 
+     *      is nonexistent or unknown.)
+     */
+    public ServerConfigurationParserException( String message, Throwable cause )
+    {
+        super( message, cause );
+    }
+}

Added: directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationWriter.java
URL: http://svn.apache.org/viewvc/directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationWriter.java?view=auto&rev=529280
==============================================================================
--- directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationWriter.java (added)
+++ directory/ldapstudio/trunk/ldapstudio-apacheds-configuration/src/main/java/org/apache/directory/ldapstudio/apacheds/configuration/model/ServerConfigurationWriter.java Mon Apr 16 08:08:36 2007
@@ -0,0 +1,40 @@
+/*
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+ *  
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *  
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License. 
+ *  
+ */
+package org.apache.directory.ldapstudio.apacheds.configuration.model;
+
+
+/**
+ * This class represents the Server Configuration Writer. It can be used to save a 'server.xml' file from.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ServerConfigurationWriter
+{
+    /**
+     * TODO write.
+     *
+     * @param serverConfiguration
+     */
+    public void write( ServerConfiguration serverConfiguration )
+    {
+        System.out.println( "Writing file to disk." );
+    }
+}



Mime
View raw message