You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by sp...@apache.org on 2006/01/18 14:48:49 UTC
svn commit: r370142 -
/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java
Author: sppatel
Date: Wed Jan 18 05:48:45 2006
New Revision: 370142
URL: http://svn.apache.org/viewcvs?rev=370142&view=rev
Log:
minor refactoring
Modified:
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java?rev=370142&r1=370141&r2=370142&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServerBehaviour.java Wed Jan 18 05:48:45 2006
@@ -74,7 +74,7 @@
* @see org.eclipse.wst.server.core.model.ServerBehaviourDelegate#stop(boolean)
*/
public void stop(boolean force) {
-
+
setServerState(IServer.STATE_STOPPING);
if (getKernel() != null) {
@@ -91,9 +91,17 @@
}
private String getJMXServiceURL() {
+
String host = getServer().getHost();
- return "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":"
- + getRMINamingPort() + "/JMXConnector";
+ String rmiPort = getRMINamingPort();
+
+ if (host != null && rmiPort != null) {
+ return "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":"
+ + rmiPort + "/JMXConnector";
+ }
+
+ return null;
+
}
private Kernel getKernel() {
@@ -104,7 +112,9 @@
getPassword() });
try {
String url = getJMXServiceURL();
- Trace.trace(Trace.INFO, url);
+ Trace.trace(Trace.INFO, "URL = " + url);
+ if (url == null)
+ return null;
JMXServiceURL address = new JMXServiceURL(url);
try {
JMXConnector jmxConnector = JMXConnectorFactory.connect(
@@ -199,58 +209,58 @@
private void invokeCommand(int deltaKind, IModule module)
throws CoreException {
- switch (deltaKind) {
- case ADDED: {
- doDeploy(module);
- break;
- }
- case CHANGED: {
- doRedeploy(module);
- break;
- }
- case REMOVED: {
- doUndeploy(module);
- break;
- }
- default:
- throw new IllegalArgumentException();
+ try {
+ switch (deltaKind) {
+ case ADDED: {
+ doDeploy(module);
+ break;
+ }
+ case CHANGED: {
+ doRedeploy(module);
+ break;
+ }
+ case REMOVED: {
+ doUndeploy(module);
+ break;
+ }
+ default:
+ throw new IllegalArgumentException();
+ }
+ } catch (CoreException e) {
+ throw e;
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
- private void doDeploy(IModule module) throws CoreException {
+ private void doDeploy(IModule module) throws Exception {
Trace.trace(Trace.INFO, ">> doDeploy() " + module.toString());
IDeploymentCommand cmd = DeploymentCommandFactory
.createDistributeCommand(module, getServer());
- try {
- IStatus status = cmd.execute(_monitor);
+ IStatus status = cmd.execute(_monitor);
- if (!status.isOK()) {
- doFail(status, Messages.DISTRIBUTE_FAIL);
- }
+ if (!status.isOK()) {
+ doFail(status, Messages.DISTRIBUTE_FAIL);
+ }
- if (status instanceof DeploymentCmdStatus) {
- TargetModuleID[] ids = ((DeploymentCmdStatus) status)
- .getResultTargetModuleIDs();
- cmd = DeploymentCommandFactory.createStartCommand(ids, module,
- getServer());
- status = cmd.execute(_monitor);
+ if (status instanceof DeploymentCmdStatus) {
+ TargetModuleID[] ids = ((DeploymentCmdStatus) status)
+ .getResultTargetModuleIDs();
+ cmd = DeploymentCommandFactory.createStartCommand(ids, module,
+ getServer());
+ status = cmd.execute(_monitor);
- if (!status.isOK()) {
- doFail(status, Messages.START_FAIL);
- }
+ if (!status.isOK()) {
+ doFail(status, Messages.START_FAIL);
}
- } catch (CoreException e) {
- throw e;
- } catch (Exception e) {
- e.printStackTrace();
}
Trace.trace(Trace.INFO, "<< doDeploy() " + module.toString());
}
- private void doRedeploy(IModule module) throws CoreException {
+ private void doRedeploy(IModule module) throws Exception {
Trace.trace(Trace.INFO, ">> doRedeploy() " + module.toString());
IDeploymentCommand cmd = DeploymentCommandFactory
@@ -260,48 +270,34 @@
if (!status.isOK()) {
doFail(status, Messages.REDEPLOY_FAIL);
}
- } catch (CoreException e) {
- throw e;
- } catch (Exception e) {
- e.printStackTrace();
- if (e instanceof TargetModuleIdNotFoundException) {
- GeronimoPlugin
- .getInstance()
- .log(
- Status.WARNING,
- "Module may have been uninstalled outside the workspace.",
- e);
- doDeploy(module);
- }
+ } catch (TargetModuleIdNotFoundException e) {
+ GeronimoPlugin.log(Status.WARNING,
+ "Module may have been uninstalled outside the workspace.",
+ e);
+ doDeploy(module);
}
Trace.trace(Trace.INFO, "<< doRedeploy() " + module.toString());
}
- private void doUndeploy(IModule module) throws CoreException {
+ private void doUndeploy(IModule module) throws Exception {
Trace.trace(Trace.INFO, ">> doUndeploy() " + module.toString());
IDeploymentCommand cmd = DeploymentCommandFactory.createStopCommand(
module, getServer());
- try {
- IStatus status = cmd.execute(_monitor);
- if (!status.isOK()) {
- doFail(status, Messages.STOP_FAIL);
- }
+ IStatus status = cmd.execute(_monitor);
- cmd = DeploymentCommandFactory.createUndeployCommand(module,
- getServer());
- status = cmd.execute(_monitor);
+ if (!status.isOK()) {
+ doFail(status, Messages.STOP_FAIL);
+ }
- if (!status.isOK()) {
- doFail(status, Messages.UNDEPLOY_FAIL);
- }
+ cmd = DeploymentCommandFactory.createUndeployCommand(module,
+ getServer());
+ status = cmd.execute(_monitor);
- } catch (CoreException e) {
- throw e;
- } catch (Exception e) {
- e.printStackTrace();
+ if (!status.isOK()) {
+ doFail(status, Messages.UNDEPLOY_FAIL);
}
Trace.trace(Trace.INFO, "<< doUndeploy()" + module.toString());