Author: adietish
Date: 2011-07-05 12:33:31 -0400 (Tue, 05 Jul 2011)
New Revision: 32619
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7StartLaunchConfiguration.java
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/JBoss7ServerStartupLaunchConfiguration.java
Log:
[JBIDE-9215] added infrastructure for remote launching (added delegate capability).
Switching is not implemented yet, it's the next step
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-05
16:26:51 UTC (rev 32618)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-07-05
16:33:31 UTC (rev 32619)
@@ -68,6 +68,7 @@
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy launchConfig,
IProgressMonitor monitor)
throws CoreException {
+ // TODO: implement setup for RSE launch delegate too
new LocalJBoss7StartupConfigurator(getServer()).configure(launchConfig);
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerStartupLaunchConfiguration.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerStartupLaunchConfiguration.java 2011-07-05
16:26:51 UTC (rev 32618)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerStartupLaunchConfiguration.java 2011-07-05
16:33:31 UTC (rev 32619)
@@ -10,70 +10,92 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.v7;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
-import org.eclipse.debug.core.model.IProcess;
-import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
-import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import
org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration;
-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.server.internal.launch.LocalJBossStartLaunchDelegate;
/**
* @author Rob Stryker
*/
-public class JBoss7ServerStartupLaunchConfiguration extends
JBossServerStartupLaunchConfiguration implements
- ILaunchConfigurationDelegate {
+public class JBoss7ServerStartupLaunchConfiguration extends
JBossServerStartupLaunchConfiguration {
- public String[] getJavaLibraryPath(ILaunchConfiguration configuration) throws
CoreException {
- return new String[] {};
+ private static HashMap<String, StartLaunchDelegate> launchDelegates;
+ private static ArrayList<IStartLaunchSetupParticipant> setupParticipants;
+
+ static {
+ setupParticipants = new ArrayList<IStartLaunchSetupParticipant>();
+ setupParticipants.add(new LocalJBossStartLaunchDelegate());
+ launchDelegates = new HashMap<String, StartLaunchDelegate>();
+ launchDelegates.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, new
LocalJBoss7StartLaunchConfiguration());
}
+
+ public static void addLaunchDelegateMapping(String mode, StartLaunchDelegate del) {
+ launchDelegates.put(mode, del);
+ }
- public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode,
IProgressMonitor monitor)
- throws CoreException {
- JBossServerBehavior jbsBehavior =
JBossServerBehaviorUtils.getServerBehavior(configuration);
- if( LaunchCommandPreferences.ignoreLaunchCommand(jbsBehavior.getServer())) {
- jbsBehavior.setServerStarting();
- jbsBehavior.setServerStarted();
- return false;
- }
- // TODO: use the configured poller
- boolean started = WebPortPoller.onePing(jbsBehavior.getServer());
- if( started ) {
- jbsBehavior.setServerStarting();
- jbsBehavior.setServerStarted();
- return false;
- }
- return true;
+ public static void addSetupLaunchParticipant(IStartLaunchSetupParticipant participant)
{
+ setupParticipants.add(participant);
}
- 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
+ // Allow all participants to set some defaults for their own details
+ // Participants should be careful not to change shared launch keys / values
+ // unless their operation mode (local / rse / etc) is in use
+ public static void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy,
IServer server) throws CoreException {
+ for( Iterator<IStartLaunchSetupParticipant> i = setupParticipants.iterator();
i.hasNext(); ) {
+ i.next().setupLaunchConfiguration(workingCopy, server);
}
+ }
+
+ protected StartLaunchDelegate getDelegate(ILaunchConfiguration configuration) throws
CoreException {
+// TODO: choose delegate upon setting (server editor)
+// IServer server = ServerUtil.getServer(configuration);
+// DeployableServerBehavior beh = ServerConverter.getDeployableServerBehavior(server);
+// IJBossServerPublishMethodType type =
beh.createPublishMethod().getPublishMethodType();
+// return launchDelegates.get(type.getId());
+
+// always return local launch delegate until all parts were implemented
+ return new LocalJBoss7StartLaunchConfiguration();
+
}
+
+ public void actualLaunch(ILaunchConfiguration configuration,
+ String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ 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);
+ }
+ /*
+ * Ensures that the working directory and classpath are 100% accurate.
+ * Merges proper required params into args and vm args
+ */
+ @Override
+ public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode,
IProgressMonitor monitor) throws CoreException {
+ return getDelegate(configuration).preLaunchCheck(configuration, mode, monitor);
+ }
- public void postLaunch(ILaunchConfiguration configuration, String mode, ILaunch launch,
IProgressMonitor monitor)
- throws CoreException {
- try {
- JBoss7ServerBehavior behavior =
JBossServerBehaviorUtils.getJBoss7ServerBehavior(configuration);
- IProcess[] processes = launch.getProcesses();
- if (processes != null && processes.length >= 1) {
- behavior.setProcess(processes[0]);
- ((LocalJBossBehaviorDelegate) (behavior.getDelegate())).setProcess(processes[0]);
- }
- behavior.setRunMode(mode);
- } catch (CoreException ce) {
- // report it
- }
+ @Override
+ public void preLaunch(ILaunchConfiguration configuration,
+ String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ getDelegate(configuration).preLaunch(configuration, mode, launch, monitor);
}
+
+ @Override
+ public void postLaunch(ILaunchConfiguration configuration, String mode,
+ ILaunch launch, IProgressMonitor monitor) throws CoreException {
+ getDelegate(configuration).postLaunch(configuration, mode, launch, monitor);
+ }
}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7StartLaunchConfiguration.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7StartLaunchConfiguration.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7StartLaunchConfiguration.java 2011-07-05
16:33:31 UTC (rev 32619)
@@ -0,0 +1,80 @@
+/*******************************************************************************
+ * Copyright (c) 2011 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.v7;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.model.IProcess;
+import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
+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.LocalJBossStartLaunchDelegate;
+import org.jboss.ide.eclipse.as.core.util.JBossServerBehaviorUtils;
+import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
+
+/**
+ * @author Rob Stryker
+ */
+public class LocalJBoss7StartLaunchConfiguration extends LocalJBossStartLaunchDelegate
+ implements StartLaunchDelegate, IStartLaunchSetupParticipant {
+
+ public String[] getJavaLibraryPath(ILaunchConfiguration configuration) throws
CoreException {
+ return new String[] {};
+ }
+
+ public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode,
IProgressMonitor monitor)
+ throws CoreException {
+ JBossServerBehavior jbsBehavior =
JBossServerBehaviorUtils.getServerBehavior(configuration);
+ if( LaunchCommandPreferences.ignoreLaunchCommand(jbsBehavior.getServer())) {
+ jbsBehavior.setServerStarting();
+ jbsBehavior.setServerStarted();
+ return false;
+ }
+ // TODO: use the configured poller
+ 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 {
+ JBoss7ServerBehavior behavior =
JBossServerBehaviorUtils.getJBoss7ServerBehavior(configuration);
+ IProcess[] processes = launch.getProcesses();
+ if (processes != null && processes.length >= 1) {
+ behavior.setProcess(processes[0]);
+ ((LocalJBossBehaviorDelegate) (behavior.getDelegate())).setProcess(processes[0]);
+ }
+ behavior.setRunMode(mode);
+ } catch (CoreException ce) {
+ // report it
+ }
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7StartLaunchConfiguration.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain