You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2003/11/17 21:31:07 UTC

cvs commit: incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment ApplicationDeployer.java

ammulder    2003/11/17 12:31:07

  Modified:    modules/core/src/java/org/apache/geronimo/enterprise/deploy/server
                        JmxProgressObject.java JmxServerConnection.java
               modules/kernel/src/java/org/apache/geronimo/kernel/deployment
                        ApplicationDeployer.java
  Log:
  Add MBean operations for JSR-88 support to ApplicationDeployer
  Begin to hook up the ProgressObject as a return value from the
    long-running operations
  Add a little logging to the JSR-88 plumbing
  
  Revision  Changes    Path
  1.2       +141 -5    incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/JmxProgressObject.java
  
  Index: JmxProgressObject.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/JmxProgressObject.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JmxProgressObject.java	17 Nov 2003 10:51:53 -0000	1.1
  +++ JmxProgressObject.java	17 Nov 2003 20:31:07 -0000	1.2
  @@ -55,6 +55,9 @@
    */
   package org.apache.geronimo.enterprise.deploy.server;
   
  +import java.util.Map;
  +import java.util.HashMap;
  +import java.util.Iterator;
   import javax.enterprise.deploy.spi.status.ProgressObject;
   import javax.enterprise.deploy.spi.status.DeploymentStatus;
   import javax.enterprise.deploy.spi.status.ClientConfiguration;
  @@ -66,7 +69,19 @@
   import javax.enterprise.deploy.shared.CommandType;
   import javax.enterprise.deploy.shared.ActionType;
   import javax.management.MBeanServer;
  +import javax.management.NotificationListener;
  +import javax.management.Notification;
  +import javax.management.ObjectName;
  +import javax.management.NotificationFilter;
  +import javax.management.InstanceNotFoundException;
  +import javax.management.ListenerNotFoundException;
  +import javax.management.MBeanException;
  +import javax.management.ReflectionException;
   import javax.swing.event.EventListenerList;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
  +import org.apache.geronimo.kernel.deployment.client.DeploymentNotification;
  +import org.apache.geronimo.kernel.jmx.JMXUtil;
   
   /**
    * A ProgressObject implementation that listens for JMX notifications
  @@ -74,14 +89,28 @@
    * @version $Revision$ $Date$
    */
   public class JmxProgressObject implements ProgressObject {
  +    private final static Log log = LogFactory.getLog(JmxProgressObject.class);
  +    private final static ObjectName CONTROLLER = JMXUtil.getObjectName("geronimo.deployment:role=DeploymentController");
       private int jobID;
       private MBeanServer server;
       private JobDeploymentStatus status = new JobDeploymentStatus();
       private EventListenerList listenerList = new EventListenerList();
  +    private NotificationListener listener;
   //todo: this class is just a beginning
       public JmxProgressObject(int jobID, MBeanServer server) {
           this.jobID = jobID;
           this.server = server;
  +        try {
  +            server.addNotificationListener(CONTROLLER, listener = new PONotificationListener(),
  +                    new PONotificationFilter(),null);
  +            server.invoke(CONTROLLER, "startDeploymentJob", new Object[]{new Integer(jobID)}, new String[]{Integer.TYPE.toString()});
  +        } catch(InstanceNotFoundException e) {
  +            throw new RuntimeException("ProgressObject unable to register with server");
  +        } catch(MBeanException e) {
  +            throw new RuntimeException("ProgressObject unable to start deployment job on server");
  +        } catch(ReflectionException e) {
  +            throw new RuntimeException("ProgressObject unable to start deployment job on server");
  +        }
       }
   
       /**
  @@ -198,13 +227,25 @@
       }
   
       private static class TMDeploymentStatus implements DeploymentStatus {
  +        private JobDeploymentStatus parent;
  +        private String message;
  +        private StateType stateType;
  +
  +        public TMDeploymentStatus(JobDeploymentStatus parent) {
  +            this.parent = parent;
  +        }
  +
           /**
            * Retrieve the StateType value.
            *
            * @return the StateType object
            */
           public StateType getState() {
  -            return null;
  +            return stateType;
  +        }
  +
  +        public void setStateType(StateType stateType) {
  +            this.stateType = stateType;
           }
   
           /**
  @@ -231,7 +272,12 @@
            * @return message text
            */
           public String getMessage() {
  -            return null;
  +            return message;
  +        }
  +
  +        public void setMessage(String message) {
  +            this.message = message;
  +            parent.setMessage(message);
           }
   
           /**
  @@ -263,13 +309,50 @@
       }
   
       private static class JobDeploymentStatus implements DeploymentStatus {
  +        private String message;
  +        private Map tms = new HashMap();
  +        private StateType stateType = StateType.RUNNING;
  +        private boolean failed = false;
  +
  +        public TMDeploymentStatus getTargetModule(TargetModuleID id) {
  +            TMDeploymentStatus tm = (TMDeploymentStatus)tms.get(id);
  +            if(tm == null) {
  +                tm = new TMDeploymentStatus(this);
  +                tms.put(id, tm);
  +            }
  +            return tm;
  +        }
  +
  +        public TMDeploymentStatus closeTargetModule(TargetModuleID id, boolean success, String message) {
  +            TMDeploymentStatus tm = (TMDeploymentStatus)tms.get(id);
  +            if(tm != null) {
  +                tm.setMessage(message);
  +                tm.setStateType(success ? StateType.COMPLETED : StateType.FAILED);
  +                if(!success) {
  +                    failed = true;
  +                }
  +                boolean finished = true;
  +                for(Iterator it = tms.values().iterator(); it.hasNext();) {
  +                    TMDeploymentStatus status = (TMDeploymentStatus)it.next();
  +                    if(status.isRunning()) {
  +                        finished = false;
  +                        break;
  +                    }
  +                }
  +                if(finished) {
  +                    stateType = failed ? StateType.FAILED : StateType.COMPLETED;
  +                }
  +            }
  +            return tm;
  +        }
  +
           /**
            * Retrieve the StateType value.
            *
            * @return the StateType object
            */
           public StateType getState() {
  -            return null;
  +            return stateType;
           }
   
           /**
  @@ -296,7 +379,11 @@
            * @return message text
            */
           public String getMessage() {
  -            return null;
  +            return message;
  +        }
  +
  +        public void setMessage(String message) {
  +            this.message = message;
           }
   
           /**
  @@ -324,6 +411,55 @@
            */
           public boolean isRunning() {
               return false;
  +        }
  +    }
  +
  +    private class PONotificationListener implements NotificationListener {
  +        /**
  +         * Called when a notification occurs.
  +         *
  +         * @param notification The notification object
  +         * @param handback Helps in associating information regarding the listener.
  +         */
  +        public void handleNotification(Notification notification, Object handback) {
  +            DeploymentNotification dn = (DeploymentNotification)notification;
  +            if(dn.getDeploymentID() == jobID) {
  +                TMDeploymentStatus st = null;
  +                if(dn.getType().equals(DeploymentNotification.DEPLOYMENT_UPDATE)) {
  +                    st = status.getTargetModule(dn.getTargetModuleID());
  +                    st.setMessage(dn.getMessage());
  +                } else if(dn.getType().equals(DeploymentNotification.DEPLOYMENT_COMPLETED)) {
  +                    st = status.closeTargetModule(dn.getTargetModuleID(), true, dn.getMessage());
  +                } else if(dn.getType().equals(DeploymentNotification.DEPLOYMENT_FAILED)) {
  +                    st = status.closeTargetModule(dn.getTargetModuleID(), false, dn.getMessage());
  +                }
  +                if(st != null) {
  +                    fireProgressEvent(dn.getTargetModuleID(), st);
  +                }
  +                if(status.isCompleted() || status.isFailed()) {
  +                    try {
  +                        server.removeNotificationListener(CONTROLLER, listener);
  +                    } catch(InstanceNotFoundException e) {
  +                        log.error("Unable to remove notification listener", e);
  +                    } catch(ListenerNotFoundException e) {
  +                        log.error("Unable to remove notification listener", e);
  +                    }
  +                }
  +            }
  +        }
  +    }
  +
  +    private static class PONotificationFilter implements NotificationFilter {
  +        /**
  +         * Invoked before sending the <code>Notification</code> to the listener.
  +         *
  +         * @return boolean true if the Notification should be sent, false otherwise
  +         *
  +         */
  +        public boolean isNotificationEnabled(Notification notification) {
  +            return notification.getType().equals(DeploymentNotification.DEPLOYMENT_COMPLETED) ||
  +                    notification.getType().equals(DeploymentNotification.DEPLOYMENT_FAILED) ||
  +                    notification.getType().equals(DeploymentNotification.DEPLOYMENT_UPDATE);
           }
       }
   }
  
  
  
  1.4       +51 -16    incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/JmxServerConnection.java
  
  Index: JmxServerConnection.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/enterprise/deploy/server/JmxServerConnection.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JmxServerConnection.java	16 Nov 2003 05:26:32 -0000	1.3
  +++ JmxServerConnection.java	17 Nov 2003 20:31:07 -0000	1.4
  @@ -16,6 +16,8 @@
   import javax.enterprise.deploy.shared.ModuleType;
   import javax.management.MBeanServer;
   import javax.management.ObjectName;
  +import org.apache.commons.logging.Log;
  +import org.apache.commons.logging.LogFactory;
   import org.apache.geronimo.kernel.jmx.JMXUtil;
   
   /**
  @@ -25,6 +27,7 @@
    * @version $Revision$
    */
   public class JmxServerConnection implements ServerConnection {
  +    private final static Log log = LogFactory.getLog(JmxServerConnection.class);
       private final static ObjectName DEPLOYER_NAME = JMXUtil.getObjectName("geronimo.deployment:role=ApplicationDeployer");
       private MBeanServer server;
   
  @@ -40,10 +43,12 @@
   
       public Target[] getTargets() throws IllegalStateException, RemoteException {
           try {
  -            return (Target[]) server.getAttribute(DEPLOYER_NAME, "Targets");
  +//            return (Target[]) server.getAttribute(DEPLOYER_NAME, "Targets");
  +            return (Target[]) server.invoke(DEPLOYER_NAME, "getTargets", new Object[0], new String[0]);
           } catch(UndeclaredThrowableException e) {
               throw new RemoteException("Server request failed", e.getCause());
           } catch(Exception e) {
  +            e.printStackTrace();
               throw new RemoteException("Server request failed", e);
           }
       }
  @@ -96,7 +101,7 @@
               //todo: figure out if the targets are all local and place the files and pass URLs via JMX
               Object moduleData = getBytes(new BufferedInputStream(new FileInputStream(moduleArchive)));
               Object ddData = getBytes(new BufferedInputStream(new FileInputStream(deploymentPlan)));
  -            Object result = server.invoke(DEPLOYER_NAME, "distribute", new Object[]{targetList,
  +            Object result = server.invoke(DEPLOYER_NAME, "prepareDistribute", new Object[]{targetList,
                                                                                           moduleArchive.getName(),
                                                                                           moduleData,
                                                                                           ddData},
  @@ -105,11 +110,16 @@
               if(result instanceof Exception) {
                   throw (Exception)result;
               } else {
  -                return null; //todo: return a proper P.O. based on whatever the server ends up returning
  +                return new JmxProgressObject(((Integer)result).intValue(), server);
               }
           } catch(UndeclaredThrowableException e) {
               throw new RemoteException("Server request failed", e.getCause());
           } catch(Exception e) {
  +            Throwable t = e;
  +            do {
  +                log.error("Problem from server", t);
  +                t = t.getCause();
  +            } while(t != null);
               throw new RemoteException("Server request failed", e);
           }
       }
  @@ -118,15 +128,20 @@
           //todo: find a way to stream the content to the server
           try {
               //todo: figure out if the targets are all local and place the files and pass URLs via JMX
  -            Object result = server.invoke(DEPLOYER_NAME, "distribute", new Object[]{targetList, getBytes(moduleArchive),getBytes(deploymentPlan)}, new String[]{getArrayType(Target.class.getName()), getByteArrayType(), getByteArrayType()});
  +            Object result = server.invoke(DEPLOYER_NAME, "prepareDistribute", new Object[]{targetList, getBytes(moduleArchive),getBytes(deploymentPlan)}, new String[]{getArrayType(Target.class.getName()), getByteArrayType(), getByteArrayType()});
               if(result instanceof Exception) {
                   throw (Exception)result;
               } else {
  -                return null; //todo: return a proper P.O. based on whatever the server ends up returning
  +                return new JmxProgressObject(((Integer)result).intValue(), server);
               }
           } catch(UndeclaredThrowableException e) {
               throw new RemoteException("Server request failed", e.getCause());
           } catch(Exception e) {
  +            Throwable t = e;
  +            do {
  +                log.error("Problem from server", t);
  +                t = t.getCause();
  +            } while(t != null);
               throw new RemoteException("Server request failed", e);
           }
       }
  @@ -135,11 +150,15 @@
           //todo: find a way to stream the content to the server
           try {
               //todo: figure out if the targets are all local and place the files and pass URLs via JMX
  -            server.invoke(DEPLOYER_NAME, "redeploy", new Object[]{moduleIDList,
  +            Object result = server.invoke(DEPLOYER_NAME, "prepareRedeploy", new Object[]{moduleIDList,
                                                                     getBytes(new BufferedInputStream(new FileInputStream(moduleArchive))),
                                                                     getBytes(new BufferedInputStream(new FileInputStream(deploymentPlan)))},
                             new String[]{getArrayType(TargetModuleID.class.getName()), getByteArrayType(), getByteArrayType()});
  -            return null; //todo: return a proper P.O. based on whatever the server ends up returning
  +            if(result instanceof Exception) {
  +                throw (Exception)result;
  +            } else {
  +                return new JmxProgressObject(((Integer)result).intValue(), server);
  +            }
           } catch(UndeclaredThrowableException e) {
               throw new RemoteException("Server request failed", e.getCause());
           } catch(Exception e) {
  @@ -151,8 +170,12 @@
           //todo: find a way to stream the content to the server
           try {
               //todo: figure out if the targets are all local and place the files and pass URLs via JMX
  -            server.invoke(DEPLOYER_NAME, "redeploy", new Object[]{moduleIDList, getBytes(moduleArchive),getBytes(deploymentPlan)}, new String[]{getArrayType(TargetModuleID.class.getName()), getByteArrayType(), getByteArrayType()});
  -            return null; //todo: return a proper P.O. based on whatever the server ends up returning
  +            Object result = server.invoke(DEPLOYER_NAME, "prepareRedeploy", new Object[]{moduleIDList, getBytes(moduleArchive),getBytes(deploymentPlan)}, new String[]{getArrayType(TargetModuleID.class.getName()), getByteArrayType(), getByteArrayType()});
  +            if(result instanceof Exception) {
  +                throw (Exception)result;
  +            } else {
  +                return new JmxProgressObject(((Integer)result).intValue(), server);
  +            }
           } catch(UndeclaredThrowableException e) {
               throw new RemoteException("Server request failed", e.getCause());
           } catch(Exception e) {
  @@ -162,9 +185,13 @@
   
       public ProgressObject start(TargetModuleID[] moduleIDList) throws IllegalStateException, RemoteException {
           try {
  -            server.invoke(DEPLOYER_NAME, "start", new Object[]{moduleIDList},
  +            Object result = server.invoke(DEPLOYER_NAME, "prepareStart", new Object[]{moduleIDList},
                             new String[]{getArrayType(TargetModuleID.class.getName())});
  -            return null; //todo: return a proper P.O. based on whatever the server ends up returning
  +            if(result instanceof Exception) {
  +                throw (Exception)result;
  +            } else {
  +                return new JmxProgressObject(((Integer)result).intValue(), server);
  +            }
           } catch(UndeclaredThrowableException e) {
               throw new RemoteException("Server request failed", e.getCause());
           } catch(Exception e) {
  @@ -174,9 +201,13 @@
   
       public ProgressObject stop(TargetModuleID[] moduleIDList) throws IllegalStateException, RemoteException {
           try {
  -            server.invoke(DEPLOYER_NAME, "stop", new Object[]{moduleIDList},
  +            Object result = server.invoke(DEPLOYER_NAME, "prepareStop", new Object[]{moduleIDList},
                             new String[]{getArrayType(TargetModuleID.class.getName())});
  -            return null; //todo: return a proper P.O. based on whatever the server ends up returning
  +            if(result instanceof Exception) {
  +                throw (Exception)result;
  +            } else {
  +                return new JmxProgressObject(((Integer)result).intValue(), server);
  +            }
           } catch(UndeclaredThrowableException e) {
               throw new RemoteException("Server request failed", e.getCause());
           } catch(Exception e) {
  @@ -186,9 +217,13 @@
   
       public ProgressObject undeploy(TargetModuleID[] moduleIDList) throws IllegalStateException, RemoteException {
           try {
  -            server.invoke(DEPLOYER_NAME, "undeploy", new Object[]{moduleIDList},
  +            Object result = server.invoke(DEPLOYER_NAME, "prepareUndeploy", new Object[]{moduleIDList},
                             new String[]{getArrayType(TargetModuleID.class.getName())});
  -            return null; //todo: return a proper P.O. based on whatever the server ends up returning
  +            if(result instanceof Exception) {
  +                throw (Exception)result;
  +            } else {
  +                return new JmxProgressObject(((Integer)result).intValue(), server);
  +            }
           } catch(UndeclaredThrowableException e) {
               throw new RemoteException("Server request failed", e.getCause());
           } catch(Exception e) {
  
  
  
  1.2       +91 -9     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ApplicationDeployer.java	17 Nov 2003 10:57:40 -0000	1.1
  +++ ApplicationDeployer.java	17 Nov 2003 20:31:07 -0000	1.2
  @@ -111,6 +111,7 @@
           GeronimoMBeanInfo mbeanInfo = new GeronimoMBeanInfo();
           mbeanInfo.setAutostart(true);
           mbeanInfo.setTargetClass(ApplicationDeployer.class.getName());
  +        // Methods taken over from DeploymentController
           mbeanInfo.addOperationInfo(new GeronimoOperationInfo("planDeployment",
                   new GeronimoParameterInfo[] {
                       new GeronimoParameterInfo("Source", ObjectName.class.getName(), "Good question!"),
  @@ -137,6 +138,83 @@
                   0,
                   "Undeploy the URL"));
           //todo: add the rest of the operation methods to support the JSR-88 client
  +        // Methods supporting JSR-88 client
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("getTargets",
  +                new GeronimoParameterInfo[] {},
  +                0,
  +                "Gets a list of the targets available for deployment"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("getRunningModules",
  +                new GeronimoParameterInfo[] {
  +                    new GeronimoParameterInfo("moduleTypeCode", Integer.TYPE.getName(), "The module type to search for, from ModuleType"),
  +                    new GeronimoParameterInfo("targetList", "[L"+Target.class.getName()+";", "The list of targets to search"),
  +                },
  +                0,
  +                "Gets a list of the modules running in the server"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("getNonRunningModules",
  +                new GeronimoParameterInfo[] {
  +                    new GeronimoParameterInfo("moduleTypeCode", Integer.TYPE.getName(), "The module type to search for, from ModuleType"),
  +                    new GeronimoParameterInfo("targetList", "[L"+Target.class.getName()+";", "The list of targets to search"),
  +                },
  +                0,
  +                "Gets a list of the modules distributed but not running in the server"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("getAvailableModules",
  +                new GeronimoParameterInfo[] {
  +                    new GeronimoParameterInfo("moduleTypeCode", Integer.TYPE.getName(), "The module type to search for, from ModuleType"),
  +                    new GeronimoParameterInfo("targetList", "[L"+Target.class.getName()+";", "The list of targets to search"),
  +                },
  +                0,
  +                "Gets a list of the all the modules in the server, whether running or not"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("prepareDistribute",
  +                new GeronimoParameterInfo[] {
  +                    new GeronimoParameterInfo("targets", "[L"+Target.class.getName()+";", "The list of targets to distribute to"),
  +                    new GeronimoParameterInfo("moduleArchive", URL.class.getName(), "A URL to the module to distribute"),
  +                    new GeronimoParameterInfo("deploymentPlan", URL.class.getName(), "A URL to the deployment plan of the module in question"),
  +                },
  +                0,
  +                "Begins the process of distributing a new module.  You must start the deployment job with the returned ID."));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("prepareDistribute",
  +                new GeronimoParameterInfo[] {
  +                    new GeronimoParameterInfo("targets", "[L"+Target.class.getName()+";", "The list of targets to distribute to"),
  +                    new GeronimoParameterInfo("name", String.class.getName(), "The name of the module"),
  +                    new GeronimoParameterInfo("moduleArchive", "[B", "The content of the module to distribute"),
  +                    new GeronimoParameterInfo("deploymentPlan", "[B", "The content of the deployment plan of the module in question"),
  +                },
  +                0,
  +                "Begins the process of distributing a new module.  You must start the deployment job with the returned ID."));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("prepareStart",
  +                new GeronimoParameterInfo[] {
  +                    new GeronimoParameterInfo("modules", "[L"+TargetModuleID.class.getName()+";", "The list of modules to start"),
  +                },
  +                0,
  +                "Begins the process of starting one or more modules.  You must start the deployment job with the returned ID."));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("prepareStop",
  +                new GeronimoParameterInfo[] {
  +                    new GeronimoParameterInfo("modules", "[L"+TargetModuleID.class.getName()+";", "The list of modules to stop"),
  +                },
  +                0,
  +                "Begins the process of stopping one or more modules.  You must start the deployment job with the returned ID."));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("prepareUndeploy",
  +                new GeronimoParameterInfo[] {
  +                    new GeronimoParameterInfo("modules", "[L"+TargetModuleID.class.getName()+";", "The list of modules to undeploy"),
  +                },
  +                0,
  +                "Begins the process of undeploying one or more modules.  You must start the deployment job with the returned ID."));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("prepareRedeploy",
  +                new GeronimoParameterInfo[] {
  +                    new GeronimoParameterInfo("moduleIDList", "[L"+TargetModuleID.class.getName()+";", "The list of modules to redeploy"),
  +                    new GeronimoParameterInfo("moduleArchive", URL.class.getName(), "A URL to the module to distribute"),
  +                    new GeronimoParameterInfo("deploymentPlan", URL.class.getName(), "A URL to the deployment plan of the module in question"),
  +                },
  +                0,
  +                "Begins the process of stopping one or more modules.  You must start the deployment job with the returned ID."));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("prepareRedeploy",
  +                new GeronimoParameterInfo[] {
  +                    new GeronimoParameterInfo("moduleIDList", "[L"+TargetModuleID.class.getName()+";", "The list of modules to redeploy"),
  +                    new GeronimoParameterInfo("moduleArchive", "[B", "The content of the module to distribute"),
  +                    new GeronimoParameterInfo("deploymentPlan", "[B", "The content of the deployment plan of the module in question"),
  +                },
  +                0,
  +                "Begins the process of stopping one or more modules.  You must start the deployment job with the returned ID."));
           return mbeanInfo;
       }
   
  @@ -251,22 +329,26 @@
           //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 DistributeURL(tm, module.toURL(), URLType.PACKED_ARCHIVE)}, new String[]{
  +            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();
   //            if(!deployments.contains(tm)) {
   //                deployments.add(tm);
   //            }
  -        } catch(Exception e) {
  +        } catch(Throwable e) {
               log.error("Unable to prepare a deployment job", e);
  +            while(e.getCause() != null) {
  +                e = e.getCause();
  +                log.error("Unable to prepare a deployment job", e);
  +            }
               return -1;
           }
       }
   
       /**
        */
  -    public int start(TargetModuleID[] modules) {
  +    public int prepareStart(TargetModuleID[] modules) {
           validateModules(modules, false);
           //todo: implement me
           return -1;
  @@ -274,7 +356,7 @@
   
       /**
        */
  -    public int stop(TargetModuleID[] modules) {
  +    public int prepareStop(TargetModuleID[] modules) {
           validateModules(modules, true);
           //todo: implement me
           return -1;
  @@ -282,7 +364,7 @@
   
       /**
        */
  -    public int undeploy(TargetModuleID[] modules) {
  +    public int prepareUndeploy(TargetModuleID[] modules) {
           validateModules(modules, false);
           //todo: implement me
           return -1;
  @@ -290,14 +372,14 @@
   
       /**
        */
  -    public int redeploy(TargetModuleID[] moduleIDList, URL moduleArchive, URL deploymentPlan) {
  +    public int prepareRedeploy(TargetModuleID[] moduleIDList, URL moduleArchive, URL deploymentPlan) {
           //todo: implement me
           return -1;
       }
   
       /**
        */
  -    public int redeploy(TargetModuleID[] moduleIDList, byte[] moduleArchive, byte[] deploymentPlan) {
  +    public int prepareRedeploy(TargetModuleID[] moduleIDList, byte[] moduleArchive, byte[] deploymentPlan) {
           //todo: implement me
           return -1;
       }