geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jboy...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/xml components.xsd
Date Mon, 11 Aug 2003 19:46:28 GMT
jboynes     2003/08/11 12:46:28

  Modified:    modules/core/src/conf boot-service.xml
               modules/core/src/java/org/apache/geronimo/deployment/plan
                        CreateMBeanInstance.java
               modules/core/src/java/org/apache/geronimo/deployment/service
                        MBeanMetadata.java MBeanMetadataXMLLoader.java
               modules/core/src/xml components.xsd
  Added:       modules/core/src/java/org/apache/geronimo/deployment/plan
                        InvokeMBeanOperation.java
               modules/core/src/java/org/apache/geronimo/deployment/service
                        MBeanOperation.java
  Log:
  Add MBean invoke operation to service deployment
  Add a sample URL to the deployment of the scanner
  
  Revision  Changes    Path
  1.2       +4 -0      incubator-geronimo/modules/core/src/conf/boot-service.xml
  
  Index: boot-service.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/conf/boot-service.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- boot-service.xml	11 Aug 2003 17:59:08 -0000	1.1
  +++ boot-service.xml	11 Aug 2003 19:46:28 -0000	1.2
  @@ -16,6 +16,10 @@
       <mbean code="org.apache.geronimo.deployment.scanner.DeploymentScanner" name="geronimo.deployment:role=DeploymentScanner">
           <attribute name="ScanInterval">5000</attribute>
           <relationship type="DeploymentController-DeploymentScanner" name="DeploymentController-DeploymentScanner"
role="DeploymentScanner"/>
  +        <invoke operation="addURL">
  +            <arg type="java.lang.String">file:/D:/temp/deploy/</arg>
  +            <arg type="boolean">false</arg>
  +        </invoke>
       </mbean>
   
   </components>
  
  
  
  1.2       +18 -1     incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/plan/CreateMBeanInstance.java
  
  Index: CreateMBeanInstance.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/plan/CreateMBeanInstance.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CreateMBeanInstance.java	11 Aug 2003 17:59:10 -0000	1.1
  +++ CreateMBeanInstance.java	11 Aug 2003 19:46:28 -0000	1.2
  @@ -84,6 +84,7 @@
   import org.apache.geronimo.deployment.DeploymentException;
   import org.apache.geronimo.deployment.service.MBeanMetadata;
   import org.apache.geronimo.deployment.service.MBeanRelationship;
  +import org.apache.geronimo.deployment.service.MBeanOperation;
   import org.apache.geronimo.jmx.JMXUtil;
   
   /**
  @@ -237,6 +238,22 @@
   
               DeploymentPlan startPlan = new DeploymentPlan();
               startPlan.addTask(new StartMBeanInstance(server, actualName));
  +            List operations = metadata.getOperations();
  +            for (Iterator i = operations.iterator(); i.hasNext();) {
  +                MBeanOperation operation = (MBeanOperation) i.next();
  +                int argCount = operation.getTypes().size();
  +                String[] argTypes = (String[]) operation.getTypes().toArray(new String[argCount]);
  +                List values = operation.getArgs();
  +                Object[] args = new Object[argCount];
  +                for (int j=0; j < argCount; j++) {
  +                    Object value = values.get(j);
  +                    if (value instanceof String) {
  +                        value = getValue(newCL, argTypes[j], (String) value);
  +                    }
  +                    args[j] = value;
  +                }
  +                startPlan.addTask(new InvokeMBeanOperation(server, actualName, operation.getOperation(),
argTypes, args));
  +            }
               plans.add(startPlan);
           } catch (DeploymentException e) {
               undo();
  
  
  
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/plan/InvokeMBeanOperation.java
  
  Index: InvokeMBeanOperation.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.deployment.plan;
  
  import javax.management.MBeanServer;
  import javax.management.ObjectName;
  import javax.management.InstanceNotFoundException;
  import javax.management.MBeanException;
  import javax.management.ReflectionException;
  
  import org.apache.geronimo.deployment.DeploymentException;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2003/08/11 19:46:28 $
   */
  public class InvokeMBeanOperation extends DeploymentTask {
      private final MBeanServer server;
      private final ObjectName name;
      private final String operation;
      private final String[] argTypes;
      private final Object[] args;
  
      public InvokeMBeanOperation(MBeanServer server, ObjectName name, String operation, String[]
argTypes, Object[] args) {
          this.server = server;
          this.name = name;
          this.operation = operation;
          this.argTypes = argTypes;
          this.args = args;
      }
  
      public void perform() throws DeploymentException {
          try {
              server.invoke(name, operation, args, argTypes);
          } catch (InstanceNotFoundException e) {
              throw new DeploymentException(e);
          } catch (MBeanException e) {
              throw new DeploymentException(e);
          } catch (ReflectionException e) {
              throw new DeploymentException(e);
          }
      }
  
      public void undo() {
      }
  }
  
  
  
  1.2       +6 -1      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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MBeanMetadata.java	11 Aug 2003 17:59:11 -0000	1.1
  +++ MBeanMetadata.java	11 Aug 2003 19:46:28 -0000	1.2
  @@ -75,6 +75,7 @@
       private final List constructorArgs = new ArrayList();
       private final Map attributeValues = new HashMap();
       private final Set relationships = new HashSet();
  +    private final List operations = new ArrayList();
   
       public String getCode() {
           return code;
  @@ -106,5 +107,9 @@
   
       public Set getRelationships() {
           return relationships;
  +    }
  +
  +    public List getOperations() {
  +        return operations;
       }
   }
  
  
  
  1.2       +19 -1     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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- MBeanMetadataXMLLoader.java	11 Aug 2003 17:59:11 -0000	1.1
  +++ MBeanMetadataXMLLoader.java	11 Aug 2003 19:46:28 -0000	1.2
  @@ -58,6 +58,7 @@
   import java.util.List;
   import java.util.Map;
   import java.util.Set;
  +import java.util.ArrayList;
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   
  @@ -116,6 +117,23 @@
               String target = argElement.getAttribute("target");
               MBeanRelationship relationship = new MBeanRelationship(name, type, role, target);
               relationships.add(relationship);
  +        }
  +
  +        nl = element.getElementsByTagName("invoke");
  +        List operations = md.getOperations();
  +        for (int i = 0; i < nl.getLength(); i++) {
  +            Element invokeElement = (Element) nl.item(i);
  +            String operation = invokeElement.getAttribute("operation");
  +            NodeList argList = invokeElement.getElementsByTagName("arg");
  +            List types = new ArrayList(argList.getLength());
  +            List args = new ArrayList(argList.getLength());
  +            for (int j=0; j < argList.getLength(); j++) {
  +                Element argElement = (Element) argList.item(j);
  +                String type = argElement.getAttribute("type");
  +                types.add(type);
  +                args.add(getValue(argElement));
  +            }
  +            operations.add(new MBeanOperation(operation, types, args));
           }
   
           return md;
  
  
  
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/service/MBeanOperation.java
  
  Index: MBeanOperation.java
  ===================================================================
  /* ====================================================================
   * The Apache Software License, Version 1.1
   *
   * Copyright (c) 2003 The Apache Software Foundation.  All rights
   * reserved.
   *
   * Redistribution and use in source and binary forms, with or without
   * modification, are permitted provided that the following conditions
   * are met:
   *
   * 1. Redistributions of source code must retain the above copyright
   *    notice, this list of conditions and the following disclaimer.
   *
   * 2. Redistributions in binary form must reproduce the above copyright
   *    notice, this list of conditions and the following disclaimer in
   *    the documentation and/or other materials provided with the
   *    distribution.
   *
   * 3. The end-user documentation included with the redistribution,
   *    if any, must include the following acknowledgment:
   *       "This product includes software developed by the
   *        Apache Software Foundation (http://www.apache.org/)."
   *    Alternately, this acknowledgment may appear in the software itself,
   *    if and wherever such third-party acknowledgments normally appear.
   *
   * 4. The names "Apache" and "Apache Software Foundation" and
   *    "Apache Geronimo" must not be used to endorse or promote products
   *    derived from this software without prior written permission. For
   *    written permission, please contact apache@apache.org.
   *
   * 5. Products derived from this software may not be called "Apache",
   *    "Apache Geronimo", nor may "Apache" appear in their name, without
   *    prior written permission of the Apache Software Foundation.
   *
   * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
   * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
   * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
   * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
   * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
   * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
   * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
   * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
   * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
   * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   * SUCH DAMAGE.
   * ====================================================================
   *
   * This software consists of voluntary contributions made by many
   * individuals on behalf of the Apache Software Foundation.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   *
   * ====================================================================
   */
  package org.apache.geronimo.deployment.service;
  
  import java.util.List;
  
  /**
   * 
   * 
   * @version $Revision: 1.1 $ $Date: 2003/08/11 19:46:28 $
   */
  public class MBeanOperation {
      private final String operation;
      private final List types;
      private final List args;
  
      public MBeanOperation(String operation, List types, List args) {
          this.operation = operation;
          this.types = types;
          this.args = args;
      }
  
      public String getOperation() {
          return operation;
      }
  
      public List getTypes() {
          return types;
      }
  
      public List getArgs() {
          return args;
      }
  }
  
  
  
  1.2       +84 -75    incubator-geronimo/modules/core/src/xml/components.xsd
  
  Index: components.xsd
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/xml/components.xsd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- components.xsd	11 Aug 2003 18:21:56 -0000	1.1
  +++ components.xsd	11 Aug 2003 19:46:28 -0000	1.2
  @@ -1,78 +1,87 @@
   <?xml version="1.0" encoding="UTF-8"?>
   <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
attributeFormDefault="unqualified">
  -  <xs:element name="components">
  -    <xs:annotation>
  -      <xs:documentation>Components to be deployed</xs:documentation>
  -    </xs:annotation>
  -    <xs:complexType>
  -      <xs:sequence>
  -        <xs:element name="class-space" minOccurs="0">
  -          <xs:complexType>
  -            <xs:sequence minOccurs="0" maxOccurs="unbounded">
  -              <xs:element name="codebase" type="codebaseType"/>
  -            </xs:sequence>
  -            <xs:attribute name="name" type="objectName" use="required"/>
  -            <xs:attribute name="dependencyType" type="dependencyType" use="optional"
default="create"/>
  -          </xs:complexType>
  -        </xs:element>
  -        <xs:element name="mbean" minOccurs="0" maxOccurs="unbounded">
  -          <xs:complexType>
  -            <xs:sequence>
  -              <xs:element name="constructor" minOccurs="0">
  -                <xs:complexType>
  -                  <xs:sequence minOccurs="0" maxOccurs="unbounded">
  -                    <xs:element name="arg">
  -                      <xs:complexType mixed="true">
  -                        <xs:sequence minOccurs="0">
  -                          <xs:any/>
  -                        </xs:sequence>
  -                        <xs:attribute name="type" type="xs:string" use="required"/>
  -                      </xs:complexType>
  -                    </xs:element>
  -                  </xs:sequence>
  -                </xs:complexType>
  -              </xs:element>
  -              <xs:element name="attribute" minOccurs="0" maxOccurs="unbounded">
  -                <xs:complexType mixed="true">
  -                  <xs:sequence minOccurs="0">
  -                    <xs:any/>
  -                  </xs:sequence>
  -                  <xs:attribute name="name" type="xs:string" use="required"/>
  -                </xs:complexType>
  -              </xs:element>
  -              <xs:element name="relationship" minOccurs="0" maxOccurs="unbounded">
  -                <xs:complexType>
  -                  <xs:attribute name="name" type="xs:string" use="required"/>
  -                  <xs:attribute name="type" type="xs:string" use="required"/>
  -                  <xs:attribute name="role" type="xs:string" use="required"/>
  -                  <xs:attribute name="target" type="objectName" use="optional"/>
  -                </xs:complexType>
  -              </xs:element>
  -            </xs:sequence>
  -            <xs:attribute name="code" type="className" use="required"/>
  -            <xs:attribute name="name" type="objectName" use="optional"/>
  -          </xs:complexType>
  -        </xs:element>
  -      </xs:sequence>
  -    </xs:complexType>
  -  </xs:element>
  -  <xs:complexType name="codebaseType">
  -    <xs:sequence minOccurs="0" maxOccurs="unbounded">
  -      <xs:element name="archive">
  -        <xs:complexType>
  -          <xs:attribute name="name" type="xs:string" use="required"/>
  -        </xs:complexType>
  -      </xs:element>
  -    </xs:sequence>
  -    <xs:attribute name="url" type="xs:anyURI" use="optional"/>
  -  </xs:complexType>
  -  <xs:simpleType name="objectName">
  -    <xs:restriction base="xs:string"/>
  -  </xs:simpleType>
  -  <xs:simpleType name="className">
  -    <xs:restriction base="xs:string"/>
  -  </xs:simpleType>
  -  <xs:simpleType name="dependencyType">
  -    <xs:restriction base="xs:string"/>
  -  </xs:simpleType>
  +	<xs:element name="components">
  +		<xs:annotation>
  +			<xs:documentation>Components to be deployed</xs:documentation>
  +		</xs:annotation>
  +		<xs:complexType>
  +			<xs:sequence>
  +				<xs:element name="class-space" minOccurs="0">
  +					<xs:complexType>
  +						<xs:sequence minOccurs="0" maxOccurs="unbounded">
  +							<xs:element name="codebase" type="codebaseType"/>
  +						</xs:sequence>
  +						<xs:attribute name="name" type="objectName" use="required"/>
  +						<xs:attribute name="dependencyType" type="dependencyType" use="optional" default="create"/>
  +					</xs:complexType>
  +				</xs:element>
  +				<xs:element name="mbean" minOccurs="0" maxOccurs="unbounded">
  +					<xs:complexType>
  +						<xs:sequence>
  +							<xs:element name="constructor" minOccurs="0">
  +								<xs:complexType>
  +									<xs:sequence minOccurs="0" maxOccurs="unbounded">
  +										<xs:element ref="arg"/>
  +									</xs:sequence>
  +								</xs:complexType>
  +							</xs:element>
  +							<xs:element name="attribute" minOccurs="0" maxOccurs="unbounded">
  +								<xs:complexType mixed="true">
  +									<xs:sequence minOccurs="0">
  +										<xs:any/>
  +									</xs:sequence>
  +									<xs:attribute name="name" type="xs:string" use="required"/>
  +								</xs:complexType>
  +							</xs:element>
  +							<xs:element name="relationship" minOccurs="0" maxOccurs="unbounded">
  +								<xs:complexType>
  +									<xs:attribute name="name" type="xs:string" use="required"/>
  +									<xs:attribute name="type" type="xs:string" use="required"/>
  +									<xs:attribute name="role" type="xs:string" use="required"/>
  +									<xs:attribute name="target" type="objectName" use="optional"/>
  +								</xs:complexType>
  +							</xs:element>
  +							<xs:element name="invoke" minOccurs="0" maxOccurs="unbounded">
  +								<xs:complexType>
  +									<xs:sequence minOccurs="0" maxOccurs="unbounded">
  +										<xs:element ref="arg"/>
  +									</xs:sequence>
  +									<xs:attribute name="operation" type="xs:string" use="required"/>
  +								</xs:complexType>
  +							</xs:element>
  +						</xs:sequence>
  +						<xs:attribute name="code" type="className" use="required"/>
  +						<xs:attribute name="name" type="objectName" use="optional"/>
  +					</xs:complexType>
  +				</xs:element>
  +			</xs:sequence>
  +		</xs:complexType>
  +	</xs:element>
  +	<xs:complexType name="codebaseType">
  +		<xs:sequence minOccurs="0" maxOccurs="unbounded">
  +			<xs:element name="archive">
  +				<xs:complexType>
  +					<xs:attribute name="name" type="xs:string" use="required"/>
  +				</xs:complexType>
  +			</xs:element>
  +		</xs:sequence>
  +		<xs:attribute name="url" type="xs:anyURI" use="optional"/>
  +	</xs:complexType>
  +	<xs:simpleType name="objectName">
  +		<xs:restriction base="xs:string"/>
  +	</xs:simpleType>
  +	<xs:simpleType name="className">
  +		<xs:restriction base="xs:string"/>
  +	</xs:simpleType>
  +	<xs:simpleType name="dependencyType">
  +		<xs:restriction base="xs:string"/>
  +	</xs:simpleType>
  +	<xs:element name="arg">
  +		<xs:complexType mixed="true">
  +			<xs:sequence minOccurs="0">
  +				<xs:any/>
  +			</xs:sequence>
  +			<xs:attribute name="type" type="xs:string" use="required"/>
  +		</xs:complexType>
  +	</xs:element>
   </xs:schema>
  
  
  

Mime
View raw message