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 2005/12/26 23:57:26 UTC
svn commit: r359121 - in
/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core:
./ src/org/apache/geronimo/core/ src/org/apache/geronimo/core/commands/
src/org/apache/geronimo/core/internal/ src/org/apache/ge...
Author: sppatel
Date: Mon Dec 26 14:57:14 2005
New Revision: 359121
URL: http://svn.apache.org/viewcvs?rev=359121&view=rev
Log:
- point to deploymentfacimpl in jsr88 jar
- refactor providing static factory methods for cmd creation
Added:
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DeploymentCommandFactory.java (with props)
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/SynchronizedDeploymentOp.java (with props)
Removed:
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/CommandLauncher.java
Modified:
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/plugin.xml
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoConnectionFactory.java
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/AbstractDeploymentCommand.java
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DistributeCommand.java
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/IDeploymentCommand.java
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/RedeployCommand.java
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/StartCommand.java
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/StopCommand.java
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/UndeployCommand.java
geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServer.java
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/plugin.xml
URL: http://svn.apache.org/viewcvs/geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/plugin.xml?rev=359121&r1=359120&r2=359121&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/plugin.xml (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/plugin.xml Mon Dec 26 14:57:14 2005
@@ -34,7 +34,7 @@
class="org.apache.geronimo.core.internal.GeronimoServer"
initialState="stopped"
supportsRemoteHosts="false"
- startTimeout="75000"
+ startTimeout="120000"
stopTimeout="30000"
startBeforePublish="true"
runtimeTypeId="org.apache.geronimo.generic.runtime.10"
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoConnectionFactory.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/GeronimoConnectionFactory.java?rev=359121&r1=359120&r2=359121&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoConnectionFactory.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/GeronimoConnectionFactory.java Mon Dec 26 14:57:14 2005
@@ -13,6 +13,8 @@
import org.apache.geronimo.core.internal.GeronimoServer;
import org.apache.geronimo.core.internal.Trace;
import org.apache.geronimo.deployment.plugin.factories.DeploymentFactoryImpl;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.eclipse.wst.server.core.IServer;
public class GeronimoConnectionFactory {
@@ -69,8 +71,10 @@
private DeploymentFactory discoverDeploymentFactory(IServer server) {
try {
- JarFile deployerJar = new JarFile(server.getRuntime().getLocation()
- .append("/deployer.jar").toFile());
+
+ IPath path = server.getRuntime().getLocation().removeLastSegments(1).append("/lib/geronimo-deploy-jsr88-1.0.jar");
+
+ JarFile deployerJar = new JarFile(path.toFile());
java.util.jar.Manifest manifestFile = deployerJar.getManifest();
Attributes attributes = manifestFile.getMainAttributes();
String key = "J2EE-DeploymentFactory-Implementation-Class";
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/AbstractDeploymentCommand.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/commands/AbstractDeploymentCommand.java?rev=359121&r1=359120&r2=359121&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/AbstractDeploymentCommand.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/AbstractDeploymentCommand.java Mon Dec 26 14:57:14 2005
@@ -37,20 +37,24 @@
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.server.core.IModule;
-public abstract class AbstractDeploymentCommand implements IDeploymentCommand {
+abstract class AbstractDeploymentCommand implements IDeploymentCommand {
- DeploymentManager deploymentManager;
+ private DeploymentManager dm;
+
+ private IModule module;
- public AbstractDeploymentCommand() {
+ public AbstractDeploymentCommand(DeploymentManager dm, IModule module) {
super();
+ this.dm = dm;
+ this.module = module;
}
public DeploymentManager getDeploymentManager() {
- return deploymentManager;
+ return dm;
}
-
- public void setDeploymentManager(DeploymentManager deploymentManager) {
- this.deploymentManager = deploymentManager;
+
+ public IModule getModule() {
+ return module;
}
public File createJarFile(IModule module) {
Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DeploymentCommandFactory.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/commands/DeploymentCommandFactory.java?rev=359121&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DeploymentCommandFactory.java (added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DeploymentCommandFactory.java Mon Dec 26 14:57:14 2005
@@ -0,0 +1,124 @@
+/**
+ * Copyright 2004, 2005 The Apache Software Foundation or its licensors, as applicable
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.geronimo.core.commands;
+
+import javax.enterprise.deploy.spi.DeploymentManager;
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.exceptions.DeploymentManagerCreationException;
+
+import org.apache.geronimo.core.GeronimoConnectionFactory;
+import org.apache.geronimo.core.internal.GeronimoPlugin;
+import org.apache.geronimo.core.internal.Messages;
+import org.apache.geronimo.core.operations.SynchronizedDeploymentOp;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.wst.server.core.IModule;
+import org.eclipse.wst.server.core.IServer;
+
+/**
+ *
+ * This class provides static factory methods that return "synchronized" wrapper instances of
+ * JSR-88 deployment commands.
+ *
+ */
+public class DeploymentCommandFactory {
+
+ private static final DeploymentCommandFactory INSTANCE = new DeploymentCommandFactory();
+
+ private DeploymentCommandFactory() {
+ }
+
+ /**
+ * @param module
+ * @param server
+ * @return
+ * @throws CoreException
+ */
+ public static SynchronizedDeploymentOp createDistributeCommand(
+ IModule module, IServer server) throws CoreException {
+ return new SynchronizedDeploymentOp(new DistributeCommand(module,
+ INSTANCE.getDeploymentManager(server)));
+ }
+
+ /**
+ * @param ids
+ * @param module
+ * @param server
+ * @return
+ * @throws CoreException
+ */
+ public static SynchronizedDeploymentOp createStartCommand(
+ TargetModuleID[] ids, IModule module, IServer server)
+ throws CoreException {
+ return new SynchronizedDeploymentOp(new StartCommand(ids, module,
+ INSTANCE.getDeploymentManager(server)));
+ }
+
+ /**
+ * @param module
+ * @param server
+ * @return
+ * @throws CoreException
+ */
+ public static SynchronizedDeploymentOp createStopCommand(IModule module,
+ IServer server) throws CoreException {
+ return new SynchronizedDeploymentOp(new StopCommand(module, INSTANCE
+ .getDeploymentManager(server)));
+ }
+
+ /**
+ * @param module
+ * @param server
+ * @return
+ * @throws CoreException
+ */
+ public static SynchronizedDeploymentOp createRedeployCommand(
+ IModule module, IServer server) throws CoreException {
+ return new SynchronizedDeploymentOp(new RedeployCommand(module,
+ INSTANCE.getDeploymentManager(server)));
+ }
+
+ /**
+ * @param module
+ * @param server
+ * @return
+ * @throws CoreException
+ */
+ public static SynchronizedDeploymentOp createUndeployCommand(
+ IModule module, IServer server) throws CoreException {
+ return new SynchronizedDeploymentOp(new UndeployCommand(module,
+ INSTANCE.getDeploymentManager(server)));
+ }
+
+ /**
+ * @param server
+ * @return
+ * @throws CoreException
+ */
+ private DeploymentManager getDeploymentManager(IServer server)
+ throws CoreException {
+ try {
+ return GeronimoConnectionFactory.getInstance()
+ .getDeploymentManager(server);
+ } catch (DeploymentManagerCreationException e) {
+ throw new CoreException(
+ new Status(IStatus.ERROR, GeronimoPlugin.PLUGIN_ID, 0,
+ Messages.DM_CONNECTION_FAIL, e));
+ }
+ }
+
+}
Propchange: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DeploymentCommandFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DeploymentCommandFactory.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DeploymentCommandFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DistributeCommand.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/commands/DistributeCommand.java?rev=359121&r1=359120&r2=359121&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DistributeCommand.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/DistributeCommand.java Mon Dec 26 14:57:14 2005
@@ -18,25 +18,26 @@
import java.io.File;
import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.DeploymentManager;
import javax.enterprise.deploy.spi.Target;
import javax.enterprise.deploy.spi.status.ProgressObject;
import org.eclipse.wst.server.core.IModule;
-public class DistributeCommand extends AbstractDeploymentCommand {
+class DistributeCommand extends AbstractDeploymentCommand {
- public DistributeCommand() {
- super();
+ public DistributeCommand(IModule module, DeploymentManager dm) {
+ super(dm, module);
}
/*
* (non-Javadoc)
*
- * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.wst.server.core.IModule)
+ * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute()
*/
- public ProgressObject execute(IModule module) {
+ public ProgressObject execute() {
Target[] targets = getDeploymentManager().getTargets();
- File jarFile = createJarFile(module);
+ File jarFile = createJarFile(getModule());
return getDeploymentManager().distribute(targets, jarFile, null);
}
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/IDeploymentCommand.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/commands/IDeploymentCommand.java?rev=359121&r1=359120&r2=359121&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/IDeploymentCommand.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/IDeploymentCommand.java Mon Dec 26 14:57:14 2005
@@ -22,8 +22,10 @@
public interface IDeploymentCommand {
- public ProgressObject execute(IModule module);
+ public ProgressObject execute();
public CommandType getCommandType();
+
+ public IModule getModule();
}
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/RedeployCommand.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/commands/RedeployCommand.java?rev=359121&r1=359120&r2=359121&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/RedeployCommand.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/RedeployCommand.java Mon Dec 26 14:57:14 2005
@@ -18,26 +18,27 @@
import java.io.File;
import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.DeploymentManager;
import javax.enterprise.deploy.spi.TargetModuleID;
import javax.enterprise.deploy.spi.status.ProgressObject;
import org.eclipse.wst.server.core.IModule;
-public class RedeployCommand extends AbstractDeploymentCommand {
+class RedeployCommand extends AbstractDeploymentCommand {
- public RedeployCommand() {
- super();
+ public RedeployCommand(IModule module, DeploymentManager dm) {
+ super(dm, module);
}
/*
* (non-Javadoc)
*
- * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.wst.server.core.IModule)
+ * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute()
*/
- public ProgressObject execute(IModule module) {
- TargetModuleID id = getTargetModuleID(module);
+ public ProgressObject execute() {
+ TargetModuleID id = getTargetModuleID(getModule());
if (id != null) {
- File jarFile = createJarFile(module);
+ File jarFile = createJarFile(getModule());
return getDeploymentManager().redeploy(new TargetModuleID[] { id },
jarFile, null);
}
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/StartCommand.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/commands/StartCommand.java?rev=359121&r1=359120&r2=359121&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/StartCommand.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/StartCommand.java Mon Dec 26 14:57:14 2005
@@ -16,39 +16,37 @@
package org.apache.geronimo.core.commands;
import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.DeploymentManager;
import javax.enterprise.deploy.spi.TargetModuleID;
import javax.enterprise.deploy.spi.status.ProgressObject;
import org.eclipse.wst.server.core.IModule;
-public class StartCommand extends AbstractDeploymentCommand {
-
- TargetModuleID[] targetModuleIDs;
+class StartCommand extends AbstractDeploymentCommand {
- public StartCommand() {
- super();
+ TargetModuleID[] ids;
+
+ public StartCommand(TargetModuleID[] ids, IModule module, DeploymentManager dm) {
+ super(dm, module);
+ this.ids = ids;
}
- /* (non-Javadoc)
- * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.wst.server.core.IModule)
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute()
*/
- public ProgressObject execute(IModule module) {
- return getDeploymentManager().start(getTargetModuleIDs());
+ public ProgressObject execute() {
+ return getDeploymentManager().start(ids);
}
- /* (non-Javadoc)
+ /*
+ * (non-Javadoc)
+ *
* @see org.apache.geronimo.core.commands.IDeploymentCommand#getCommandType()
*/
public CommandType getCommandType() {
return CommandType.START;
- }
-
- public TargetModuleID[] getTargetModuleIDs() {
- return targetModuleIDs;
- }
-
- public void setTargetModuleIDs(TargetModuleID[] targetModuleIDs) {
- this.targetModuleIDs = targetModuleIDs;
}
}
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/StopCommand.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/commands/StopCommand.java?rev=359121&r1=359120&r2=359121&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/StopCommand.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/StopCommand.java Mon Dec 26 14:57:14 2005
@@ -16,24 +16,24 @@
package org.apache.geronimo.core.commands;
import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.DeploymentManager;
import javax.enterprise.deploy.spi.TargetModuleID;
import javax.enterprise.deploy.spi.status.ProgressObject;
import org.eclipse.wst.server.core.IModule;
-public class StopCommand extends AbstractDeploymentCommand {
+class StopCommand extends AbstractDeploymentCommand {
- public StopCommand() {
- super();
+ public StopCommand(IModule module, DeploymentManager dm) {
+ super(dm, module);
}
- /*
- * (non-Javadoc)
- *
- * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.wst.server.core.IModule)
+
+ /* (non-Javadoc)
+ * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute()
*/
- public ProgressObject execute(IModule module) {
- TargetModuleID id = getTargetModuleID(module);
+ public ProgressObject execute() {
+ TargetModuleID id = getTargetModuleID(getModule());
if (id != null) {
return getDeploymentManager().stop(new TargetModuleID[] { id });
}
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/UndeployCommand.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/commands/UndeployCommand.java?rev=359121&r1=359120&r2=359121&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/UndeployCommand.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/commands/UndeployCommand.java Mon Dec 26 14:57:14 2005
@@ -16,24 +16,25 @@
package org.apache.geronimo.core.commands;
import javax.enterprise.deploy.shared.CommandType;
+import javax.enterprise.deploy.spi.DeploymentManager;
import javax.enterprise.deploy.spi.TargetModuleID;
import javax.enterprise.deploy.spi.status.ProgressObject;
import org.eclipse.wst.server.core.IModule;
-public class UndeployCommand extends AbstractDeploymentCommand {
+class UndeployCommand extends AbstractDeploymentCommand {
- public UndeployCommand() {
- super();
+ public UndeployCommand(IModule module, DeploymentManager dm) {
+ super(dm, module);
}
/*
* (non-Javadoc)
*
- * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute(org.eclipse.wst.server.core.IModule)
+ * @see org.apache.geronimo.core.commands.IDeploymentCommand#execute()
*/
- public ProgressObject execute(IModule module) {
- TargetModuleID id = getTargetModuleID(module);
+ public ProgressObject execute() {
+ TargetModuleID id = getTargetModuleID(getModule());
if (id != null) {
return getDeploymentManager().undeploy(new TargetModuleID[] { id });
}
Modified: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServer.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/GeronimoServer.java?rev=359121&r1=359120&r2=359121&view=diff
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServer.java (original)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/internal/GeronimoServer.java Mon Dec 26 14:57:14 2005
@@ -31,7 +31,7 @@
public static final String PROPERTY_RMI_PORT = "rmiport";
- public static final String PROPERY_HTTP_PORT = "port";
+ public static final String PROPERTY_HTTP_PORT = "port";
/*
* (non-Javadoc)
@@ -82,7 +82,7 @@
}
public String getHTTPPort() {
- return (String) getServerInstanceProperties().get(PROPERY_HTTP_PORT);
+ return (String) getServerInstanceProperties().get(PROPERTY_HTTP_PORT);
}
public void setAdminID(String value) {
@@ -98,7 +98,7 @@
}
public void setHTTPPort(String value) {
- getServerInstanceProperties().put(PROPERY_HTTP_PORT, value);
+ getServerInstanceProperties().put(PROPERTY_HTTP_PORT, value);
}
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=359121&r1=359120&r2=359121&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 Mon Dec 26 14:57:14 2005
@@ -27,13 +27,9 @@
import javax.management.remote.JMXConnectorFactory;
import javax.management.remote.JMXServiceURL;
-import org.apache.geronimo.core.CommandLauncher;
import org.apache.geronimo.core.GeronimoConnectionFactory;
-import org.apache.geronimo.core.commands.DistributeCommand;
-import org.apache.geronimo.core.commands.RedeployCommand;
-import org.apache.geronimo.core.commands.StartCommand;
-import org.apache.geronimo.core.commands.StopCommand;
-import org.apache.geronimo.core.commands.UndeployCommand;
+import org.apache.geronimo.core.commands.DeploymentCommandFactory;
+import org.apache.geronimo.core.operations.SynchronizedDeploymentOp;
import org.apache.geronimo.gbean.GBeanQuery;
import org.apache.geronimo.kernel.GBeanNotFoundException;
import org.apache.geronimo.kernel.Kernel;
@@ -81,10 +77,11 @@
// kill the process
super.stop(true);
}
-
+
private String getJMXServiceURL() {
String host = getServer().getHost();
- return "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":" + getRMINamingPort() + "/JMXConnector";
+ return "service:jmx:rmi://" + host + "/jndi/rmi://" + host + ":"
+ + getRMINamingPort() + "/JMXConnector";
}
private Kernel getKernel() {
@@ -228,27 +225,30 @@
}
private void doDeploy(IModule module) throws CoreException {
- CommandLauncher launcher = new CommandLauncher(new DistributeCommand(),
- module, getServer());
- IStatus status = launcher.executeCommand(_monitor);
-
- if(!status.isOK()) {
+ SynchronizedDeploymentOp op = DeploymentCommandFactory
+ .createDistributeCommand(module, getServer());
+ IStatus status = op.run(_monitor);
+
+ if (!status.isOK()) {
doFail(status, Messages.DISTRIBUTE_FAIL);
}
-
- StartCommand startCmd = new StartCommand();
- startCmd.setTargetModuleIDs(launcher.getResultTargetModuleIDs());
- launcher = new CommandLauncher(startCmd, module, getServer());
- status = launcher.executeCommand(_monitor);
- if(!status.isOK()) {
+
+ op = DeploymentCommandFactory.createStartCommand(op
+ .getResultTargetModuleIDs(), module, getServer());
+
+ status = op.run(_monitor);
+
+ if (!status.isOK()) {
doFail(status, Messages.START_FAIL);
}
}
private void doRedeploy(IModule module) throws CoreException {
- CommandLauncher launcher = new CommandLauncher(new RedeployCommand(),
- module, getServer());
- IStatus status = launcher.executeCommand(_monitor);
+ SynchronizedDeploymentOp op = DeploymentCommandFactory
+ .createRedeployCommand(module, getServer());
+
+ IStatus status = op.run(_monitor);
+
if (!status.isOK()) {
doFail(status, Messages.REDEPLOY_FAIL);
}
@@ -256,18 +256,20 @@
private void doUndeploy(IModule module) throws CoreException,
DeploymentManagerCreationException {
- CommandLauncher launcher = new CommandLauncher(new StopCommand(),
- module, getServer());
- IStatus status = launcher.executeCommand(_monitor);
+ SynchronizedDeploymentOp op = DeploymentCommandFactory
+ .createStopCommand(module, getServer());
+
+ IStatus status = op.run(_monitor);
if (!status.isOK()) {
doFail(status, Messages.STOP_FAIL);
}
- launcher = new CommandLauncher(new UndeployCommand(), module,
- getServer());
- status = launcher.executeCommand(_monitor);
-
+ op = DeploymentCommandFactory
+ .createUndeployCommand(module, getServer());
+
+ status = op.run(_monitor);
+
if (!status.isOK()) {
doFail(status, Messages.UNDEPLOY_FAIL);
}
@@ -290,19 +292,28 @@
public String getPassword() {
return GeronimoConnectionFactory.getInstance().getPassword(getServer());
}
-
+
public String getRMINamingPort() {
- return GeronimoConnectionFactory.getInstance().getRMINamingPort(getServer());
+ return GeronimoConnectionFactory.getInstance().getRMINamingPort(
+ getServer());
}
-
- public void setupLaunchConfiguration(ILaunchConfigurationWorkingCopy workingCopy, IProgressMonitor monitor) throws CoreException {
- String defaultArgs = getServerDefinition().getResolver().resolveProperties(getServerDefinition().getStart().getProgramArgumentsAsString());
- String existingPrgArgs = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,defaultArgs);
- super.setupLaunchConfiguration(workingCopy, monitor);
- if(existingPrgArgs !=null) {
- workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,existingPrgArgs);
- }
+
+ public void setupLaunchConfiguration(
+ ILaunchConfigurationWorkingCopy workingCopy,
+ IProgressMonitor monitor) throws CoreException {
+ String defaultArgs = getServerDefinition().getResolver()
+ .resolveProperties(
+ getServerDefinition().getStart()
+ .getProgramArgumentsAsString());
+ String existingPrgArgs = workingCopy.getAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ defaultArgs);
+ super.setupLaunchConfiguration(workingCopy, monitor);
+ if (existingPrgArgs != null) {
+ workingCopy.setAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS,
+ existingPrgArgs);
+ }
}
-
}
Added: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/SynchronizedDeploymentOp.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/operations/SynchronizedDeploymentOp.java?rev=359121&view=auto
==============================================================================
--- geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/SynchronizedDeploymentOp.java (added)
+++ geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/SynchronizedDeploymentOp.java Mon Dec 26 14:57:14 2005
@@ -0,0 +1,100 @@
+package org.apache.geronimo.core.operations;
+
+import javax.enterprise.deploy.spi.TargetModuleID;
+import javax.enterprise.deploy.spi.status.DeploymentStatus;
+import javax.enterprise.deploy.spi.status.ProgressEvent;
+import javax.enterprise.deploy.spi.status.ProgressListener;
+import javax.enterprise.deploy.spi.status.ProgressObject;
+
+import org.apache.geronimo.core.commands.IDeploymentCommand;
+import org.apache.geronimo.core.internal.DeploymentStatusMessageTranslator;
+import org.apache.geronimo.core.internal.GeronimoPlugin;
+import org.apache.geronimo.core.internal.Trace;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+
+public class SynchronizedDeploymentOp implements ProgressListener {
+
+ private static final long TIMEOUT = 10000;
+
+ private IDeploymentCommand command;
+
+ private Thread waitThread;
+
+ private IStatus status = null;
+
+ private TargetModuleID[] result;
+
+ private IProgressMonitor _monitor = null;
+
+ public SynchronizedDeploymentOp(IDeploymentCommand command) {
+ super();
+ this.command = command;
+ }
+
+ public IStatus run(IProgressMonitor monitor)
+ throws CoreException {
+
+ if (monitor == null) {
+ monitor = new NullProgressMonitor();
+ }
+
+ _monitor = monitor;
+
+ waitThread = new WaitForNotificationThread();
+ waitThread.start();
+ ProgressObject po = command.execute();
+ po.addProgressListener(this);
+
+ try {
+ waitThread.join();
+ } catch (InterruptedException e) {
+ } finally {
+ po.removeProgressListener(this);
+ }
+
+ result = po.getResultTargetModuleIDs();
+
+ return status;
+ }
+
+ class WaitForNotificationThread extends Thread {
+ public void run() {
+ try {
+ sleep(TIMEOUT);
+ Trace.trace(Trace.INFO, "Wait thread TIMEOUT!");
+ } catch (InterruptedException e) {
+ Trace.trace(Trace.INFO, "Wait thread interrupted");
+ }
+ }
+ }
+
+ public void handleProgressEvent(ProgressEvent event) {
+ DeploymentStatus deploymentStatus = event.getDeploymentStatus();
+ if (deploymentStatus != null) {
+ String msg = DeploymentStatusMessageTranslator
+ .getTranslatedMessage(event, command.getModule().getProject());
+ Trace.trace(Trace.INFO, msg);
+ _monitor.subTask(msg);
+ if (command.getCommandType() == deploymentStatus.getCommand()) {
+ if (deploymentStatus.isCompleted()) {
+ status = new Status(IStatus.OK, GeronimoPlugin.PLUGIN_ID,
+ 0, msg, null);
+ waitThread.interrupt();
+ } else if (deploymentStatus.isFailed()) {
+ status = new Status(IStatus.ERROR,
+ GeronimoPlugin.PLUGIN_ID, 0, msg, null);
+ waitThread.interrupt();
+ }
+ }
+ }
+ }
+
+ public TargetModuleID[] getResultTargetModuleIDs() {
+ return result;
+ }
+
+}
Propchange: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/SynchronizedDeploymentOp.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/SynchronizedDeploymentOp.java
------------------------------------------------------------------------------
svn:keywords = Date Author Id Revision HeadURL
Propchange: geronimo/devtools/trunk/modules/eclipse-plugin/plugins/org.apache.geronimo.devtools.eclipse.core/src/org/apache/geronimo/core/operations/SynchronizedDeploymentOp.java
------------------------------------------------------------------------------
svn:mime-type = text/plain