You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by se...@apache.org on 2008/09/18 18:19:34 UTC

svn commit: r696693 - in /directory/studio/trunk: connection-core/src/main/java/org/apache/directory/studio/connection/core/ connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/ ldapbrowser-common/src/main/java/org/apache/...

Author: seelmann
Date: Thu Sep 18 09:19:34 2008
New Revision: 696693

URL: http://svn.apache.org/viewvc?rev=696693&view=rev
Log:
o Fix for DIRSTUDIO-297 (Add a 'save as' for logs)
o Added preferences for log file rotation
o Fixed a ClassCastException



Added:
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ExportAction.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/ExportAction.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportLogsToWizardPage.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportModificationLogsWizard.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportSearchLogsWizard.java
Modified:
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePreferencesInitializer.java
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java
    directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifSearchLogger.java
    directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/NewEntryAction.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/ModificationLogsPreferencePage.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/SearchLogsPreferencePage.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewActionGroup.java
    directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewActionGroup.java

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java?rev=696693&r1=696692&r2=696693&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java (original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCoreConstants.java Thu Sep 18 09:19:34 2008
@@ -44,10 +44,22 @@
     /** The constant used to identify the "enable modification logs" preference  */
     public static final String PREFERENCE_MODIFICATIONLOGS_ENABLE = "modificationLogsEnable";
 
+    /** The constant used to identify the "modification log file count" preference  */
+    public static final String PREFERENCE_MODIFICATIONLOGS_FILE_COUNT = "modificationLogsFileCount";
+
+    /** The constant used to identify the "modification log file size" preference  */
+    public static final String PREFERENCE_MODIFICATIONLOGS_FILE_SIZE = "modificationLogsFileSize";
+
     /** The constant used to identify the "enable search request logs" preference  */
     public static final String PREFERENCE_SEARCHREQUESTLOGS_ENABLE = "searchRequestLogsEnable";
 
     /** The constant used to identify the "enable search result entry logs" preference  */
     public static final String PREFERENCE_SEARCHRESULTENTRYLOGS_ENABLE = "searchResultEntryLogsEnable";
 
+    /** The constant used to identify the "search log file count" preference  */
+    public static final String PREFERENCE_SEARCHLOGS_FILE_COUNT = "searchLogsFileCount";
+
+    /** The constant used to identify the "search log file size" preference  */
+    public static final String PREFERENCE_SEARCHLOGS_FILE_SIZE = "searchLogsFileSize";
+
 }

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePreferencesInitializer.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePreferencesInitializer.java?rev=696693&r1=696692&r2=696693&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePreferencesInitializer.java (original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/ConnectionCorePreferencesInitializer.java Thu Sep 18 09:19:34 2008
@@ -46,10 +46,14 @@
 
         // Modification Logs
         preferences.setDefault( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_ENABLE, true );
+        preferences.setDefault( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT, 10 );
+        preferences.setDefault( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE, 100 );
 
         // Search Logs
         preferences.setDefault( ConnectionCoreConstants.PREFERENCE_SEARCHREQUESTLOGS_ENABLE, true );
         preferences.setDefault( ConnectionCoreConstants.PREFERENCE_SEARCHRESULTENTRYLOGS_ENABLE, false );
+        preferences.setDefault( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT, 10 );
+        preferences.setDefault( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE, 100 );
     }
 
 }

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java?rev=696693&r1=696692&r2=696693&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java (original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifModificationLogger.java Thu Sep 18 09:19:34 2008
@@ -72,6 +72,8 @@
 import org.apache.directory.studio.ldifparser.model.lines.LdifNewrdnLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifNewsuperiorLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifSepLine;
+import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
+import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
 
 
 /**
@@ -104,6 +106,46 @@
      */
     public LdifModificationLogger()
     {
+        ConnectionCorePlugin.getDefault().getPluginPreferences().addPropertyChangeListener(
+            new IPropertyChangeListener()
+            {
+                public void propertyChange( PropertyChangeEvent event )
+                {
+                    if ( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT.equals( event.getProperty() )
+                        || ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE.equals( event.getProperty() ) )
+                    {
+                        // dispose all loggers/handlers
+                        for ( Logger logger : loggers.values() )
+                        {
+                            for ( Handler handler : logger.getHandlers() )
+                            {
+                                handler.close();
+                            }
+                        }
+
+                        // delete files with index greater than new file count
+                        for ( FileHandler fh : fileHandlers.values() )
+                        {
+                            try
+                            {
+                                File[] logFiles = getLogFiles( fh );
+                                for ( int i = getFileCount(); i < logFiles.length; i++ )
+                                {
+                                    if ( logFiles[i] != null && logFiles[i].exists() )
+                                    {
+                                        logFiles[i].delete();
+                                    }
+                                }
+                            }
+                            catch ( Exception e )
+                            {
+                            }
+                        }
+
+                        loggers.clear();
+                    }
+                }
+            } );
     }
 
 
@@ -119,7 +161,7 @@
         String logfileName = ConnectionManager.getModificationLogFileName( connection );
         try
         {
-            FileHandler fileHandler = new FileHandler( logfileName, 100000, 10, true );
+            FileHandler fileHandler = new FileHandler( logfileName, getFileSizeInKb() * 1000, getFileCount(), true );
             fileHandlers.put( connection.getId(), fileHandler );
             fileHandler.setFormatter( new Formatter()
             {
@@ -402,7 +444,7 @@
         // don't log searches 
     }
 
-    
+
     /**
      * {@inheritDoc}
      */
@@ -412,6 +454,7 @@
         // don't log searches 
     }
 
+
     /**
      * {@inheritDoc}
      */
@@ -526,6 +569,30 @@
     }
 
 
+    /**
+     * Gets the number of log files to use.
+     * 
+     * @return the number of log files to use
+     */
+    private int getFileCount()
+    {
+        return ConnectionCorePlugin.getDefault().getPluginPreferences().getInt(
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT );
+    }
+
+
+    /**
+     * Gets the maximum file size in kB.
+     * 
+     * @return the maximum file size in kB
+     */
+    private int getFileSizeInKb()
+    {
+        return ConnectionCorePlugin.getDefault().getPluginPreferences().getInt(
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE );
+    }
+
+
     public String getId()
     {
         return id;

Modified: directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifSearchLogger.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifSearchLogger.java?rev=696693&r1=696692&r2=696693&view=diff
==============================================================================
--- directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifSearchLogger.java (original)
+++ directory/studio/trunk/connection-core/src/main/java/org/apache/directory/studio/connection/core/io/jndi/LdifSearchLogger.java Thu Sep 18 09:19:34 2008
@@ -62,6 +62,8 @@
 import org.apache.directory.studio.ldifparser.model.lines.LdifDnLine;
 import org.apache.directory.studio.ldifparser.model.lines.LdifLineBase;
 import org.apache.directory.studio.ldifparser.model.lines.LdifSepLine;
+import org.eclipse.core.runtime.Preferences.IPropertyChangeListener;
+import org.eclipse.core.runtime.Preferences.PropertyChangeEvent;
 
 
 /**
@@ -94,6 +96,46 @@
      */
     public LdifSearchLogger()
     {
+        ConnectionCorePlugin.getDefault().getPluginPreferences().addPropertyChangeListener(
+            new IPropertyChangeListener()
+            {
+                public void propertyChange( PropertyChangeEvent event )
+                {
+                    if ( ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT.equals( event.getProperty() )
+                        || ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE.equals( event.getProperty() ) )
+                    {
+                        // dispose all loggers/handlers
+                        for ( Logger logger : loggers.values() )
+                        {
+                            for ( Handler handler : logger.getHandlers() )
+                            {
+                                handler.close();
+                            }
+                        }
+
+                        // delete files with index greater than new file count
+                        for ( FileHandler fh : fileHandlers.values() )
+                        {
+                            try
+                            {
+                                File[] logFiles = getLogFiles( fh );
+                                for ( int i = getFileCount(); i < logFiles.length; i++ )
+                                {
+                                    if ( logFiles[i] != null && logFiles[i].exists() )
+                                    {
+                                        logFiles[i].delete();
+                                    }
+                                }
+                            }
+                            catch ( Exception e )
+                            {
+                            }
+                        }
+
+                        loggers.clear();
+                    }
+                }
+            } );
     }
 
 
@@ -109,7 +151,7 @@
         String logfileName = ConnectionManager.getSearchLogFileName( connection );
         try
         {
-            FileHandler fileHandler = new FileHandler( logfileName, 100000, 10, true );
+            FileHandler fileHandler = new FileHandler( logfileName, getFileSizeInKb() * 1000, getFileCount(), true );
             fileHandlers.put( connection.getId(), fileHandler );
             fileHandler.setFormatter( new Formatter()
             {
@@ -508,6 +550,30 @@
     }
 
 
+    /**
+     * Gets the number of log files to use.
+     * 
+     * @return the number of log files to use
+     */
+    private int getFileCount()
+    {
+        return ConnectionCorePlugin.getDefault().getPluginPreferences().getInt(
+            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT );
+    }
+
+
+    /**
+     * Gets the maximum file size in kB.
+     * 
+     * @return the maximum file size in kB
+     */
+    private int getFileSizeInKb()
+    {
+        return ConnectionCorePlugin.getDefault().getPluginPreferences().getInt(
+            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE );
+    }
+
+
     public String getId()
     {
         return id;

Modified: directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java?rev=696693&r1=696692&r2=696693&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java (original)
+++ directory/studio/trunk/ldapbrowser-common/src/main/java/org/apache/directory/studio/ldapbrowser/common/wizards/NewEntryWizard.java Thu Sep 18 09:19:34 2008
@@ -39,6 +39,7 @@
 import org.apache.directory.studio.ldapbrowser.core.model.IValue;
 import org.apache.directory.studio.ldapbrowser.core.model.impl.DummyEntry;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.wizard.IWizardPage;
 import org.eclipse.jface.wizard.Wizard;
@@ -118,9 +119,9 @@
     {
         // determine the currently selected entry
         Object o = selection.getFirstElement();
-        
+
         isNewContextEntry = isNewContextEntry( selection );
-        if(isNewContextEntry)
+        if ( isNewContextEntry )
         {
             setWindowTitle( "New Context Entry" );
         }
@@ -128,7 +129,7 @@
         {
             setWindowTitle( "New Entry" );
         }
-        
+
         if ( o instanceof IEntry )
         {
             selectedEntry = ( ( IEntry ) o );
@@ -411,11 +412,11 @@
      * 
      * @return true, if is new context entry
      */
-    public static boolean isNewContextEntry( IStructuredSelection selection )
+    public static boolean isNewContextEntry( ISelection selection )
     {
-        if ( selection != null )
+        if ( selection != null && selection instanceof IStructuredSelection )
         {
-            Object object = selection.getFirstElement();
+            Object object = ( ( IStructuredSelection ) selection ).getFirstElement();
 
             if ( object instanceof IRootDSE || object instanceof BrowserCategory )
             {

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/NewEntryAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/NewEntryAction.java?rev=696693&r1=696692&r2=696693&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/NewEntryAction.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/actions/NewEntryAction.java Thu Sep 18 09:19:34 2008
@@ -103,8 +103,7 @@
      */
     public String getText()
     {
-        boolean isNewContextEntry = NewEntryWizard.isNewContextEntry( ( IStructuredSelection ) window
-            .getSelectionService().getSelection() );
+        boolean isNewContextEntry = NewEntryWizard.isNewContextEntry( window.getSelectionService().getSelection() );
         return isNewContextEntry ? "New Context Entry..." : "New Entry...";
     }
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/ModificationLogsPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/ModificationLogsPreferencePage.java?rev=696693&r1=696692&r2=696693&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/ModificationLogsPreferencePage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/ModificationLogsPreferencePage.java Thu Sep 18 09:19:34 2008
@@ -26,9 +26,13 @@
 import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
@@ -44,6 +48,8 @@
 {
 
     private Button enableModificationLogging;
+    private Text logFileCountText;
+    private Text logFileSizeText;
 
 
     /**
@@ -78,6 +84,47 @@
         enableModificationLogging.setSelection( ConnectionCorePlugin.getDefault().getPluginPreferences().getBoolean(
             ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_ENABLE ) );
 
+        Group rotateGroup = BaseWidgetUtils.createGroup( BaseWidgetUtils.createColumnContainer( composite, 1, 1 ),
+            "Log File Rotation", 1 );
+        Composite rotateComposite = BaseWidgetUtils.createColumnContainer( rotateGroup, 5, 1 );
+        BaseWidgetUtils.createLabel( rotateComposite, "Use ", 1 );
+        logFileCountText = BaseWidgetUtils.createText( rotateComposite, "", 3, 1 );
+        logFileCountText.setText( ConnectionCorePlugin.getDefault().getPluginPreferences().getString(
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT ) );
+        logFileCountText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+                if ( "".equals( logFileCountText.getText() ) && e.text.matches( "[0]" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+        BaseWidgetUtils.createLabel( rotateComposite, " log files each with ", 1 );
+        logFileSizeText = BaseWidgetUtils.createText( rotateComposite, "", 5, 1 );
+        logFileSizeText.setText( ConnectionCorePlugin.getDefault().getPluginPreferences().getString(
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE ) );
+        logFileSizeText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+                if ( "".equals( logFileSizeText.getText() ) && e.text.matches( "[0]" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+        BaseWidgetUtils.createLabel( rotateComposite, " kB.", 1 );
+
         applyDialogFont( composite );
         return composite;
     }
@@ -90,6 +137,10 @@
     {
         ConnectionCorePlugin.getDefault().getPluginPreferences().setValue(
             ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_ENABLE, enableModificationLogging.getSelection() );
+        ConnectionCorePlugin.getDefault().getPluginPreferences().setValue(
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT, logFileCountText.getText() );
+        ConnectionCorePlugin.getDefault().getPluginPreferences().setValue(
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE, logFileSizeText.getText() );
         return true;
     }
 
@@ -101,6 +152,10 @@
     {
         enableModificationLogging.setSelection( ConnectionCorePlugin.getDefault().getPluginPreferences()
             .getDefaultBoolean( ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_ENABLE ) );
+        logFileCountText.setText( ConnectionCorePlugin.getDefault().getPluginPreferences().getDefaultString(
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_COUNT ) );
+        logFileSizeText.setText( ConnectionCorePlugin.getDefault().getPluginPreferences().getDefaultString(
+            ConnectionCoreConstants.PREFERENCE_MODIFICATIONLOGS_FILE_SIZE ) );
         super.performDefaults();
     }
 

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/SearchLogsPreferencePage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/SearchLogsPreferencePage.java?rev=696693&r1=696692&r2=696693&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/SearchLogsPreferencePage.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/dialogs/preferences/SearchLogsPreferencePage.java Thu Sep 18 09:19:34 2008
@@ -26,9 +26,13 @@
 import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
 import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
 import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
 import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Text;
 import org.eclipse.ui.IWorkbench;
 import org.eclipse.ui.IWorkbenchPreferencePage;
 
@@ -45,6 +49,8 @@
 
     private Button enableSearchRequestLogging;
     private Button enableSearchResultEntryLogging;
+    private Text logFileCountText;
+    private Text logFileSizeText;
 
 
     /**
@@ -78,9 +84,51 @@
         enableSearchRequestLogging = BaseWidgetUtils.createCheckbox( composite, "Enable search request logs", 1 );
         enableSearchRequestLogging.setSelection( ConnectionCorePlugin.getDefault().getPluginPreferences().getBoolean(
             ConnectionCoreConstants.PREFERENCE_SEARCHREQUESTLOGS_ENABLE ) );
-        enableSearchResultEntryLogging = BaseWidgetUtils.createCheckbox( composite, "Enable search result entry logs (!)", 1 );
-        enableSearchResultEntryLogging.setSelection( ConnectionCorePlugin.getDefault().getPluginPreferences().getBoolean(
-            ConnectionCoreConstants.PREFERENCE_SEARCHRESULTENTRYLOGS_ENABLE ) );
+        enableSearchResultEntryLogging = BaseWidgetUtils.createCheckbox( composite,
+            "Enable search result entry logs (!)", 1 );
+        enableSearchResultEntryLogging.setSelection( ConnectionCorePlugin.getDefault().getPluginPreferences()
+            .getBoolean( ConnectionCoreConstants.PREFERENCE_SEARCHRESULTENTRYLOGS_ENABLE ) );
+
+        Group rotateGroup = BaseWidgetUtils.createGroup( BaseWidgetUtils.createColumnContainer( composite, 1, 1 ),
+            "Log File Rotation", 1 );
+        Composite rotateComposite = BaseWidgetUtils.createColumnContainer( rotateGroup, 5, 1 );
+        BaseWidgetUtils.createLabel( rotateComposite, "Use ", 1 );
+        logFileCountText = BaseWidgetUtils.createText( rotateComposite, "", 3, 1 );
+        logFileCountText.setText( ConnectionCorePlugin.getDefault().getPluginPreferences().getString(
+            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT ) );
+        logFileCountText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+                if ( "".equals( logFileCountText.getText() ) && e.text.matches( "[0]" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+        BaseWidgetUtils.createLabel( rotateComposite, " log files each with ", 1 );
+        logFileSizeText = BaseWidgetUtils.createText( rotateComposite, "", 5, 1 );
+        logFileSizeText.setText( ConnectionCorePlugin.getDefault().getPluginPreferences().getString(
+            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE ) );
+        logFileSizeText.addVerifyListener( new VerifyListener()
+        {
+            public void verifyText( VerifyEvent e )
+            {
+                if ( !e.text.matches( "[0-9]*" ) )
+                {
+                    e.doit = false;
+                }
+                if ( "".equals( logFileSizeText.getText() ) && e.text.matches( "[0]" ) )
+                {
+                    e.doit = false;
+                }
+            }
+        } );
+        BaseWidgetUtils.createLabel( rotateComposite, " kB.", 1 );
 
         applyDialogFont( composite );
         return composite;
@@ -95,7 +143,12 @@
         ConnectionCorePlugin.getDefault().getPluginPreferences().setValue(
             ConnectionCoreConstants.PREFERENCE_SEARCHREQUESTLOGS_ENABLE, enableSearchRequestLogging.getSelection() );
         ConnectionCorePlugin.getDefault().getPluginPreferences().setValue(
-            ConnectionCoreConstants.PREFERENCE_SEARCHRESULTENTRYLOGS_ENABLE, enableSearchResultEntryLogging.getSelection() );
+            ConnectionCoreConstants.PREFERENCE_SEARCHRESULTENTRYLOGS_ENABLE,
+            enableSearchResultEntryLogging.getSelection() );
+        ConnectionCorePlugin.getDefault().getPluginPreferences().setValue(
+            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT, logFileCountText.getText() );
+        ConnectionCorePlugin.getDefault().getPluginPreferences().setValue(
+            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE, logFileSizeText.getText() );
         return true;
     }
 
@@ -109,6 +162,10 @@
             .getDefaultBoolean( ConnectionCoreConstants.PREFERENCE_SEARCHREQUESTLOGS_ENABLE ) );
         enableSearchResultEntryLogging.setSelection( ConnectionCorePlugin.getDefault().getPluginPreferences()
             .getDefaultBoolean( ConnectionCoreConstants.PREFERENCE_SEARCHRESULTENTRYLOGS_ENABLE ) );
+        logFileCountText.setText( ConnectionCorePlugin.getDefault().getPluginPreferences().getDefaultString(
+            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_COUNT ) );
+        logFileSizeText.setText( ConnectionCorePlugin.getDefault().getPluginPreferences().getDefaultString(
+            ConnectionCoreConstants.PREFERENCE_SEARCHLOGS_FILE_SIZE ) );
         super.performDefaults();
     }
 

Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ExportAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ExportAction.java?rev=696693&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ExportAction.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ExportAction.java Thu Sep 18 09:19:34 2008
@@ -0,0 +1,102 @@
+/*
+ *  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.studio.ldapbrowser.ui.views.modificationlogs;
+
+
+import org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.apache.directory.studio.ldapbrowser.ui.wizards.ExportModificationLogsWizard;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardDialog;
+
+
+/**
+ * Action to save the log files to a place outside the workspace.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportAction extends BrowserAction
+{
+
+    /**
+     * Creates a new instance of SaveAction.
+     */
+    public ExportAction()
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_EXPORT );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        return "Export Modification Logs...";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+        return getInput() != null && ( getInput() instanceof ModificationLogsViewInput )
+            && ( ( ModificationLogsViewInput ) getInput() ).getBrowserConnection().getConnection() != null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        ModificationLogsViewInput input = ( ModificationLogsViewInput ) getInput();
+        if ( input.getBrowserConnection().getConnection() != null )
+        {
+            ExportModificationLogsWizard wizard = new ExportModificationLogsWizard();
+            wizard.getSearch().setBrowserConnection( input.getBrowserConnection() );
+            WizardDialog dialog = new WizardDialog( getShell(), wizard );
+            dialog.setBlockOnOpen( true );
+            dialog.create();
+            dialog.open();
+        }
+    }
+
+}

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewActionGroup.java?rev=696693&r1=696692&r2=696693&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewActionGroup.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/modificationlogs/ModificationLogsViewActionGroup.java Thu Sep 18 09:19:34 2008
@@ -28,7 +28,6 @@
 import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 import org.apache.directory.studio.ldapbrowser.common.actions.proxy.ActionHandlerManager;
 import org.apache.directory.studio.ldapbrowser.ui.actions.proxy.ModificationLogsViewActionProxy;
-import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.Separator;
@@ -57,9 +56,12 @@
     /** The Constant refreshAction. */
     private static final String refreshAction = "refreshAction";
 
-    /** The Constant refreshAction. */
+    /** The Constant clearAction. */
     private static final String clearAction = "clearAction";
 
+    /** The Constant exportAction. */
+    private static final String exportAction = "exportAction";
+
     /** The enable modification logs action. */
     private EnableModificationLogsAction enableModificationLogsAction;
 
@@ -89,6 +91,8 @@
             new RefreshAction( view ) ) );
         modificationLogsViewActionMap.put( clearAction, new ModificationLogsViewActionProxy( viewer, new ClearAction(
             view ) ) );
+        modificationLogsViewActionMap.put( exportAction, new ModificationLogsViewActionProxy( viewer,
+            new ExportAction() ) );
         enableModificationLogsAction = new EnableModificationLogsAction();
         openModificationLogsPreferencePageAction = new OpenModificationLogsPreferencePageAction();
     }
@@ -125,11 +129,13 @@
     public void fillActionBars( IActionBars actionBars )
     {
         // Tool Bar
-        actionBars.getToolBarManager().add( ( IAction ) modificationLogsViewActionMap.get( clearAction ) );
-        actionBars.getToolBarManager().add( ( IAction ) modificationLogsViewActionMap.get( refreshAction ) );
+        actionBars.getToolBarManager().add( modificationLogsViewActionMap.get( clearAction ) );
+        actionBars.getToolBarManager().add( modificationLogsViewActionMap.get( refreshAction ) );
+        actionBars.getToolBarManager().add( new Separator() );
+        actionBars.getToolBarManager().add( modificationLogsViewActionMap.get( olderAction ) );
+        actionBars.getToolBarManager().add( modificationLogsViewActionMap.get( newerAction ) );
         actionBars.getToolBarManager().add( new Separator() );
-        actionBars.getToolBarManager().add( ( IAction ) modificationLogsViewActionMap.get( olderAction ) );
-        actionBars.getToolBarManager().add( ( IAction ) modificationLogsViewActionMap.get( newerAction ) );
+        actionBars.getToolBarManager().add( modificationLogsViewActionMap.get( exportAction ) );
 
         // Menu Bar
         actionBars.getMenuManager().add( enableModificationLogsAction );

Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/ExportAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/ExportAction.java?rev=696693&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/ExportAction.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/ExportAction.java Thu Sep 18 09:19:34 2008
@@ -0,0 +1,102 @@
+/*
+ *  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.studio.ldapbrowser.ui.views.searchlogs;
+
+
+import org.apache.directory.studio.ldapbrowser.common.actions.BrowserAction;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.apache.directory.studio.ldapbrowser.ui.wizards.ExportSearchLogsWizard;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.wizard.WizardDialog;
+
+
+/**
+ * Action to save the log files to a place outside the workspace.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportAction extends BrowserAction
+{
+
+    /**
+     * Creates a new instance of SaveAction.
+     */
+    public ExportAction()
+    {
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getCommandId()
+    {
+        return null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public ImageDescriptor getImageDescriptor()
+    {
+        return BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_EXPORT );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public String getText()
+    {
+        return "Export Search Logs...";
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean isEnabled()
+    {
+        return getInput() != null && ( getInput() instanceof SearchLogsViewInput )
+            && ( ( SearchLogsViewInput ) getInput() ).getBrowserConnection().getConnection() != null;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        SearchLogsViewInput input = ( SearchLogsViewInput ) getInput();
+        if ( input.getBrowserConnection().getConnection() != null )
+        {
+            ExportSearchLogsWizard wizard = new ExportSearchLogsWizard();
+            wizard.getSearch().setBrowserConnection( input.getBrowserConnection() );
+            WizardDialog dialog = new WizardDialog( getShell(), wizard );
+            dialog.setBlockOnOpen( true );
+            dialog.create();
+            dialog.open();
+        }
+    }
+
+}

Modified: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewActionGroup.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewActionGroup.java?rev=696693&r1=696692&r2=696693&view=diff
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewActionGroup.java (original)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/views/searchlogs/SearchLogsViewActionGroup.java Thu Sep 18 09:19:34 2008
@@ -28,7 +28,6 @@
 import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
 import org.apache.directory.studio.ldapbrowser.common.actions.proxy.ActionHandlerManager;
 import org.apache.directory.studio.ldapbrowser.ui.actions.proxy.SearchLogsViewActionProxy;
-import org.eclipse.jface.action.IAction;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
 import org.eclipse.jface.action.Separator;
@@ -60,6 +59,9 @@
     /** The Constant refreshAction. */
     private static final String clearAction = "clearAction";
 
+    /** The Constant exportAction. */
+    private static final String exportAction = "exportAction";
+
     /** The enable search request logs action. */
     private EnableSearchRequestLogsAction enableSearchRequestLogsAction;
 
@@ -74,9 +76,9 @@
 
 
     /**
-     * Creates a new instance of ModificationLogsViewActionGroup.
+     * Creates a new instance of SearchLogsViewActionGroup.
      *
-     * @param view the modification logs view
+     * @param view the search logs view
      */
     public SearchLogsViewActionGroup( SearchLogsView view )
     {
@@ -84,14 +86,11 @@
         SourceViewer viewer = this.view.getMainWidget().getSourceViewer();
 
         searchLogsViewActionMap = new HashMap<String, SearchLogsViewActionProxy>();
-        searchLogsViewActionMap.put( olderAction, new SearchLogsViewActionProxy( viewer, new OlderAction(
-            view ) ) );
-        searchLogsViewActionMap.put( newerAction, new SearchLogsViewActionProxy( viewer, new NewerAction(
-            view ) ) );
-        searchLogsViewActionMap.put( refreshAction, new SearchLogsViewActionProxy( viewer,
-            new RefreshAction( view ) ) );
-        searchLogsViewActionMap.put( clearAction, new SearchLogsViewActionProxy( viewer, new ClearAction(
-            view ) ) );
+        searchLogsViewActionMap.put( olderAction, new SearchLogsViewActionProxy( viewer, new OlderAction( view ) ) );
+        searchLogsViewActionMap.put( newerAction, new SearchLogsViewActionProxy( viewer, new NewerAction( view ) ) );
+        searchLogsViewActionMap.put( refreshAction, new SearchLogsViewActionProxy( viewer, new RefreshAction( view ) ) );
+        searchLogsViewActionMap.put( clearAction, new SearchLogsViewActionProxy( viewer, new ClearAction( view ) ) );
+        searchLogsViewActionMap.put( exportAction, new SearchLogsViewActionProxy( viewer, new ExportAction() ) );
         enableSearchRequestLogsAction = new EnableSearchRequestLogsAction();
         enableSearchResultEntryLogsAction = new EnableSearchResultEntryLogsAction();
         openSearchLogsPreferencePageAction = new OpenSearchLogsPreferencePageAction();
@@ -130,11 +129,13 @@
     public void fillActionBars( IActionBars actionBars )
     {
         // Tool Bar
-        actionBars.getToolBarManager().add( ( IAction ) searchLogsViewActionMap.get( clearAction ) );
-        actionBars.getToolBarManager().add( ( IAction ) searchLogsViewActionMap.get( refreshAction ) );
+        actionBars.getToolBarManager().add( searchLogsViewActionMap.get( clearAction ) );
+        actionBars.getToolBarManager().add( searchLogsViewActionMap.get( refreshAction ) );
+        actionBars.getToolBarManager().add( new Separator() );
+        actionBars.getToolBarManager().add( searchLogsViewActionMap.get( olderAction ) );
+        actionBars.getToolBarManager().add( searchLogsViewActionMap.get( newerAction ) );
         actionBars.getToolBarManager().add( new Separator() );
-        actionBars.getToolBarManager().add( ( IAction ) searchLogsViewActionMap.get( olderAction ) );
-        actionBars.getToolBarManager().add( ( IAction ) searchLogsViewActionMap.get( newerAction ) );
+        actionBars.getToolBarManager().add( searchLogsViewActionMap.get( exportAction ) );
 
         // Menu Bar
         actionBars.getMenuManager().add( enableSearchRequestLogsAction );

Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportLogsToWizardPage.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportLogsToWizardPage.java?rev=696693&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportLogsToWizardPage.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportLogsToWizardPage.java Thu Sep 18 09:19:34 2008
@@ -0,0 +1,84 @@
+/*
+ *  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.studio.ldapbrowser.ui.wizards;
+
+
+import org.apache.directory.studio.connection.ui.widgets.BaseWidgetUtils;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIConstants;
+import org.apache.directory.studio.ldapbrowser.ui.BrowserUIPlugin;
+import org.eclipse.swt.widgets.Composite;
+
+
+/**
+ * This class implements the page to select the target file.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportLogsToWizardPage extends ExportBaseToPage
+{
+
+    /** The extensions used by LDIF files */
+    private static final String[] EXTENSIONS = new String[]
+        { "*.ldif", "*.*" };
+
+
+    /**
+     * Creates a new instance of ExportModificationLogsToWizardPage.
+     * 
+     * @param pageName the page name
+     * @param wizard the wizard
+     */
+    public ExportLogsToWizardPage( String pageName, ExportBaseWizard wizard )
+    {
+        super( pageName, wizard );
+        setImageDescriptor( BrowserUIPlugin.getDefault().getImageDescriptor( BrowserUIConstants.IMG_EXPORT_LDIF_WIZARD ) );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void createControl( Composite parent )
+    {
+        final Composite composite = BaseWidgetUtils.createColumnContainer( parent, 3, 1 );
+        super.createControl( composite );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String[] getExtensions()
+    {
+        return EXTENSIONS;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    protected String getFileType()
+    {
+        return "Log";
+    }
+
+}

Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportModificationLogsWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportModificationLogsWizard.java?rev=696693&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportModificationLogsWizard.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportModificationLogsWizard.java Thu Sep 18 09:19:34 2008
@@ -0,0 +1,112 @@
+/*
+ *  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.studio.ldapbrowser.ui.wizards;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.io.jndi.LdifModificationLogger;
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+
+/**
+ * This class implements the wizard for exporting the modification logs.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportModificationLogsWizard extends ExportBaseWizard
+{
+
+    /** The to page, used to select the target file. */
+    private ExportLogsToWizardPage toPage;
+
+
+    /**
+     * Creates a new instance of ExportModificationLogsWizard.
+     */
+    public ExportModificationLogsWizard()
+    {
+        super( "Export Modification Logs" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPages()
+    {
+        toPage = new ExportLogsToWizardPage( ExportLogsToWizardPage.class.getName(), this );
+        addPage( toPage );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean performFinish()
+    {
+        toPage.saveDialogSettings();
+
+        if ( search.getBrowserConnection().getConnection() != null )
+        {
+            try
+            {
+                File targetFile = new File( exportFilename );
+                FileOutputStream os = FileUtils.openOutputStream( targetFile );
+
+                LdifModificationLogger modificationLogger = ConnectionCorePlugin.getDefault()
+                    .getLdifModificationLogger();
+                File[] files = modificationLogger.getFiles( search.getBrowserConnection().getConnection() );
+                // need to go backward through the files as the 1st file contains the newest entry
+                for ( int i = files.length - 1; i >= 0; i-- )
+                {
+                    File file = files[i];
+                    if ( file != null && file.exists() && file.canRead() )
+                    {
+                        FileInputStream is = FileUtils.openInputStream( file );
+                        IOUtils.copy( is, os );
+                        is.close();
+                    }
+                }
+                os.close();
+            }
+            catch ( IOException e )
+            {
+                ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(
+                    new Status( IStatus.ERROR, BrowserCommonConstants.PLUGIN_ID, IStatus.ERROR,
+                        "Can't export modification logs", e ) );
+            }
+        }
+
+        return true;
+    }
+
+}

Added: directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportSearchLogsWizard.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportSearchLogsWizard.java?rev=696693&view=auto
==============================================================================
--- directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportSearchLogsWizard.java (added)
+++ directory/studio/trunk/ldapbrowser-ui/src/main/java/org/apache/directory/studio/ldapbrowser/ui/wizards/ExportSearchLogsWizard.java Thu Sep 18 09:19:34 2008
@@ -0,0 +1,111 @@
+/*
+ *  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.studio.ldapbrowser.ui.wizards;
+
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import org.apache.commons.io.FileUtils;
+import org.apache.commons.io.IOUtils;
+import org.apache.directory.studio.connection.core.ConnectionCorePlugin;
+import org.apache.directory.studio.connection.core.io.jndi.LdifSearchLogger;
+import org.apache.directory.studio.connection.ui.ConnectionUIPlugin;
+import org.apache.directory.studio.ldapbrowser.common.BrowserCommonConstants;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+
+
+/**
+ * This class implements the wizard for exporting the search logs.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ * @version $Rev$, $Date$
+ */
+public class ExportSearchLogsWizard extends ExportBaseWizard
+{
+
+    /** The to page, used to select the target file. */
+    private ExportLogsToWizardPage toPage;
+
+
+    /**
+     * Creates a new instance of ExportSearchLogsWizard.
+     */
+    public ExportSearchLogsWizard()
+    {
+        super( "Export Search Logs" );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void addPages()
+    {
+        toPage = new ExportLogsToWizardPage( ExportLogsToWizardPage.class.getName(), this );
+        addPage( toPage );
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public boolean performFinish()
+    {
+        toPage.saveDialogSettings();
+
+        if ( search.getBrowserConnection().getConnection() != null )
+        {
+            try
+            {
+                File targetFile = new File( exportFilename );
+                FileOutputStream os = FileUtils.openOutputStream( targetFile );
+
+                LdifSearchLogger searchLogger = ConnectionCorePlugin.getDefault().getLdifSearchLogger();
+                File[] files = searchLogger.getFiles( search.getBrowserConnection().getConnection() );
+                // need to go backward through the files as the 1st file contains the newest entry
+                for ( int i = files.length - 1; i >= 0; i-- )
+                {
+                    File file = files[i];
+                    if ( file != null && file.exists() && file.canRead() )
+                    {
+                        FileInputStream is = FileUtils.openInputStream( file );
+                        IOUtils.copy( is, os );
+                        is.close();
+                    }
+                }
+                os.close();
+            }
+            catch ( IOException e )
+            {
+                ConnectionUIPlugin.getDefault().getExceptionHandler().handleException(
+                    new Status( IStatus.ERROR, BrowserCommonConstants.PLUGIN_ID, IStatus.ERROR,
+                        "Can't export search logs", e ) );
+            }
+        }
+
+        return true;
+    }
+
+}