Author: adietish
Date: 2011-05-10 10:04:34 -0400 (Tue, 10 May 2011)
New Revision: 31180
Added:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerConnectException.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeLaunchConfigurator.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/JBoss7RuntimeClasspathUtil.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/JBossServerBehaviorUtils.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java
Removed:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeClasspathUtil.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeLaunchConfigBuilder.java
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/WebPortPoller.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerAttributeHelper.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/TwiddleLaunchConfiguration.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerStartupLaunchConfiguration.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/ServerLogView.java
Log:
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/WebPortPoller.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/WebPortPoller.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/extensions/polling/WebPortPoller.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -41,7 +41,7 @@
t.start();
}
- public void pollerRun() {
+ private void pollerRun() {
done = false;
String url = getURL(getServer());
while(!canceled && !done) {
@@ -53,7 +53,7 @@
}
}
- public static String getURL(IServer server) {
+ private static String getURL(IServer server) {
String url = "http://"+server.getHost(); //$NON-NLS-1$
JBossServer jbs = ServerConverter.getJBossServer(server);
int port = jbs.getJBossWebPort();
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/IJBoss7ManagerService.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -26,8 +26,8 @@
/**
* Asynchronously deploy a file to a server
+ * @param host
*
- * @param host
* The host
* @param port
* The port
@@ -130,6 +130,8 @@
*/
public JBoss7ServerState getServerState(String host, int port) throws Exception;
+ public JBoss7ServerState getServerState(String host) throws Exception;
+
/**
* Stops the given server
*
@@ -139,6 +141,6 @@
public void stop(String host, int port) throws Exception;
public void stop(String host) throws Exception;
-
+
public void dispose();
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossBehaviorDelegate.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -37,6 +37,7 @@
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.launch.StopLaunchConfiguration;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
+import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
/**
*
@@ -161,10 +162,11 @@
}
protected void pollServer(final boolean expectedState) {
- if( this.pollThread != null ) {
+ if( pollThread != null ) {
pollThread.cancel();
}
- this.pollThread = new PollThread(Messages.ServerPollerThreadName, expectedState,
getActualBehavior());
+ IServerStatePoller poller = PollThreadUtils.getPoller(expectedState, getServer());
+ this.pollThread = new PollThread(Messages.ServerPollerThreadName, expectedState,
poller, getActualBehavior());
pollThread.start();
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/LocalJBossServerRuntime.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -10,6 +10,26 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.DEFAULT_MEM_ARGS;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.DEFAULT_MEM_ARGS_AS50;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.ENDORSED_DIRS;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.EQ;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.JAVA_LIB_PATH;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.JAVA_PREFER_IP4_ARG;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.PROGRAM_NAME_ARG;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.QUOTE;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.SERVER_ARG;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.SPACE;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.STARTUP_ARG_CONFIG_LONG;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.SUN_CLIENT_GC_ARG;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.SUN_SERVER_GC_ARG;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.SYSPROP;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants.BIN;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants.ENDORSED;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants.LIB;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants.NATIVE;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants.SERVER;
+
import java.util.HashMap;
import org.eclipse.core.runtime.IPath;
@@ -23,15 +43,14 @@
import org.eclipse.wst.server.core.IRuntimeType;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
-import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
-import org.jboss.ide.eclipse.as.core.util.IConstants;
+import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
public class LocalJBossServerRuntime extends AbstractLocalJBossServerRuntime implements
IJBossServerRuntime {
public void setDefaults(IProgressMonitor monitor) {
super.setDefaults(monitor);
- setAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME,
IJBossServerConstants.DEFAULT_CONFIGURATION);
+ setAttribute(IJBossServerRuntime.PROPERTY_CONFIGURATION_NAME,
IJBossRuntimeResourceConstants.DEFAULT_CONFIGURATION);
}
protected String getNextRuntimeName() {
@@ -68,47 +87,46 @@
}
public String getDefaultRunArgs() {
- return IConstants.STARTUP_ARG_CONFIG_LONG + "=" + getJBossConfiguration() +
IConstants.SPACE; //$NON-NLS-1$
+ return STARTUP_ARG_CONFIG_LONG + "=" + getJBossConfiguration() + SPACE;
//$NON-NLS-1$
}
public String getDefaultRunVMArgs() {
- IConstants c = new IConstants(){};
String name = getRuntime().getName();
- String ret = c.QUOTE + c.SYSPROP + c.PROGRAM_NAME_ARG + c.EQ +
- "JBossTools: " + name + c.QUOTE + c.SPACE; //$NON-NLS-1$
+ String ret = QUOTE + SYSPROP + PROGRAM_NAME_ARG + EQ +
+ "JBossTools: " + name + QUOTE + SPACE; //$NON-NLS-1$
if( Platform.getOS().equals(Platform.OS_MACOSX))
- ret += c.SERVER_ARG + c.SPACE;
+ ret += SERVER_ARG + SPACE;
IRuntimeType type = getRuntime().getRuntimeType();
if (type != null &&
(IJBossToolingConstants.AS_50.equals(type.getId()) ||
IJBossToolingConstants.AS_51.equals(type.getId()) ||
IJBossToolingConstants.AS_60.equals(type.getId()) ||
IJBossToolingConstants.EAP_50.equals(type.getId())) ) {
- ret += c.DEFAULT_MEM_ARGS_AS50;
+ ret += DEFAULT_MEM_ARGS_AS50;
} else {
- ret += c.DEFAULT_MEM_ARGS;
+ ret += DEFAULT_MEM_ARGS;
}
if( Platform.getOS().equals(Platform.OS_LINUX))
- ret += c.SYSPROP + c.JAVA_PREFER_IP4_ARG + c.EQ + true + c.SPACE;
- ret += c.SYSPROP + c.SUN_CLIENT_GC_ARG + c.EQ + 3600000 + c.SPACE;
- ret += c.SYSPROP + c.SUN_SERVER_GC_ARG + c.EQ + 3600000 + c.SPACE;
- ret += c.QUOTE + c.SYSPROP + c.ENDORSED_DIRS + c.EQ +
- (getRuntime().getLocation().append(c.LIB).append(c.ENDORSED)) + c.QUOTE + c.SPACE;
- if( getRuntime().getLocation().append(c.BIN).append(c.NATIVE).toFile().exists() )
- ret += c.SYSPROP + c.JAVA_LIB_PATH + c.EQ + c.QUOTE +
- getRuntime().getLocation().append(c.BIN).append(c.NATIVE) + c.QUOTE + c.SPACE;
+ ret += SYSPROP + JAVA_PREFER_IP4_ARG + EQ + true + SPACE;
+ ret += SYSPROP + SUN_CLIENT_GC_ARG + EQ + 3600000 + SPACE;
+ ret += SYSPROP + SUN_SERVER_GC_ARG + EQ + 3600000 + SPACE;
+ ret += QUOTE + SYSPROP + ENDORSED_DIRS + EQ +
+ (getRuntime().getLocation().append(LIB).append(ENDORSED)) + QUOTE + SPACE;
+ if( getRuntime().getLocation().append(BIN).append(NATIVE).toFile().exists() )
+ ret += SYSPROP + JAVA_LIB_PATH + EQ + QUOTE +
+ getRuntime().getLocation().append(BIN).append(NATIVE) + QUOTE + SPACE;
return ret;
}
public HashMap<String, String> getDefaultRunEnvVars(){
HashMap<String, String> envVars = new HashMap<String, String>(1);
- envVars.put("Path", IConstants.NATIVE); //$NON-NLS-1$
+ envVars.put("Path", NATIVE); //$NON-NLS-1$
return envVars;
}
public String getConfigLocation() {
- return getAttribute(PROPERTY_CONFIG_LOCATION, IConstants.SERVER);
+ return getAttribute(PROPERTY_CONFIG_LOCATION, SERVER);
}
public void setConfigLocation(String configLocation) {
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/PollThread.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -21,12 +21,10 @@
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.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.IPollerFailureHandler;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller.PollingException;
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller.RequiresInfoException;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
/**
*
@@ -56,35 +54,15 @@
private JBossServerBehavior behavior;
private String pollerId;
- public PollThread(String name, boolean expectedState,
- JBossServerBehavior behavior) {
+ public PollThread(String name, boolean expectedState, IServerStatePoller poller,
JBossServerBehavior behavior) {
super(name);
this.expectedState = expectedState;
this.abort = false;
this.abortMessage = null;
this.behavior = behavior;
- this.poller = discoverPoller(behavior, expectedState);
+ this.poller = poller;
}
- protected IServerStatePoller discoverPoller(JBossServerBehavior behavior,
- boolean expectedState) {
- JBossServer s = ServerConverter.getJBossServer(behavior.getServer());
- ServerAttributeHelper helper = s.getAttributeHelper();
- String key = expectedState == IServerStatePoller.SERVER_UP ?
IJBossServerConstants.STARTUP_POLLER_KEY
- : IJBossServerConstants.SHUTDOWN_POLLER_KEY;
- String defaultPoller = expectedState == IServerStatePoller.SERVER_UP ?
IJBossServerConstants.DEFAULT_STARTUP_POLLER
- : IJBossServerConstants.DEFAULT_SHUTDOWN_POLLER;
- pollerId = helper.getAttribute(key, defaultPoller);
- ServerStatePollerType type = ExtensionManager.getDefault()
- .getPollerType(pollerId);
- if (type != null) {
- IServerStatePoller tempPoller = type.createPoller();
- tempPoller.setPollerType(type);
- return tempPoller;
- }
- return null;
- }
-
public void cancel() {
cancel(null);
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerAttributeHelper.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerAttributeHelper.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/ServerAttributeHelper.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -21,7 +21,6 @@
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.internal.Server;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
import org.jboss.ide.eclipse.as.core.Messages;
@@ -43,10 +42,10 @@
return null;
}
- private ServerWorkingCopy wch;
+ private IServerWorkingCopy wch;
private IServer server;
public ServerAttributeHelper(IServer server, IServerWorkingCopy copy) {
- this.wch = (ServerWorkingCopy)copy;
+ this.wch = copy;
this.server = server;
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/JBossServerStartupLaunchConfiguration.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -17,14 +17,19 @@
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.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+import org.jboss.ide.eclipse.as.core.Messages;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IJBossServerPublishMethodType;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
@@ -80,7 +85,11 @@
public String[] getJavaLibraryPath(ILaunchConfiguration configuration) throws
CoreException {
IServer server = ServerUtil.getServer(configuration);
- JBossServer jbs = AbstractJBossLaunchConfigType.findJBossServer(server.getId());
+ JBossServer jbs = ServerConverter.findJBossServer(server.getId());
+ if (jbs == null) {
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
+ NLS.bind(Messages.ServerNotFound, server.getId())));
+ }
IJBossServerRuntime runtime = (IJBossServerRuntime)
jbs.getServer().getRuntime().loadAdapter(IJBossServerRuntime.class, null);
IPath nativeFolder = runtime.getRuntime().getLocation()
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -36,7 +36,6 @@
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.ServerCore;
-import org.eclipse.wst.server.core.ServerUtil;
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;
@@ -46,12 +45,14 @@
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.v7.JBoss7RuntimeClasspathUtil;
import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
import org.jboss.ide.eclipse.as.core.util.IConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
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.JBoss7RuntimeClasspathUtil;
+import org.jboss.ide.eclipse.as.core.util.JBossServerBehaviorUtils;
+import org.jboss.ide.eclipse.as.core.util.ServerConverter;
public class LocalJBossServerStartupLaunchUtil implements StartLaunchDelegate,
IStartLaunchSetupParticipant {
@@ -67,11 +68,11 @@
}
// Upgrade old launch configs
- JBossServer jbs = AbstractJBossLaunchConfigType.findJBossServer(server.getId());
- if (jbs == null)
+ JBossServer jbs = ServerConverter.findJBossServer(server.getId());
+ if (jbs == null) {
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
NLS.bind(Messages.CannotSetUpImproperServer, server.getName())));
-
+ }
String cpProvider =
workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER,
(String) null);
if (!DEFAULT_CP_PROVIDER_ID.equals(cpProvider)) {
@@ -177,10 +178,11 @@
}
protected static void forceDefaultsSet(ILaunchConfigurationWorkingCopy wc, IServer
server) throws CoreException {
- JBossServer jbs = AbstractJBossLaunchConfigType.findJBossServer(server.getId());
- if (jbs == null)
+ JBossServer jbs = ServerConverter.findJBossServer(server.getId());
+ if (jbs == null) {
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
NLS.bind(Messages.CannotSetUpImproperServer, server.getName())));
+ }
String serverHome = AbstractJBossLaunchConfigType.getServerHome(jbs);
if (serverHome == null)
@@ -247,12 +249,6 @@
return null;
}
- public static JBossServerBehavior getServerBehavior(ILaunchConfiguration configuration)
throws CoreException {
- IServer server = ServerUtil.getServer(configuration);
- JBossServerBehavior jbossServerBehavior = (JBossServerBehavior)
server.getAdapter(JBossServerBehavior.class);
- return jbossServerBehavior;
- }
-
/* For "restore defaults" functionality */
private static final String DEFAULT_CP_PROVIDER_ID =
"org.jboss.ide.eclipse.as.core.server.internal.launch.serverClasspathProvider";
//$NON-NLS-1$
@@ -305,7 +301,7 @@
public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode,
IProgressMonitor monitor)
throws CoreException {
- JBossServerBehavior jbsBehavior = getServerBehavior(configuration);
+ JBossServerBehavior jbsBehavior =
JBossServerBehaviorUtils.getServerBehavior(configuration);
if (!jbsBehavior.canStart(mode).isOK())
throw new CoreException(jbsBehavior.canStart(mode));
return true;
@@ -314,7 +310,7 @@
public void preLaunch(ILaunchConfiguration configuration,
String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
try {
- JBossServerBehavior jbsBehavior = getServerBehavior(configuration);
+ JBossServerBehavior jbsBehavior =
JBossServerBehaviorUtils.getServerBehavior(configuration);
jbsBehavior.setRunMode(mode);
jbsBehavior.serverStarting();
} catch (CoreException ce) {
@@ -326,7 +322,7 @@
ILaunch launch, IProgressMonitor monitor) throws CoreException {
try {
IProcess[] processes = launch.getProcesses();
- JBossServerBehavior jbsBehavior = getServerBehavior(configuration);
+ JBossServerBehavior jbsBehavior =
JBossServerBehaviorUtils.getServerBehavior(configuration);
((LocalJBossBehaviorDelegate) (jbsBehavior.getDelegate())).setProcess(processes[0]);
} catch (CoreException ce) {
// report
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/StopLaunchConfiguration.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -100,23 +100,27 @@
}
public static String getDefaultArgs(JBossServer jbs) {
- IJBossRuntimeConstants c = new IJBossRuntimeConstants() {};
- IJBossToolingConstants tc = new IJBossToolingConstants() {};
String runtimeTypeId = jbs.getRuntime().getRuntime().getRuntimeType().getId();
String serverUrl;
- if (runtimeTypeId.equals(tc.AS_60)){
+ if (runtimeTypeId.equals(IJBossToolingConstants.AS_60)){
IJBoss6Server server6 =
(IJBoss6Server)jbs.getServer().loadAdapter(IJBoss6Server.class, new
NullProgressMonitor());
serverUrl = "service:jmx:rmi:///jndi/rmi://" + jbs.getHost() + ":"
+ server6.getJMXRMIPort() + "/jmxrmi"; //$NON-NLS-1$ //$NON-NLS-2$
//$NON-NLS-3$
} else {
serverUrl = jbs.getHost() + ":" + jbs.getJNDIPort(); //$NON-NLS-1$
}
- String args = c.SHUTDOWN_STOP_ARG + c.SPACE;
- args += c.SHUTDOWN_SERVER_ARG + c.SPACE + serverUrl + c.SPACE;
+ String args = IJBossRuntimeConstants.SHUTDOWN_STOP_ARG
+ + IJBossRuntimeConstants.SPACE;
+ args += IJBossRuntimeConstants.SHUTDOWN_SERVER_ARG
+ + IJBossRuntimeConstants.SPACE
+ + serverUrl
+ + IJBossRuntimeConstants.SPACE;
if( jbs.getUsername() != null && !jbs.getUsername().equals(""))
//$NON-NLS-1$
- args += c.SHUTDOWN_USER_ARG + c.SPACE + jbs.getUsername() + c.SPACE;
+ args += IJBossRuntimeConstants.SHUTDOWN_USER_ARG
+ + IJBossRuntimeConstants.SPACE + jbs.getUsername() + IJBossRuntimeConstants.SPACE;
if( jbs.getPassword() != null && !jbs.getPassword().equals(""))
//$NON-NLS-1$
- args += c.SHUTDOWN_PASS_ARG + c.SPACE + jbs.getPassword() + c.SPACE;
+ args += IJBossRuntimeConstants.SHUTDOWN_PASS_ARG
+ + IJBossRuntimeConstants.SPACE + jbs.getPassword() + IJBossRuntimeConstants.SPACE;
return args;
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/TwiddleLaunchConfiguration.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/TwiddleLaunchConfiguration.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/TwiddleLaunchConfiguration.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -10,22 +10,36 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.core.server.internal.launch;
+
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.RMIAdaptor;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.SHUTDOWN_ADAPTER_ARG;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.SHUTDOWN_PASS_ARG;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.SHUTDOWN_SERVER_ARG;
+import static
org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.SHUTDOWN_USER_ARG;
+import static org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants.SPACE;
+
import java.io.File;
import java.util.ArrayList;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugPlugin;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.debug.core.ILaunchManager;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IServer;
+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.JBossServer;
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.ServerConverter;
public class TwiddleLaunchConfiguration extends AbstractJBossLaunchConfigType {
@@ -40,7 +54,11 @@
}
public static ILaunchConfigurationWorkingCopy createLaunchConfiguration(IServer server,
String args) throws CoreException {
- JBossServer jbs = findJBossServer(server.getId());
+ JBossServer jbs = ServerConverter.findJBossServer(server.getId());
+ if (jbs == null) {
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
+ NLS.bind(Messages.ServerNotFound, server.getName())));
+ }
IJBossServerRuntime jbrt = findJBossServerRuntime(server);
String serverHome = getServerHome(jbs);
@@ -71,16 +89,28 @@
}
public static String getDefaultArgs(IServer server) throws CoreException {
- IJBossRuntimeConstants c = new IJBossRuntimeConstants() { };
- JBossServer jbs = findJBossServer(server.getId());
- String twiddleArgs = c.SHUTDOWN_SERVER_ARG + c.SPACE + jbs.getHost() + ":"
//$NON-NLS-1$
- + jbs.getJNDIPort() + c.SPACE + c.SHUTDOWN_ADAPTER_ARG
- + c.SPACE + c.RMIAdaptor + c.SPACE;
+ JBossServer jbs = ServerConverter.findJBossServer(server.getId());
+ if (jbs == null) {
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
+ NLS.bind(Messages.ServerNotFound, server.getName())));
+ }
+ String twiddleArgs = SHUTDOWN_SERVER_ARG
+ + SPACE
+ + jbs.getHost() + ":" + jbs.getJNDIPort() //$NON-NLS-1$
+ + SPACE
+ + SHUTDOWN_ADAPTER_ARG
+ + SPACE
+ + RMIAdaptor
+ + SPACE;
if( jbs.getUsername() != null )
- twiddleArgs += c.SHUTDOWN_USER_ARG + c.SPACE + jbs.getUsername() + c.SPACE;
+ twiddleArgs += SHUTDOWN_USER_ARG
+ + SPACE + jbs.getUsername()
+ + SPACE;
if( jbs.getPassword() != null )
- twiddleArgs += c.SHUTDOWN_PASS_ARG + c.SPACE + jbs.getPassword() + c.SPACE;
+ twiddleArgs += SHUTDOWN_PASS_ARG
+ + SPACE
+ + jbs.getPassword()
+ + SPACE;
return twiddleArgs;
}
-
}
Added:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java
(rev 0)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -0,0 +1,118 @@
+package org.jboss.ide.eclipse.as.core.server.internal.v7;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.server.IJBoss7ManagerService;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerStatePollerType;
+
+public class JBoss7ManagerServicePoller implements IServerStatePoller {
+
+ public static final String POLLER_ID =
"org.jboss.ide.eclipse.as.core.server.JBoss7ManagerServicePoller";
//$NON-NLS-1$
+ private IServer server;
+ private ServerStatePollerType type;
+ private boolean expectedState;
+
+ public void beginPolling(IServer server, boolean expectedState, PollThread pollTread) {
+ this.server = server;
+ this.expectedState = expectedState;
+ }
+
+ public ServerStatePollerType getPollerType() {
+ return type;
+ }
+
+ public void setPollerType(ServerStatePollerType type) {
+ this.type = type;
+ }
+
+ public IServer getServer() {
+ return server;
+ }
+
+ public boolean isComplete() throws PollingException, RequiresInfoException {
+ IJBoss7ManagerService service = null;
+ try {
+ service = JBoss7ManagerUtil.getService(server);
+ if (expectedState == SERVER_DOWN) {
+ return awaitShutdown(service);
+ } else {
+ return awaitRunning(service);
+ }
+ } catch (Exception e) {
+ throw new PollingException(e.getMessage());
+ } finally {
+ disposeService(service);
+ }
+ }
+
+ private Boolean awaitRunning(IJBoss7ManagerService service) {
+ try {
+ JBoss7ServerState serverState = null;
+ do {
+ serverState = service.getServerState(getServer().getHost());
+ System.err.println("state = " + serverState); //$NON-NLS-1$
+ } while (serverState == JBoss7ServerState.STARTING);
+ return serverState == JBoss7ServerState.RUNNING;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ private Boolean awaitShutdown(IJBoss7ManagerService service) {
+ try {
+ JBoss7ServerState serverState = null;
+ do {
+ serverState = service.getServerState(getServer().getHost());
+ System.err.println("state = " + serverState); //$NON-NLS-1$
+ } while (serverState == JBoss7ServerState.RUNNING);
+ return false;
+ } catch (JBoss7ManangerConnectException e) {
+ System.err.println("connection closed!"); //$NON-NLS-1$
+ return true;
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ private void disposeService(IJBoss7ManagerService service) {
+ if (service != null) {
+ service.dispose();
+ }
+ }
+
+ public boolean getState() throws PollingException, RequiresInfoException {
+ IJBoss7ManagerService service = null;
+ try {
+ service = JBoss7ManagerUtil.getService(getServer());
+ JBoss7ServerState serverState = service.getServerState(getServer().getHost());
+ return serverState == JBoss7ServerState.RUNNING
+ || serverState == JBoss7ServerState.RESTART_REQUIRED;
+ } catch (Exception e) {
+ throw new PollingException(e.getMessage());
+ } finally {
+ disposeService(service);
+ }
+ }
+
+ public void cleanup() {
+ }
+
+ public List<String> getRequiredProperties() {
+ return new ArrayList<String>();
+ }
+
+ public void failureHandled(Properties properties) {
+ }
+
+ public void cancel(int type) {
+ }
+
+ public int getTimeoutBehavior() {
+ return TIMEOUT_BEHAVIOR_FAIL;
+ }
+}
Property changes on:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServicePoller.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerServiceProxy.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -47,6 +47,10 @@
return checkedGetService().getServerState(host, port);
}
+ public JBoss7ServerState getServerState(String host) throws Exception {
+ return checkedGetService().getServerState(host);
+ }
+
public void stop(String host, int port) throws Exception {
checkedGetService().stop(host, port);
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManagerUtil.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -17,8 +17,6 @@
public class JBoss7ManagerUtil {
- public static final String SERVICE_VERSION_70 =
"org.jboss.ide.eclipse.as.management.as7.service"; //$NON-NLS-1$
-
public static IJBoss7ManagerService getService(IServer server) throws Exception {
BundleContext context = JBossServerCorePlugin.getContext();
JBoss7ManagerServiceProxy proxy = new JBoss7ManagerServiceProxy(context,
getRequiredVersion(server));
Added:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerConnectException.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerConnectException.java
(rev 0)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerConnectException.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat Inc..
+ * All rights reserved. This program and the accompanying materials
+ * are 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 Incorporated - initial API and implementation
+ *******************************************************************************/
+package org.jboss.ide.eclipse.as.core.server.internal.v7;
+
+/**
+ * @author André Dietisheim
+ */
+public class JBoss7ManangerConnectException extends JBoss7ManangerException {
+
+ private static final long serialVersionUID = 1L;
+
+ public JBoss7ManangerConnectException(Throwable cause) {
+ super(cause);
+ }
+
+}
Property changes on:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ManangerConnectException.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Deleted:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeClasspathUtil.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeClasspathUtil.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeClasspathUtil.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * 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.v7;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
-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.internal.launch.AbstractJBossLaunchConfigType;
-import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
-
-public class JBoss7RuntimeClasspathUtil {
-
- public static List<String> getClasspath(IServer server, IVMInstall vmInstall)
throws CoreException {
- List<IRuntimeClasspathEntry> classpath = new
ArrayList<IRuntimeClasspathEntry>();
- classpath.add(getModulesClasspathEntry(server));
- AbstractJBossLaunchConfigType.addJREEntry(classpath, vmInstall);
- List<String> runtimeClassPaths =
AbstractJBossLaunchConfigType.convertClasspath(classpath);
- return runtimeClassPaths;
- }
-
- public static IRuntimeClasspathEntry getModulesClasspathEntry(IServer server) throws
CoreException {
- IPath runtimeLocation = server.getRuntime().getLocation();
- IPath modulesLocation =
runtimeLocation.append(IJBossRuntimeResourceConstants.JBOSS_MODULES_JAR);
- return JavaRuntime.newArchiveRuntimeClasspathEntry(modulesLocation);
- }
-}
Deleted:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeLaunchConfigBuilder.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeLaunchConfigBuilder.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeLaunchConfigBuilder.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -1,90 +0,0 @@
-/*******************************************************************************
- * 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.v7;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.IVMInstall;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.wst.server.core.IRuntime;
-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.launch.AbstractJBossLaunchConfigType;
-import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
-
-public class JBoss7RuntimeLaunchConfigBuilder {
-
- private ILaunchConfigurationWorkingCopy launchConfig;
- private IJBossServerRuntime jbossRuntime;
-
- public JBoss7RuntimeLaunchConfigBuilder(ILaunchConfigurationWorkingCopy launchConfig,
IJBossServerRuntime runtime) {
- this.launchConfig = launchConfig;
- this.jbossRuntime = runtime;
- }
-
- public JBoss7RuntimeLaunchConfigBuilder setVmContainer() {
- IVMInstall vmInstall = jbossRuntime.getVM();
- if (vmInstall != null) {
- setVmContainer(JavaRuntime.newJREContainerPath(vmInstall).toPortableString());
- }
- return this;
- }
-
- public JBoss7RuntimeLaunchConfigBuilder setVmContainer(String vmPath) {
- launchConfig.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, vmPath);
- return this;
- }
-
- public JBoss7RuntimeLaunchConfigBuilder setDefaultArguments() {
- launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
- jbossRuntime.getDefaultRunArgs());
- launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
- jbossRuntime.getDefaultRunVMArgs());
- return this;
- }
-
- public JBoss7RuntimeLaunchConfigBuilder setClassPath(IServer server) throws
CoreException {
- return setClassPath(JBoss7RuntimeClasspathUtil.getClasspath(server,
jbossRuntime.getVM()));
- }
-
- public JBoss7RuntimeLaunchConfigBuilder setClassPath(List<String> entries) throws
CoreException {
- launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER,
- JBoss7ServerBehavior.DEFAULT_CP_PROVIDER_ID);
- launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, entries);
- launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH,
false);
- return this;
- }
-
- public JBoss7RuntimeLaunchConfigBuilder setMainType(String mainType) {
- launchConfig.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, mainType);
- return this;
- }
-
- public JBoss7RuntimeLaunchConfigBuilder setWorkingDirectory(IRuntime runtime) {
- setWorkingDirectory(runtime.getLocation().append(IJBossRuntimeResourceConstants.BIN).toString());
- return this;
- }
-
- public JBoss7RuntimeLaunchConfigBuilder setWorkingDirectory(String directory) {
- launchConfig.setAttribute(
- IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, directory);
- return this;
- }
-
- public void setServerId(IServer server) {
- launchConfig.setAttribute(AbstractJBossLaunchConfigType.SERVER_ID, server.getId());
- }
-}
Added:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeLaunchConfigurator.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeLaunchConfigurator.java
(rev 0)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeLaunchConfigurator.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * 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.v7;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IVMInstall;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.wst.server.core.IRuntime;
+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.launch.AbstractJBossLaunchConfigType;
+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.JBoss7RuntimeClasspathUtil;
+
+public class JBoss7RuntimeLaunchConfigurator {
+
+ private static final String DEFAULTS_SET = "DEFAULTS_SET"; //$NON-NLS-1$
+ private ILaunchConfigurationWorkingCopy launchConfig;
+
+ public JBoss7RuntimeLaunchConfigurator(ILaunchConfigurationWorkingCopy launchConfig) {
+ this.launchConfig = launchConfig;
+ }
+
+ public void apply(IServer server, IRuntime runtime, IJBossServerRuntime jbossRuntime)
throws CoreException {
+ if (!areDefaultsSet()) {
+ setVmContainer(jbossRuntime)
+ .setClassPath(server, jbossRuntime)
+ .setDefaultArguments(jbossRuntime)
+ .setMainType(IJBossRuntimeConstants.START7_MAIN_TYPE)
+ .setWorkingDirectory(runtime)
+ .setServerId(server)
+ .setDefaultsSet();
+ }
+ }
+
+ private JBoss7RuntimeLaunchConfigurator setVmContainer(IJBossServerRuntime jbossRuntime)
{
+ IVMInstall vmInstall = jbossRuntime.getVM();
+ if (vmInstall != null) {
+ setVmContainer(JavaRuntime.newJREContainerPath(vmInstall).toPortableString());
+ }
+ return this;
+ }
+
+ private JBoss7RuntimeLaunchConfigurator setVmContainer(String vmPath) {
+ launchConfig.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, vmPath);
+ return this;
+ }
+
+ private JBoss7RuntimeLaunchConfigurator setDefaultArguments(IJBossServerRuntime
jbossRuntime) {
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ jbossRuntime.getDefaultRunArgs());
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS,
+ jbossRuntime.getDefaultRunVMArgs());
+ return this;
+ }
+
+ private JBoss7RuntimeLaunchConfigurator setClassPath(IServer server, IJBossServerRuntime
jbossRuntime)
+ throws CoreException {
+ return setClassPath(JBoss7RuntimeClasspathUtil.getClasspath(server,
jbossRuntime.getVM()));
+ }
+
+ private JBoss7RuntimeLaunchConfigurator setClassPath(List<String> entries) throws
CoreException {
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER,
+ JBoss7ServerBehavior.DEFAULT_CP_PROVIDER_ID);
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, entries);
+ launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH,
false);
+ return this;
+ }
+
+ private JBoss7RuntimeLaunchConfigurator setMainType(String mainType) {
+ launchConfig.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, mainType);
+ return this;
+ }
+
+ private JBoss7RuntimeLaunchConfigurator setWorkingDirectory(IRuntime runtime) {
+ setWorkingDirectory(runtime.getLocation().append(IJBossRuntimeResourceConstants.BIN).toString());
+ return this;
+ }
+
+ private JBoss7RuntimeLaunchConfigurator setWorkingDirectory(String directory) {
+ launchConfig.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, directory);
+ return this;
+ }
+
+ private JBoss7RuntimeLaunchConfigurator setServerId(IServer server) {
+ launchConfig.setAttribute(AbstractJBossLaunchConfigType.SERVER_ID, server.getId());
+ return this;
+ }
+
+ private boolean areDefaultsSet() throws CoreException {
+ return launchConfig.hasAttribute(DEFAULTS_SET);
+ }
+
+ private void setDefaultsSet() {
+ launchConfig.setAttribute(DEFAULTS_SET, true);
+ }
+}
\ No newline at end of file
Property changes on:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7RuntimeLaunchConfigurator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerBehavior.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -13,6 +13,7 @@
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
@@ -20,25 +21,37 @@
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.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
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.server.IJBoss7ManagerService;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
-import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeConstants;
+import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
+import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
public class JBoss7ServerBehavior extends JBossServerBehavior {
+ private IProcess serverProcess;
+ private IJBoss7ManagerService service;
+ private IDebugEventSetListener serverProcessListener;
+ private PollThread pollThread;
+
public static final String DEFAULT_CP_PROVIDER_ID =
"org.jboss.ide.eclipse.as.core.server.internal.launch.serverClasspathProvider";
//$NON-NLS-1$
- private IJBoss7ManagerService service;
-
private static HashMap<String, Class> delegateClassMap;
static {
delegateClassMap = new HashMap<String, Class>();
@@ -53,17 +66,6 @@
return delegateClassMap;
}
- public void stop(boolean force) {
- try {
- IJBoss7ManagerService service = getService();
- // TODO: for now only local, implement for remote afterwards
- service.stop("localhost"); //$NON-NLS-1$
- setServerStopped();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
public boolean shouldSuspendScanner() {
return false;
}
@@ -72,19 +74,46 @@
throws CoreException {
IServer server = getServer();
IRuntime runtime = server.getRuntime();
- IJBossServerRuntime serverRuntime =
- (IJBossServerRuntime) runtime.loadAdapter(LocalJBoss7ServerRuntime.class, null);
- new JBoss7RuntimeLaunchConfigBuilder(launchConfig, serverRuntime)
- .setVmContainer()
- .setClassPath(server)
- .setDefaultArguments()
- .setMainType(IJBossRuntimeConstants.START7_MAIN_TYPE)
- .setWorkingDirectory(runtime)
- .setServerId(server);
+ IJBossServerRuntime serverRuntime = (IJBossServerRuntime)
runtime.loadAdapter(IJBossServerRuntime.class, null);
+ new JBoss7RuntimeLaunchConfigurator(launchConfig).apply(server, runtime,
serverRuntime);
}
+ public void setProcess(IProcess process) {
+ this.serverProcess = process;
+ initDebugListener(process);
+ }
+ protected void pollServer(final boolean expectedState) {
+ if( pollThread != null ) {
+ pollThread.cancel();
+ }
+ IServerStatePoller poller =
PollThreadUtils.getPoller(JBoss7ManagerServicePoller.POLLER_ID, expectedState,
getServer());
+ this.pollThread = new PollThread(Messages.ServerPollerThreadName, expectedState,
poller, this);
+ pollThread.start();
+ }
+
@Override
+ public void serverStarting() {
+ pollServer(IServerStatePoller.SERVER_UP);
+// super.serverStarting();
+ }
+
+ @Override
+ public void serverStopping() {
+ pollServer(IServerStatePoller.SERVER_DOWN);
+// super.serverStopping();
+ }
+
+ private void initDebugListener(IProcess process) {
+ DebugPlugin.getDefault().addDebugEventListener(serverProcessListener = new
JBossServerLifecycleListener());
+ }
+
+ private void disposeServerProcessListener() {
+ DebugPlugin.getDefault().removeDebugEventListener(serverProcessListener);
+ serverProcess = null;
+ }
+
+ @Override
protected void publishModule(int kind, int deltaKind, IModule[] module, IProgressMonitor
monitor)
throws CoreException {
if (method == null)
@@ -101,7 +130,7 @@
DeployableServerBehavior beh =
ServerConverter.getDeployableServerBehavior(getServer());
Object o = beh.getPublishData(JBoss7JSTPublisher.MARK_DO_DEPLOY);
if (o != null && (o instanceof ArrayList<?>)) {
- ArrayList<IPath> l = (ArrayList<IPath>) o;
+ List<IPath> l = (List<IPath>) o;
int size = l.size();
monitor.beginTask("Completing Publishes", size + 1); //$NON-NLS-1$
Iterator<IPath> i = l.iterator();
@@ -115,13 +144,38 @@
super.publishFinish(monitor);
}
- private IJBoss7ManagerService getService() throws Exception {
+ protected IJBoss7ManagerService getService() throws Exception {
if (service == null) {
service = JBoss7ManagerUtil.getService(getServer());
}
return service;
}
+ private boolean isServerRunning(String host) throws Exception {
+ try {
+ return getService().getServerState(host) == JBoss7ServerState.RUNNING;
+ } catch (JBoss7ManangerConnectException e) {
+ return false;
+ }
+ }
+
+ public void stop(boolean force) {
+ try {
+ if (force) {
+ serverProcess.terminate();
+ } else {
+ // TODO: for now only local, implement for remote afterwards
+ if (isServerRunning("localhost")) { //$NON-NLS-1$
+ getService().stop("localhost"); //$NON-NLS-1$
+ }
+ }
+ serverStopping();
+ setServerStopped();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
@Override
public void dispose() {
super.dispose();
@@ -129,4 +183,31 @@
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.equals(event.getSource())
+ && event.getKind() == DebugEvent.TERMINATE) {
+ setServerStopped();
+ break;
+ }
+ }
+ }
+ }
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerStartupLaunchConfiguration.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerStartupLaunchConfiguration.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7ServerStartupLaunchConfiguration.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -15,9 +15,10 @@
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.server.internal.JBossServerBehavior;
import
org.jboss.ide.eclipse.as.core.server.internal.launch.JBossServerStartupLaunchConfiguration;
-import
org.jboss.ide.eclipse.as.core.server.internal.launch.LocalJBossServerStartupLaunchUtil;
+import org.jboss.ide.eclipse.as.core.util.JBossServerBehaviorUtils;
/**
* @author Rob Stryker
@@ -29,22 +30,15 @@
return new String[] {};
}
- public void actualLaunch(ILaunchConfiguration configuration,
- String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
- super.actualLaunch(configuration, mode, launch, monitor);
- }
-
public boolean preLaunchCheck(ILaunchConfiguration configuration, String mode,
IProgressMonitor monitor)
throws CoreException {
- // return super.preLaunchCheck(configuration, mode, monitor);
return true;
}
- public void preLaunch(ILaunchConfiguration configuration,
- String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
- // super.preLaunch(configuration, mode, launch, monitor);
+ public void preLaunch(ILaunchConfiguration configuration, String mode, ILaunch launch,
IProgressMonitor monitor)
+ throws CoreException {
try {
- JBossServerBehavior jbsBehavior =
LocalJBossServerStartupLaunchUtil.getServerBehavior(configuration);
+ JBossServerBehavior jbsBehavior =
JBossServerBehaviorUtils.getServerBehavior(configuration);
jbsBehavior.setRunMode(mode);
jbsBehavior.serverStarting();
} catch (CoreException ce) {
@@ -52,13 +46,16 @@
}
}
- public void postLaunch(ILaunchConfiguration configuration, String mode,
- ILaunch launch, IProgressMonitor monitor) throws CoreException {
- // super.postLaunch(configuration, mode, launch, monitor);
+ public void postLaunch(ILaunchConfiguration configuration, String mode, ILaunch launch,
IProgressMonitor monitor)
+ throws CoreException {
try {
- JBossServerBehavior jbsBehavior =
LocalJBossServerStartupLaunchUtil.getServerBehavior(configuration);
- jbsBehavior.setRunMode(mode);
- jbsBehavior.setServerStarted();
+ JBoss7ServerBehavior behavior =
JBossServerBehaviorUtils.getJBoss7ServerBehavior(configuration);
+ IProcess[] processes = launch.getProcesses();
+ if (processes != null && processes.length >= 1) {
+ behavior.setProcess(processes[0]);
+ }
+ behavior.setRunMode(mode);
+ behavior.setServerStarted();
} catch (CoreException ce) {
// report it
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/LocalJBoss7BehaviorDelegate.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -15,6 +15,7 @@
import org.jboss.ide.eclipse.as.core.server.internal.LocalJBossBehaviorDelegate;
public class LocalJBoss7BehaviorDelegate extends LocalJBossBehaviorDelegate {
+
public IStatus canChangeState(String launchMode) {
// return Status.CANCEL_STATUS;
return Status.OK_STATUS;
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/DeploymentPreferenceLoader.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -23,7 +23,6 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IServer;
-import org.eclipse.wst.server.core.internal.Server;
import org.jboss.ide.eclipse.as.core.ExtensionManager;
import org.jboss.ide.eclipse.as.core.publishers.LocalPublishMethod;
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
@@ -65,7 +64,7 @@
}
public static DeploymentPreferences loadPreferencesFromServer(IServer server) {
- String xml = ((Server)server).getAttribute(DEPLOYMENT_PREFERENCES_KEY, (String)null);
+ String xml = server.getAttribute(DEPLOYMENT_PREFERENCES_KEY, (String)null);
ByteArrayInputStream bis = null;
if( xml != null ) {
bis = new ByteArrayInputStream(xml.getBytes());
Added:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/JBoss7RuntimeClasspathUtil.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/JBoss7RuntimeClasspathUtil.java
(rev 0)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/JBoss7RuntimeClasspathUtil.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -0,0 +1,39 @@
+/*******************************************************************************
+ * 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.util;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+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.internal.launch.AbstractJBossLaunchConfigType;
+
+public class JBoss7RuntimeClasspathUtil {
+
+ public static List<String> getClasspath(IServer server, IVMInstall vmInstall)
throws CoreException {
+ List<IRuntimeClasspathEntry> classpath = new
ArrayList<IRuntimeClasspathEntry>();
+ classpath.add(getModulesClasspathEntry(server));
+ AbstractJBossLaunchConfigType.addJREEntry(classpath, vmInstall);
+ List<String> runtimeClassPaths =
AbstractJBossLaunchConfigType.convertClasspath(classpath);
+ return runtimeClassPaths;
+ }
+
+ public static IRuntimeClasspathEntry getModulesClasspathEntry(IServer server) throws
CoreException {
+ IPath runtimeLocation = server.getRuntime().getLocation();
+ IPath modulesLocation =
runtimeLocation.append(IJBossRuntimeResourceConstants.JBOSS_MODULES_JAR);
+ return JavaRuntime.newArchiveRuntimeClasspathEntry(modulesLocation);
+ }
+}
Property changes on:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/JBoss7RuntimeClasspathUtil.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/JBossServerBehaviorUtils.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/JBossServerBehaviorUtils.java
(rev 0)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/JBossServerBehaviorUtils.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -0,0 +1,21 @@
+package org.jboss.ide.eclipse.as.core.util;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServerBehavior;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerBehavior;
+
+public class JBossServerBehaviorUtils {
+
+ public static JBossServerBehavior getServerBehavior(ILaunchConfiguration configuration)
throws CoreException {
+ IServer server = ServerUtil.getServer(configuration);
+ return (JBossServerBehavior) server.getAdapter(JBossServerBehavior.class);
+ }
+
+ public static JBoss7ServerBehavior getJBoss7ServerBehavior(ILaunchConfiguration
configuration) throws CoreException {
+ IServer server = ServerUtil.getServer(configuration);
+ return (JBoss7ServerBehavior) server.getAdapter(JBoss7ServerBehavior.class);
+ }
+}
Property changes on:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/JBossServerBehaviorUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java
(rev 0)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -0,0 +1,38 @@
+package org.jboss.ide.eclipse.as.core.util;
+
+import org.eclipse.wst.server.core.IServer;
+import org.jboss.ide.eclipse.as.core.ExtensionManager;
+import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.core.server.internal.ServerStatePollerType;
+
+public class PollThreadUtils {
+
+ public static String getPollerId(boolean expectedState, IServer server) {
+ JBossServer s = ServerConverter.getJBossServer(server);
+ ServerAttributeHelper helper = s.getAttributeHelper();
+ String key = expectedState == IServerStatePoller.SERVER_UP ?
+ IJBossToolingConstants.STARTUP_POLLER_KEY
+ : IJBossToolingConstants.SHUTDOWN_POLLER_KEY;
+ String defaultPoller = expectedState == IServerStatePoller.SERVER_UP ?
+ IJBossToolingConstants.DEFAULT_STARTUP_POLLER
+ : IJBossToolingConstants.DEFAULT_SHUTDOWN_POLLER;
+ String pollerId = helper.getAttribute(key, defaultPoller);
+ return pollerId;
+ }
+
+ public static IServerStatePoller getPoller(boolean expectedState, IServer server) {
+ return getPoller(getPollerId(expectedState, server), expectedState, server);
+ }
+
+ public static IServerStatePoller getPoller(String pollerId, boolean expectedState,
IServer server) {
+ ServerStatePollerType type = ExtensionManager.getDefault().getPollerType(pollerId);
+ if (type != null) {
+ IServerStatePoller tempPoller = type.createPoller();
+ tempPoller.setPollerType(type);
+ return tempPoller;
+ }
+ return null;
+ }
+}
Property changes on:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/PollThreadUtils.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -12,6 +12,7 @@
import java.util.ArrayList;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
@@ -28,6 +29,17 @@
* @author rob.stryker(a)jboss.com
*/
public class ServerConverter {
+
+ public static JBossServer findJBossServer(String serverId) throws CoreException {
+ if (serverId == null)
+ return null;
+
+ IServer s = ServerCore.findServer(serverId);
+ if (s == null)
+ return null;
+ return ServerConverter.getJBossServer(s);
+ }
+
public static JBossServer getJBossServer(IServer server) {
JBossServer jbServer = (JBossServer)server.getAdapter(JBossServer.class);
if (jbServer == null) {
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -17,7 +17,6 @@
import org.eclipse.wst.server.core.ServerCore;
import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
-import org.eclipse.wst.server.core.internal.ServerWorkingCopy;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServer;
@@ -44,7 +43,7 @@
IRuntimeWorkingCopy wc = rt.createRuntime(rtName, null);
IRuntime runtime = wc.save(true, null);
IServerType st =
ServerCore.findServerType("org.jboss.ide.eclipse.as.systemCopyServer");
//$NON-NLS-1$
- ServerWorkingCopy swc = (ServerWorkingCopy) st.createServer(serverName, null, null);
+ IServerWorkingCopy swc = st.createServer(serverName, null, null);
swc.setServerConfiguration(null);
swc.setName(serverName);
swc.setRuntime(runtime);
Modified: workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/plugin.xml
===================================================================
--- workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2011-05-10
12:55:23 UTC (rev 31179)
+++ workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.core/plugin.xml 2011-05-10
14:04:34 UTC (rev 31180)
@@ -699,6 +699,13 @@
supportsShutdown="true"
supportsStartup="true">
</serverPoller>
+ <serverPoller
+
class="org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManagerServicePoller"
+
id="org.jboss.ide.eclipse.as.core.server.JBoss7ManagerServicePoller"
+ name="JBoss 7 Manager Service Poller"
+ supportsShutdown="true"
+ supportsStartup="true">
+ </serverPoller>
</extension>
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/AS7Manager.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -25,6 +25,7 @@
import java.io.EOFException;
import java.io.File;
import java.io.IOException;
+import java.net.ConnectException;
import java.net.UnknownHostException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
@@ -40,6 +41,7 @@
import org.jboss.dmr.ModelNode;
import org.jboss.ide.eclipse.as.core.server.internal.v7.IJBoss7DeploymentResult;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7DeploymentState;
+import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerConnectException;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ManangerException;
import org.jboss.ide.eclipse.as.core.server.internal.v7.JBoss7ServerState;
import org.jboss.ide.eclipse.as.management.as7.AS7Messages;
@@ -189,12 +191,14 @@
));
}
return response.get(RESULT);
+ } catch(ConnectException e) {
+ throw new JBoss7ManangerConnectException(e);
} catch (Exception e) {
throw new JBoss7ManangerException(e);
}
}
- public void quietlyExecute(ModelNode node) throws JBoss7ManangerException {
+ private void quietlyExecute(ModelNode node) throws JBoss7ManangerException {
try {
client.execute(node);
} catch (Exception e) {
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.management.as7/src/org/jboss/ide/eclipse/as/management/as7/deployment/JBoss7ManagerService.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -57,6 +57,10 @@
return manager.getServerState();
}
+ public JBoss7ServerState getServerState(String host) throws Exception {
+ return new AS7Manager(host).getServerState();
+ }
+
public void stop(String host) throws Exception {
new AS7Manager(host).stopServer();
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEBehaviourDelegate.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -16,6 +16,7 @@
import org.jboss.ide.eclipse.as.core.server.IServerStatePoller;
import org.jboss.ide.eclipse.as.core.server.internal.AbstractJBossBehaviourDelegate;
import org.jboss.ide.eclipse.as.core.server.internal.PollThread;
+import org.jboss.ide.eclipse.as.core.util.PollThreadUtils;
public class RSEBehaviourDelegate extends AbstractJBossBehaviourDelegate {
private PollThread pollThread = null;
@@ -45,7 +46,8 @@
if( this.pollThread != null ) {
pollThread.cancel();
}
- this.pollThread = new PollThread(Messages.ServerPollerThreadName, expectedState,
getActualBehavior());
+ IServerStatePoller poller = PollThreadUtils.getPoller(expectedState, getServer());
+ this.pollThread = new PollThread(Messages.ServerPollerThreadName, expectedState,
poller, getActualBehavior());
pollThread.start();
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSELaunchDelegate.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -22,6 +22,7 @@
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.osgi.util.NLS;
import org.eclipse.rse.core.RSECorePlugin;
import org.eclipse.rse.services.clientserver.messages.SystemMessageException;
import org.eclipse.rse.services.shells.IHostOutput;
@@ -29,6 +30,8 @@
import org.eclipse.rse.services.shells.IHostShellChangeEvent;
import org.eclipse.rse.services.shells.IHostShellOutputListener;
import org.eclipse.wst.server.core.IServer;
+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.ServerLogger;
import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
import org.jboss.ide.eclipse.as.core.server.internal.DeployableServerBehavior;
@@ -43,6 +46,7 @@
import org.jboss.ide.eclipse.as.core.util.ArgsUtil;
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.JBossServerBehaviorUtils;
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.rse.core.RSEHostShellModel.ServerShellModel;
@@ -58,7 +62,7 @@
JBossServerStartupLaunchConfiguration launchConfig,
ILaunchConfiguration configuration, String mode, ILaunch launch,
IProgressMonitor monitor) throws CoreException {
- JBossServerBehavior beh =
LocalJBossServerStartupLaunchUtil.getServerBehavior(configuration);
+ JBossServerBehavior beh = JBossServerBehaviorUtils.getServerBehavior(configuration);
beh.setServerStarting();
String command = configuration.getAttribute(RSE_STARTUP_COMMAND, (String)null);
try {
@@ -128,8 +132,8 @@
public boolean preLaunchCheck(ILaunchConfiguration configuration,
String mode, IProgressMonitor monitor) throws CoreException {
// ping if up
- final JBossServerBehavior beh =
LocalJBossServerStartupLaunchUtil.getServerBehavior(configuration);
- boolean started = new WebPortPoller().onePing(beh.getServer());
+ final JBossServerBehavior beh =
JBossServerBehaviorUtils.getServerBehavior(configuration);
+ boolean started = WebPortPoller.onePing(beh.getServer());
if( started ) {
beh.setServerStarting();
beh.setServerStarted();
@@ -205,7 +209,11 @@
public static IServer findServer(ILaunchConfiguration config) throws CoreException {
String serverId = config.getAttribute("server-id", (String)null);
- JBossServer jbs = AbstractJBossLaunchConfigType.findJBossServer(serverId);
+ JBossServer jbs = ServerConverter.findJBossServer(serverId);
+ if (jbs == null) {
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
+ NLS.bind(Messages.ServerNotFound, serverId)));
+ }
return jbs.getServer();
}
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/DeploymentModuleOptionCompositeAssistant.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -13,10 +13,18 @@
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
+import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ICellModifier;
import org.eclipse.jface.viewers.ILabelProvider;
@@ -27,6 +35,8 @@
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.DisposeEvent;
+import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionEvent;
@@ -42,7 +52,6 @@
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.DirectoryDialog;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.TreeColumn;
@@ -51,6 +60,7 @@
import org.eclipse.ui.forms.widgets.ExpandableComposite;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.progress.UIJob;
import org.eclipse.wst.server.core.IModule;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServerWorkingCopy;
@@ -623,35 +633,69 @@
viewer.setCellModifier(new LocalDeploymentCellModifier());
viewer.setCellEditors(editors);
- Link link = new Link(root, SWT.DEFAULT);
- link.setText("<a>" + Messages.EditorRefreshViewer +
"</a>");
- link.addSelectionListener(new SelectionListener() {
- public void widgetSelected(SelectionEvent e) {
- refreshViewer();
- }
- public void widgetDefaultSelected(SelectionEvent e) {
- }
- });
- FormData linkData = new FormData();
- linkData.bottom = new FormAttachment(100,-5);
- linkData.left = new FormAttachment(0, 5);
- link.setLayoutData(linkData);
-
FormData treeData = new FormData();
treeData.top = new FormAttachment(0, 5);
- treeData.bottom = new FormAttachment(link, -5);
+ treeData.bottom = new FormAttachment(100, -5);
treeData.left = new FormAttachment(0, 5);
treeData.right = new FormAttachment(100, -5);
viewer.getTree().setLayoutData(treeData);
+ initWorkspaceChangeListener(root);
+
return root;
}
-
- private void refreshViewer() {
- page.refreshPossibleModules();
- viewer.setInput(""); // irrelevent
+
+ private void initWorkspaceChangeListener(Composite composite) {
+ final IResourceChangeListener workspaceChangeListener = onWorkspaceChanged();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(workspaceChangeListener);
+ composite.addDisposeListener(new DisposeListener() {
+
+ @Override
+ public void widgetDisposed(DisposeEvent e) {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(workspaceChangeListener);
+ }
+ });
}
+
+ private IResourceChangeListener onWorkspaceChanged() {
+ return new IResourceChangeListener() {
+
+ @Override
+ public void resourceChanged(final IResourceChangeEvent event) {
+ new UIJob("refreshing available deployments") {
+
+ @Override
+ public IStatus runInUIThread(IProgressMonitor monitor) {
+ viewer.refresh();
+ return Status.OK_STATUS;
+ }
+ }.schedule();
+ }
+ };
+ }
+
+ public IModule[] getPossibleModules() {
+ IServerWorkingCopy server = getPage().getServer();
+ List<IModule> possibleChildren = new ArrayList<IModule>();
+ IModule[] modules2 =
org.eclipse.wst.server.core.ServerUtil.getModules(server.getServerType().getRuntimeType()
+ .getModuleTypes());
+ if (modules2 != null) {
+ int size = modules2.length;
+ for (int i = 0; i < size; i++) {
+ IModule module = modules2[i];
+ IStatus status = server.canModifyModules(new IModule[] { module }, null, null);
+ if (status != null
+ && status.getSeverity() != IStatus.ERROR
+ && module.getProject().isAccessible()) {
+ possibleChildren.add(module);
+ }
+ }
+ }
+ return possibleChildren.toArray(new IModule[possibleChildren.size()]);
+ }
+
+
private class LocalDeploymentCellModifier implements ICellModifier {
public boolean canModify(Object element, String property) {
if( property == COLUMN_NAME)
@@ -702,7 +746,7 @@
}
public Object[] getElements(Object inputElement) {
- return page.getPossibleModules();
+ return getPossibleModules();
}
public boolean hasChildren(Object element) {
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/ModuleDeploymentPage.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -43,7 +43,6 @@
public class ModuleDeploymentPage extends ServerEditorPart {
protected ServerResourceCommandManager commandManager;
- protected ArrayList<IModule> possibleModules;
protected DeploymentPreferences preferences;
protected ServerAttributeHelper helper;
protected DeploymentModuleOptionCompositeAssistant tab;
@@ -60,10 +59,6 @@
return helper;
}
- public IModule[] getPossibleModules() {
- return (IModule[]) possibleModules.toArray(new IModule[possibleModules.size()]);
- }
-
public FormToolkit getFormToolkit(Composite parent) {
return getFormToolkit(parent.getDisplay());
}
@@ -74,7 +69,6 @@
public void init(IEditorSite site, IEditorInput input) {
super.init(site, input);
- refreshPossibleModules();
if (input instanceof IServerEditorPartInput) {
IServerEditorPartInput sepi = (IServerEditorPartInput) input;
server = sepi.getServer();
@@ -84,21 +78,6 @@
helper = new ServerAttributeHelper(server.getOriginal(), server);
}
- public void refreshPossibleModules() {
- ArrayList<IModule> possibleChildren = new ArrayList<IModule>();
- IModule[] modules2 =
org.eclipse.wst.server.core.ServerUtil.getModules(server.getServerType().getRuntimeType().getModuleTypes());
- if (modules2 != null) {
- int size = modules2.length;
- for (int i = 0; i < size; i++) {
- IModule module = modules2[i];
- IStatus status = server.canModifyModules(new IModule[] { module }, null, null);
- if (status != null && status.getSeverity() != IStatus.ERROR)
- possibleChildren.add(module);
- }
- }
- this.possibleModules = possibleChildren;
- }
-
public void createPartControl(Composite parent) {
preferences =
DeploymentPreferenceLoader.loadPreferencesFromServer(server.getOriginal());
ScrolledForm innerContent = createPageStructure(parent);
Modified:
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/ServerLogView.java
===================================================================
---
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/ServerLogView.java 2011-05-10
12:55:23 UTC (rev 31179)
+++
workspace/rstryker/andre2/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/views/ServerLogView.java 2011-05-10
14:04:34 UTC (rev 31180)
@@ -98,7 +98,7 @@
fReLogErrorsAction;
private TreeColumn fColumn1;
private TreeColumn fColumn2;
- private Comparator fComparator;
+ private Comparator<AbstractEntry> fComparator;
private List<AbstractEntry> elements;
public ServerLogView() {
super();
@@ -614,8 +614,8 @@
private void setComparator(byte sortType) {
if (sortType == DATE) {
- fComparator = new Comparator() {
- public int compare(Object e1, Object e2) {
+ fComparator = new Comparator<AbstractEntry>() {
+ public int compare(AbstractEntry e1, AbstractEntry e2) {
long date1 = 0;
long date2 = 0;
if ((e1 instanceof LogEntry) && (e2 instanceof LogEntry)) {
@@ -637,8 +637,8 @@
}
};
} else {
- fComparator = new Comparator() {
- public int compare(Object e1, Object e2) {
+ fComparator = new Comparator<AbstractEntry>() {
+ public int compare(AbstractEntry e1, AbstractEntry e2) {
if ((e1 instanceof LogEntry) && (e2 instanceof LogEntry)) {
LogEntry entry1 = (LogEntry) e1;
LogEntry entry2 = (LogEntry) e2;