directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r490766 - in /directory/trunks/ldapstudio: ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/ ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ ldapstudio-browser-core/...
Date Thu, 28 Dec 2006 17:47:29 GMT
Author: pamarcelot
Date: Thu Dec 28 09:47:28 2006
New Revision: 490766

URL: http://svn.apache.org/viewvc?view=rev&rev=490766
Log:
Adding DSML Export Wizard. (The filter, subentries control and sizeLimit features doesn't
currently work).

Added:
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/icons/export_dsml.gif   (with props)
    directory/trunks/ldapstudio/ldapstudio-browser-ui/icons/export_dsml_wizard.gif   (with
props)
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlFromWizardPage.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlToWizardPage.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlWizard.java
Modified:
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/BrowserCoreMessages.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/browsercoremessages.properties
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ImportDsmlJob.java
    directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifValueLineBase.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/plugin.xml
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIConstants.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/ImportExportAction.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewActionGroup.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/connection/ConnectionViewActionGroup.java
    directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ImportDsmlMainWizardPage.java

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/BrowserCoreMessages.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/BrowserCoreMessages.java?view=diff&rev=490766&r1=490765&r2=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/BrowserCoreMessages.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/BrowserCoreMessages.java
Thu Dec 28 09:47:28 2006
@@ -280,6 +280,12 @@
     public static String jobs__export_ldif_task;
 
     public static String jobs__export_ldif_error;
+    
+    public static String jobs__export_dsml_name;
+
+    public static String jobs__export_dsml_task;
+
+    public static String jobs__export_dsml_error;
 
     public static String jobs__export_progress;
 

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/browsercoremessages.properties
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/browsercoremessages.properties?view=diff&rev=490766&r1=490765&r2=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/browsercoremessages.properties
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/browsercoremessages.properties
Thu Dec 28 09:47:28 2006
@@ -167,6 +167,9 @@
 jobs__export_xls_name=XLS Export
 jobs__export_xls_task=Exporting XLS
 jobs__export_xls_error=Error while exporting XLS
+jobs__export_dsml_name=DSML Export
+jobs__export_dsml_task=Exporting DSML
+jobs__export_dsml_error=Error while exporting DSML
 
 jobs__read_entry_name=Read Entry
 jobs__read_entry_task=Reading entry {0}

Added: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java?view=auto&rev=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java
(added)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ExportDsmlJob.java
Thu Dec 28 09:47:28 2006
@@ -0,0 +1,206 @@
+/*
+ *  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.browser.core.jobs;
+
+
+import java.io.FileOutputStream;
+import java.io.PrintStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.commons.codec.digest.DigestUtils;
+import org.apache.directory.ldapstudio.browser.core.BrowserCoreMessages;
+import org.apache.directory.ldapstudio.browser.core.model.IConnection;
+import org.apache.directory.ldapstudio.browser.core.model.ISearch;
+import org.apache.directory.ldapstudio.browser.core.model.SearchParameter;
+import org.apache.directory.ldapstudio.dsmlv2.engine.Dsmlv2Engine;
+
+/**
+ * This class implements a Job for Exporting a part of a LDAP Server into a DSML File.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportDsmlJob extends AbstractEclipseJob
+{
+    /** The name of the DSML file to export to */
+    private String exportDsmlFilename;
+
+    /** The connection to use */
+    private IConnection connection;
+
+    /** The Search Parameter of the export*/
+    private SearchParameter searchParameter;
+
+
+    /**
+     * Creates a new instance of ExportDsmlJob.
+     *
+     * @param exportDsmlFilename
+     *          the name of the DSML file to export to
+     * @param connection
+     *          the connection to use
+     * @param searchParameter
+     *          the Search Parameter of the export
+     */
+    public ExportDsmlJob( String exportDsmlFilename, IConnection connection, SearchParameter
searchParameter )
+    {
+        this.exportDsmlFilename = exportDsmlFilename;
+        this.connection = connection;
+        this.searchParameter = searchParameter;
+
+        setName( BrowserCoreMessages.jobs__export_dsml_name ); 
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.browser.core.jobs.AbstractEclipseJob#getConnections()
+     */
+    protected IConnection[] getConnections()
+    {
+        return new IConnection[]
+            { connection };
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.browser.core.jobs.AbstractEclipseJob#getLockedObjects()
+     */
+    protected Object[] getLockedObjects()
+    {
+        List l = new ArrayList();
+        l.add( connection.getUrl() + "_" + DigestUtils.shaHex( exportDsmlFilename ) );
+        return l.toArray();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.browser.core.jobs.AbstractEclipseJob#executeAsyncJob(org.apache.directory.ldapstudio.browser.core.jobs.ExtendedProgressMonitor)
+     */
+    protected void executeAsyncJob( ExtendedProgressMonitor monitor )
+    {
+        monitor.beginTask( BrowserCoreMessages.jobs__export_dsml_task, 2 );
+        monitor.reportProgress( " " ); //$NON-NLS-1$
+        monitor.worked( 1 );
+
+        try
+        {
+            // Getting and preparing each parameter for the request        
+            String requestDN = searchParameter.getSearchBase().toString();
+            
+            String requestScope = null;
+            int scope = searchParameter.getScope();
+            if ( scope == ISearch.SCOPE_OBJECT )
+            {
+                requestScope = "baseObject";
+            }
+            else if ( scope == ISearch.SCOPE_ONELEVEL)
+            {
+                requestScope = "singleLevel";
+            }
+            else if ( scope == ISearch.SCOPE_SUBTREE )
+            {
+                requestScope = "wholeSubtree";
+            }
+            
+            String requestDerefAliases = null;
+            int derefAliases = searchParameter.getAliasesDereferencingMethod();
+            if ( derefAliases == IConnection.DEREFERENCE_ALIASES_ALWAYS )
+            {
+                requestDerefAliases = "derefAlways";
+            }
+            else if ( derefAliases == IConnection.DEREFERENCE_ALIASES_FINDING)
+            {
+                requestDerefAliases = "derefFindingBaseObj";
+            }
+            else if ( derefAliases == IConnection.DEREFERENCE_ALIASES_NEVER )
+            {
+                requestDerefAliases = "neverDerefAliases";
+            }
+            else if ( derefAliases == IConnection.DEREFERENCE_ALIASES_SEARCH )
+            {
+                requestDerefAliases = "derefInSearching";
+            }
+            
+            String requestTimeLimit = null;
+            int timeLimit = searchParameter.getTimeLimit();
+            if ( timeLimit != 0);
+            {
+                requestTimeLimit = "" + timeLimit;
+            }
+            
+            String requestSizeLimit = null;
+            int countLimit = searchParameter.getCountLimit();
+            if ( countLimit != 0);
+            {
+                requestSizeLimit = "" + countLimit;
+            }
+            
+            // Constructing the request
+            String request = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>";
+            request += "<batchRequest>";
+            request += "<searchRequest dn=\"" + requestDN + "\"";
+            request += " scope=\"" + requestScope + "\" ";
+            request += " derefAliases=\"" +requestDerefAliases + "\"";
+            if ( requestTimeLimit != null )
+            {
+                request += " timelimit=\"" +requestTimeLimit + "\"";
+            }
+            if ( requestSizeLimit != null )
+            {
+                request += " sizelimit=\"" +requestSizeLimit + "\"";
+            }
+            request += ">";
+            request += "<filter><present name=\"objectclass\"></present></filter>";
+            request += "<attributes>";
+            String[] returningAttributes = searchParameter.getReturningAttributes();
+            for ( int i = 0; i < returningAttributes.length; i++ )
+            {
+                request += "<attribute name=\"" + returningAttributes[i] + "\"/>";
+            }
+            request += "</attributes>";
+            request += "</searchRequest>";
+            request += "</batchRequest>";
+            
+            System.out.println( request );
+            
+            // Executing the request
+            Dsmlv2Engine engine = new Dsmlv2Engine( connection.getHost(), connection.getPort(),
connection.getBindPrincipal(), connection.getBindPassword() );
+            String response = engine.processDSML( request );
+            
+            FileOutputStream fout = new FileOutputStream( exportDsmlFilename );
+            new PrintStream( fout ).println( response );
+            fout.close();
+        }
+        catch ( Exception e )
+        {
+            monitor.reportError( e );
+        }
+    }
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.browser.core.jobs.AbstractEclipseJob#getErrorMessage()
+     */
+    protected String getErrorMessage()
+    {
+        return BrowserCoreMessages.jobs__export_dsml_error;
+    }
+}

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ImportDsmlJob.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ImportDsmlJob.java?view=diff&rev=490766&r1=490765&r2=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ImportDsmlJob.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/jobs/ImportDsmlJob.java
Thu Dec 28 09:47:28 2006
@@ -44,7 +44,6 @@
  */
 public class ImportDsmlJob extends AbstractEclipseJob
 {
-
     /** The connection to use */
     private IConnection connection;
 

Modified: directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifValueLineBase.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifValueLineBase.java?view=diff&rev=490766&r1=490765&r2=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifValueLineBase.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-core/src/main/java/org/apache/directory/ldapstudio/browser/core/model/ldif/lines/LdifValueLineBase.java
Thu Dec 28 09:47:28 2006
@@ -154,11 +154,11 @@
      * Returns the real data:
      * <ul>
      * <li>The unfolded String if value is a safe value.
-     * </ul>
+     * </li>
      * <li>A byte array if value is base64 encoded.
-     * </ul>
+     * </li>
      * <li>A byte array if value references an URL.
-     * </ul>
+     * </li>
      * </ul>
      * 
      * @return the real value or null

Added: directory/trunks/ldapstudio/ldapstudio-browser-ui/icons/export_dsml.gif
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/icons/export_dsml.gif?view=auto&rev=490766
==============================================================================
Binary file - no diff available.

Propchange: directory/trunks/ldapstudio/ldapstudio-browser-ui/icons/export_dsml.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: directory/trunks/ldapstudio/ldapstudio-browser-ui/icons/export_dsml_wizard.gif
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/icons/export_dsml_wizard.gif?view=auto&rev=490766
==============================================================================
Binary file - no diff available.

Propchange: directory/trunks/ldapstudio/ldapstudio-browser-ui/icons/export_dsml_wizard.gif
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/plugin.xml
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/plugin.xml?view=diff&rev=490766&r1=490765&r2=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/plugin.xml (original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/plugin.xml Thu Dec 28 09:47:28 2006
@@ -169,6 +169,17 @@
        <selection class="org.apache.directory.ldapstudio.browser.core.model.IEntry"/>
     </wizard>
     <wizard
+          class="org.apache.directory.ldapstudio.browser.ui.wizards.ExportDsmlWizard"
+          icon="icons/export_dsml.gif"
+          id="org.apache.directory.ldapstudio.browser.ui.wizards.ExportDdsmlWizard"
+          name="LDAP to DSML">
+       <description>
+          Exports a DSML file from a LDAP directory
+       </description>
+       <selection class="org.apache.directory.ldapstudio.browser.core.model.IConnection"/>
+       <selection class="org.apache.directory.ldapstudio.browser.core.model.IEntry"/>
+    </wizard>
+    <wizard
           class="org.apache.directory.ldapstudio.browser.ui.wizards.ExportCsvWizard"
           icon="icons/export_csv.gif"
           id="org.apache.directory.ldapstudio.browser.ui.wizards.ExportCsvWizard"

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIConstants.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIConstants.java?view=diff&rev=490766&r1=490765&r2=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIConstants.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/BrowserUIConstants.java
Thu Dec 28 09:47:28 2006
@@ -257,6 +257,8 @@
     public static final String IMG_EXPORT = "icons/export.gif";
     
     public static final String IMG_IMPORT_DSML_WIZARD = "icons/import_dsml_wizard.gif";
+    
+    public static final String IMG_EXPORT_DSML_WIZARD = "icons/export_dsml_wizard.gif";
 
     public static final String IMG_IMPORT_LDIF_WIZARD = "icons/import_ldif_wizard.gif";
 
@@ -271,6 +273,8 @@
     public static final String IMG_EXPORT_XLS_WIZARD = "icons/export_xls_wizard.gif";
 
     public static final String IMG_IMPORT_DSML = "icons/import_dsml.gif";
+    
+    public static final String IMG_EXPORT_DSML = "icons/export_dsml.gif";
     
     public static final String IMG_IMPORT_LDIF = "icons/import_ldif.gif";
 

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/ImportExportAction.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/ImportExportAction.java?view=diff&rev=490766&r1=490765&r2=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/ImportExportAction.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/actions/ImportExportAction.java
Thu Dec 28 09:47:28 2006
@@ -27,6 +27,7 @@
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
 import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
 import org.apache.directory.ldapstudio.browser.ui.wizards.ExportCsvWizard;
+import org.apache.directory.ldapstudio.browser.ui.wizards.ExportDsmlWizard;
 import org.apache.directory.ldapstudio.browser.ui.wizards.ExportExcelWizard;
 import org.apache.directory.ldapstudio.browser.ui.wizards.ExportLdifWizard;
 import org.apache.directory.ldapstudio.browser.ui.wizards.ImportDsmlWizard;
@@ -49,6 +50,8 @@
     public static final int TYPE_EXPORT_EXCEL = 3;
     
     public static final int TYPE_IMPORT_DSML = 4;
+    
+    public static final int TYPE_EXPORT_DSML = 5;
 
     private int type;
 
@@ -82,6 +85,10 @@
         {
             return "DSML Import...";
         }
+        else if ( this.type == TYPE_EXPORT_DSML )
+        {
+            return "DSML Export...";
+        }
         else
         {
             return "Export...";
@@ -111,6 +118,10 @@
         {
             return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_IMPORT_DSML
);
         }
+        else if ( this.type == TYPE_EXPORT_DSML )
+        {
+            return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_EXPORT_DSML
);
+        }
         else
         {
             return null;
@@ -184,6 +195,10 @@
         else if ( this.type == TYPE_EXPORT_EXCEL )
         {
             wizard = new ExportExcelWizard();
+        }
+        else if ( this.type == TYPE_EXPORT_DSML )
+        {
+            wizard = new ExportDsmlWizard();
         }
 
         if ( wizard != null )

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewActionGroup.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewActionGroup.java?view=diff&rev=490766&r1=490765&r2=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewActionGroup.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/browser/BrowserViewActionGroup.java
Thu Dec 28 09:47:28 2006
@@ -109,6 +109,8 @@
     private static final String importLdifAction = "importLdifAction";
 
     private static final String exportLdifAction = "exportLdifAction";
+    
+    private static final String exportDsmlAction = "exportDsmlAction";
 
     private static final String exportCsvAction = "exportCsvAction";
 
@@ -165,6 +167,8 @@
 
         this.browserActionMap.put( importDsmlAction, new BrowserViewActionProxy( viewer,
new ImportExportAction(
                 ImportExportAction.TYPE_IMPORT_DSML ) ) );
+        this.browserActionMap.put( exportDsmlAction, new BrowserViewActionProxy( viewer,
new ImportExportAction(
+            ImportExportAction.TYPE_EXPORT_DSML ) ) );
         this.browserActionMap.put( importLdifAction, new BrowserViewActionProxy( viewer,
new ImportExportAction(
             ImportExportAction.TYPE_IMPORT_LDIF ) ) );
         this.browserActionMap.put( exportLdifAction, new BrowserViewActionProxy( viewer,
new ImportExportAction(
@@ -266,12 +270,13 @@
         // import/export
         MenuManager importMenuManager = new MenuManager( "Import" );
         importMenuManager.add( ( IAction ) this.browserActionMap.get( importLdifAction )
);
-        importMenuManager.add( new Separator() );
         importMenuManager.add( ( IAction ) this.browserActionMap.get( importDsmlAction )
);
+        importMenuManager.add( new Separator() );
         menuManager.add( importMenuManager );
 
         MenuManager exportMenuManager = new MenuManager( "Export" );
         exportMenuManager.add( ( IAction ) this.browserActionMap.get( exportLdifAction )
);
+        exportMenuManager.add( ( IAction ) this.browserActionMap.get( exportDsmlAction )
);
         exportMenuManager.add( new Separator() );
         exportMenuManager.add( ( IAction ) this.browserActionMap.get( exportCsvAction ) );
         exportMenuManager.add( ( IAction ) this.browserActionMap.get( exportExcelAction )
);

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/connection/ConnectionViewActionGroup.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/connection/ConnectionViewActionGroup.java?view=diff&rev=490766&r1=490765&r2=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/connection/ConnectionViewActionGroup.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/views/connection/ConnectionViewActionGroup.java
Thu Dec 28 09:47:28 2006
@@ -41,12 +41,13 @@
 
 public class ConnectionViewActionGroup extends ConnectionActionGroup
 {
-
     private ConnectionView view;
 
     private static final String selectAllAction = "selectAllAction";
 
     private static final String importDsmlAction = "importDsmlAction";
+    
+    private static final String exportDsmlAction = "exportDsmlAction";
 
     private static final String importLdifAction = "importLdifAction";
 
@@ -72,7 +73,9 @@
         this.connectionActionMap.put( selectAllAction, new ConnectionViewActionProxy( viewer,
new SelectAllAction(
             viewer ) ) );
         this.connectionActionMap.put( importDsmlAction, new ConnectionViewActionProxy( viewer,
new ImportExportAction(
-                ImportExportAction.TYPE_IMPORT_DSML ) ) );
+            ImportExportAction.TYPE_IMPORT_DSML ) ) );
+        this.connectionActionMap.put( exportDsmlAction, new ConnectionViewActionProxy( viewer,
new ImportExportAction(
+            ImportExportAction.TYPE_EXPORT_DSML ) ) );
         this.connectionActionMap.put( importLdifAction, new ConnectionViewActionProxy( viewer,
new ImportExportAction(
             ImportExportAction.TYPE_IMPORT_LDIF ) ) );
         this.connectionActionMap.put( exportLdifAction, new ConnectionViewActionProxy( viewer,
new ImportExportAction(
@@ -139,11 +142,12 @@
         // import/export
         MenuManager importMenuManager = new MenuManager( "Import" );
         importMenuManager.add( ( IAction ) this.connectionActionMap.get( importLdifAction
) );
-        importMenuManager.add( new Separator() );
         importMenuManager.add( ( IAction ) this.connectionActionMap.get( importDsmlAction
) );
+        importMenuManager.add( new Separator() );
         menuManager.add( importMenuManager );
         MenuManager exportMenuManager = new MenuManager( "Export" );
         exportMenuManager.add( ( IAction ) this.connectionActionMap.get( exportLdifAction
) );
+        exportMenuManager.add( ( IAction ) this.connectionActionMap.get( exportDsmlAction
) );
         exportMenuManager.add( new Separator() );
         exportMenuManager.add( ( IAction ) this.connectionActionMap.get( exportCsvAction
) );
         exportMenuManager.add( ( IAction ) this.connectionActionMap.get( exportExcelAction
) );

Added: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlFromWizardPage.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlFromWizardPage.java?view=auto&rev=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlFromWizardPage.java
(added)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlFromWizardPage.java
Thu Dec 28 09:47:28 2006
@@ -0,0 +1,58 @@
+/*
+ *  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.browser.ui.wizards;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.widgets.search.SearchPageWrapper;
+
+
+/**
+ * This class implements the From Page of the DSML Export Wizard.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportDsmlFromWizardPage extends ExportBaseFromWizardPage
+{
+
+    /**
+     * Creates a new instance of ExportDsmlFromWizardPage.
+     *
+     * @param pageName
+     *          the name of the page
+     * @param wizard
+     *          the wizard the page is attached to
+     */
+    public ExportDsmlFromWizardPage( String pageName, ExportBaseWizard wizard )
+    {
+        super( pageName, wizard, new SearchPageWrapper(
+            SearchPageWrapper.NAME_INVISIBLE
+                | SearchPageWrapper.ALLATTRIBUTES_VISIBLE
+                | SearchPageWrapper.OPERATIONALATTRIBUTES_VISIBLE
+                | ( ( wizard.getSearch().getReturningAttributes() == null || wizard.getSearch()
+                    .getReturningAttributes().length == 0 ) ? SearchPageWrapper.ALLATTRIBUTES_CHECKED
+                    : SearchPageWrapper.NONE ) ) );
+        super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor(
+            BrowserUIConstants.IMG_EXPORT_DSML_WIZARD ) );
+    }
+}

Added: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlToWizardPage.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlToWizardPage.java?view=auto&rev=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlToWizardPage.java
(added)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlToWizardPage.java
Thu Dec 28 09:47:28 2006
@@ -0,0 +1,85 @@
+/*
+ *  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.browser.ui.wizards;
+
+
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIConstants;
+import org.apache.directory.ldapstudio.browser.ui.BrowserUIPlugin;
+import org.apache.directory.ldapstudio.browser.ui.widgets.BaseWidgetUtils;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * This class implements the To Page of the DSML Export Wizard
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportDsmlToWizardPage extends ExportBaseToPage
+{
+    /** The extensions used by DSML files*/
+    private static final String[] EXTENSIONS = new String[]
+        { "*.xml", "*.*" };
+
+
+    /**
+     * Creates a new instance of ExportDsmlToWizardPage.
+     *
+     * @param pageName
+     *          the name of the page
+     * @param wizard
+     *          the wizard the page is attached to
+     */
+    public ExportDsmlToWizardPage( String pageName, ExportBaseWizard wizard )
+    {
+        super( pageName, wizard );
+        super.setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor(
+            BrowserUIConstants.IMG_EXPORT_DSML_WIZARD ) );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.browser.ui.wizards.ExportBaseToPage#createControl(org.eclipse.swt.widgets.Composite)
+     */
+    public void createControl( Composite parent )
+    {
+        final Composite composite = BaseWidgetUtils.createColumnContainer( parent, 3, 1 );
+        super.createControl( composite );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.browser.ui.wizards.ExportBaseToPage#getExtensions()
+     */
+    protected String[] getExtensions()
+    {
+        return EXTENSIONS;
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.apache.directory.ldapstudio.browser.ui.wizards.ExportBaseToPage#getFileType()
+     */
+    protected String getFileType()
+    {
+        return "DSML";
+    }
+}

Added: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlWizard.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlWizard.java?view=auto&rev=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlWizard.java
(added)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ExportDsmlWizard.java
Thu Dec 28 09:47:28 2006
@@ -0,0 +1,86 @@
+/*
+ *  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.browser.ui.wizards;
+
+import org.apache.directory.ldapstudio.browser.core.jobs.ExportDsmlJob;
+
+
+/**
+ * This class implements the Wizard for Exporting to DSML
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportDsmlWizard extends ExportBaseWizard
+{
+    public static final String WIZARD_TITLE = "DSML Export";
+
+    private ExportDsmlFromWizardPage fromPage;
+
+    private ExportDsmlToWizardPage toPage;
+
+
+    /**
+     * Creates a new instance of ExportDsmlWizard.
+     */
+    public ExportDsmlWizard()
+    {
+        super( WIZARD_TITLE );
+    }
+
+
+    /**
+     * Gets the ID of the Export DSML Wizard
+     * @return The ID of the Export DSML Wizard
+     */
+    public static String getId()
+    {
+        return ExportDsmlWizard.class.getName();
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.wizard.Wizard#addPages()
+     */
+    public void addPages()
+    {
+        fromPage = new ExportDsmlFromWizardPage( ExportDsmlFromWizardPage.class.getName(),
this );
+        addPage( fromPage );
+        toPage = new ExportDsmlToWizardPage( ExportDsmlToWizardPage.class.getName(), this
);
+        addPage( toPage );
+    }
+
+
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.wizard.Wizard#performFinish()
+     */
+    public boolean performFinish()
+    {
+        this.fromPage.saveDialogSettings();
+        this.toPage.saveDialogSettings();
+
+        ExportDsmlJob edj = new ExportDsmlJob( this.exportFilename, this.search.getConnection(),
this.search
+            .getSearchParameter() );
+        edj.execute();
+        
+        return true;
+    }
+}

Modified: directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ImportDsmlMainWizardPage.java
URL: http://svn.apache.org/viewvc/directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ImportDsmlMainWizardPage.java?view=diff&rev=490766&r1=490765&r2=490766
==============================================================================
--- directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ImportDsmlMainWizardPage.java
(original)
+++ directory/trunks/ldapstudio/ldapstudio-browser-ui/src/main/java/org/apache/directory/ldapstudio/browser/ui/wizards/ImportDsmlMainWizardPage.java
Thu Dec 28 09:47:28 2006
@@ -37,6 +37,12 @@
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Group;
 
+/**
+ * This class implements the Main Page of the DSML Import Wizard
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
 public class ImportDsmlMainWizardPage extends WizardPage
 {    
     /** The wizard the page is attached to */
@@ -56,6 +62,14 @@
     
     private String customResponseFileName;
     
+    /**
+     * Creates a new instance of ImportDsmlMainWizardPage.
+     *
+     * @param pageName
+     *          the name of the page
+     * @param wizard
+     *          the wizard the page is attached to
+     */
     public ImportDsmlMainWizardPage( String pageName, ImportDsmlWizard wizard )
     {
         super( pageName );
@@ -66,6 +80,9 @@
         this.wizard = wizard;
     }
     
+    /* (non-Javadoc)
+     * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+     */
     public void createControl( Composite parent )
     {
         Composite composite = BaseWidgetUtils.createColumnContainer( parent, 3, 1 );
@@ -177,6 +194,9 @@
         setControl( composite );
     }
     
+    /**
+     * Validates the page. This method is responsible for displaying errors, as well as enabling/disabling
the "Finish" button
+     */
     private void validate()
     {
         boolean ok = true;



Mime
View raw message