directory-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pamarce...@apache.org
Subject svn commit: r965845 - in /directory/studio/trunk/ldapservers.apacheds.v156: ./ resources/conf/ src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/
Date Tue, 20 Jul 2010 13:46:07 GMT
Author: pamarcelot
Date: Tue Jul 20 13:46:06 2010
New Revision: 965845

URL: http://svn.apache.org/viewvc?rev=965845&view=rev
Log:
Implemented the start method (ApacheDS can now be started, but not stopped yet...).

Added:
    directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/log4j.properties
    directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/server.xml
      - copied unchanged from r965771, directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/server-1.5.6.xml
Removed:
    directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/server-1.5.6.xml
Modified:
    directory/studio/trunk/ldapservers.apacheds.v156/pom.xml
    directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156LdapServerAdapter.java

Modified: directory/studio/trunk/ldapservers.apacheds.v156/pom.xml
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/pom.xml?rev=965845&r1=965844&r2=965845&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/pom.xml (original)
+++ directory/studio/trunk/ldapservers.apacheds.v156/pom.xml Tue Jul 20 13:46:06 2010
@@ -118,6 +118,9 @@
  org.eclipse.ui,
  org.eclipse.jface.text,
  org.eclipse.ui.ide,
+ org.eclipse.jdt.launching,
+ org.eclipse.debug.core,
+ org.eclipse.debug.ui,
  org.apache.directory.studio.jars,
  org.apache.directory.studio.common.ui,
  org.apache.directory.studio.ldapservers

Added: directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/log4j.properties
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/log4j.properties?rev=965845&view=auto
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/log4j.properties (added)
+++ directory/studio/trunk/ldapservers.apacheds.v156/resources/conf/log4j.properties Tue Jul
20 13:46:06 2010
@@ -0,0 +1,38 @@
+#############################################################################
+#    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.
+#############################################################################
+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.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
+log4j.logger.org.apache.directory.shared.codec=WARN
+log4j.logger.org.apache.directory.shared.asn1=WARN

Modified: directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156LdapServerAdapter.java
URL: http://svn.apache.org/viewvc/directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156LdapServerAdapter.java?rev=965845&r1=965844&r2=965845&view=diff
==============================================================================
--- directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156LdapServerAdapter.java
(original)
+++ directory/studio/trunk/ldapservers.apacheds.v156/src/main/java/org/apache/directory/studio/ldapserver/apacheds/v156/ApacheDS156LdapServerAdapter.java
Tue Jul 20 13:46:06 2010
@@ -27,16 +27,32 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.net.URL;
+import java.util.ArrayList;
+import java.util.List;
 
 import org.apache.directory.studio.common.CommonUiUtils;
 import org.apache.directory.studio.ldapservers.LdapServersManager;
 import org.apache.directory.studio.ldapservers.model.LdapServer;
 import org.apache.directory.studio.ldapservers.model.LdapServerAdapter;
 import org.apache.directory.studio.ldapservers.model.LdapServerStatus;
+import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.FileLocator;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
 import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.osgi.util.NLS;
 
 
 /**
@@ -46,20 +62,54 @@ import org.eclipse.core.runtime.Path;
  */
 public class ApacheDS156LdapServerAdapter implements LdapServerAdapter
 {
+    // Various strings constants used in paths
+    private static final String SERVER_XML = "server.xml";
+    private static final String LOG4J_PROPERTIES = "log4j.properties";
+    private static final String RESOURCES = "resources";
+    private static final String LIBS = "libs";
+    private static final String CONF = "conf";
+
+    /** The array of libraries names */
+    private static final String[] libraries = new String[]
+        { "antlr-2.7.7.jar", "apacheds-avl-partition-1.5.6.jar", "apacheds-core-1.5.6.jar",
+            "apacheds-core-annotations-1.5.6.jar", "apacheds-core-api-1.5.6.jar", "apacheds-core-avl-1.5.6.jar",
+            "apacheds-core-constants-1.5.6.jar", "apacheds-core-entry-1.5.6.jar", "apacheds-core-jndi-1.5.6.jar",
+            "apacheds-core-mock-1.5.6.jar", "apacheds-http-integration-1.5.6.jar", "apacheds-i18n-1.5.6.jar",
+            "apacheds-interceptor-kerberos-1.5.6.jar", "apacheds-jdbm-1.5.6.jar", "apacheds-jdbm-partition-1.5.6.jar",
+            "apacheds-jdbm-store-1.5.6.jar", "apacheds-kerberos-shared-1.5.6.jar", "apacheds-launcher-1.5.0.jar",
+            "apacheds-ldif-partition-1.5.6.jar", "apacheds-protocol-changepw-1.5.6.jar",
+            "apacheds-protocol-dns-1.5.6.jar", "apacheds-protocol-kerberos-1.5.6.jar",
+            "apacheds-protocol-ldap-1.5.6.jar", "apacheds-protocol-ntp-1.5.6.jar",
+            "apacheds-protocol-shared-1.5.6.jar", "apacheds-server-jndi-1.5.6.jar", "apacheds-server-xml-1.5.6.jar",
+            "apacheds-utils-1.5.6.jar", "apacheds-xbean-spring-1.5.6.jar", "apacheds-xdbm-base-1.5.6.jar",
+            "apacheds-xdbm-search-1.5.6.jar", "apacheds-xdbm-tools-1.5.6.jar", "bcprov-jdk15-140.jar",
+            "commons-cli-1.2.jar", "commons-collections-3.2.1.jar", "commons-daemon-1.0.1.jar",
"commons-io-1.4.jar",
+            "commons-lang-2.5.jar", "daemon-bootstrappers-1.1.7.jar", "dom4j-1.6.1.jar",
"jcl-over-slf4j-1.5.10.jar",
+            "jetty-6.1.14.jar", "jetty-util-6.1.14.jar", "junit-4.7.jar", "log4j-1.2.14.jar",
+            "mina-core-2.0.0-RC1.jar", "servlet-api-2.5-6.1.14.jar", "shared-asn1-0.9.18.jar",
+            "shared-asn1-codec-0.9.18.jar", "shared-cursor-0.9.18.jar", "shared-dsml-parser-0.9.18.jar",
+            "shared-i18n-0.9.18.jar", "shared-ldap-0.9.18.jar", "shared-ldap-constants-0.9.18.jar",
+            "shared-ldap-converter-0.9.18.jar", "shared-ldap-jndi-0.9.18.jar", "shared-ldap-schema-0.9.18.jar",
+            "shared-ldap-schema-dao-0.9.18.jar", "shared-ldap-schema-loader-0.9.18.jar",
+            "shared-ldap-schema-manager-0.9.18.jar", "shared-ldif-0.9.18.jar", "slf4j-api-1.5.10.jar",
+            "slf4j-log4j12-1.5.10.jar", "spring-beans-2.5.6.SEC01.jar", "spring-context-2.5.6.SEC01.jar",
+            "spring-core-2.5.6.SEC01.jar", "xbean-spring-3.5.jar", "xercesImpl-2.9.1.jar",
"xpp3-1.1.4c.jar" };
+
+
+    /**
+     * {@inheritDoc}
+     */
     public void add( LdapServer server, IProgressMonitor monitor ) throws Exception
     {
-        //
-        monitor.subTask( "verifying ApacheDS 1.5.6 libraries" );
-        verifyLibrariesFolder();
+        // Verifying and copying ApacheDS 1.5.6 libraries
+        monitor.subTask( "verifying and copying ApacheDS 1.5.6 libraries" );
+        verifyAndCopyLibraries();
 
-        monitor.subTask( "copying ApacheDS 1.5.6 libraries" );
-
-        monitor.subTask( "creating server folder struture" );
+        // Creating server folder structure
+        monitor.subTask( "creating server folder structure" );
         File serverFolder = LdapServersManager.getServerFolder( server ).toFile();
         File confFolder = new File( serverFolder, "conf" );
         confFolder.mkdir();
-        //        File serverSocketFolder = new File( serverFolder, "serverSocket" );
-        //        serverSocketFolder.mkdir();
         File ldifFolder = new File( serverFolder, "ldif" );
         ldifFolder.mkdir();
         File logFolder = new File( serverFolder, "log" );
@@ -67,149 +117,176 @@ public class ApacheDS156LdapServerAdapte
         File partitionFolder = new File( serverFolder, "partitions" );
         partitionFolder.mkdir();
 
-        // Checking if the Apache DS servers folder exists
-
-        // Creating the server folder
-        //        IPath serverFolderPath = getApacheDsServersFolder().append( id );
-        //        File serverFolder = new File( serverFolderPath.toOSString() );
-        //        serverFolder.mkdir();
-        //
-        //        // Creating the server sub folders ('conf', 'ldif', 'log' and 'partitions')
-        //
-        //        // Copying default configuration files
-        //        try
-        //        {
-        //            // Creating log4j.properties file
-        //            File log4jPropertiesFile = new File( confFolder, "log4j.properties"
);
-        //            createServersLog4jPropertiesFile( new FileOutputStream( log4jPropertiesFile
), 1024, getServerLogsLevel(), // Setting 1024 as default port
-        //                getServerLogsPattern() );
-        //
-        //            // Copying server.xml file
-        //            File serverXmlFile = new File( confFolder, "server.xml" );
-        //            copyConfigurationFile( "server-1.5.6.xml", serverXmlFile );
-        //
-        //            // Creating log4j.properties file to the serverSocket folder
-        //            File log4jPropertiesServerSocketFile = new File( serverSocketFolder,
"log4j.properties" );
-        //            createServerSocketLog4jPropertiesFile( new FileOutputStream( log4jPropertiesServerSocketFile
), id );
-        //        }
-        //        catch ( IOException e )
-        //        {
-        //            ApacheDsPluginUtils
-        //                .reportError( "An error occurred when copying the default configuration
files to the server's folder '"
-        //                    + serverFolder.getAbsolutePath() + "'.\n\n" + e.getMessage()
);
-        //        }
+        // Copying configuration files
+        monitor.subTask( "copying configuration files" );
+        IPath resourceConfFolderPath = new Path( RESOURCES ).append( CONF );
+        copyResource( resourceConfFolderPath.append( SERVER_XML ), new File( confFolder,
SERVER_XML ) );
+        copyResource( resourceConfFolderPath.append( LOG4J_PROPERTIES ), new File( confFolder,
LOG4J_PROPERTIES ) );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void delete( LdapServer server ) throws Exception
     {
         System.out.println( "delete " + server.getName() );
     }
 
 
+    /**
+     * {@inheritDoc}
+     */
     public void start( LdapServer server, IProgressMonitor monitor ) throws Exception
     {
-        System.out.println( "start " + server.getName() );
-
-        Thread.sleep( 3000 );
+        launchApacheDS( server );
 
         server.setStatus( LdapServerStatus.STARTED );
     }
 
 
-    public void stop( LdapServer server, IProgressMonitor monitor ) throws Exception
+    /**
+     * Launches Apache DS using a launch configuration.
+     */
+    private void launchApacheDS( LdapServer server )
     {
-        System.out.println( "stop " + server.getName() );
+        try
+        {
+            // Getting the default VM installation
+            IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
 
-        Thread.sleep( 3000 );
+            // Creating a new editable launch configuration
+            ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager()
+                .getLaunchConfigurationType( IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION
);
+            ILaunchConfigurationWorkingCopy workingCopy = type.newInstance( null,
+                NLS.bind( "Starting {0}", new String[]
+                    { server.getName() } ) );
+
+            // Setting the JRE container path attribute
+            workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH,
vmInstall
+                .getInstallLocation().toString() );
+
+            // Setting the main type attribute
+            workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
+                "org.apache.directory.studio.apacheds.Launcher" ); //$NON-NLS-1$
+
+            // Creating the classpath list
+            List<String> classpath = new ArrayList<String>();
+            IPath apacheDsLibrariesFolder = getServerLibrariesFolder();
+            for ( String library : libraries )
+            {
+                IRuntimeClasspathEntry libraryClasspathEntry = JavaRuntime
+                    .newArchiveRuntimeClasspathEntry( apacheDsLibrariesFolder.append( library
) );
+                libraryClasspathEntry.setClasspathProperty( IRuntimeClasspathEntry.USER_CLASSES
);
 
-        server.setStatus( LdapServerStatus.STOPPED );
+                classpath.add( libraryClasspathEntry.getMemento() );
+            }
+
+            // Setting the classpath type attribute
+            workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath
);
+
+            // Setting the default classpath type attribute to false
+            workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH,
false );
+
+            // The server folder path
+            IPath serverFolderPath = LdapServersManager.getServerFolder( server );
+
+            // Setting the program arguments attribute
+            workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
"\"" //$NON-NLS-1$
+                + serverFolderPath.toOSString() + "\"" ); //$NON-NLS-1$
+
+            // Creating the VM arguments string
+            StringBuffer vmArguments = new StringBuffer();
+            vmArguments.append( "-Dlog4j.configuration=file:\"" //$NON-NLS-1$
+                + serverFolderPath.append( "conf" ).append( "log4j.properties" ).toOSString()
+ "\"" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+            vmArguments.append( " " ); //$NON-NLS-1$
+            vmArguments.append( "-Dapacheds.var.dir=\"" + serverFolderPath.toOSString() +
"\"" ); //$NON-NLS-1$ //$NON-NLS-2$
+            vmArguments.append( " " ); //$NON-NLS-1$
+            vmArguments.append( "-Dapacheds.log.dir=\"" + serverFolderPath.append( "log"
).toOSString() + "\"" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+            vmArguments.append( " " ); //$NON-NLS-1$
+            vmArguments.append( "-Dapacheds.run.dir=\"" + serverFolderPath.append( "run"
).toOSString() + "\"" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+            vmArguments.append( " " ); //$NON-NLS-1$
+            vmArguments.append( "-Dapacheds.instance=\"" + server.getName() + "\"" ); //$NON-NLS-1$
//$NON-NLS-2$
+
+            // Setting the VM arguments attribute
+            workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
vmArguments.toString() );
+
+            // Setting the launch configuration as private
+            workingCopy.setAttribute( IDebugUIConstants.ATTR_PRIVATE, true );
+
+            // Indicating that we don't want any console to show up
+            workingCopy.setAttribute( DebugPlugin.ATTR_CAPTURE_OUTPUT, false );
+
+            // Saving the launch configuration
+            ILaunchConfiguration configuration = workingCopy.doSave();
+
+            // Launching the launch configuration
+            ILaunch launch = configuration.launch( ILaunchManager.RUN_MODE, new NullProgressMonitor()
);
+        }
+        catch ( CoreException e )
+        {
+            CommonUiUtils.reportError( NLS.bind( "An error occurred when launching the server.\n\n{0}",
new String[]
+                { e.getMessage() } ) );
+        }
     }
 
 
     /**
-     * TODO getLibraries.
-     *
-     * @return
+     * {@inheritDoc}
      */
-    private static String[] getLibraries()
+    public void stop( LdapServer server, IProgressMonitor monitor ) throws Exception
     {
-        return new String[]
-            { "antlr-2.7.7.jar", "apacheds-avl-partition-1.5.6.jar", "apacheds-core-1.5.6.jar",
-                "apacheds-core-annotations-1.5.6.jar", "apacheds-core-api-1.5.6.jar", "apacheds-core-avl-1.5.6.jar",
-                "apacheds-core-constants-1.5.6.jar", "apacheds-core-entry-1.5.6.jar", "apacheds-core-jndi-1.5.6.jar",
-                "apacheds-core-mock-1.5.6.jar", "apacheds-http-integration-1.5.6.jar", "apacheds-i18n-1.5.6.jar",
-                "apacheds-interceptor-kerberos-1.5.6.jar", "apacheds-jdbm-1.5.6.jar",
-                "apacheds-jdbm-partition-1.5.6.jar", "apacheds-jdbm-store-1.5.6.jar",
-                "apacheds-kerberos-shared-1.5.6.jar", "apacheds-launcher-1.5.0.jar",
-                "apacheds-ldif-partition-1.5.6.jar", "apacheds-protocol-changepw-1.5.6.jar",
-                "apacheds-protocol-dns-1.5.6.jar", "apacheds-protocol-kerberos-1.5.6.jar",
-                "apacheds-protocol-ldap-1.5.6.jar", "apacheds-protocol-ntp-1.5.6.jar",
-                "apacheds-protocol-shared-1.5.6.jar", "apacheds-server-jndi-1.5.6.jar",
-                "apacheds-server-xml-1.5.6.jar", "apacheds-utils-1.5.6.jar", "apacheds-xbean-spring-1.5.6.jar",
-                "apacheds-xdbm-base-1.5.6.jar", "apacheds-xdbm-search-1.5.6.jar", "apacheds-xdbm-tools-1.5.6.jar",
-                "bcprov-jdk15-140.jar", "commons-cli-1.2.jar", "commons-collections-3.2.1.jar",
-                "commons-daemon-1.0.1.jar", "commons-io-1.4.jar", "commons-lang-2.5.jar",
-                "daemon-bootstrappers-1.1.7.jar", "dom4j-1.6.1.jar", "jcl-over-slf4j-1.5.10.jar",
"jetty-6.1.14.jar",
-                "jetty-util-6.1.14.jar", "junit-4.7.jar", "log4j-1.2.14.jar", "mina-core-2.0.0-RC1.jar",
-                "servlet-api-2.5-6.1.14.jar", "shared-asn1-0.9.18.jar", "shared-asn1-codec-0.9.18.jar",
-                "shared-cursor-0.9.18.jar", "shared-dsml-parser-0.9.18.jar", "shared-i18n-0.9.18.jar",
-                "shared-ldap-0.9.18.jar", "shared-ldap-constants-0.9.18.jar", "shared-ldap-converter-0.9.18.jar",
-                "shared-ldap-jndi-0.9.18.jar", "shared-ldap-schema-0.9.18.jar", "shared-ldap-schema-dao-0.9.18.jar",
-                "shared-ldap-schema-loader-0.9.18.jar", "shared-ldap-schema-manager-0.9.18.jar",
-                "shared-ldif-0.9.18.jar", "slf4j-api-1.5.10.jar", "slf4j-log4j12-1.5.10.jar",
-                "spring-beans-2.5.6.SEC01.jar", "spring-context-2.5.6.SEC01.jar", "spring-core-2.5.6.SEC01.jar",
-                "xbean-spring-3.5.jar", "xercesImpl-2.9.1.jar", "xpp3-1.1.4c.jar" };
-    }
+        System.out.println( "stop " + server.getName() );
 
-    private static final String RESOURCES = "resources";
-    private static final String LIBS = "libs";
+        Thread.sleep( 3000 );
 
-    /** The name of the libraries folder */
-    private static final String LIBRARIES_FOLDER_NAME = "libs";
+        server.setStatus( LdapServerStatus.STOPPED );
+    }
 
 
     /**
      * Verifies that the libraries folder exists and contains the jar files 
      * needed to launch the server.
-     * 
-     * @param server
-     *      the server
-     */
-    public static void verifyLibrariesFolder()
-    {
-        // Libraries folder
-        IPath librariesFolderPath = ApacheDS156Plugin.getDefault().getStateLocation().append(
LIBRARIES_FOLDER_NAME );
-        File librariesFolder = new File( librariesFolderPath.toOSString() );
-        if ( !librariesFolder.exists() )
+     */
+    public static void verifyAndCopyLibraries()
+    {
+        // Source libraries folder
+        IPath sourceLibrariesPath = new Path( RESOURCES ).append( LIBS );
+
+        // Destination libraries folder
+        IPath destinationLibrariesFolderPath = getServerLibrariesFolder();
+        File destinationLibrariesFolder = destinationLibrariesFolderPath.toFile();
+        if ( !destinationLibrariesFolder.exists() )
         {
-            librariesFolder.mkdir();
+            destinationLibrariesFolder.mkdir();
         }
 
-        // Creating the path for the libs folder
-        IPath libsFolderPath = new Path( RESOURCES ).append( LIBS );
-
-        // Jar libraries
-        for ( String libraryFilename : getLibraries() )
+        // Verifying and copying libraries (if needed)
+        for ( String library : libraries )
         {
-            IPath apachedsLibraryPath = librariesFolderPath.append( libraryFilename );
-            File apachedsLibrary = new File( apachedsLibraryPath.toOSString() );
-            if ( !apachedsLibrary.exists() )
+            File destinationLibraryFile = destinationLibrariesFolderPath.append( library
).toFile();
+            if ( !destinationLibraryFile.exists() )
             {
                 try
                 {
-                    copyResource( libsFolderPath.append( libraryFilename ), apachedsLibrary
);
+                    copyResource( sourceLibrariesPath.append( library ), destinationLibraryFile
);
                 }
                 catch ( IOException e )
                 {
-                    CommonUiUtils.reportError( "An error occurred when copying the library
'" + libraryFilename
-                        + "' to the location '" + apachedsLibrary.getAbsolutePath() + "'.\n\n"
+ e.getMessage() );
+                    CommonUiUtils.reportError( "An error occurred when copying the library
'" + library
+                        + "' to the location '" + destinationLibraryFile.getAbsolutePath()
+ "'.\n\n" + e.getMessage() );
                 }
             }
         }
     }
 
 
+    private static IPath getServerLibrariesFolder()
+    {
+        return ApacheDS156Plugin.getDefault().getStateLocation().append( LIBS );
+    }
+
+
     /**
     * Copy the given resource.
     *
@@ -217,8 +294,6 @@ public class ApacheDS156LdapServerAdapte
     *      the path of the resource
     * @param destination
     *      the destination
-    * @param server
-    *      the server
     * @throws IOException
     *      if an error occurs when copying the jar file
     */



Mime
View raw message