[jbosstools-commits] JBoss Tools SVN: r30388 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch.

jbosstools-commits at lists.jboss.org jbosstools-commits at lists.jboss.org
Wed Apr 6 14:48:49 EDT 2011


Author: rob.stryker at jboss.com
Date: 2011-04-06 14:48:49 -0400 (Wed, 06 Apr 2011)
New Revision: 30388

Modified:
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
   trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/RunJarContainerWrapper.java
Log:
JBIDE-8461 patch for trunk

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java	2011-04-06 18:24:47 UTC (rev 30387)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java	2011-04-06 18:48:49 UTC (rev 30388)
@@ -15,6 +15,7 @@
 import java.util.Iterator;
 
 import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.debug.core.DebugPlugin;
 import org.eclipse.debug.core.ILaunch;
@@ -26,7 +27,10 @@
 import org.eclipse.wst.server.core.ServerUtil;
 import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
 import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
 import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
 import org.jboss.ide.eclipse.as.core.util.ServerConverter;
 
 public class JBossServerStartupLaunchConfiguration extends AbstractJBossLaunchConfigType {
@@ -73,6 +77,20 @@
 			i.next().setupLaunchConfiguration(workingCopy, server);
 		}
 	}	
+
+	public String[] getJavaLibraryPath(ILaunchConfiguration configuration) throws CoreException {
+		IServer server = ServerUtil.getServer(configuration);
+		JBossServer jbs = AbstractJBossLaunchConfigType.findJBossServer(server.getId());
+		IJBossServerRuntime runtime = (IJBossServerRuntime)
+			jbs.getServer().getRuntime().loadAdapter(IJBossServerRuntime.class, null);
+		IPath nativeFolder = runtime.getRuntime().getLocation()
+				.append(IJBossRuntimeResourceConstants.BIN)
+				.append(IJBossRuntimeResourceConstants.NATIVE);
+		if( nativeFolder.toFile().exists() ) {
+			return new String[]{nativeFolder.toOSString()};
+		}
+		return new String[]{};
+	}
 	
 	protected StartLaunchDelegate getDelegate(ILaunchConfiguration configuration) throws CoreException {
 		IServer server = ServerUtil.getServer(configuration);

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java	2011-04-06 18:24:47 UTC (rev 30387)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java	2011-04-06 18:48:49 UTC (rev 30388)
@@ -28,6 +28,10 @@
 import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
 import org.eclipse.debug.core.ILaunchManager;
 import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jdt.core.IClasspathAttribute;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.internal.launching.RuntimeClasspathEntry;
 import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
 import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
 import org.eclipse.jdt.launching.IVMInstall;
@@ -46,6 +50,7 @@
 import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
 import org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration.IStartLaunchSetupParticipant;
 import org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration.StartLaunchDelegate;
+import org.jboss.ide.eclipse.as.core.server.internal.launch.RunJarContainerWrapper.RunJarContainer;
 import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
 import org.jboss.ide.eclipse.as.core.util.IConstants;
 import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
@@ -129,43 +134,11 @@
 			}
 		} catch( MalformedURLException murle) {}
 
-		
 		vmArgs= ArgsUtil.setArg(vmArgs, null, 
 				IJBossRuntimeConstants.SYSPROP + IJBossRuntimeConstants.ENDORSED_DIRS,
 				runtime.getRuntime().getLocation().append(
 						IJBossRuntimeResourceConstants.LIB).append(
 								IJBossRuntimeResourceConstants.ENDORSED).toOSString(), true);
-		
-		if( runtime.getRuntime().getLocation().append(
-				IJBossRuntimeResourceConstants.BIN).append(	
-						IJBossRuntimeResourceConstants.NATIVE).toFile().exists() ) {
-			String argVal = ArgsUtil.getValue(vmArgs, null, 
-					IJBossRuntimeConstants.SYSPROP + IJBossRuntimeConstants.JAVA_LIB_PATH);
-			
-			String libPath = 
-				runtime.getRuntime().getLocation()
-					.append(IJBossRuntimeResourceConstants.BIN)
-					.append(IJBossRuntimeResourceConstants.NATIVE).toOSString();
-			if( argVal != null ) {
-				if( argVal.startsWith("\"")) //$NON-NLS-1$
-					argVal = argVal.substring(1);
-				if( argVal.endsWith("\"")) //$NON-NLS-1$
-					argVal = argVal.substring(0, argVal.length()-1);
-				if( argVal.startsWith(":")) //$NON-NLS-1$
-					argVal = argVal.substring(1);
-				
-				String[] asArr = argVal.split(File.pathSeparator); 
-				asArr[0] = libPath;
-				String implode = ""; //$NON-NLS-1$
-				for( int i = 0; i < asArr.length; i++ ) 
-					implode += asArr[i] + File.pathSeparator;
-				libPath = implode;
-			}
-			vmArgs = ArgsUtil.setArg(vmArgs, null, 
-					IJBossRuntimeConstants.SYSPROP + IJBossRuntimeConstants.JAVA_LIB_PATH,
-					libPath, true);
-		}
-		
 		/* Claspath */
 		List<String> cp = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, new ArrayList<String>());
 		List<String> newCP = fixCP(cp, jbs);

Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/RunJarContainerWrapper.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/RunJarContainerWrapper.java	2011-04-06 18:24:47 UTC (rev 30387)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/RunJarContainerWrapper.java	2011-04-06 18:48:49 UTC (rev 30388)
@@ -12,6 +12,7 @@
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 import org.eclipse.debug.core.ILaunchConfiguration;
 import org.eclipse.jdt.core.ClasspathContainerInitializer;
 import org.eclipse.jdt.core.IClasspathContainer;
@@ -70,13 +71,20 @@
 		public RunJarContainer(IPath path) {
 			this.path = path;
 		}
+		public RunJarContainer(String serverName) {
+			this(new Path(ID).append(serverName));
+		}
 		
 		public IClasspathEntry[] getClasspathEntries() {
 			String name = path.segment(1);
+			return getClasspathEntries(name);
+		}
+		
+		public static IClasspathEntry[] getClasspathEntries(String serverName) {
 			IServer[] servers = ServerCore.getServers();
 			IServer s = null;
 			for( int i = 0; i < servers.length; i++ ) {
-				if( servers[i].getName().equals(name))
+				if( servers[i].getName().equals(serverName))
 					s = servers[i];
 			}
 			if( s != null ) {



More information about the jbosstools-commits mailing list