geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service ServiceDeploymentPlanner.java
Date Mon, 18 Aug 2003 22:13:18 GMT
dain        2003/08/18 15:13:18

  Modified:    modules/core/src/java/org/apache/geronimo/deployment/service
                        ServiceDeploymentPlanner.java
  Log:
  Added a plan to stop the deployment before destruction.  Since all MBeans now depend on
  thier parent deployment unit, the stop will stop all MBeans in the deployment.
  
  Revision  Changes    Path
  1.5       +23 -16    incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/ServiceDeploymentPlanner.java
  
  Index: ServiceDeploymentPlanner.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/ServiceDeploymentPlanner.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ServiceDeploymentPlanner.java	16 Aug 2003 23:16:34 -0000	1.4
  +++ ServiceDeploymentPlanner.java	18 Aug 2003 22:13:18 -0000	1.5
  @@ -90,6 +90,7 @@
   import org.apache.geronimo.deployment.plan.RegisterMBeanInstance;
   import org.apache.geronimo.deployment.plan.InitializeMBeanInstance;
   import org.apache.geronimo.deployment.plan.StartMBeanInstance;
  +import org.apache.geronimo.deployment.plan.StopMBeanInstance;
   import org.apache.geronimo.deployment.scanner.URLType;
   import org.apache.geronimo.jmx.JMXUtil;
   
  @@ -205,8 +206,11 @@
           } catch (MalformedObjectNameException e) {
               throw new DeploymentException(e);
           }
  +
           ServiceDeployment serviceInfo = new ServiceDeployment(deploymentName, null, url);
           createDeploymentUnitPlan.addTask(new RegisterMBeanInstance(server, deploymentName,
serviceInfo));
  +        MBeanMetadata metadata = new MBeanMetadata(deploymentName);
  +        createDeploymentUnitPlan.addTask(new StartMBeanInstance(server, metadata));
   
           ObjectName loaderName = addClassSpaces(doc.getElementsByTagName("class-space"),
createDeploymentUnitPlan, url);
           plans.add(createDeploymentUnitPlan);
  @@ -217,17 +221,17 @@
               DeploymentPlan createPlan = new DeploymentPlan();
   
               Element mbeanElement = (Element) nl.item(i);
  -            MBeanMetadata md = mbeanLoader.loadXML(mbeanElement);
  -            if (server.isRegistered(md.getName())) {
  -                throw new DeploymentException("MBean already exists " + md.getName());
  +            metadata = mbeanLoader.loadXML(mbeanElement);
  +            if (server.isRegistered(metadata.getName())) {
  +                throw new DeploymentException("MBean already exists " + metadata.getName());
               }
  -            md.setLoaderName(loaderName);
  -            md.setParentName(deploymentName);
  -            CreateMBeanInstance createTask = new CreateMBeanInstance(server, md);
  +            metadata.setLoaderName(loaderName);
  +            metadata.setParentName(deploymentName);
  +            CreateMBeanInstance createTask = new CreateMBeanInstance(server, metadata);
               createPlan.addTask(createTask);
  -            InitializeMBeanInstance initTask = new InitializeMBeanInstance(server, md);
  +            InitializeMBeanInstance initTask = new InitializeMBeanInstance(server, metadata);
               createPlan.addTask(initTask);
  -            StartMBeanInstance startTask = new StartMBeanInstance(server, md);
  +            StartMBeanInstance startTask = new StartMBeanInstance(server, metadata);
               createPlan.addTask(startTask);
   
               plans.add(createPlan);
  @@ -272,17 +276,20 @@
               throw new DeploymentException(e);
           }
   
  +        // Stop the main deployment which stopps all dependents including its children
  +        DeploymentPlan stopPlan = new DeploymentPlan();
  +        stopPlan.addTask(new StopMBeanInstance(server, deploymentName));
  +        plans.add(stopPlan);
  +
  +        // Plan the destruction of all the children and then the deployment
  +        DeploymentPlan destroyPlan = new DeploymentPlan();
           for (Iterator i = mbeans.iterator(); i.hasNext();) {
               ObjectName name = (ObjectName) i.next();
  -            DeploymentTask task = new DestroyMBeanInstance(server, name);
  -            DeploymentPlan destroyPlan = new DeploymentPlan();
  -            destroyPlan.addTask(task);
  -            plans.add(destroyPlan);
  +            destroyPlan.addTask(new DestroyMBeanInstance(server, name));
           }
   
  -        DeploymentPlan undeployPlan = new DeploymentPlan();
  -        undeployPlan.addTask(new DestroyMBeanInstance(server, deploymentName));
  -        plans.add(undeployPlan);
  +        destroyPlan.addTask(new DestroyMBeanInstance(server, deploymentName));
  +        plans.add(destroyPlan);
   
           goals.remove(goal);
           return true;
  
  
  

Mime
View raw message