Author: adietish
Date: 2011-07-04 12:37:42 -0400 (Mon, 04 Jul 2011)
New Revision: 32558
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossStartLaunchDelegate.java
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
Log:
[JBIDE-9215] deprecating LocalJBossServerStartupLaunchUtil:
* bad name
* calls super method in delegating class back again!
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-07-04
16:30:01 UTC (rev 32557)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java 2011-07-04
16:37:42 UTC (rev 32558)
@@ -58,9 +58,9 @@
static {
setupParticipants = new ArrayList<IStartLaunchSetupParticipant>();
- setupParticipants.add(new LocalJBossServerStartupLaunchUtil());
+ setupParticipants.add(new LocalJBossStartLaunchDelegate());
launchDelegates = new HashMap<String, StartLaunchDelegate>();
- launchDelegates.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, new
LocalJBossServerStartupLaunchUtil());
+ launchDelegates.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, new
LocalJBossStartLaunchDelegate());
}
public static void addLaunchDelegateMapping(String mode, StartLaunchDelegate del) {
@@ -114,6 +114,7 @@
getDelegate(configuration).actualLaunch(this, configuration, mode, launch, monitor);
}
+ @Deprecated
public void superActualLaunch(ILaunchConfiguration configuration,
String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
super.actualLaunch(configuration, mode, launch, monitor);
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-07-04
16:30:01 UTC (rev 32557)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-07-04
16:37:42 UTC (rev 32558)
@@ -15,7 +15,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
@@ -33,27 +32,28 @@
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.configuration.JBossLaunchConfigProperties;
+import
org.jboss.ide.eclipse.as.core.server.internal.launch.configuration.LocalJBossStartupConfigurator;
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.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.JBossServerBehaviorUtils;
import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
import org.jboss.ide.eclipse.as.core.util.LaunchConfigUtils;
/**
+ * @deprecated please use {@link LocalJBossStartLaunchDelegate}
+ *
* @author Rob Stryker
* @author André Dietisheim
*/
+@Deprecated
public class LocalJBossServerStartupLaunchUtil implements StartLaunchDelegate,
IStartLaunchSetupParticipant {
public static final String DEFAULTS_SET = "jboss.defaults.been.set";
//$NON-NLS-1$
- static final String START_JAR_LOC = IJBossRuntimeResourceConstants.BIN + Path.SEPARATOR
- + IJBossRuntimeResourceConstants.START_JAR;
static final String START_MAIN_TYPE = IJBossRuntimeConstants.START_MAIN_TYPE;
public void setupLaunchConfiguration(
ILaunchConfigurationWorkingCopy workingCopy, IServer server) throws CoreException {
- new JBossStartupConfigurator(server).configure(workingCopy);
+ new LocalJBossStartupConfigurator(server).configure(workingCopy);
}
public static class JBossServerDefaultClasspathProvider extends
StandardClasspathProvider {
@@ -69,7 +69,7 @@
protected IRuntimeClasspathEntry[] defaultEntries(ILaunchConfiguration config) {
try {
- String server = JBossRuntimeLaunchConfigUtils.getServerId(config);
+ String server = JBossLaunchConfigProperties.getServerId(config);
IServer s = ServerCore.findServer(server);
AbstractLocalJBossServerRuntime ibjsrt = (AbstractLocalJBossServerRuntime)
s.getRuntime().loadAdapter(AbstractLocalJBossServerRuntime.class, new
NullProgressMonitor());
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossStartLaunchDelegate.java
(from rev 32529,
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartLaunchDelegate.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossStartLaunchDelegate.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossStartLaunchDelegate.java 2011-07-04
16:37:42 UTC (rev 32558)
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * 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;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.StandardClasspathProvider;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerCore;
+import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
+import org.jboss.ide.eclipse.as.core.server.internal.AbstractLocalJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
+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.configuration.JBossLaunchConfigProperties;
+import
org.jboss.ide.eclipse.as.core.server.internal.launch.configuration.LocalJBossStartupConfigurator;
+import org.jboss.ide.eclipse.as.core.util.JBossServerBehaviorUtils;
+import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
+import org.jboss.ide.eclipse.as.core.util.LaunchConfigUtils;
+
+/**
+ * @author Rob Stryker
+ * @author André Dietisheim
+ */
+public class LocalJBossStartLaunchDelegate extends AbstractJBossLaunchConfigType
implements StartLaunchDelegate, IStartLaunchSetupParticipant {
+
+ public void setupLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy workingCopy, IServer server) throws CoreException {
+ new LocalJBossStartupConfigurator(server).configure(workingCopy);
+ }
+
+ /*
+ * Actual instance methods
+ */
+ public void actualLaunch(
+ JBossServerStartupLaunchConfiguration launchConfig,
+ ILaunchConfiguration configuration, String mode, ILaunch launch,
+ IProgressMonitor monitor) throws CoreException {
+ launch(configuration, mode, launch, monitor);
+ }
+
+ public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode,
IProgressMonitor monitor)
+ throws CoreException {
+ JBossServerBehavior jbsBehavior =
JBossServerBehaviorUtils.getServerBehavior(configuration);
+ if (!jbsBehavior.canStart(mode).isOK())
+ throw new CoreException(jbsBehavior.canStart(mode));
+ if (LaunchCommandPreferences.ignoreLaunchCommand(jbsBehavior.getServer())) {
+ jbsBehavior.setServerStarting();
+ jbsBehavior.setServerStarted();
+ return false;
+ }
+ boolean started = WebPortPoller.onePing(jbsBehavior.getServer());
+ if (started) {
+ jbsBehavior.setServerStarting();
+ jbsBehavior.setServerStarted();
+ return false;
+ }
+
+ return true;
+ }
+
+ public void preLaunch(ILaunchConfiguration configuration,
+ String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ try {
+ JBossServerBehavior jbsBehavior =
JBossServerBehaviorUtils.getServerBehavior(configuration);
+ jbsBehavior.setRunMode(mode);
+ jbsBehavior.serverStarting();
+ } catch (CoreException ce) {
+ // report it
+ }
+ }
+
+ public void postLaunch(ILaunchConfiguration configuration, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ try {
+ IProcess[] processes = launch.getProcesses();
+ JBossServerBehavior jbsBehavior =
JBossServerBehaviorUtils.getServerBehavior(configuration);
+ ((LocalJBossBehaviorDelegate) (jbsBehavior.getDelegate())).setProcess(processes[0]);
+ } catch (CoreException ce) {
+ // report
+ }
+ }
+
+ public static class JBossServerDefaultClasspathProvider extends
StandardClasspathProvider {
+ public IRuntimeClasspathEntry[] computeUnresolvedClasspath(ILaunchConfiguration
configuration)
+ throws CoreException {
+ if (JBossLaunchConfigProperties.isUseDefaultClasspath(configuration)) {
+ return defaultEntries(configuration);
+ }
+ return super.computeUnresolvedClasspath(configuration);
+ }
+
+ protected IRuntimeClasspathEntry[] defaultEntries(ILaunchConfiguration config) {
+ try {
+ String server = JBossLaunchConfigProperties.getServerId(config);
+ IServer s = ServerCore.findServer(server);
+ AbstractLocalJBossServerRuntime ibjsrt = (AbstractLocalJBossServerRuntime)
+ s.getRuntime().loadAdapter(AbstractLocalJBossServerRuntime.class, new
NullProgressMonitor());
+ IVMInstall install = ibjsrt.getVM();
+ ArrayList<IRuntimeClasspathEntry> list = new
ArrayList<IRuntimeClasspathEntry>();
+ LaunchConfigUtils.addJREEntry(install, list);
+ list.add(LaunchConfigUtils.getRunJarRuntimeCPEntry(s));
+ return (IRuntimeClasspathEntry[]) list
+ .toArray(new IRuntimeClasspathEntry[list.size()]);
+ } catch (CoreException ce) {
+ // ignore
+ }
+
+ try {
+ return super.computeUnresolvedClasspath(config);
+ } catch (CoreException ce) {
+ // ignore
+ }
+ return new IRuntimeClasspathEntry[] {};
+ }
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossStartLaunchDelegate.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain