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 2008/05/30 16:31:56 UTC
svn commit: r661733 -
/directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java
Author: pamarcelot
Date: Fri May 30 07:31:56 2008
New Revision: 661733
URL: http://svn.apache.org/viewvc?rev=661733&view=rev
Log:
Code cleaning.
Modified:
directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java
Modified: directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java
URL: http://svn.apache.org/viewvc/directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java?rev=661733&r1=661732&r2=661733&view=diff
==============================================================================
--- directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java (original)
+++ directory/studio/branches/apacheds-plugin-branch/apacheds/src/main/java/org/apache/directory/studio/apacheds/jobs/LaunchServerJob.java Fri May 30 07:31:56 2008
@@ -371,99 +371,75 @@
*/
private void launchApacheDS()
{
- // Getting the default VM installation
- IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
-
- // Creating a new editable launch configuration
- ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType type = manager
- .getLaunchConfigurationType( IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION );
- ILaunchConfigurationWorkingCopy workingCopy = null;
try
{
- workingCopy = type.newInstance( null, "Starting " + server.getName() );
- }
- catch ( CoreException e )
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ // Getting the default VM installation
+ IVMInstall vmInstall = JavaRuntime.getDefaultVMInstall();
- // 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" );
-
- // Creating the classpath list
- List classpath = new ArrayList();
- IPath apacheDsLibrariesFolder = ApacheDsPluginUtils.getApacheDsLibrariesFolder();
- for ( String library : ApacheDsPluginUtils.apachedsLibraries )
- {
- IPath libraryPath = apacheDsLibrariesFolder.append( library );
- IRuntimeClasspathEntry libraryClasspathEntry = JavaRuntime.newArchiveRuntimeClasspathEntry( libraryPath );
- libraryClasspathEntry.setClasspathProperty( IRuntimeClasspathEntry.USER_CLASSES );
- try
+ // Creating a new editable launch configuration
+ ILaunchConfigurationType type = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurationType(
+ IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION );
+ ILaunchConfigurationWorkingCopy workingCopy = type.newInstance( null, "Starting " + 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" );
+
+ // Creating the classpath list
+ List<String> classpath = new ArrayList<String>();
+ IPath apacheDsLibrariesFolder = ApacheDsPluginUtils.getApacheDsLibrariesFolder();
+ for ( String library : ApacheDsPluginUtils.apachedsLibraries )
{
+ IRuntimeClasspathEntry libraryClasspathEntry = JavaRuntime
+ .newArchiveRuntimeClasspathEntry( apacheDsLibrariesFolder.append( library ) );
+ libraryClasspathEntry.setClasspathProperty( IRuntimeClasspathEntry.USER_CLASSES );
+
classpath.add( libraryClasspathEntry.getMemento() );
}
- catch ( CoreException e )
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- // Setting the classpath type attribute
- workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath );
- workingCopy.setAttribute( DebugPlugin.ATTR_CAPTURE_OUTPUT, false );
-
- // Setting the default classpath type attribute to false
- workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false );
-
- // Useful paths
- IPath serversFolderPath = ApacheDsPluginUtils.getApacheDsServersFolder();
- IPath serverFolderPath = serversFolderPath.append( server.getId() );
-
- // Setting the program arguments attribute
- workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, serverFolderPath
- .toOSString() );
-
- // Creating the VM arguments string
- StringBuffer vmArguments = new StringBuffer();
- vmArguments.append( "-Dlog4j.configuration=file:"
- + serverFolderPath.append( "conf" ).append( "log4j.properties" ).toOSString() );
- vmArguments.append( " " );
- vmArguments.append( "-Dapacheds.var.dir=\"" + serverFolderPath.toOSString() + "\"" );
- vmArguments.append( " " );
- vmArguments.append( "-Dapacheds.log.dir=\"" + serverFolderPath.append( "log" ).toOSString() + "\"" );
- vmArguments.append( " " );
- vmArguments.append( "-Dapacheds.run.dir=\"" + serverFolderPath.append( "run" ).toOSString() + "\"" );
- vmArguments.append( " " );
- vmArguments.append( "-Dapacheds.instance=\"" + server.getName() + "\"" );
+ // Setting the classpath type attribute
+ workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath );
- // Setting the VM arguments attribute
- workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArguments.toString() );
+ // Setting the default classpath type attribute to false
+ workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false );
- workingCopy.setAttribute( IDebugUIConstants.ATTR_PRIVATE, true );
+ // The server folder path
+ IPath serverFolderPath = ApacheDsPluginUtils.getApacheDsServersFolder().append( server.getId() );
- // Saving to a launch configuration
- ILaunchConfiguration configuration = null;
- try
- {
- configuration = workingCopy.doSave();
- }
- catch ( CoreException e )
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ // Setting the program arguments attribute
+ workingCopy.setAttribute( IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, serverFolderPath
+ .toOSString() );
+
+ // Creating the VM arguments string
+ StringBuffer vmArguments = new StringBuffer();
+ vmArguments.append( "-Dlog4j.configuration=file:"
+ + serverFolderPath.append( "conf" ).append( "log4j.properties" ).toOSString() );
+ vmArguments.append( " " );
+ vmArguments.append( "-Dapacheds.var.dir=\"" + serverFolderPath.toOSString() + "\"" );
+ vmArguments.append( " " );
+ vmArguments.append( "-Dapacheds.log.dir=\"" + serverFolderPath.append( "log" ).toOSString() + "\"" );
+ vmArguments.append( " " );
+ vmArguments.append( "-Dapacheds.run.dir=\"" + serverFolderPath.append( "run" ).toOSString() + "\"" );
+ vmArguments.append( " " );
+ vmArguments.append( "-Dapacheds.instance=\"" + server.getName() + "\"" );
+
+ // 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 );
- // Launching the launch configuration
- try
- {
+ // 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
launch = configuration.launch( ILaunchManager.RUN_MODE, new NullProgressMonitor() );
}
catch ( CoreException e )