JBoss Tools SVN: r32570 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-04 13:03:24 -0400 (Mon, 04 Jul 2011)
New Revision: 32570
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java
Log:
[JBIDE-9215] replaced manual attribute read by util method and manual adapter code by centralized util method
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java 2011-07-04 17:00:19 UTC (rev 32569)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java 2011-07-04 17:03:24 UTC (rev 32570)
@@ -19,7 +19,6 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
@@ -35,9 +34,9 @@
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.server.internal.AbstractLocalJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
+import org.jboss.ide.eclipse.as.core.server.internal.launch.configuration.JBossLaunchConfigProperties;
import org.jboss.ide.eclipse.as.core.util.LaunchConfigUtils;
import org.jboss.ide.eclipse.as.core.util.RuntimeUtils;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
@@ -47,7 +46,6 @@
* @author Rob Stryker
*/
public abstract class AbstractJBossLaunchConfigType extends AbstractJavaLaunchConfigurationDelegate {
- public static final String SERVER_ID = "server-id"; //$NON-NLS-1$
// we have no need to do anything in pre-launch check
@Override
@@ -73,7 +71,7 @@
actualLaunch(configuration, mode, launch, monitor);
postLaunch(configuration, mode, launch, monitor);
}
-
+
protected void actualLaunch(ILaunchConfiguration configuration,
String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
// And off we go!
@@ -137,7 +135,7 @@
// Launch the configuration
runner.run(runConfig, launch, monitor);
}
-
+
@Deprecated
public static JBossServer findJBossServer(String serverId) throws CoreException {
return ServerConverter.findJBossServer(serverId);
@@ -187,12 +185,10 @@
@Deprecated
public IVMInstall getVMInstall(ILaunchConfiguration configuration) throws CoreException {
- String serverId = configuration.getAttribute(SERVER_ID, (String) null);
- JBossServer jbs = findJBossServer(serverId);
- AbstractLocalJBossServerRuntime rt = (AbstractLocalJBossServerRuntime)
- jbs.getServer().getRuntime()
- .loadAdapter(AbstractLocalJBossServerRuntime.class, new NullProgressMonitor());
- return rt.getVM();
+ String serverId = JBossLaunchConfigProperties.getServerId(configuration);
+ JBossServer jbs = ServerConverter.findJBossServer(serverId);
+ IJBossServerRuntime runtime = RuntimeUtils.checkedGetJBossServerRuntime(jbs.getServer());
+ return runtime.getVM();
}
}
13 years, 5 months
JBoss Tools SVN: r32569 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-04 13:00:19 -0400 (Mon, 04 Jul 2011)
New Revision: 32569
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
Log:
[JBIDE-9215] renamed JBossStartupConfigurator to LocalJBossStartupConfigurator
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-07-04 16:58:55 UTC (rev 32568)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-07-04 17:00:19 UTC (rev 32569)
@@ -36,7 +36,6 @@
import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
-import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
@@ -69,7 +68,7 @@
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy launchConfig, IProgressMonitor monitor)
throws CoreException {
- new JBoss7StartupConfigurator(getServer()).configure(launchConfig);
+ new LocalJBoss7StartupConfigurator(getServer()).configure(launchConfig);
}
public void setProcess(IProcess process) {
13 years, 5 months
JBoss Tools SVN: r32568 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-04 12:58:55 -0400 (Mon, 04 Jul 2011)
New Revision: 32568
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalStopLaunchConfigurator.java
Log:
[JBIDE-9215] added configurator for stop launch config
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalStopLaunchConfigurator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalStopLaunchConfigurator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalStopLaunchConfigurator.java 2011-07-04 16:58:55 UTC (rev 32568)
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal.launch.configuration;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior.JBossBehaviourDelegate;
+import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
+import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
+import org.jboss.ide.eclipse.as.core.util.LaunchConfigUtils;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
+
+/**
+ * @author André Dietisheim
+ */
+public class LocalStopLaunchConfigurator extends AbstractLaunchConfigurator {
+
+ public LocalStopLaunchConfigurator(IServer server) throws CoreException {
+ super(server);
+ }
+
+ @Override
+ protected void doConfigure(ILaunchConfigurationWorkingCopy launchConfig, JBossServer jbossServer,
+ IJBossServerRuntime jbossRuntime) throws CoreException {
+
+ JBossLaunchConfigProperties.setProgramArguments(getDefaultProgramArguments(jbossServer, jbossRuntime), launchConfig);
+ JBossLaunchConfigProperties.setMainType(getMainType(), launchConfig);
+ JBossLaunchConfigProperties.setWorkingDirectory(getWorkingDirectory(jbossServer, jbossRuntime), launchConfig);
+ JBossLaunchConfigProperties.setClasspath(getClasspath(jbossServer, jbossRuntime, JBossLaunchConfigProperties.getClasspath(launchConfig)), launchConfig);
+ JBossLaunchConfigProperties.setUseDefaultClassPath(isUseDefaultClasspath(), launchConfig);
+ JBossLaunchConfigProperties.setServerId(getServerId(jbossServer), launchConfig);
+ }
+
+ @Override
+ protected String getDefaultProgramArguments(JBossServer server, IJBossServerRuntime runtime) throws CoreException {
+ JBossBehaviourDelegate delegate = ServerUtil.checkedGetBehaviorDelegate(server.getServer());
+ return delegate.getDefaultStopArguments();
+ }
+
+ @Override
+ protected String getMainType() {
+ return IJBossRuntimeConstants.SHUTDOWN_MAIN_TYPE;
+ }
+
+ @Override
+ protected String getWorkingDirectory(JBossServer server, IJBossServerRuntime jbossRuntime) throws CoreException {
+ return ServerUtil.getServerBinDirectory(server).toOSString();
+ }
+
+ @Override
+ protected List<String> getClasspath(JBossServer server, IJBossServerRuntime runtime, List<String> currentClasspath)
+ throws CoreException {
+ ArrayList<IRuntimeClasspathEntry> classpath = new ArrayList<IRuntimeClasspathEntry>();
+ LaunchConfigUtils.addCPEntry(ServerUtil.getServerHomePath(server).toOSString(), IJBossRuntimeResourceConstants.SHUTDOWN_JAR_LOC, classpath);
+ LaunchConfigUtils.addJREEntry(runtime.getVM(), classpath);
+ return LaunchConfigUtils.toStrings(classpath);
+ }
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalStopLaunchConfigurator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 5 months
JBoss Tools SVN: r32567 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-04 12:58:32 -0400 (Mon, 04 Jul 2011)
New Revision: 32567
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/AbstractLaunchConfigurator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/AbstractStartupConfigurator.java
Log:
[JBIDE-9215] added configurator super class
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/AbstractLaunchConfigurator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/AbstractLaunchConfigurator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/AbstractLaunchConfigurator.java 2011-07-04 16:58:32 UTC (rev 32567)
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal.launch.configuration;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractLaunchConfigurator implements ILaunchConfigConfigurator {
+
+ private static final String DEFAULTS_SET = "DEFAULTS_SET"; //$NON-NLS-1$
+
+ private JBossServer jbossServer;
+ private IJBossServerRuntime jbossRuntime;
+
+ public AbstractLaunchConfigurator(IServer server) throws CoreException {
+ this.jbossServer = ServerConverter.checkedGetJBossServer(server);
+ this.jbossRuntime = jbossServer.getRuntime();
+ }
+
+ @Override
+ public void configure(ILaunchConfigurationWorkingCopy launchConfig) throws CoreException {
+ if (!areDefaultsSet(launchConfig)) {
+ doConfigure(launchConfig, jbossServer, jbossRuntime);
+ setDefaultsSet(launchConfig);
+ }
+ }
+
+ protected abstract void doConfigure(ILaunchConfigurationWorkingCopy launchConfig, JBossServer jbossServer, IJBossServerRuntime jbossRuntime) throws CoreException;
+
+ protected abstract String getDefaultProgramArguments(JBossServer server, IJBossServerRuntime runtime) throws CoreException;
+
+ protected abstract String getMainType();
+
+ protected abstract String getWorkingDirectory(JBossServer server, IJBossServerRuntime jbossRuntime)
+ throws CoreException;
+
+ protected String getServerId(JBossServer server) {
+ return server.getServer().getId();
+ }
+
+ protected abstract List<String> getClasspath(JBossServer server, IJBossServerRuntime runtime, List<String> currentClasspath) throws CoreException;
+
+ protected boolean isUseDefaultClasspath() {
+ return false;
+ }
+
+ protected JBossServer getJbossServer() {
+ return jbossServer;
+ }
+
+ protected IJBossServerRuntime getJbossRuntime() {
+ return jbossRuntime;
+ }
+
+ private boolean areDefaultsSet(ILaunchConfigurationWorkingCopy launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(DEFAULTS_SET);
+ }
+
+ private void setDefaultsSet(ILaunchConfigurationWorkingCopy launchConfig) {
+ launchConfig.setAttribute(DEFAULTS_SET, true);
+ }
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/AbstractLaunchConfigurator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/AbstractStartupConfigurator.java (from rev 32422, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractStartupConfigurator.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/AbstractStartupConfigurator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/AbstractStartupConfigurator.java 2011-07-04 16:58:32 UTC (rev 32567)
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal.launch.configuration;
+
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
+
+/**
+ * @author André Dietisheim
+ */
+public abstract class AbstractStartupConfigurator extends AbstractLaunchConfigurator {
+
+ private static final String DEFAULT_CP_PROVIDER_ID = "org.jboss.ide.eclipse.as.core.server.internal.launch.serverClasspathProvider"; ///$NON-NLS-1$
+
+ public AbstractStartupConfigurator(IServer server) throws CoreException {
+ super(server);
+ }
+
+ @Override
+ protected void doConfigure(ILaunchConfigurationWorkingCopy launchConfig, JBossServer jbossServer, IJBossServerRuntime jbossRuntime) throws CoreException {
+ JBossLaunchConfigProperties.setProgramArguments(getDefaultProgramArguments(jbossServer, jbossRuntime), launchConfig);
+ JBossLaunchConfigProperties.setHost(getHost(jbossServer, jbossRuntime), launchConfig);
+ JBossLaunchConfigProperties.setConfig(getServerConfig(jbossRuntime), launchConfig);
+ JBossLaunchConfigProperties.setServerHome(getServerHome(jbossRuntime), jbossRuntime, launchConfig);
+ JBossLaunchConfigProperties.setVmArguments(getDefaultVMArguments(jbossRuntime), launchConfig);
+ JBossLaunchConfigProperties.setJreContainer(getJreContainerPath(jbossRuntime), launchConfig);
+ JBossLaunchConfigProperties.setEndorsedDir(getEndorsedDir(jbossRuntime), launchConfig);
+ JBossLaunchConfigProperties.setMainType(getMainType(), launchConfig);
+ JBossLaunchConfigProperties.setWorkingDirectory(getWorkingDirectory(jbossServer, jbossRuntime), launchConfig);
+ JBossLaunchConfigProperties.setEnvironmentVariables(getEnvironmentVariables(jbossRuntime), launchConfig);
+ JBossLaunchConfigProperties.setClasspathProvider(getClasspathProvider(), launchConfig);
+ JBossLaunchConfigProperties.setClasspath(getClasspath(jbossServer, jbossRuntime, JBossLaunchConfigProperties.getClasspath(launchConfig)), launchConfig);
+ JBossLaunchConfigProperties.setUseDefaultClassPath(isUseDefaultClasspath(), launchConfig);
+ JBossLaunchConfigProperties.setServerId(getServerId(jbossServer), launchConfig);
+ }
+
+
+ protected abstract String getEndorsedDir(IJBossServerRuntime runtime);
+
+ protected abstract String getServerConfig(IJBossServerRuntime runtime);
+
+ protected abstract String getServerHome(IJBossServerRuntime runtime);
+
+ private void setServerHome(String serverHome, IJBossServerRuntime runtime,
+ ILaunchConfigurationWorkingCopy launchConfig) throws CoreException {
+ if (!isCustomConfigLocation(runtime)) {
+ JBossLaunchConfigProperties.setServerHome(serverHome, runtime, launchConfig);
+ }
+ }
+
+ protected boolean isCustomConfigLocation(IJBossServerRuntime runtime) {
+ return runtime.getConfigLocation().equals(IJBossRuntimeResourceConstants.SERVER);
+ }
+
+ protected String getClasspathProvider() {
+ return DEFAULT_CP_PROVIDER_ID;
+ }
+
+ protected Map<String, String> getEnvironmentVariables(IJBossServerRuntime runtime) {
+ return runtime.getDefaultRunEnvVars();
+ }
+
+ protected abstract String getDefaultVMArguments(IJBossServerRuntime runtime);
+
+
+ protected String getJreContainerPath(IJBossServerRuntime runtime) {
+ IVMInstall vmInstall = runtime.getVM();
+ if (vmInstall == null) {
+ return null;
+ }
+ return JavaRuntime.newJREContainerPath(vmInstall).toPortableString();
+ }
+
+ protected abstract String getHost(JBossServer server, IJBossServerRuntime runtime);
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/AbstractStartupConfigurator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 5 months
JBoss Tools SVN: r32566 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-04 12:58:02 -0400 (Mon, 04 Jul 2011)
New Revision: 32566
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalJBossStartupConfigurator.java
Log:
[JBIDE-9215] renamed JBossStartupConfigurator to LocalJBossStartupConfigurator
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalJBossStartupConfigurator.java (from rev 32422, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossStartupConfigurator.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalJBossStartupConfigurator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalJBossStartupConfigurator.java 2011-07-04 16:58:02 UTC (rev 32566)
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal.launch.configuration;
+
+import java.net.MalformedURLException;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.internal.launch.RunJarContainerWrapper;
+import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
+import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
+import org.jboss.ide.eclipse.as.core.util.LaunchConfigUtils;
+import org.jboss.ide.eclipse.as.core.util.ServerUtil;
+
+public class LocalJBossStartupConfigurator extends AbstractStartupConfigurator {
+
+ public LocalJBossStartupConfigurator(IServer server) throws CoreException {
+ super(server);
+ }
+
+ @Override
+ protected String getMainType() {
+ return IJBossRuntimeConstants.START_MAIN_TYPE;
+ }
+
+ @Override
+ protected String getWorkingDirectory(JBossServer server, IJBossServerRuntime runtime) throws CoreException {
+ return ServerUtil.checkedGetServerHome(server)
+ + Path.SEPARATOR
+ + IJBossRuntimeResourceConstants.BIN;
+ }
+
+ @Override
+ protected List<String> getClasspath(JBossServer server, IJBossServerRuntime runtime, List<String> currentClasspath) throws CoreException {
+ try {
+ boolean replaced = replaceRunJarContainer(server, currentClasspath);
+ if (!replaced) {
+ String runJarEntry = LaunchConfigUtils.getRunJarRuntimeCPEntry(server.getServer()).getMemento();
+ currentClasspath.add(runJarEntry);
+ }
+ return currentClasspath;
+ } catch (CoreException ce) {
+ return currentClasspath;
+ }
+ }
+
+ private boolean replaceRunJarContainer(JBossServer server, List<String> classpath)
+ throws CoreException {
+ boolean replaced = false;
+ for (int i = 0; i < classpath.size(); i++) {
+ String classPathEntry = classpath.get(0);
+ if (classPathEntry.contains(RunJarContainerWrapper.ID)) {
+ replaced = true;
+ classpath.set(i, LaunchConfigUtils.getRunJarRuntimeCPEntry(server.getServer()).getMemento());
+ }
+ }
+ return replaced;
+ }
+
+ @Override
+ protected String getHost(JBossServer server, IJBossServerRuntime runtime) {
+ return server.getServer().getHost();
+ }
+
+ @Override
+ protected String getServerHome(IJBossServerRuntime runtime) {
+ String serverHome = null;
+ try {
+ serverHome = runtime.getConfigLocationFullPath().toFile().toURL().toString();
+ } catch (MalformedURLException murle) {
+ }
+ return serverHome;
+ }
+
+ @Override
+ protected String getServerConfig(IJBossServerRuntime runtime) {
+ return runtime.getJBossConfiguration();
+ }
+
+ @Override
+ protected String getEndorsedDir(IJBossServerRuntime runtime) {
+ return runtime.getRuntime().getLocation().append(
+ IJBossRuntimeResourceConstants.LIB).append(
+ IJBossRuntimeResourceConstants.ENDORSED).toOSString();
+ }
+
+ @Override
+ protected String getDefaultProgramArguments(JBossServer server, IJBossServerRuntime runtime) {
+ return runtime.getDefaultRunArgs() +
+ IJBossRuntimeConstants.SPACE + IJBossRuntimeConstants.STARTUP_ARG_HOST_SHORT +
+ IJBossRuntimeConstants.SPACE + server.getServer().getHost();
+ }
+
+ @Override
+ protected String getDefaultVMArguments(IJBossServerRuntime runtime) {
+ // not needed
+ return null;
+ }
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/LocalJBossStartupConfigurator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 5 months
JBoss Tools SVN: r32565 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-04 12:57:06 -0400 (Mon, 04 Jul 2011)
New Revision: 32565
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/JBossLaunchConfigProperties.java
Log:
[JBIDE-9215] renamed JBossLaunchConfigUtils to JBossLaunchConfigProperties
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/JBossLaunchConfigProperties.java (from rev 32425, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossRuntimeLaunchConfigUtils.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/JBossLaunchConfigProperties.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/JBossLaunchConfigProperties.java 2011-07-04 16:57:06 UTC (rev 32565)
@@ -0,0 +1,254 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal.launch.configuration;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
+import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
+
+/**
+ * @author André Dietisheim
+ */
+public class JBossLaunchConfigProperties {
+
+ private static final String SERVER_ID = "server-id"; //$NON-NLS-1$
+
+ public static void setClasspath(List<String> entries, ILaunchConfigurationWorkingCopy launchConfig) {
+ if (isSet(entries)) {
+ launchConfig.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, entries);
+ }
+ }
+
+ public static boolean isClasspathSet(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH);
+ }
+
+ public static void setUseDefaultClassPath(boolean useDefaultClassPath, ILaunchConfigurationWorkingCopy launchConfig) {
+ launchConfig.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, useDefaultClassPath);
+ }
+
+ public static boolean isUseDefaultClasspath(ILaunchConfiguration launchConfig) throws CoreException {
+ return isUseDefaultClasspath(launchConfig, true);
+ }
+
+ public static boolean isUseDefaultClasspath(ILaunchConfiguration launchConfig, boolean defaultValue) throws CoreException {
+ return launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, defaultValue);
+ }
+
+ public static boolean isUseDefaultClasspathSet(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH);
+ }
+
+ public static void setMainType(String mainType, ILaunchConfigurationWorkingCopy launchConfig) {
+ if (isSet(mainType)) {
+ launchConfig.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, mainType);
+ }
+ }
+
+ public static boolean isMainTypeSet(ILaunchConfigurationWorkingCopy launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME);
+ }
+
+ public static void setWorkingDirectory(String directory, ILaunchConfigurationWorkingCopy launchConfig) {
+ if (isSet(directory)) {
+ launchConfig.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, directory);
+ }
+ }
+
+ public static boolean isWorkingDirectorySet(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY);
+ }
+
+ public static void setServerId(String serverId, ILaunchConfigurationWorkingCopy launchConfig) {
+ if (isSet(serverId)) {
+ launchConfig.setAttribute(SERVER_ID, serverId);
+ }
+ }
+
+ public static String getServerId(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.getAttribute(SERVER_ID, (String) null);
+ }
+
+ public static boolean isServerIdSet(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(SERVER_ID);
+ }
+
+ public static void setHost(String host, ILaunchConfigurationWorkingCopy launchConfig) throws CoreException {
+ if (isSet(host)) {
+ String currentHost = getHost(launchConfig);
+ if (currentHost == null
+ || !host.equals(currentHost)) {
+ String programArguments = getProgramArguments(launchConfig);
+ programArguments = ArgsUtil.setArg(programArguments,
+ IJBossRuntimeConstants.STARTUP_ARG_HOST_SHORT,
+ IJBossRuntimeConstants.STARTUP_ARG_HOST_LONG,
+ host);
+ setProgramArguments(programArguments, launchConfig);
+ }
+ }
+ }
+
+ public static boolean isHostSet(ILaunchConfiguration launchConfig) throws CoreException {
+ String value = ArgsUtil.getValue(getProgramArguments(launchConfig),
+ IJBossRuntimeConstants.STARTUP_ARG_HOST_SHORT,
+ IJBossRuntimeConstants.STARTUP_ARG_HOST_LONG);
+ return value != null;
+ }
+
+ public static void setProgramArguments(String programArguments, ILaunchConfigurationWorkingCopy launchConfig)
+ throws CoreException {
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments);
+ }
+
+ public static String getProgramArguments(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$;
+ }
+
+ public static boolean areProgramArgumentsSet(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS);
+ }
+
+ public static boolean isConfigSet(ILaunchConfiguration launchConfig) throws CoreException {
+ String value = ArgsUtil.getValue(getProgramArguments(launchConfig),
+ IJBossRuntimeConstants.STARTUP_ARG_CONFIG_SHORT,
+ IJBossRuntimeConstants.STARTUP_ARG_CONFIG_LONG);
+ return value != null;
+ }
+
+ public static String getHost(ILaunchConfiguration launchConfig) throws CoreException {
+ return ArgsUtil.getValue(getProgramArguments(launchConfig),
+ IJBossRuntimeConstants.STARTUP_ARG_HOST_SHORT,
+ IJBossRuntimeConstants.STARTUP_ARG_HOST_LONG);
+ }
+
+ public static void setConfig(String config, ILaunchConfigurationWorkingCopy launchConfig) throws CoreException {
+ if (isSet(config)) {
+ String programArguments = getProgramArguments(launchConfig);
+ programArguments = ArgsUtil.setArg(programArguments,
+ IJBossRuntimeConstants.STARTUP_ARG_CONFIG_SHORT,
+ IJBossRuntimeConstants.STARTUP_ARG_CONFIG_LONG, config);
+ setProgramArguments(programArguments, launchConfig);
+ }
+ }
+
+ public static void setJreContainer(String vmContainerPath, ILaunchConfigurationWorkingCopy launchConfig) {
+ if (isSet(vmContainerPath)) {
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, vmContainerPath);
+ }
+ }
+
+ public static boolean isJreContainerSet(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH);
+ }
+
+ public static void setServerHome(String serverHome, IJBossServerRuntime runtime,
+ ILaunchConfigurationWorkingCopy launchConfig) throws CoreException {
+ if (isSet(serverHome)) {
+ String programArguments = getProgramArguments(launchConfig);
+ String arguments = ArgsUtil.setArg(programArguments,
+ null,
+ IJBossRuntimeConstants.SYSPROP + IJBossRuntimeConstants.JBOSS_SERVER_HOME_URL,
+ serverHome);
+ setProgramArguments(arguments, launchConfig);
+ }
+ }
+
+ public static boolean isServerHomeSet(ILaunchConfigurationWorkingCopy launchConfig) throws CoreException {
+ String value = ArgsUtil.getValue(getProgramArguments(launchConfig),
+ null,
+ IJBossRuntimeConstants.SYSPROP + IJBossRuntimeConstants.JBOSS_SERVER_HOME_URL);
+ return value != null;
+ }
+
+ public static void setClasspathProvider(String classpathProvider, ILaunchConfigurationWorkingCopy launchConfig) {
+ if (isSet(classpathProvider)) {
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, classpathProvider);
+ }
+ }
+
+ public static boolean isClasspathProviderSet(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER);
+ }
+
+ public static void setEndorsedDir(String endorsedDir, ILaunchConfigurationWorkingCopy launchConfig)
+ throws CoreException {
+ if (isSet(endorsedDir)) {
+ String vmArguments = getVMArguments(launchConfig);
+ vmArguments = ArgsUtil.setArg(vmArguments,
+ null, IJBossRuntimeConstants.SYSPROP + IJBossRuntimeConstants.ENDORSED_DIRS, endorsedDir);
+ setVmArguments(vmArguments, launchConfig);
+ }
+ }
+
+ public static boolean isEndorsedDirSet(ILaunchConfiguration launchConfig) throws CoreException {
+ String value = ArgsUtil.getValue(getVMArguments(launchConfig),
+ null,
+ IJBossRuntimeConstants.SYSPROP + IJBossRuntimeConstants.ENDORSED_DIRS);
+ return value != null;
+ }
+
+ public static void setVmArguments(String vmArguments, ILaunchConfigurationWorkingCopy launchConfig) {
+ if (isSet(vmArguments)) {
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArguments);
+ }
+ }
+
+ public static String getVMArguments(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, ""); //$NON-NLS-1$
+ }
+
+ public static boolean areVMArgumentsSet(ILaunchConfigurationWorkingCopy launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS);
+ }
+
+ public static void setEnvironmentVariables(Map<String, String> environmentVariables,
+ ILaunchConfigurationWorkingCopy launchConfig) {
+ if (isSet(environmentVariables)) {
+ launchConfig.setAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES, environmentVariables);
+ }
+ }
+
+ public static boolean areEnvironmentVariablesSet(ILaunchConfiguration launchConfig) throws CoreException {
+ return launchConfig.hasAttribute(ILaunchManager.ATTR_ENVIRONMENT_VARIABLES);
+ }
+
+ @SuppressWarnings("unchecked")
+ public static List<String> getClasspath(ILaunchConfiguration launchConfig) throws CoreException {
+ return (List<String>) launchConfig.getAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, new ArrayList<String>());
+ }
+
+ private static boolean isSet(String value) {
+ return value != null && value.length() > 0;
+ }
+
+ private static boolean isSet(List<String> list) {
+ return list != null;
+ }
+
+ private static boolean isSet(Map<String, String> map) {
+ return map != null;
+ }
+
+}
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/JBossLaunchConfigProperties.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 5 months
JBoss Tools SVN: r32563 - in trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch: configuration and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-07-04 12:53:52 -0400 (Mon, 04 Jul 2011)
New Revision: 32563
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/ILaunchConfigConfigurator.java
Log:
[JBIDE-9215] added copyright header
Copied: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/ILaunchConfigConfigurator.java (from rev 32422, trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/ILaunchConfigConfigurator.java)
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/ILaunchConfigConfigurator.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/ILaunchConfigConfigurator.java 2011-07-04 16:53:52 UTC (rev 32563)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.ide.eclipse.as.core.server.internal.launch.configuration;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+
+/**
+ * @author André Dietisheim
+ */
+public interface ILaunchConfigConfigurator {
+
+ public abstract void configure(ILaunchConfigurationWorkingCopy launchConfig) throws CoreException;
+
+}
\ No newline at end of file
Property changes on: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/configuration/ILaunchConfigConfigurator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
13 years, 5 months
JBoss Tools SVN: r32561 - trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test.
by jbosstools-commits@lists.jboss.org
Author: max.andersen(a)jboss.com
Date: 2011-07-04 12:47:36 -0400 (Mon, 04 Jul 2011)
New Revision: 32561
Removed:
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/bin/
Modified:
trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test/
Log:
remove bad bin
Property changes on: trunk/bpmn/tests/org.jboss.tools.bpmn.ui.bot.test
___________________________________________________________________
Added: svn:ignore
+ target
buildlog.latest.txt
bin
build
13 years, 5 months