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 MBeanMetadata.java MBeanMetadataXMLLoader.java ServiceDeploymentPlanner.java
Date Fri, 05 Sep 2003 02:37:49 GMT
dain        2003/09/04 19:37:49

  Modified:    modules/core/src/java/org/apache/geronimo/deployment/service
                        MBeanMetadata.java MBeanMetadataXMLLoader.java
                        ServiceDeploymentPlanner.java
  Log:
  Added support for GeronimoMBean.
  
  Revision  Changes    Path
  1.6       +21 -3     incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanMetadata.java
  
  Index: MBeanMetadata.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanMetadata.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MBeanMetadata.java	20 Aug 2003 22:41:23 -0000	1.5
  +++ MBeanMetadata.java	5 Sep 2003 02:37:49 -0000	1.6
  @@ -55,22 +55,25 @@
    */
   package org.apache.geronimo.deployment.service;
   
  +import java.net.URI;
   import java.util.ArrayList;
   import java.util.HashMap;
   import java.util.HashSet;
   import java.util.List;
   import java.util.Map;
   import java.util.Set;
  -import java.net.URI;
   import javax.management.ObjectName;
   
  +import org.apache.geronimo.jmx.GeronimoMBeanInfo;
  +
   /**
  - *
  + * Metadata about an MBean that is use during deployment.
    *
    * @version $Revision$ $Date$
    */
   public class MBeanMetadata {
       private String code;
  +    private GeronimoMBeanInfo geronimoMBeanInfo;
       private ObjectName name;
       private ObjectName loaderName;
       private ObjectName parentName;
  @@ -106,12 +109,27 @@
           this.parentName = parentName;
       }
   
  +    public MBeanMetadata(ObjectName name, GeronimoMBeanInfo geronimoMBeanInfo, ObjectName
loaderName, ObjectName parentName) {
  +        this.name = name;
  +        this.geronimoMBeanInfo = geronimoMBeanInfo;
  +        this.loaderName = loaderName;
  +        this.parentName = parentName;
  +    }
  +
       public String getCode() {
           return code;
       }
   
       public void setCode(String code) {
           this.code = code;
  +    }
  +
  +    public GeronimoMBeanInfo getGeronimoMBeanInfo() {
  +        return geronimoMBeanInfo;
  +    }
  +
  +    public void setGeronimoMBeanInfo(GeronimoMBeanInfo geronimoMBeanInfo) {
  +        this.geronimoMBeanInfo = geronimoMBeanInfo;
       }
   
       public ObjectName getName() {
  
  
  
  1.6       +25 -6     incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanMetadataXMLLoader.java
  
  Index: MBeanMetadataXMLLoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanMetadataXMLLoader.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- MBeanMetadataXMLLoader.java	27 Aug 2003 03:43:36 -0000	1.5
  +++ MBeanMetadataXMLLoader.java	5 Sep 2003 02:37:49 -0000	1.6
  @@ -55,27 +55,46 @@
    */
   package org.apache.geronimo.deployment.service;
   
  +import java.net.URI;
   import java.util.List;
   import java.util.Map;
   import java.util.Set;
  -
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   
   import org.apache.geronimo.deployment.DeploymentException;
  +import org.apache.geronimo.jmx.GeronimoMBeanInfo;
  +import org.apache.geronimo.jmx.GeronimoMBeanInfoXMLLoader;
  +
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
   
   /**
  - *
  + * Loads MBean metadata from xml.
    *
    * @version $Revision$ $Date$
    */
   public class MBeanMetadataXMLLoader {
  -    public MBeanMetadata loadXML(Element element) throws DeploymentException {
  +    private final GeronimoMBeanInfoXMLLoader xmlLoader;
  +
  +    public MBeanMetadataXMLLoader() throws DeploymentException {
  +        this.xmlLoader = new GeronimoMBeanInfoXMLLoader();
  +    }
  +
  +    public MBeanMetadata loadXML(URI baseURI, Element element) throws DeploymentException
{
           MBeanMetadata md = new MBeanMetadata();
  -        md.setCode(element.getAttribute("code").trim());
  +        md.setBaseURI(baseURI);
  +        String code = element.getAttribute("code").trim();
  +        if (code.length() > 0) {
  +            md.setCode(code);
  +        }
  +        String descriptor = element.getAttribute("descriptor").trim();
  +        if (descriptor.length() > 0) {
  +            URI descriptorURI = baseURI.resolve(descriptor);
  +            GeronimoMBeanInfo geronimoMBeanInfo = xmlLoader.loadXML(descriptorURI);
  +            md.setGeronimoMBeanInfo(geronimoMBeanInfo);
  +        }
           String s = element.getAttribute("name").trim();
           try {
               if (s.length() > 0) {
  @@ -117,7 +136,7 @@
   
               ObjectName target = null;
               String targetString = argElement.getAttribute("target");
  -            if(targetString != null && targetString.length() > 0) {
  +            if (targetString != null && targetString.length() > 0) {
                   try {
                       target = new ObjectName(targetString);
                   } catch (MalformedObjectNameException e) {
  
  
  
  1.11      +10 -15    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.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ServiceDeploymentPlanner.java	1 Sep 2003 20:38:49 -0000	1.10
  +++ ServiceDeploymentPlanner.java	5 Sep 2003 02:37:49 -0000	1.11
  @@ -64,7 +64,6 @@
   import java.util.Iterator;
   import java.util.List;
   import java.util.Set;
  -
   import javax.management.AttributeNotFoundException;
   import javax.management.InstanceNotFoundException;
   import javax.management.MBeanException;
  @@ -79,8 +78,6 @@
   import javax.xml.parsers.DocumentBuilderFactory;
   import javax.xml.parsers.ParserConfigurationException;
   
  -import org.apache.commons.logging.Log;
  -import org.apache.commons.logging.LogFactory;
   import org.apache.geronimo.deployment.DeploymentException;
   import org.apache.geronimo.deployment.goal.DeployURL;
   import org.apache.geronimo.deployment.goal.DeploymentGoal;
  @@ -96,29 +93,26 @@
   import org.apache.geronimo.deployment.plan.StopMBeanInstance;
   import org.apache.geronimo.deployment.scanner.URLType;
   import org.apache.geronimo.jmx.JMXUtil;
  +
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
   
   /**
  + * Plans deployment of MBean services.
    *
  - * @jmx:mbean
  - *      extends="org.apache.geronimo.deployment.DeploymentPlanner"
  + * @jmx:mbean extends="org.apache.geronimo.deployment.DeploymentPlanner"
    *
    * @version $Revision$ $Date$
    */
  -public class ServiceDeploymentPlanner
  -    implements ServiceDeploymentPlannerMBean, MBeanRegistration
  -{
  -    private static final Log log = LogFactory.getLog(ServiceDeploymentPlanner.class);
  -    
  +public class ServiceDeploymentPlanner implements ServiceDeploymentPlannerMBean, MBeanRegistration
{
       private MBeanServer server;
       private ObjectName objectName;
       private RelationServiceMBean relationService;
       private final DocumentBuilder parser;
       private final MBeanMetadataXMLLoader mbeanLoader;
   
  -    public ServiceDeploymentPlanner() {
  +    public ServiceDeploymentPlanner() throws DeploymentException {
           DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
           try {
               parser = factory.newDocumentBuilder();
  @@ -173,8 +167,9 @@
       private boolean addURL(DeployURL goal, Set goals, Set plans) throws DeploymentException
{
           InputStream is;
           URL url = goal.getUrl();
  -        URI baseURI = URI.create(url.toString()).normalize();;
  -        
  +        URI baseURI = URI.create(url.toString()).normalize();
  +        ;
  +
           URLType type = goal.getType();
           if (type == URLType.RESOURCE) {
               if (!url.getPath().endsWith("-service.xml")) {
  @@ -227,7 +222,7 @@
               DeploymentPlan createPlan = new DeploymentPlan();
   
               Element mbeanElement = (Element) nl.item(i);
  -            metadata = mbeanLoader.loadXML(mbeanElement);
  +            metadata = mbeanLoader.loadXML(baseURI, mbeanElement);
               if (server.isRegistered(metadata.getName())) {
                   throw new DeploymentException("MBean already exists " + metadata.getName());
               }
  
  
  

Mime
View raw message