djencks 2003/12/08 20:23:33
Modified: modules/kernel/src/java/org/apache/geronimo/kernel/deployment
ApplicationDeployer.java
Log:
Use an endpoint instead of mbean invocation
Revision Changes Path
1.3 +20 -20
incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/ApplicationDeployer.java
Index: ApplicationDeployer.java
===================================================================
RCS file:
/home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/ApplicationDeployer.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- ApplicationDeployer.java 17 Nov 2003 20:31:07 -0000 1.2
+++ ApplicationDeployer.java 9 Dec 2003 04:23:33 -0000 1.3
@@ -84,6 +84,7 @@
import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
import org.apache.geronimo.kernel.service.GeronimoOperationInfo;
import org.apache.geronimo.kernel.service.GeronimoParameterInfo;
+import org.apache.geronimo.kernel.service.GeronimoMBeanEndpoint;
import org.apache.geronimo.kernel.jmx.JMXUtil;
import org.apache.geronimo.kernel.deployment.scanner.URLInfo;
import org.apache.geronimo.kernel.deployment.scanner.URLType;
@@ -102,10 +103,10 @@
*/
public class ApplicationDeployer implements GeronimoMBeanTarget {
private final static Log log =
LogFactory.getLog(ApplicationDeployer.class);
- private final static ObjectName DEPLOYER_NAME =
JMXUtil.getObjectName("geronimo.deployment:role=DeploymentController");
private ServerTarget localServerTarget;
private File saveDir;
private GeronimoMBeanContext context;
+ private DeploymentController deploymentController;
public static GeronimoMBeanInfo getGeronimoMBeanInfo() throws Exception {
GeronimoMBeanInfo mbeanInfo = new GeronimoMBeanInfo();
@@ -215,6 +216,10 @@
},
0,
"Begins the process of stopping one or more modules. You
must start the deployment job with the returned ID."));
+ mbeanInfo.addEndpoint(new
GeronimoMBeanEndpoint("DeploymentController",
+ DeploymentController.class,
+
ObjectName.getInstance("geronimo.deployment:role=DeploymentController"),
+ true));
return mbeanInfo;
}
@@ -230,6 +235,14 @@
}
}
+ public DeploymentController getDeploymentController() {
+ return deploymentController;
+ }
+
+ public void setDeploymentController(DeploymentController
deploymentController) {
+ this.deploymentController = deploymentController;
+ }
+
/**
* Sets the GeronimoMBeanContext. This is called before doStart and
with a null context after stop.
*
@@ -329,10 +342,9 @@
//todo: Create and start an MBean for the deployment, use that later
to check status of the deployment
GeronimoTargetModule tm = new
GeronimoTargetModule(localServerTarget, name); //todo: specify URL for web apps
try {
- Integer id = (Integer)context.getServer().invoke(DEPLOYER_NAME,
"prepareDeploymentJob", new Object[]{new DeploymentGoal[]{
- new DistributeURL(tm, module.toURL(),
URLType.PACKED_ARCHIVE)}}, new String[]{
- "[L"+DeploymentGoal.class.getName()+";"});
- return id.intValue();
+ int id = deploymentController.prepareDeploymentJob(new
DeploymentGoal[]{
+ new DistributeURL(tm, module.toURL(),
URLType.PACKED_ARCHIVE)});
+ return id;
// if(!deployments.contains(tm)) {
// deployments.add(tm);
// }
@@ -469,20 +481,8 @@
}
private void runDeployment(DeploymentGoal[] goals) {
- try {
- context.getServer().invoke(DEPLOYER_NAME, "runDeploymentJob",
new Object[]{goals},
- new String[]{"[L"+DeploymentGoal.class.getName()+";"});
- } catch(InstanceNotFoundException e) {
- e.printStackTrace();
- throw new RuntimeException("Unable to execute deployment", e);
- } catch(MBeanException e) {
- e.printStackTrace();
- throw new RuntimeException("Unable to execute deployment", e);
- } catch(ReflectionException e) {
- e.printStackTrace();
- throw new RuntimeException("Unable to execute deployment", e);
- }
- }
+ deploymentController.runDeploymentJob(goals);
+ }
// ------------------------ Moved from DeploymentController
------------------------------
private final Map scanResults = new HashMap();