You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by pa...@apache.org on 2010/10/11 17:10:03 UTC

svn commit: r1021373 - in /directory/studio/trunk/plugins: ldapservers.apacheds.v153/resources/conf/ ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ ldapservers.apacheds.v154/resources/conf/ ldapservers.ap...

Author: pamarcelot
Date: Mon Oct 11 15:10:02 2010
New Revision: 1021373

URL: http://svn.apache.org/viewvc?rev=1021373&view=rev
Log:
Added the ability for an LDAP Server to log in the Console view through reading of the default log file.

Added:
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ConsolePrinterThread.java
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ConsolesManager.java
Modified:
    directory/studio/trunk/plugins/ldapservers.apacheds.v153/resources/conf/log4j.properties
    directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ApacheDS153LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers.apacheds.v154/resources/conf/log4j.properties
    directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers.apacheds.v155/resources/conf/log4j.properties
    directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/ApacheDS155LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers.apacheds.v156/resources/conf/log4j.properties
    directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers.apacheds.v157/resources/conf/log4j.properties
    directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/ApacheDS157LdapServerAdapter.java
    directory/studio/trunk/plugins/ldapservers/pom.xml
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersUtils.java
    directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/NewServerAction.java

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v153/resources/conf/log4j.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v153/resources/conf/log4j.properties?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v153/resources/conf/log4j.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v153/resources/conf/log4j.properties Mon Oct 11 15:10:02 2010
@@ -14,23 +14,13 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 #############################################################################
-log4j.rootCategory=WARN, R, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.File=${apacheds.log.dir}/apacheds-rolling.log
-
-log4j.appender.R.MaxFileSize=1024KB
-# Keep some backup files
-log4j.appender.R.MaxBackupIndex=5
+log4j.rootCategory=WARN, R
 
+log4j.appender.R=org.apache.log4j.FileAppender
+log4j.appender.R.File=${apacheds.log.dir}/apacheds.log
 log4j.appender.R.layout=org.apache.log4j.PatternLayout
 log4j.appender.R.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 
-log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
-
 # with these we'll not get innundated when switching to DEBUG
 log4j.logger.org.apache.directory.shared.ldap.name=WARN
 log4j.logger.org.springframework=WARN

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ApacheDS153LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ApacheDS153LdapServerAdapter.java?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ApacheDS153LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v153/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v153/ApacheDS153LdapServerAdapter.java Mon Oct 11 15:10:02 2010
@@ -112,6 +112,9 @@ public class ApacheDS153LdapServerAdapte
             SERVER_XML ) );
         LdapServersUtils.copyResource( bundle, resourceConfFolderPath.append( LOG4J_PROPERTIES ), new File( confFolder,
             LOG4J_PROPERTIES ) );
+
+        // Creating an empty log file
+        new File( confFolder, "apacheds.log" ).createNewFile();
     }
 
 
@@ -156,6 +159,9 @@ public class ApacheDS153LdapServerAdapte
      */
     public void start( LdapServer server, StudioProgressMonitor monitor ) throws Exception
     {
+        // Starting the console printer thread
+        LdapServersUtils.startConsolePrinterThread( server );
+
         // Launching Apache DS
         ILaunch launch = LdapServersUtils.launchApacheDS( server, getServerLibrariesFolder(), libraries );
 
@@ -172,17 +178,11 @@ public class ApacheDS153LdapServerAdapte
      */
     public void stop( LdapServer server, StudioProgressMonitor monitor ) throws Exception
     {
-        // Getting the launch
-        ILaunch launch = ( ILaunch ) server.removeCustomObject( LdapServersUtils.LAUNCH_CONFIGURATION_CUSTOM_OBJECT );
-        if ( ( launch != null ) && ( !launch.isTerminated() ) )
-        {
-            // Terminating the launch
-            launch.terminate();
-        }
-        else
-        {
-            throw new Exception( "The associated launch configuration could not be found or is already terminated." );
-        }
+        // Stopping the console printer thread
+        LdapServersUtils.stopConsolePrinterThread( server );
+
+        // Terminating the launch configuration
+        LdapServersUtils.terminateLaunchConfiguration( server );
     }
 
 

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v154/resources/conf/log4j.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v154/resources/conf/log4j.properties?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v154/resources/conf/log4j.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v154/resources/conf/log4j.properties Mon Oct 11 15:10:02 2010
@@ -14,23 +14,13 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 #############################################################################
-log4j.rootCategory=WARN, R, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.File=${apacheds.log.dir}/apacheds-rolling.log
-
-log4j.appender.R.MaxFileSize=1024KB
-# Keep some backup files
-log4j.appender.R.MaxBackupIndex=5
+log4j.rootCategory=WARN, R
 
+log4j.appender.R=org.apache.log4j.FileAppender
+log4j.appender.R.File=${apacheds.log.dir}/apacheds.log
 log4j.appender.R.layout=org.apache.log4j.PatternLayout
 log4j.appender.R.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 
-log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
-
 # with these we'll not get innundated when switching to DEBUG
 log4j.logger.org.apache.directory.shared.ldap.name=WARN
 log4j.logger.org.springframework=WARN

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v154/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v154/ApacheDS154LdapServerAdapter.java Mon Oct 11 15:10:02 2010
@@ -114,6 +114,9 @@ public class ApacheDS154LdapServerAdapte
             SERVER_XML ) );
         LdapServersUtils.copyResource( bundle, resourceConfFolderPath.append( LOG4J_PROPERTIES ), new File( confFolder,
             LOG4J_PROPERTIES ) );
+
+        // Creating an empty log file
+        new File( confFolder, "apacheds.log" ).createNewFile();
     }
 
 
@@ -158,6 +161,9 @@ public class ApacheDS154LdapServerAdapte
      */
     public void start( LdapServer server, StudioProgressMonitor monitor ) throws Exception
     {
+        // Starting the console printer thread
+        LdapServersUtils.startConsolePrinterThread( server );
+
         // Launching Apache DS
         ILaunch launch = LdapServersUtils.launchApacheDS( server, getServerLibrariesFolder(), libraries );
 
@@ -174,17 +180,11 @@ public class ApacheDS154LdapServerAdapte
      */
     public void stop( LdapServer server, StudioProgressMonitor monitor ) throws Exception
     {
-        // Getting the launch
-        ILaunch launch = ( ILaunch ) server.removeCustomObject( LdapServersUtils.LAUNCH_CONFIGURATION_CUSTOM_OBJECT );
-        if ( ( launch != null ) && ( !launch.isTerminated() ) )
-        {
-            // Terminating the launch
-            launch.terminate();
-        }
-        else
-        {
-            throw new Exception( "The associated launch configuration could not be found or is already terminated." );
-        }
+        // Stopping the console printer thread
+        LdapServersUtils.stopConsolePrinterThread( server );
+
+        // Terminating the launch configuration
+        LdapServersUtils.terminateLaunchConfiguration( server );
     }
 
 

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v155/resources/conf/log4j.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v155/resources/conf/log4j.properties?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v155/resources/conf/log4j.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v155/resources/conf/log4j.properties Mon Oct 11 15:10:02 2010
@@ -14,23 +14,14 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 #############################################################################
-log4j.rootCategory=WARN, R, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.File=${apacheds.log.dir}/apacheds-rolling.log
-
-log4j.appender.R.MaxFileSize=1024KB
-# Keep some backup files
-log4j.appender.R.MaxBackupIndex=5
+log4j.rootCategory=WARN, R
 
+log4j.appender.R=org.apache.log4j.FileAppender
+log4j.appender.R.File=${apacheds.log.dir}/apacheds.log
+log4j.appender.R.Append=false
 log4j.appender.R.layout=org.apache.log4j.PatternLayout
 log4j.appender.R.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 
-log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
-
 # with these we'll not get innundated when switching to DEBUG
 log4j.logger.org.apache.directory.shared.ldap.name=WARN
 log4j.logger.org.springframework=WARN

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/ApacheDS155LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/ApacheDS155LdapServerAdapter.java?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/ApacheDS155LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v155/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v155/ApacheDS155LdapServerAdapter.java Mon Oct 11 15:10:02 2010
@@ -114,6 +114,9 @@ public class ApacheDS155LdapServerAdapte
             SERVER_XML ) );
         LdapServersUtils.copyResource( bundle, resourceConfFolderPath.append( LOG4J_PROPERTIES ), new File( confFolder,
             LOG4J_PROPERTIES ) );
+
+        // Creating an empty log file
+        new File( confFolder, "apacheds.log" ).createNewFile();
     }
 
 
@@ -158,6 +161,9 @@ public class ApacheDS155LdapServerAdapte
      */
     public void start( LdapServer server, StudioProgressMonitor monitor ) throws Exception
     {
+        // Starting the console printer thread
+        LdapServersUtils.startConsolePrinterThread( server );
+
         // Launching Apache DS
         ILaunch launch = LdapServersUtils.launchApacheDS( server, getServerLibrariesFolder(), libraries );
 
@@ -174,17 +180,11 @@ public class ApacheDS155LdapServerAdapte
      */
     public void stop( LdapServer server, StudioProgressMonitor monitor ) throws Exception
     {
-        // Getting the launch
-        ILaunch launch = ( ILaunch ) server.removeCustomObject( LdapServersUtils.LAUNCH_CONFIGURATION_CUSTOM_OBJECT );
-        if ( ( launch != null ) && ( !launch.isTerminated() ) )
-        {
-            // Terminating the launch
-            launch.terminate();
-        }
-        else
-        {
-            throw new Exception( "The associated launch configuration could not be found or is already terminated." );
-        }
+        // Stopping the console printer thread
+        LdapServersUtils.stopConsolePrinterThread( server );
+
+        // Terminating the launch configuration
+        LdapServersUtils.terminateLaunchConfiguration( server );
     }
 
 

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v156/resources/conf/log4j.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v156/resources/conf/log4j.properties?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v156/resources/conf/log4j.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v156/resources/conf/log4j.properties Mon Oct 11 15:10:02 2010
@@ -14,23 +14,13 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 #############################################################################
-log4j.rootCategory=WARN, R, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.File=${apacheds.log.dir}/apacheds-rolling.log
-
-log4j.appender.R.MaxFileSize=1024KB
-# Keep some backup files
-log4j.appender.R.MaxBackupIndex=5
+log4j.rootCategory=WARN, R
 
+log4j.appender.R=org.apache.log4j.FileAppender
+log4j.appender.R.File=${apacheds.log.dir}/apacheds.log
 log4j.appender.R.layout=org.apache.log4j.PatternLayout
 log4j.appender.R.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 
-log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
-
 # with these we'll not get innundated when switching to DEBUG
 log4j.logger.org.apache.directory.shared.ldap.name=WARN
 log4j.logger.org.springframework=WARN

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v156/ApacheDS156LdapServerAdapter.java Mon Oct 11 15:10:02 2010
@@ -119,6 +119,9 @@ public class ApacheDS156LdapServerAdapte
             SERVER_XML ) );
         LdapServersUtils.copyResource( bundle, resourceConfFolderPath.append( LOG4J_PROPERTIES ), new File( confFolder,
             LOG4J_PROPERTIES ) );
+
+        // Creating an empty log file
+        new File( confFolder, "apacheds.log" ).createNewFile();
     }
 
 
@@ -163,6 +166,9 @@ public class ApacheDS156LdapServerAdapte
      */
     public void start( LdapServer server, StudioProgressMonitor monitor ) throws Exception
     {
+        // Starting the console printer thread
+        LdapServersUtils.startConsolePrinterThread( server );
+
         // Launching Apache DS
         ILaunch launch = LdapServersUtils.launchApacheDS( server, getServerLibrariesFolder(), libraries );
 
@@ -179,17 +185,11 @@ public class ApacheDS156LdapServerAdapte
      */
     public void stop( LdapServer server, StudioProgressMonitor monitor ) throws Exception
     {
-        // Getting the launch
-        ILaunch launch = ( ILaunch ) server.removeCustomObject( LdapServersUtils.LAUNCH_CONFIGURATION_CUSTOM_OBJECT );
-        if ( ( launch != null ) && ( !launch.isTerminated() ) )
-        {
-            // Terminating the launch
-            launch.terminate();
-        }
-        else
-        {
-            throw new Exception( "The associated launch configuration could not be found or is already terminated." );
-        }
+        // Stopping the console printer thread
+        LdapServersUtils.stopConsolePrinterThread( server );
+
+        // Terminating the launch configuration
+        LdapServersUtils.terminateLaunchConfiguration( server );
     }
 
 

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v157/resources/conf/log4j.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v157/resources/conf/log4j.properties?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v157/resources/conf/log4j.properties (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v157/resources/conf/log4j.properties Mon Oct 11 15:10:02 2010
@@ -14,23 +14,13 @@
 #    See the License for the specific language governing permissions and
 #    limitations under the License.
 #############################################################################
-log4j.rootCategory=WARN, R, stdout
-
-log4j.appender.stdout=org.apache.log4j.ConsoleAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-
-log4j.appender.R=org.apache.log4j.RollingFileAppender
-log4j.appender.R.File=${apacheds.log.dir}/apacheds-rolling.log
-
-log4j.appender.R.MaxFileSize=1024KB
-# Keep some backup files
-log4j.appender.R.MaxBackupIndex=5
+log4j.rootCategory=WARN, R
 
+log4j.appender.R=org.apache.log4j.FileAppender
+log4j.appender.R.File=${apacheds.log.dir}/apacheds.log
 log4j.appender.R.layout=org.apache.log4j.PatternLayout
 log4j.appender.R.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
 
-log4j.appender.stdout.layout.ConversionPattern=[%d{HH:mm:ss}] %p [%c] - %m%n
-
 # with these we'll not get innundated when switching to DEBUG
 log4j.logger.org.apache.directory.shared.ldap.name=WARN
 log4j.logger.org.springframework=WARN

Modified: directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/ApacheDS157LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/ApacheDS157LdapServerAdapter.java?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/ApacheDS157LdapServerAdapter.java (original)
+++ directory/studio/trunk/plugins/ldapservers.apacheds.v157/src/main/java/org/apache/directory/studio/ldapservers/apacheds/v157/ApacheDS157LdapServerAdapter.java Mon Oct 11 15:10:02 2010
@@ -119,6 +119,9 @@ public class ApacheDS157LdapServerAdapte
             SERVER_XML ) );
         LdapServersUtils.copyResource( bundle, resourceConfFolderPath.append( LOG4J_PROPERTIES ), new File( confFolder,
             LOG4J_PROPERTIES ) );
+
+        // Creating an empty log file
+        new File( confFolder, "apacheds.log" ).createNewFile();
     }
 
 
@@ -163,6 +166,9 @@ public class ApacheDS157LdapServerAdapte
      */
     public void start( LdapServer server, StudioProgressMonitor monitor ) throws Exception
     {
+        // Starting the console printer thread
+        LdapServersUtils.startConsolePrinterThread( server );
+
         // Launching Apache DS
         ILaunch launch = LdapServersUtils.launchApacheDS( server, getServerLibrariesFolder(), libraries );
 
@@ -179,17 +185,11 @@ public class ApacheDS157LdapServerAdapte
      */
     public void stop( LdapServer server, StudioProgressMonitor monitor ) throws Exception
     {
-        // Getting the launch
-        ILaunch launch = ( ILaunch ) server.removeCustomObject( LdapServersUtils.LAUNCH_CONFIGURATION_CUSTOM_OBJECT );
-        if ( ( launch != null ) && ( !launch.isTerminated() ) )
-        {
-            // Terminating the launch
-            launch.terminate();
-        }
-        else
-        {
-            throw new Exception( "The associated launch configuration could not be found or is already terminated." );
-        }
+        // Stopping the console printer thread
+        LdapServersUtils.stopConsolePrinterThread( server );
+
+        // Terminating the launch configuration
+        LdapServersUtils.terminateLaunchConfiguration( server );
     }
 
 
@@ -222,7 +222,7 @@ public class ApacheDS157LdapServerAdapte
             .append( "server.xml" ).toFile() );
 
         ServerXmlIOV157 serverXmlIOV157 = new ServerXmlIOV157();
-        return (ServerConfigurationV157) serverXmlIOV157.parse( fis );
+        return ( ServerConfigurationV157 ) serverXmlIOV157.parse( fis );
     }
 
 

Modified: directory/studio/trunk/plugins/ldapservers/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/pom.xml?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/pom.xml (original)
+++ directory/studio/trunk/plugins/ldapservers/pom.xml Mon Oct 11 15:10:02 2010
@@ -129,6 +129,7 @@
  org.eclipse.jdt.launching,
  org.eclipse.jface.text,
  org.eclipse.ui,
+ org.eclipse.ui.console,
  org.eclipse.ui.ide
             </Require-Bundle>
             <Embed-Dependency>*;scope=compile|runtime</Embed-Dependency>
@@ -289,6 +290,11 @@
     </dependency>
     <dependency>
       <groupId>org.eclipse.ui</groupId>
+      <artifactId>console</artifactId>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.eclipse.ui</groupId>
       <artifactId>forms</artifactId>
       <scope>provided</scope>
     </dependency>

Added: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ConsolePrinterThread.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ConsolePrinterThread.java?rev=1021373&view=auto
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ConsolePrinterThread.java (added)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ConsolePrinterThread.java Mon Oct 11 15:10:02 2010
@@ -0,0 +1,77 @@
+package org.apache.directory.studio.ldapservers;
+
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.IOException;
+
+import org.eclipse.ui.console.MessageConsoleStream;
+
+
+public class ConsolePrinterThread extends Thread
+{
+    private boolean stop = false;
+    private File file;
+    private MessageConsoleStream consoleStream;
+
+
+    public ConsolePrinterThread( File file, MessageConsoleStream consoleStream )
+    {
+        this.file = file;
+        this.consoleStream = consoleStream;
+    }
+
+
+    /**
+     * {@inheritDoc}
+     */
+    public void run()
+    {
+        if ( file.exists() && file.isFile() && file.canRead() )
+        {
+            try
+            {
+                BufferedReader reader = new BufferedReader( new FileReader( file ) );
+                String line = null;
+
+                while ( !stop )
+                {
+                    line = reader.readLine();
+                    if ( line != null )
+                    {
+                        consoleStream.println( line );
+                        continue;
+                    }
+
+                    sleep( 1000 );
+                }
+
+                reader.close();
+
+            }
+            catch ( FileNotFoundException e )
+            {
+                // Will never get thrown
+            }
+            catch ( InterruptedException e )
+            {
+                // Nothing to do
+            }
+            catch ( IOException e )
+            {
+                // TODO Auto-generated catch block
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+
+    public void close()
+    {
+        System.out.println( "close" );
+        stop = true;
+    }
+}

Added: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ConsolesManager.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ConsolesManager.java?rev=1021373&view=auto
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ConsolesManager.java (added)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/ConsolesManager.java Mon Oct 11 15:10:02 2010
@@ -0,0 +1,101 @@
+/*
+ *  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.ldapservers;
+
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.apache.directory.studio.ldapservers.model.LdapServer;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.MessageConsole;
+
+
+/**
+ * This class implements the consoles manager.
+ * <p>
+ * 
+ * It is used to store all the consoles associated to servers.
+ *
+ * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
+ */
+public class ConsolesManager
+{
+    /** The default instance */
+    private static ConsolesManager instance;
+
+    /** The map of consoles identified by server ID */
+    private Map<LdapServer, MessageConsole> consolesMap;
+
+
+    /**
+     * Creates a new instance of ConsolesManager.
+     */
+    private ConsolesManager()
+    {
+        // Initialization of the map
+        consolesMap = new HashMap<LdapServer, MessageConsole>();
+    }
+
+
+    /**
+     * Gets the default consoles manager (singleton pattern).
+     *
+     * @return
+     *      the default consoles manager
+     */
+    public static ConsolesManager getDefault()
+    {
+        if ( instance == null )
+        {
+            instance = new ConsolesManager();
+        }
+
+        return instance;
+    }
+
+
+    /**
+     * Gets the message console associated with the if of the server.
+     *
+     * @param server
+     *      the server
+     * @return
+     *      the associated message console.
+     */
+    public MessageConsole getMessageConsole( LdapServer server )
+    {
+        if ( consolesMap.containsKey( server ) )
+        {
+            return consolesMap.get( server );
+        }
+        else
+        {
+            MessageConsole messageConsole = new MessageConsole( server.getName() + " [LDAP Server]", null );
+            consolesMap.put( server, messageConsole );
+
+            ConsolePlugin.getDefault().getConsoleManager().addConsoles( new IConsole[]
+                { messageConsole } );
+
+            return messageConsole;
+        }
+    }
+}

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersUtils.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersUtils.java?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersUtils.java (original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/LdapServersUtils.java Mon Oct 11 15:10:02 2010
@@ -52,6 +52,7 @@ import org.eclipse.jdt.launching.IRuntim
 import org.eclipse.jdt.launching.IVMInstall;
 import org.eclipse.jdt.launching.JavaRuntime;
 import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.console.MessageConsole;
 import org.osgi.framework.Bundle;
 
 
@@ -63,6 +64,9 @@ public class LdapServersUtils
     /** The ID of the launch configuration custom object */
     public static final String LAUNCH_CONFIGURATION_CUSTOM_OBJECT = "launchConfiguration"; //$NON-NLS-1$
 
+    /** The ID of the console printer custom object */
+    public static final String CONSOLE_PRINTER_CUSTOM_OBJECT = "consolePrinter"; //$NON-NLS-1$
+
 
     /**
      * Runs the startup listener watchdog.
@@ -203,6 +207,42 @@ public class LdapServersUtils
 
 
     /**
+     * Starts the console printer thread.
+     *
+     * @param server
+     *      the server
+     */
+    public static void startConsolePrinterThread( LdapServer server )
+    {
+        MessageConsole messageConsole = ConsolesManager.getDefault().getMessageConsole( server );
+        ConsolePrinterThread consolePrinter = new ConsolePrinterThread( LdapServersManager.getServerFolder( server ).append( "log" )
+            .append( "apacheds.log" ).toFile(), messageConsole.newMessageStream() );
+        consolePrinter.start();
+
+        // Storing the console printer as a custom object in the LDAP Server for later use
+        server.putCustomObject( CONSOLE_PRINTER_CUSTOM_OBJECT, consolePrinter );
+    }
+
+
+    /**
+     * Stops the console printer thread.
+     *
+     * @param server
+     *      the server
+     */
+    public static void stopConsolePrinterThread( LdapServer server )
+    {
+        // Getting the console printer
+        ConsolePrinterThread consolePrinter = ( ConsolePrinterThread ) server.removeCustomObject( CONSOLE_PRINTER_CUSTOM_OBJECT );
+        if ( ( consolePrinter != null ) && ( consolePrinter.isAlive() ) )
+        {
+            // Closing the console printer
+            consolePrinter.close();
+        }
+    }
+
+
+    /**
      * Launches Apache DS using a launch configuration.
      *
      * @param server
@@ -294,6 +334,29 @@ public class LdapServersUtils
 
 
     /**
+     * Terminates the launch configuration.
+     *
+     * @param server
+     *      the server
+     * @throws Exception
+     */
+    public static void terminateLaunchConfiguration( LdapServer server ) throws Exception
+    {
+        // Getting the launch
+        ILaunch launch = ( ILaunch ) server.removeCustomObject( LdapServersUtils.LAUNCH_CONFIGURATION_CUSTOM_OBJECT );
+        if ( ( launch != null ) && ( !launch.isTerminated() ) )
+        {
+            // Terminating the launch
+            launch.terminate();
+        }
+        else
+        {
+            throw new Exception( "The associated launch configuration could not be found or is already terminated." );
+        }
+    }
+
+
+    /**
      * Verifies that the libraries folder exists and contains the jar files 
      * needed to launch the server.
      *

Modified: directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/NewServerAction.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/NewServerAction.java?rev=1021373&r1=1021372&r2=1021373&view=diff
==============================================================================
--- directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/NewServerAction.java (original)
+++ directory/studio/trunk/plugins/ldapservers/src/main/java/org/apache/directory/studio/ldapservers/actions/NewServerAction.java Mon Oct 11 15:10:02 2010
@@ -31,6 +31,9 @@ import org.eclipse.jface.wizard.WizardDi
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.IWorkbenchWindowActionDelegate;
 import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsole;
+import org.eclipse.ui.console.MessageConsole;
 
 
 /**
@@ -59,6 +62,18 @@ public class NewServerAction extends Act
      */
     public void run()
     {
+//        MessageConsole messageConsole = new MessageConsole( "test", null );
+//
+//        ConsolePlugin.getDefault().getConsoleManager().addConsoles( new IConsole[]
+//            { messageConsole } );
+//
+//        messageConsole.newMessageStream().print( "message" );
+//
+//        if ( true )
+//        {
+//            return;
+//        }
+
         // Instantiates and initializes the wizard
         NewServerWizard wizard = new NewServerWizard();
         wizard.init( PlatformUI.getWorkbench(), StructuredSelection.EMPTY );