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/kernel/src/java/org/apache/geronimo/kernel/deployment/service ClassSpaceMetadata.java ClassSpaceMetadataXMLLoader.java ServiceDeploymentPlanner.java
Date Mon, 27 Oct 2003 21:29:46 GMT
dain        2003/10/27 13:29:46

  Modified:    modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service
                        ClassSpaceMetadata.java
                        ClassSpaceMetadataXMLLoader.java
                        ServiceDeploymentPlanner.java
  Log:
  Updated to reflet new class space implementation.
  
  Revision  Changes    Path
  1.3       +61 -11    incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service/ClassSpaceMetadata.java
  
  Index: ClassSpaceMetadata.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service/ClassSpaceMetadata.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClassSpaceMetadata.java	22 Oct 2003 02:04:31 -0000	1.2
  +++ ClassSpaceMetadata.java	27 Oct 2003 21:29:46 -0000	1.3
  @@ -59,8 +59,10 @@
   import java.util.List;
   import javax.management.ObjectName;
   
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  +
   /**
  - *
  + * This class contains the information necessary to setup a class space for a deployment.
    *
    * @version $Revision$ $Date$
    */
  @@ -71,51 +73,99 @@
   
       private ObjectName name;
       private ObjectName deploymentName;
  -    private String className;
  +    private GeronimoMBeanInfo geronimoMBeanInfo;
       private int create;
       private final List urls = new ArrayList();
       private ObjectName parent;
   
  +    /**
  +     * Gets the object name of the class space for the deployment.
  +     * @return the object name of the class space
  +     */
       public ObjectName getName() {
           return name;
       }
   
  +    /**
  +     * Sets the object name of the class space for the deployment.
  +     * @param name the new class space name
  +     */
       public void setName(ObjectName name) {
           this.name = name;
       }
   
  +    /**
  +     * Gets the object name of the deployment.
  +     * @return the object name of the deployment
  +     */
       public ObjectName getDeploymentName() {
           return deploymentName;
       }
   
  +    /**
  +     * Sets the object name of the deployment
  +     * @param deploymentName the new deployment name
  +     */
       public void setDeploymentName(ObjectName deploymentName) {
           this.deploymentName = deploymentName;
       }
   
  -    public String getClassName() {
  -        return className;
  -    }
  -
  -    public void setClassName(String className) {
  -        this.className = className;
  -    }
  -
  +    /**
  +     * Gets the geronimo mbean info for the class space.  This is only used when
  +     * constructing a new class space.
  +     * @return the geronimo mbean info for the class spacce
  +     */
  +    public GeronimoMBeanInfo getGeronimoMBeanInfo() {
  +        return geronimoMBeanInfo;
  +    }
  +
  +    /**
  +     * Sets the geronimo mbean info for the class space.  This is only used when
  +     * constructing a new class space.
  +     * @param geronimoMBeanInfo the geronimo mbean info for the class spacce
  +     */
  +    public void setGeronimoMBeanInfo(GeronimoMBeanInfo geronimoMBeanInfo) {
  +        this.geronimoMBeanInfo = geronimoMBeanInfo;
  +    }
  +
  +    /**
  +     * Gets the create flag for this class space.  The create flag controls the
  +     * creation of the class space.
  +     * @return the create flag
  +     */
       public int getCreate() {
           return create;
       }
   
  +    /**
  +     * Sets the create flag for this class space.  The create flag controls the
  +     * creation of the class space.
  +     * @param create the create flag
  +     */
       public void setCreate(int create) {
           this.create = create;
       }
   
  +    /**
  +     * Gets the urls to add to the class space for the deployment.
  +     * @return the urls to add to the class space
  +     */
       public List getUrls() {
           return urls;
       }
   
  +    /**
  +     * Gets the name of parent of this class space.
  +     * @return the name of the parent class space
  +     */
       public ObjectName getParent() {
           return parent;
       }
   
  +    /**
  +     * Sets the name of parent of this class space.
  +     * @param parent the name of the parent
  +     */
       public void setParent(ObjectName parent) {
           this.parent = parent;
       }
  
  
  
  1.3       +19 -9     incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service/ClassSpaceMetadataXMLLoader.java
  
  Index: ClassSpaceMetadataXMLLoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/java/org/apache/geronimo/kernel/deployment/service/ClassSpaceMetadataXMLLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ClassSpaceMetadataXMLLoader.java	22 Oct 2003 02:04:31 -0000	1.2
  +++ ClassSpaceMetadataXMLLoader.java	27 Oct 2003 21:29:46 -0000	1.3
  @@ -65,24 +65,28 @@
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   
  +import org.apache.geronimo.kernel.deployment.DeploymentException;
   import org.apache.geronimo.kernel.deployment.scanner.FileSystemScanner;
   import org.apache.geronimo.kernel.deployment.scanner.Scanner;
   import org.apache.geronimo.kernel.deployment.scanner.URLInfo;
   import org.apache.geronimo.kernel.deployment.scanner.WebDAVScanner;
  -import org.apache.geronimo.kernel.deployment.DeploymentException;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfoXMLLoader;
   
   import org.w3c.dom.Element;
   import org.w3c.dom.NodeList;
   
   /**
  - *
  + * Loads class space metadata from xml.
    *
    * @version $Revision$ $Date$
    */
   public class ClassSpaceMetadataXMLLoader {
  +    private static final String DEFAULT_MBEAN_DESCRIPTOR = "org/apache/geronimo/kernel/classspace/classspace-mbean.xml";
  +
       private final URL baseURL;
   
  -    public ClassSpaceMetadataXMLLoader(URL baseURL) {
  +    public ClassSpaceMetadataXMLLoader(URL baseURL) throws DeploymentException {
           this.baseURL = baseURL;
       }
   
  @@ -94,13 +98,19 @@
               throw new DeploymentException(e);
           }
   
  -        // implementation class
  -        String code = element.getAttribute("code").trim();
  -        if (code.length() > 0) {
  -            md.setClassName(code);
  +        // Get the Geronimo MBean info for this class space
  +        String descriptor = element.getAttribute("descriptor").trim();
  +        URL descriptorURL = null;
  +        if (descriptor.length() > 0) {
  +            descriptorURL = ClassLoader.getSystemResource(descriptor);
  +            if (descriptorURL == null) {
  +                throw new DeploymentException("Could not load class space descriptor from
system class loader: descriptor=" + descriptor);
  +            }
           } else {
  -            md.setClassName("org.apache.geronimo.kernel.deployment.loader.ClassSpace");
  +            descriptorURL = ClassLoader.getSystemResource(DEFAULT_MBEAN_DESCRIPTOR);
           }
  +        GeronimoMBeanInfo geronimoMBeanInfo = GeronimoMBeanInfoXMLLoader.loadMBean(descriptorURL);
  +        md.setGeronimoMBeanInfo(geronimoMBeanInfo);
   
           // should we be creating the classloader
           String create = element.getAttribute("create").trim();
  
  
  
  1.4       +8 -5      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.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ServiceDeploymentPlanner.java	22 Oct 2003 02:04:31 -0000	1.3
  +++ ServiceDeploymentPlanner.java	27 Oct 2003 21:29:46 -0000	1.4
  @@ -93,6 +93,7 @@
   import org.apache.geronimo.kernel.deployment.task.StartMBeanInstance;
   import org.apache.geronimo.kernel.deployment.task.StopMBeanInstance;
   import org.apache.geronimo.kernel.jmx.JMXUtil;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfoXMLLoader;
   
   import org.w3c.dom.Document;
   import org.w3c.dom.Element;
  @@ -244,20 +245,22 @@
           return true;
       }
   
  -    private ClassSpaceMetadata createClassSpaceMetadata(Element classSpaceElement, ObjectName
deploymentName, URL baseURL) throws DeploymentException {
  +    private ClassSpaceMetadata createClassSpaceMetadata(Element classSpaceElement, ObjectName
deploymentName, URL deploymentURL) throws DeploymentException {
           ClassSpaceMetadata classSpaceMetadata;
           if (classSpaceElement == null) {
               classSpaceMetadata = new ClassSpaceMetadata();
               try {
  -                classSpaceMetadata.setName(new ObjectName("geronimo.system:role=ClassSpace,name=Application"));
  +                classSpaceMetadata.setName(new ObjectName("geronimo.system:role=ClassSpace,name=Application,url="
+ ObjectName.quote(deploymentURL.toString())));
               } catch (MalformedObjectNameException e) {
                   // this will never happen as above is a valid object name
                   throw new AssertionError(e);
               }
  -            classSpaceMetadata.setClassName("org.apache.geronimo.kernel.deployment.loader.ClassSpace");
  +            classSpaceMetadata.setGeronimoMBeanInfo(GeronimoMBeanInfoXMLLoader.loadMBean(
  +                    ClassLoader.getSystemResource("org/apache/geronimo/kernel/classspace/classspace-mbean.xml")
  +            ));
               classSpaceMetadata.setCreate(ClassSpaceMetadata.CREATE_IF_NECESSARY);
           } else {
  -            ClassSpaceMetadataXMLLoader classSpaceLoader = new ClassSpaceMetadataXMLLoader(baseURL);
  +            ClassSpaceMetadataXMLLoader classSpaceLoader = new ClassSpaceMetadataXMLLoader(deploymentURL);
               classSpaceMetadata = classSpaceLoader.loadXML(classSpaceElement);
           }
           classSpaceMetadata.setDeploymentName(deploymentName);
  
  
  

Mime
View raw message