Author: rob.stryker(a)jboss.com
Date: 2011-07-18 07:04:24 -0400 (Mon, 18 Jul 2011)
New Revision: 33005
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7StartLaunchConfiguration.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DelegatingServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7ServerBehavior.java
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.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSECorePlugin.java
Log:
JBIDE-8960 - Unifying DelegatingJBoss7StartLaunchConfiguration and its super class
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2011-07-18
11:00:38 UTC (rev 33004)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/ExtensionManager.java 2011-07-18
11:04:24 UTC (rev 33005)
@@ -30,6 +30,7 @@
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerType;
+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.IJBossServerPublisher;
import org.jboss.ide.eclipse.as.core.server.IPollerFailureHandler;
@@ -37,6 +38,11 @@
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.ServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.internal.ServerStatePollerType;
+import org.jboss.ide.eclipse.as.core.server.internal.launch.IStartLaunchDelegate;
+import
org.jboss.ide.eclipse.as.core.server.internal.launch.IStartLaunchSetupParticipant;
+import
org.jboss.ide.eclipse.as.core.server.internal.launch.LocalJBossStartLaunchDelegate;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.LocalJBoss7StartLaunchDelegate;
+import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
/**
* Manages the extensions for this plugin
@@ -331,4 +337,39 @@
defaultAlreadyStartedHandler = handler;
}
+
+ /**
+ * Temporary home for start launch setup participants and launch configs
+ * Should eventually be replaced by an extension point of some type
+ *
+ * TODO Convert this into a suitable fixed API
+ */
+ public static HashMap<String, IStartLaunchDelegate> JBoss7launchDelegates;
+ public static ArrayList<IStartLaunchSetupParticipant> JBoss7setupParticipants;
+ public static HashMap<String, IStartLaunchDelegate> JBossLaunchDelegates;
+ public static ArrayList<IStartLaunchSetupParticipant> JBossSetupParticipants;
+ static {
+ JBoss7setupParticipants = new ArrayList<IStartLaunchSetupParticipant>();
+ JBoss7launchDelegates = new HashMap<String, IStartLaunchDelegate>();
+ JBoss7setupParticipants.add(new LocalJBoss7StartLaunchDelegate());
+ JBoss7launchDelegates.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, new
LocalJBoss7StartLaunchDelegate());
+
+ JBossSetupParticipants = new ArrayList<IStartLaunchSetupParticipant>();
+ JBossLaunchDelegates = new HashMap<String, IStartLaunchDelegate>();
+ JBossSetupParticipants.add(new LocalJBossStartLaunchDelegate());
+ JBossLaunchDelegates.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, new
LocalJBossStartLaunchDelegate());
+ }
+ public HashMap<String, IStartLaunchDelegate> getLaunchDelegates(IServer server) {
+ if( server.getServerType().getId().equals(IJBossToolingConstants.SERVER_AS_70)) {
+ return JBoss7launchDelegates;
+ }
+ return JBossLaunchDelegates;
+ }
+ public ArrayList<IStartLaunchSetupParticipant> getSetupParticipants(IServer
server) {
+ if( server.getServerType().getId().equals(IJBossToolingConstants.SERVER_AS_70)) {
+ return JBoss7setupParticipants;
+ }
+ return JBossSetupParticipants;
+ }
+
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DelegatingServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DelegatingServerBehavior.java 2011-07-18
11:00:38 UTC (rev 33004)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/DelegatingServerBehavior.java 2011-07-18
11:04:24 UTC (rev 33005)
@@ -98,7 +98,7 @@
* to participate?
*/
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy,
IProgressMonitor monitor) throws CoreException {
- DelegatingStartLaunchConfiguration.setupLaunchConfiguration(workingCopy, getServer());
+ new DelegatingStartLaunchConfiguration().setupLaunchConfiguration(workingCopy,
getServer());
}
public void setRunMode(String mode) {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-07-18
11:00:38 UTC (rev 33004)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServerBehavior.java 2011-07-18
11:04:24 UTC (rev 33005)
@@ -108,7 +108,7 @@
* to participate?
*/
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy,
IProgressMonitor monitor) throws CoreException {
- DelegatingStartLaunchConfiguration.setupLaunchConfiguration(workingCopy, getServer());
+ new DelegatingStartLaunchConfiguration().setupLaunchConfiguration(workingCopy,
getServer());
}
public void setRunMode(String mode) {
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java 2011-07-18
11:00:38 UTC (rev 33004)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/DelegatingStartLaunchConfiguration.java 2011-07-18
11:04:24 UTC (rev 33005)
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007 Red Hat, Inc.
+ * 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,
@@ -21,36 +21,24 @@
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerUtil;
-import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
public class DelegatingStartLaunchConfiguration extends
AbstractJBossStartLaunchConfiguration {
-
- private static HashMap<String, IStartLaunchDelegate> launchDelegates;
- private static ArrayList<IStartLaunchSetupParticipant> setupParticipants;
-
- static {
- setupParticipants = new ArrayList<IStartLaunchSetupParticipant>();
- setupParticipants.add(new LocalJBossStartLaunchDelegate());
- launchDelegates = new HashMap<String, IStartLaunchDelegate>();
- launchDelegates.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, new
LocalJBossStartLaunchDelegate());
+ public ArrayList<IStartLaunchSetupParticipant> getSetupParticipants(IServer
server) {
+ return ExtensionManager.getDefault().getSetupParticipants(server);
}
-
- public static void addLaunchDelegateMapping(String mode, IStartLaunchDelegate del) {
- launchDelegates.put(mode, del);
+ public HashMap<String, IStartLaunchDelegate> getLaunchDelegates(IServer server) {
+ return ExtensionManager.getDefault().getLaunchDelegates(server);
}
- public static void addSetupLaunchParticipant(IStartLaunchSetupParticipant participant)
{
- setupParticipants.add(participant);
- }
-
// 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(); ) {
+ public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy,
IServer server) throws CoreException {
+ for( Iterator<IStartLaunchSetupParticipant> i =
getSetupParticipants(server).iterator(); i.hasNext(); ) {
i.next().setupLaunchConfiguration(workingCopy, server);
}
}
@@ -59,7 +47,7 @@
IServer server = ServerUtil.getServer(configuration);
DeployableServerBehavior beh = ServerConverter.getDeployableServerBehavior(server);
IJBossServerPublishMethodType type = beh.createPublishMethod().getPublishMethodType();
- return launchDelegates.get(type.getId());
+ return getLaunchDelegates(server).get(type.getId());
}
public void actualLaunch(ILaunchConfiguration configuration,
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7ServerBehavior.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7ServerBehavior.java 2011-07-18
11:00:38 UTC (rev 33004)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7ServerBehavior.java 2011-07-18
11:04:24 UTC (rev 33005)
@@ -35,10 +35,10 @@
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
+import
org.jboss.ide.eclipse.as.core.server.internal.launch.DelegatingStartLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
@@ -73,7 +73,7 @@
public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy launchConfig,
IProgressMonitor monitor)
throws CoreException {
// TODO: implement setup for RSE launch delegate too
- DelegatingJBoss7StartLaunchConfiguration.setupLaunchConfiguration(launchConfig,
getServer());
+ new DelegatingStartLaunchConfiguration().setupLaunchConfiguration(launchConfig,
getServer());
}
public void setProcess(IProcess process) {
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7StartLaunchConfiguration.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7StartLaunchConfiguration.java 2011-07-18
11:00:38 UTC (rev 33004)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/DelegatingJBoss7StartLaunchConfiguration.java 2011-07-18
11:04:24 UTC (rev 33005)
@@ -1,102 +0,0 @@
-/*******************************************************************************
- * 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 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.ILaunchConfigurationWorkingCopy;
-import org.eclipse.wst.server.core.IServer;
-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.internal.DeployableServerBehavior;
-import
org.jboss.ide.eclipse.as.core.server.internal.launch.DelegatingStartLaunchConfiguration;
-import org.jboss.ide.eclipse.as.core.server.internal.launch.IStartLaunchDelegate;
-import
org.jboss.ide.eclipse.as.core.server.internal.launch.IStartLaunchSetupParticipant;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-
-/**
- * @author Rob Stryker
- */
-public class DelegatingJBoss7StartLaunchConfiguration extends
DelegatingStartLaunchConfiguration {
-
- private static HashMap<String, IStartLaunchDelegate> launchDelegates;
- private static ArrayList<IStartLaunchSetupParticipant> setupParticipants;
-
- static {
- setupParticipants = new ArrayList<IStartLaunchSetupParticipant>();
- setupParticipants.add(new LocalJBoss7StartLaunchDelegate());
- launchDelegates = new HashMap<String, IStartLaunchDelegate>();
- launchDelegates.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD, new
LocalJBoss7StartLaunchDelegate());
- }
-
- public static void addLaunchDelegateMapping(String mode, IStartLaunchDelegate del) {
- launchDelegates.put(mode, del);
- }
-
- public static void addSetupLaunchParticipant(IStartLaunchSetupParticipant participant)
{
- setupParticipants.add(participant);
- }
-
- // 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(); ) {
- IStartLaunchSetupParticipant setupParticipant = i.next();
- setupParticipant.setupLaunchConfiguration(workingCopy, server);
- }
- }
-
- protected IStartLaunchDelegate getDelegate(ILaunchConfiguration configuration) throws
CoreException {
- IServer server = ServerUtil.getServer(configuration);
- DeployableServerBehavior beh = ServerConverter.getDeployableServerBehavior(server);
- IJBossServerPublishMethodType type = beh.createPublishMethod().getPublishMethodType();
- return launchDelegates.get(type.getId());
- }
-
- 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);
- }
-
- @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);
- }
-}
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-18
11:00:38 UTC (rev 33004)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-07-18
11:04:24 UTC (rev 33005)
@@ -10,239 +10,11 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.v7;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.SubProgressMonitor;
-import org.eclipse.debug.core.DebugEvent;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.IDebugEventSetListener;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.wst.server.core.IModule;
-import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
-import org.jboss.ide.eclipse.as.core.Messages;
-import org.jboss.ide.eclipse.as.core.extensions.events.IEventCodes;
-import org.jboss.ide.eclipse.as.core.extensions.events.ServerLogger;
-import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
-import org.jboss.ide.eclipse.as.core.publishers.PublishUtil;
-import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
-import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethod;
-import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
-import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
-import org.jboss.ide.eclipse.as.core.util.LaunchCommandPreferences;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
-
/**
* @deprecated replaced by {@link DelegatingJBoss7ServerBehavior}
*
* @author Rob Stryker
*/
-public class JBoss7ServerBehavior extends DelegatingServerBehavior {
-
- public static final String MARK_DO_DEPLOY =
"org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7JSTPublisher.markUndeploy";
//$NON-NLS-1$
-
- private IProcess serverProcess;
- private IJBoss7ManagerService service;
- private IDebugEventSetListener serverProcessListener;
- private PollThread pollThread;
-
- private static HashMap<String, Class> delegateClassMap;
- static {
- delegateClassMap = new HashMap<String, Class>();
- delegateClassMap.put(LocalPublishMethod.LOCAL_PUBLISH_METHOD,
LocalJBoss7BehaviorDelegate.class);
- }
-
- public static void addDelegateMapping(String s, Class c) {
- delegateClassMap.put(s, c);
- }
-
- protected HashMap<String, Class> getDelegateMap() {
- return delegateClassMap;
- }
-
- public boolean shouldSuspendScanner() {
- return false;
- }
-
- public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy launchConfig,
IProgressMonitor monitor)
- throws CoreException {
- // TODO: implement setup for RSE launch delegate too
- new LocalJBoss7StartConfigurator(getServer()).configure(launchConfig);
- }
-
- public void setProcess(IProcess process) {
- this.serverProcess = process;
- initDebugListener(process);
- }
-
- private void initDebugListener(IProcess process) {
- DebugPlugin.getDefault().addDebugEventListener(serverProcessListener = new
JBossServerLifecycleListener());
- }
-
- private void disposeServerProcessListener() {
- if( serverProcessListener != null ) {
- DebugPlugin.getDefault().removeDebugEventListener(serverProcessListener);
- serverProcess = null;
- if( pollThread != null )
- pollThread.cancel();
- }
- }
-
- @Override
- protected void publishModule(int kind, int deltaKind, IModule[] module, IProgressMonitor
monitor)
- throws CoreException {
- super.publishModule(kind, deltaKind, module, monitor);
- }
-
- @Override
- protected void publishFinish(IProgressMonitor monitor) throws CoreException {
- // Handle the dodeploy
- createDoDeployMarkers(monitor);
- super.publishFinish(new SubProgressMonitor(monitor, 1));
- }
-
- private void createDoDeployMarkers(IProgressMonitor monitor) throws CoreException {
- if (!hasMarkedDoDeploy()) {
- return;
- }
- List<IPath> paths = getMarkedDoDeploy();
- monitor.beginTask("Completing Publishes", paths.size() + 1); //$NON-NLS-1$
- createDoDeployMarker(paths, monitor);
- }
-
- public void restartModule(IModule[] module, IProgressMonitor monitor) throws
CoreException {
- IDeployableServer ds = ServerConverter.getDeployableServer(getServer());
- if( ds == null )
- return;
-
- IJBossServerPublishMethod method = getOrCreatePublishMethod();
- IPath depPath = PublishUtil.getDeployPath(method, module, ds);
- createDoDeployMarker(new IPath[]{depPath}, monitor);
- }
-
-
- protected IJBoss7ManagerService getService() throws Exception {
- if (service == null) {
- service = JBoss7ManagerUtil.getService(getServer());
- }
- return service;
- }
-
- private boolean isServerRunning(String host, int port) throws Exception {
- try {
- return getService().getServerState(host, port) == JBoss7ServerState.RUNNING;
- } catch (JBoss7ManangerConnectException e) {
- return false;
- }
- }
-
- public void stop(boolean force) {
- if( LaunchCommandPreferences.isIgnoreLaunchCommand(getServer())) {
- super.setServerStopped();
- return;
- }
- try {
- if (force) {
- if( serverProcess != null )
- serverProcess.terminate();
- } else {
- setServerStopping();
- String host = getServer().getHost();
- JBoss7Server server = ServerConverter.checkedGetJBossServer(getServer(),
JBoss7Server.class);
- int mgmtPort = server.getManagementPort();
- // TODO: for now only local, implement for remote afterwards
- if (isServerRunning(host, mgmtPort)) {
- // The service and Poller will make sure the server is down
- getService().stop(host, mgmtPort);
- return;
- } else {
- if( serverProcess != null && !serverProcess.isTerminated()) {
- serverProcess.terminate();
- }
- }
- }
- } catch (Exception e) {
- IStatus status = new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
MessageFormat.format(Messages.JBoss7ServerBehavior_could_not_stop, getServer().getName()),
e);
- JBossServerCorePlugin.getDefault().getLog().log(status);
- }
- setServerStopped();
- }
-
- @Override
- public void dispose() {
- super.dispose();
- if (service != null) {
- service.dispose();
- }
- }
-
- @Override
- public void setServerStopped() {
- disposeServerProcessListener();
- logServerStopped();
- super.setServerStopped();
- }
-
- private void logServerStopped() {
- IStatus status = new Status(IStatus.INFO,
- JBossServerCorePlugin.PLUGIN_ID, IEventCodes.BEHAVIOR_PROCESS_TERMINATED,
- Messages.TERMINATED, null);
- ServerLogger.getDefault().log(getServer(), status);
- }
-
- private class JBossServerLifecycleListener implements IDebugEventSetListener {
-
- public void handleDebugEvents(DebugEvent[] events) {
- for (DebugEvent event : events) {
- if (serverProcess != null && serverProcess.equals(event.getSource())
- && event.getKind() == DebugEvent.TERMINATE) {
- setServerStopped();
- break;
- }
- }
- }
- }
-
- public void markDoDeploy(IPath path) {
- Object o = getPublishData(MARK_DO_DEPLOY);
- if(!(o instanceof List<?>)) {
- o = new ArrayList<IPath>();
- setPublishData(MARK_DO_DEPLOY, o);
- }
- List<IPath> list = (List<IPath>)o;
- if( !list.contains(path)) {
- list.add(path);
- }
-
- }
-
- public boolean hasMarkedDoDeploy() {
- return getMarkedDoDeploy().size() > 0;
- }
-
- private List<IPath> getMarkedDoDeploy() {
- Object o = getPublishData(MARK_DO_DEPLOY);
- if (!(o instanceof List<?>)) {
- return Collections.emptyList();
- }
- return (List<IPath>) o;
- }
- private void createDoDeployMarker(IPath[] paths, IProgressMonitor monitor) throws
CoreException {
- List<IPath> allPaths = Arrays.asList(paths);
- createDoDeployMarker(allPaths, monitor);
- }
- private void createDoDeployMarker(List<IPath> paths, IProgressMonitor monitor)
throws CoreException {
- DeploymentMarkerUtils.addDoDeployMarker(getOrCreatePublishMethod(), getServer(), paths,
monitor);
- }
+public class JBoss7ServerBehavior extends DelegatingJBoss7ServerBehavior {
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSECorePlugin.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSECorePlugin.java 2011-07-18
11:00:38 UTC (rev 33004)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSECorePlugin.java 2011-07-18
11:04:24 UTC (rev 33005)
@@ -12,10 +12,9 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.rse.core;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.server.internal.DelegatingServerBehavior;
-import
org.jboss.ide.eclipse.as.core.server.internal.launch.DelegatingStartLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.server.internal.v7.DelegatingJBoss7ServerBehavior;
-import
org.jboss.ide.eclipse.as.core.server.internal.v7.DelegatingJBoss7StartLaunchConfiguration;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
@@ -35,13 +34,11 @@
public void start(BundleContext bundleContext) throws Exception {
RSECorePlugin.context = bundleContext;
DelegatingServerBehavior.addDelegateMapping(RSEPublishMethod.RSE_ID,
RSEBehaviourDelegate.class);
- DelegatingStartLaunchConfiguration.addLaunchDelegateMapping(RSEPublishMethod.RSE_ID,
new RSEJBossStartLaunchDelegate());
- DelegatingStartLaunchConfiguration.addSetupLaunchParticipant(new
RSEJBossStartLaunchDelegate());
-
DelegatingJBoss7ServerBehavior.addDelegateMapping(RSEPublishMethod.RSE_ID,
RSEJBoss7BehaviourDelegate.class);
- DelegatingJBoss7StartLaunchConfiguration.addLaunchDelegateMapping(RSEPublishMethod.RSE_ID,
new RSEJBoss7StartLaunchDelegate());
- DelegatingJBoss7StartLaunchConfiguration.addSetupLaunchParticipant(new
RSEJBoss7StartLaunchDelegate());
-
+ ExtensionManager.JBossLaunchDelegates.put(RSEPublishMethod.RSE_ID, new
RSEJBossStartLaunchDelegate());
+ ExtensionManager.JBossSetupParticipants.add(new RSEJBossStartLaunchDelegate());
+ ExtensionManager.JBoss7launchDelegates.put(RSEPublishMethod.RSE_ID, new
RSEJBoss7StartLaunchDelegate());
+ ExtensionManager.JBoss7setupParticipants.add(new RSEJBoss7StartLaunchDelegate());
}
/*