geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/web/src/java/org/apache/geronimo/web AbstractWebContainer.java WebDeployment.java
Date Sun, 28 Dec 2003 23:06:42 GMT
djencks     2003/12/28 15:06:42

  Modified:    modules/core/src/java/org/apache/geronimo/connector/deployment
                        ConnectorDeploymentPlanner.java
               modules/kernel/src/java/org/apache/geronimo/kernel/deployment
                        DeploymentInfo.java
               modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service
                        ServiceDeploymentPlanner.java
               modules/web/src/java/org/apache/geronimo/web
                        AbstractWebContainer.java
  Removed:     modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service
                        ServiceDeployment.java
               modules/web/src/java/org/apache/geronimo/web
                        WebDeployment.java
  Log:
  Make DeploymentInfo into a GeronimoMBean
  
  Revision  Changes    Path
  1.9       +7 -13     incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/ConnectorDeploymentPlanner.java
  
  Index: ConnectorDeploymentPlanner.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/ConnectorDeploymentPlanner.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ConnectorDeploymentPlanner.java	9 Dec 2003 04:22:10 -0000	1.8
  +++ ConnectorDeploymentPlanner.java	28 Dec 2003 23:06:42 -0000	1.9
  @@ -148,22 +148,16 @@
   
           ObjectName deploymentUnitName = dHelper.buildDeploymentName();
   
  -        // Defines a deployment plan for the deployment unit.
  -        DeploymentPlan deploymentPlan = new DeploymentPlan();
  -        DeploymentInfo deploymentInfo =
  -                new DeploymentInfo(deploymentUnitName, null, url);
  -        deploymentPlan.addTask(
  -                new RegisterMBeanInstance(getServer(), deploymentUnitName, deploymentInfo));
  -        MBeanMetadata deploymentUnitMetadata = new MBeanMetadata(deploymentUnitName);
  -        deploymentPlan.addTask(
  -                new StartMBeanInstance(getServer(), deploymentUnitMetadata));
  +        // Define a deployment plan for the deployment unit.
  +        DeploymentPlan deploymentInfoPlan = DeploymentInfo.planDeploymentInfo(getServer(),
null, deploymentUnitName, null, url);
  +
           // Define the ClassSpace for the Connector archives.
           ClassSpaceMetadata raCS = dHelper.buildClassSpace();
  -        deploymentPlan.addTask(new CreateClassSpace(getServer(), raCS));//parent???
  -        plans.add(deploymentPlan);
  +        deploymentInfoPlan.addTask(new CreateClassSpace(getServer(), raCS));//parent???
  +        plans.add(deploymentInfoPlan);
   
           //now another plan for the tasks that depend on the class space.
  -        deploymentPlan = new DeploymentPlan();
  +        DeploymentPlan deploymentPlan = new DeploymentPlan();
           // Load the deployment descriptor into our POJO
           URI raURI = URI.create(raURL.toString()).normalize();
           log.trace("Loading deployment descriptor " + raURI);
  
  
  
  1.2       +40 -32    incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/DeploymentInfo.java
  
  Index: DeploymentInfo.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/DeploymentInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DeploymentInfo.java	8 Sep 2003 04:38:33 -0000	1.1
  +++ DeploymentInfo.java	28 Dec 2003 23:06:42 -0000	1.2
  @@ -60,77 +60,85 @@
   import java.util.Collections;
   import java.util.HashSet;
   import java.util.Set;
  +
  +import javax.management.MBeanServer;
   import javax.management.ObjectName;
   
  -import org.apache.geronimo.kernel.service.AbstractManagedObject;
  +import org.apache.geronimo.kernel.deployment.service.MBeanMetadata;
  +import org.apache.geronimo.kernel.deployment.task.DeployGeronimoMBean;
  +import org.apache.geronimo.kernel.deployment.task.StartMBeanInstance;
  +import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  +import org.apache.geronimo.kernel.service.GeronimoOperationInfo;
  +import org.apache.geronimo.kernel.service.GeronimoParameterInfo;
   
   /**
    *
  - * @jmx:mbean
  - *      extends="org.apache.geronimo.kernel.management.StateManageable,org.apache.geronimo.kernel.management.ManagedObject"
  - *
    * @version $Revision$ $Date$
    */
  -public class DeploymentInfo extends AbstractManagedObject implements DeploymentInfoMBean
{
  +public class DeploymentInfo {
       private final URL url;
       private final ObjectName name;
       private final ObjectName parent;
       private final Set children = new HashSet();
   
  -    /**
  -     * @jmx:managed-constructor
  -     */
       public DeploymentInfo(ObjectName name, ObjectName parent, URL url) {
           this.name = name;
           this.parent = parent;
           this.url = url;
       }
   
  -    protected void doStart() throws Exception {
  -    }
   
  -    protected void doStop() throws Exception {
  -    }
  -
  -    /**
  -     * @jmx:managed-attribute
  -     */
       public URL getURL() {
           return url;
       }
   
  -    /**
  -     * @jmx:managed-attribute
  -     */
       public ObjectName getName() {
           return name;
       }
   
  -    /**
  -     * @jmx:managed-attribute
  -     */
       public ObjectName getParent() {
           return parent;
       }
   
  -    /**
  -     * @jmx:managed-attribute
  -     */
       public Collection getChildren() {
           return Collections.unmodifiableCollection(children);
       }
   
  -    /**
  -     * @jmx:managed-attribute
  -     */
       public synchronized void addChild(ObjectName childName) {
           children.add(childName);
       }
   
  -    /**
  -     * @jmx:managed-attribute
  -     */
       public synchronized void removeChild(ObjectName childName) {
           children.remove(childName);
  +    }
  +
  +    public static GeronimoMBeanInfo getGeronimoMBeanInfo() {
  +        GeronimoMBeanInfo mbeanInfo = new GeronimoMBeanInfo();
  +        mbeanInfo.setTargetClass(DeploymentInfo.class);
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("URL", true, false, "URL of
deployed package"));
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Name", true, false, "Name
of deployed package"));
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Parent", true, false, "Parent
DeploymentInfo ObjectName of deployed package"));
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Children", true, false, "Child
DeploymentInfo ObjectName of deployed package"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("addChild",
  +                new GeronimoParameterInfo[]{new GeronimoParameterInfo("ChildName", ObjectName.class,
"ObjectName of child deployment info")},
  +                GeronimoOperationInfo.ACTION,
  +                "Add a child deployment info"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("removeChild",
  +                new GeronimoParameterInfo[]{new GeronimoParameterInfo("ChildName", ObjectName.class,
"ObjectName of child deployment info")},
  +                GeronimoOperationInfo.ACTION,
  +                "remove a child deployment info"));
  +        return mbeanInfo;
  +    }
  +
  +    public static DeploymentPlan planDeploymentInfo(MBeanServer server, ObjectName loaderName,
ObjectName deploymentInfoName, ObjectName parentName, URL deploymentURL) {
  +        DeploymentPlan plan = new DeploymentPlan();
  +        DeploymentInfo deploymentInfo = new DeploymentInfo(deploymentInfoName, parentName,
deploymentURL);
  +        GeronimoMBeanInfo mbeanInfo = DeploymentInfo.getGeronimoMBeanInfo();
  +        mbeanInfo.setTarget(deploymentInfo);
  +        MBeanMetadata metadata = new MBeanMetadata(deploymentInfoName, mbeanInfo, loaderName,
parentName);
  +        plan.addTask(new DeployGeronimoMBean(server, metadata));
  +        plan.addTask(new StartMBeanInstance(server, metadata));
  +        return plan;
       }
   }
  
  
  
  1.7       +9 -28     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service/ServiceDeploymentPlanner.java
  
  Index: ServiceDeploymentPlanner.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service/ServiceDeploymentPlanner.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ServiceDeploymentPlanner.java	14 Nov 2003 16:27:34 -0000	1.6
  +++ ServiceDeploymentPlanner.java	28 Dec 2003 23:06:42 -0000	1.7
  @@ -60,50 +60,36 @@
   import java.net.URI;
   import java.net.URL;
   import java.util.Collection;
  -import java.util.HashSet;
   import java.util.Iterator;
  -import java.util.List;
   import java.util.Set;
   
   import javax.management.AttributeNotFoundException;
   import javax.management.InstanceNotFoundException;
   import javax.management.MBeanException;
  -import javax.management.MBeanRegistration;
  -import javax.management.MBeanServer;
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   import javax.management.ReflectionException;
  -import javax.management.relation.RelationServiceMBean;
  -import javax.management.relation.Role;
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.ParserConfigurationException;
   
  +import org.apache.geronimo.kernel.deployment.AbstractDeploymentPlanner;
   import org.apache.geronimo.kernel.deployment.DeploymentException;
  -import org.apache.geronimo.kernel.deployment.scanner.URLType;
  +import org.apache.geronimo.kernel.deployment.DeploymentInfo;
  +import org.apache.geronimo.kernel.deployment.DeploymentPlan;
   import org.apache.geronimo.kernel.deployment.goal.DeployURL;
  -import org.apache.geronimo.kernel.deployment.goal.DeploymentGoal;
   import org.apache.geronimo.kernel.deployment.goal.RedeployURL;
   import org.apache.geronimo.kernel.deployment.goal.UndeployURL;
  +import org.apache.geronimo.kernel.deployment.scanner.URLType;
   import org.apache.geronimo.kernel.deployment.task.CreateClassSpace;
   import org.apache.geronimo.kernel.deployment.task.CreateMBeanInstance;
  -import org.apache.geronimo.kernel.deployment.DeploymentPlan;
  -import org.apache.geronimo.kernel.deployment.DeploymentPlanner;
  -import org.apache.geronimo.kernel.deployment.AbstractDeploymentPlanner;
  +import org.apache.geronimo.kernel.deployment.task.DeployGeronimoMBean;
   import org.apache.geronimo.kernel.deployment.task.DestroyMBeanInstance;
   import org.apache.geronimo.kernel.deployment.task.InitializeMBeanInstance;
  -import org.apache.geronimo.kernel.deployment.task.RegisterMBeanInstance;
   import org.apache.geronimo.kernel.deployment.task.StartMBeanInstance;
   import org.apache.geronimo.kernel.deployment.task.StopMBeanInstance;
  -import org.apache.geronimo.kernel.deployment.task.DeployGeronimoMBean;
  -import org.apache.geronimo.kernel.jmx.JMXUtil;
  -import org.apache.geronimo.kernel.service.GeronimoMBeanInfoXMLLoader;
  -import org.apache.geronimo.kernel.service.GeronimoMBeanTarget;
  -import org.apache.geronimo.kernel.service.GeronimoMBeanContext;
   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.GeronimoMBeanInfoXMLLoader;
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
  @@ -175,18 +161,13 @@
           }
   
           // Create a plan to register the deployment unit and create the class loader
  -        DeploymentPlan createDeploymentUnitPlan = new DeploymentPlan();
           ObjectName deploymentName = null;
           try {
               deploymentName = new ObjectName("geronimo.deployment:role=DeploymentUnit,type=Service,url="
+ ObjectName.quote(url.toString()));
           } catch (MalformedObjectNameException e) {
               throw new DeploymentException(e);
           }
  -        ServiceDeployment serviceInfo = new ServiceDeployment(deploymentName, null, url);
  -        createDeploymentUnitPlan.addTask(new RegisterMBeanInstance(getServer(), deploymentName,
serviceInfo));
  -        MBeanMetadata metadata = new MBeanMetadata(deploymentName);
  -        createDeploymentUnitPlan.addTask(new StartMBeanInstance(getServer(), metadata));
  -
  +        DeploymentPlan createDeploymentUnitPlan = DeploymentInfo.planDeploymentInfo(getServer(),
null, deploymentName, null, url);
           // add a plan to create a class space
           ClassSpaceMetadata md = createClassSpaceMetadata((Element) doc.getElementsByTagName("class-space").item(0),
deploymentName, url);
           createDeploymentUnitPlan.addTask(new CreateClassSpace(getServer(), md));
  @@ -198,7 +179,7 @@
           for (int i = 0; i < nl.getLength(); i++) {
   
               Element mbeanElement = (Element) nl.item(i);
  -            metadata = mbeanLoader.loadXML(baseURI, mbeanElement);
  +            MBeanMetadata metadata = mbeanLoader.loadXML(baseURI, mbeanElement);
               if (getServer().isRegistered(metadata.getName())) {
                   throw new DeploymentException("MBean already exists " + metadata.getName());
               }
  
  
  
  1.25      +2 -6      incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebContainer.java
  
  Index: AbstractWebContainer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/web/src/java/org/apache/geronimo/web/AbstractWebContainer.java,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- AbstractWebContainer.java	7 Dec 2003 03:45:48 -0000	1.24
  +++ AbstractWebContainer.java	28 Dec 2003 23:06:42 -0000	1.25
  @@ -243,11 +243,7 @@
           ObjectName deploymentUnitName = deploymentHelper.buildDeploymentName();
   
           // Add a task to deploy and start the deployment unit mbean
  -        DeploymentPlan deploymentInfoPlan = new DeploymentPlan();
  -        DeploymentInfo deploymentInfo = new DeploymentInfo(deploymentUnitName, null, url);
  -        deploymentInfoPlan.addTask(new RegisterMBeanInstance(server, deploymentUnitName,
deploymentInfo));
  -        MBeanMetadata deploymentUnitMetadata = new MBeanMetadata(deploymentUnitName);
  -        deploymentInfoPlan.addTask(new StartMBeanInstance(server, deploymentUnitMetadata));
  +        DeploymentPlan deploymentInfoPlan = DeploymentInfo.planDeploymentInfo(server, null,
deploymentUnitName, null, url);
   
           // Define the ClassSpace for the archives.
           ClassSpaceMetadata classSpaceMetaData = deploymentHelper.buildClassSpace();
  
  
  

Mime
View raw message