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/core/src/test-data/xml/deployment simple-geronimo-ejb-jar.xml
Date Wed, 19 Nov 2003 08:01:53 GMT
djencks     2003/11/19 00:01:53

  Modified:    modules/core/src/java/org/apache/geronimo/deployment/model/ejb
                        EjbRelationshipRole.java
               modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb
                        EjbJar.java
               modules/core/src/java/org/apache/geronimo/xml/deployment
                        EjbJarLoader.java GeronimoEjbJarLoader.java
               modules/core/src/schema geronimo-ejb-jar.xsd
               modules/core/src/test/org/apache/geronimo/xml/deployment
                        GeronimoEjbJarLoaderTest.java
               modules/core/src/test-data/xml/deployment
                        simple-geronimo-ejb-jar.xml
  Added:       modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb
                        EjbRelation.java EjbRelationshipRole.java
                        RelationshipQuery.java Relationships.java
  Log:
  initial xml cmr support
  
  Revision  Changes    Path
  1.2       +3 -3      incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/ejb/EjbRelationshipRole.java
  
  Index: EjbRelationshipRole.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/ejb/EjbRelationshipRole.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EjbRelationshipRole.java	2 Sep 2003 17:04:19 -0000	1.1
  +++ EjbRelationshipRole.java	19 Nov 2003 08:01:52 -0000	1.2
  @@ -63,10 +63,10 @@
    * @version $Revision$ $Date$
    */
   public class EjbRelationshipRole extends Describable {
  -    private String ejbRelationshipRoleName;
  +    private String ejbRelationshipRoleName;  //description
       private String multiplicity;
       private boolean cascadeDelete;
  -    private RelationshipRoleSource relationshipRoleSource;
  +    private RelationshipRoleSource relationshipRoleSource;//ejb name
       private CmrField cmrField;
   
       public boolean isCascadeDelete() {
  
  
  
  1.5       +5 -1      incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/EjbJar.java
  
  Index: EjbJar.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/EjbJar.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- EjbJar.java	18 Nov 2003 04:16:09 -0000	1.4
  +++ EjbJar.java	19 Nov 2003 08:01:52 -0000	1.5
  @@ -115,5 +115,9 @@
           this.datasourceName = datasourceName;
       }
   
  +    public Relationships getGeronimoRelationships() {
  +        return (Relationships)super.getRelationships();
  +    }
  +
   
   }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/EjbRelation.java
  
  Index: EjbRelation.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.model.geronimo.ejb;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2003/11/19 08:01:52 $
   *
   * */
  public class EjbRelation extends org.apache.geronimo.deployment.model.ejb.EjbRelation {
  
      public EjbRelationshipRole[] getGeronimoEjbRelationshipRole() {
          return (EjbRelationshipRole[])super.getEjbRelationshipRole();
      }
  
      public EjbRelationshipRole getGeronimoEjbRelationshipRole(int i) {
          return (EjbRelationshipRole)super.getEjbRelationshipRole(i);
      }
  
  }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/EjbRelationshipRole.java
  
  Index: EjbRelationshipRole.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.model.geronimo.ejb;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2003/11/19 08:01:52 $
   *
   * */
  public class EjbRelationshipRole extends org.apache.geronimo.deployment.model.ejb.EjbRelationshipRole
{
      //We might want to include the Abstract schema name here to avoid a lookup during deployment
      private RelationshipQuery query;
  
      private RelationshipQuery update;
  
      public RelationshipQuery getQuery() {
          return query;
      }
  
      public void setQuery(RelationshipQuery query) {
          this.query = query;
      }
  
      public RelationshipQuery getUpdate() {
          return update;
      }
  
      public void setUpdate(RelationshipQuery update) {
          this.update = update;
      }
  
  }
  
  
  
  
  
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/RelationshipQuery.java
  
  Index: RelationshipQuery.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.model.geronimo.ejb;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2003/11/19 08:01:52 $
   *
   * */
  public class RelationshipQuery {
  
      private String sql;
  
      private Binding[] inputBinding;
      private Binding[] outputBinding;
  
      public String getSql() {
          return sql;
      }
  
      public void setSql(String sql) {
          this.sql = sql;
      }
  
      public Binding[] getInputBinding() {
          return inputBinding;
      }
  
      public void setInputBinding(Binding[] inputBinding) {
          this.inputBinding = inputBinding;
      }
  
      public Binding[] getOutputBinding() {
          return outputBinding;
      }
  
      public void setOutputBinding(Binding[] outputBinding) {
          this.outputBinding = outputBinding;
      }
  
  }
  
  
  
  1.1                  incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/ejb/Relationships.java
  
  Index: Relationships.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.model.geronimo.ejb;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2003/11/19 08:01:52 $
   *
   * */
  public class Relationships extends org.apache.geronimo.deployment.model.ejb.Relationships{
  
      public EjbRelation[] getGeronimoEjbRelation() {
          return (EjbRelation[])super.getEjbRelation();
      }
  
      public EjbRelation getGeronimoEjbRelation(int i) {
          return (EjbRelation)super.getEjbRelation(i);
      }
  
  }
  
  
  
  1.13      +18 -10    incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/EjbJarLoader.java
  
  Index: EjbJarLoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/EjbJarLoader.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- EjbJarLoader.java	19 Nov 2003 00:33:59 -0000	1.12
  +++ EjbJarLoader.java	19 Nov 2003 08:01:52 -0000	1.13
  @@ -192,27 +192,35 @@
           for(int i = 0; i < roots.length; i++) {
               Element root = roots[i];
               rels[i] = new EjbRelation();
  -            J2EELoader.loadDescribable(root, rels[i]);
  -            rels[i].setEjbRelationName(LoaderUtil.getChildContent(root, "ejb-relation-name"));
  +            loadEjbRelation(root, rels[i]);
               rels[i].setEjbRelationshipRole(loadRelationshipRoles(root));
           }
           return rels;
       }
   
  +    static void loadEjbRelation(Element root, EjbRelation rel) {
  +        J2EELoader.loadDescribable(root, rel);
  +        rel.setEjbRelationName(LoaderUtil.getChildContent(root, "ejb-relation-name"));
  +    }
  +
       private static EjbRelationshipRole[] loadRelationshipRoles(Element parent) {
           Element[] roots = LoaderUtil.getChildren(parent, "ejb-relationship-role");
           EjbRelationshipRole[] roles = new EjbRelationshipRole[roots.length];
  -        for(int i = 0; i < roots.length; i++) {
  +        for(int i = 0; i < roots.length; i++) { //i == 0 or 1
               Element root = roots[i];
               roles[i] = new EjbRelationshipRole();
  -            J2EELoader.loadDescribable(root, roles[i]);
  -            roles[i].setEjbRelationshipRoleName(LoaderUtil.getChildContent(root, "ejb-relationship-role-name"));
  -            roles[i].setMultiplicity(LoaderUtil.getChildContent(root, "multiplicity"));
  -            roles[i].setCascadeDelete(LoaderUtil.getChild(root, "cascade-delete") != null);
  -            roles[i].setRelationshipRoleSource(loadRelationshipRoleSource(LoaderUtil.getChild(root,
"relationship-role-source")));
  -            roles[i].setCmrField(loadCmrField(LoaderUtil.getChild(root, "cmr-field")));
  +            loadEjbRelationshipRole(root, roles[i]);
           }
           return roles;
  +    }
  +
  +    static void loadEjbRelationshipRole(Element root, EjbRelationshipRole role) {
  +        J2EELoader.loadDescribable(root, role);
  +        role.setEjbRelationshipRoleName(LoaderUtil.getChildContent(root, "ejb-relationship-role-name"));
  +        role.setMultiplicity(LoaderUtil.getChildContent(root, "multiplicity"));
  +        role.setCascadeDelete(LoaderUtil.getChild(root, "cascade-delete") != null);
  +        role.setRelationshipRoleSource(loadRelationshipRoleSource(LoaderUtil.getChild(root,
"relationship-role-source")));
  +        role.setCmrField(loadCmrField(LoaderUtil.getChild(root, "cmr-field")));
       }
   
       private static RelationshipRoleSource loadRelationshipRoleSource(Element parent) {
  
  
  
  1.13      +38 -3     incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoader.java
  
  Index: GeronimoEjbJarLoader.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoader.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- GeronimoEjbJarLoader.java	19 Nov 2003 00:33:59 -0000	1.12
  +++ GeronimoEjbJarLoader.java	19 Nov 2003 08:01:52 -0000	1.13
  @@ -67,8 +67,11 @@
   import org.apache.geronimo.deployment.model.geronimo.ejb.Binding;
   import org.apache.geronimo.deployment.model.geronimo.ejb.ActivationConfig;
   import org.apache.geronimo.deployment.model.ejb.Ejb;
  -import org.apache.geronimo.deployment.model.ejb.Relationships;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Relationships;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.EjbRelationshipRole;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.RelationshipQuery;
   import org.apache.geronimo.deployment.model.ejb.AssemblyDescriptor;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.EjbRelation;
   
   /**
    * Loads a Geronimo ejb-jar.xml file into POJOs
  @@ -104,7 +107,7 @@
           if (re != null) {
               Relationships rel = new Relationships();
               J2EELoader.loadDescribable(re, rel);
  -            rel.setEjbRelation(EjbJarLoader.loadEjbRelations(re));
  +            rel.setEjbRelation(loadEjbRelations(re));
               jar.setRelationships(rel);
           }
           //todo: override any Geronimo-specific assembly-descriptor content
  @@ -117,6 +120,38 @@
           GeronimoEjbJarDocument result = new GeronimoEjbJarDocument();
           result.setEjbJar(jar);
           return result;
  +    }
  +
  +    private static EjbRelation[] loadEjbRelations(Element re) {
  +        Element[] roots = LoaderUtil.getChildren(re, "ejb-relation");
  +        EjbRelation[] ejbRelations = new EjbRelation[roots.length];
  +        for (int i = 0; i < ejbRelations.length; i++) {
  +            EjbRelation ejbRelation = new EjbRelation();
  +            EjbJarLoader.loadEjbRelation(roots[i], ejbRelation);
  +            Element[] roles = LoaderUtil.getChildren(roots[i], "ejb-relationship-role");
  +            EjbRelationshipRole[] ejbRelationshipRoles = new EjbRelationshipRole[roles.length];
  +            for (int j = 0; j < roles.length; j++) {  //j == 0 or 1
  +                Element role = roles[j];
  +                EjbRelationshipRole ejbRelationshipRole = new EjbRelationshipRole();
  +                EjbJarLoader.loadEjbRelationshipRole(role, ejbRelationshipRole);
  +                ejbRelationshipRole.setQuery(loadRelationshipQuery(LoaderUtil.getChild(role,
"query")));
  +                ejbRelationshipRole.setUpdate(loadRelationshipQuery(LoaderUtil.getChild(role,
"update")));
  +                ejbRelationshipRoles[j] = ejbRelationshipRole;
  +            }
  +            ejbRelation.setEjbRelationshipRole(ejbRelationshipRoles);
  +            ejbRelations[i] = ejbRelation;
  +        }
  +        return ejbRelations;
  +    }
  +
  +    private static RelationshipQuery loadRelationshipQuery(Element query) {
  +        RelationshipQuery relationshipQuery = new RelationshipQuery();
  +        relationshipQuery.setSql(LoaderUtil.getChildContent(query, "sql"));
  +        Element inputBinding = LoaderUtil.getChild(query, "input-binding");
  +        relationshipQuery.setInputBinding(loadBinding(inputBinding));
  +        Element outputBinding = LoaderUtil.getChild(query, "output-binding");
  +        relationshipQuery.setOutputBinding(loadBinding(outputBinding));
  +        return relationshipQuery;
       }
   
       private static MessageDriven[] loadMessageDrivens(Element parent) {
  
  
  
  1.13      +11 -0     incubator-geronimo/modules/core/src/schema/geronimo-ejb-jar.xsd
  
  Index: geronimo-ejb-jar.xsd
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/schema/geronimo-ejb-jar.xsd,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- geronimo-ejb-jar.xsd	19 Nov 2003 06:37:01 -0000	1.12
  +++ geronimo-ejb-jar.xsd	19 Nov 2003 08:01:52 -0000	1.13
  @@ -131,6 +131,8 @@
               <xsd:element name="cascade-delete" type="j2ee:emptyType" minOccurs="0"/>
               <xsd:element name="relationship-role-source" type="j2ee:relationship-role-sourceType"/>
               <xsd:element name="cmr-field" type="j2ee:cmr-fieldType" minOccurs="0"/>
  +            <xsd:element name="query" type="relationship-queryType"/>
  +            <xsd:element name="update" type="relationship-queryType"/>
           </xsd:sequence>
           <xsd:attribute name="id" type="xsd:ID"/>
       </xsd:complexType>
  @@ -348,7 +350,16 @@
           </xsd:sequence>
           <xsd:attribute name="id" type="xsd:ID"/>
       </xsd:complexType>
  +    <xsd:complexType name="relationship-queryType">
  +        <xsd:sequence>
  +            <xsd:element name="sql" type="j2ee:xsdStringType"/>
  +            <xsd:element name="input-binding" type="ger:input-bindingType"/>
  +            <xsd:element name="output-binding" type="ger:input-bindingType"/>
  +        </xsd:sequence>
  +        <xsd:attribute name="id" type="xsd:ID"/>
  +    </xsd:complexType>
       <xsd:complexType name="input-bindingType">
  +        <!-- this should be named something like simple-bindingType-->
           <xsd:sequence>
               <xsd:element name="binding" type="ger:bindingType" minOccurs="0" maxOccurs="unbounded"/>
           </xsd:sequence>
  
  
  
  1.7       +29 -1     incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoaderTest.java
  
  Index: GeronimoEjbJarLoaderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoEjbJarLoaderTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- GeronimoEjbJarLoaderTest.java	19 Nov 2003 00:33:59 -0000	1.6
  +++ GeronimoEjbJarLoaderTest.java	19 Nov 2003 08:01:53 -0000	1.7
  @@ -58,6 +58,8 @@
   import java.io.File;
   import java.io.FileReader;
   
  +import javax.management.relation.Relation;
  +
   import junit.framework.TestCase;
   import org.w3c.dom.Document;
   import org.apache.geronimo.deployment.model.geronimo.ejb.GeronimoEjbJarDocument;
  @@ -69,6 +71,10 @@
   import org.apache.geronimo.deployment.model.geronimo.ejb.Binding;
   import org.apache.geronimo.deployment.model.geronimo.ejb.MessageDriven;
   import org.apache.geronimo.deployment.model.geronimo.ejb.ActivationConfig;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.Relationships;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.EjbRelation;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.EjbRelationshipRole;
  +import org.apache.geronimo.deployment.model.geronimo.ejb.RelationshipQuery;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.ResourceEnvRef;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.EjbRef;
   import org.apache.geronimo.deployment.model.geronimo.j2ee.ClassSpace;
  @@ -91,6 +97,15 @@
           checkGeronimoJar(doc);
       }
   
  +    public void testRelationshipLoad() throws Exception {
  +        File f = new File(docDir, "simple-geronimo-ejb-jar.xml");
  +        Document xmlDoc = LoaderUtil.parseXML(new FileReader(f));
  +        GeronimoEjbJarDocument doc = loader.load(xmlDoc);
  +        EjbJar jar = doc.getEjbJar();
  +        Relationships relationships = jar.getGeronimoRelationships();
  +        checkRelationships(relationships);
  +    }
  +
       static void checkGeronimoJar(GeronimoEjbJarDocument doc) {
           EjbJar jar = doc.getEjbJar();
           EjbJarLoaderTest.checkEjbJar(jar, "OverrideExample");
  @@ -185,6 +200,19 @@
           assertEquals(1, outputBinding.length);
           assertEquals("org.openejb.nova.persistence.binding.jdbc.StringBinding", outputBinding[0].getType());
           assertEquals(0, outputBinding[0].getParam());
  +    }
  +
  +    protected static void checkRelationships(Relationships relationships) throws Exception
{
  +        EjbRelation[] ejbRelation = relationships.getGeronimoEjbRelation();
  +        assertEquals(1, ejbRelation.length);
  +        EjbRelationshipRole[] roles = ejbRelation[0].getGeronimoEjbRelationshipRole();
  +        assertEquals(2, roles.length);
  +        assertEquals("One", roles[0].getMultiplicity());
  +        assertEquals("Something", roles[0].getRelationshipRoleSource().getEjbName());
  +        RelationshipQuery query = roles[0].getQuery();
  +        assertEquals("select something from somewhere", query.getSql());
  +        assertEquals(2, query.getInputBinding().length);
  +
       }
   
       protected void setUp() throws Exception {
  
  
  
  1.6       +64 -0     incubator-geronimo/modules/core/src/test-data/xml/deployment/simple-geronimo-ejb-jar.xml
  
  Index: simple-geronimo-ejb-jar.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/test-data/xml/deployment/simple-geronimo-ejb-jar.xml,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- simple-geronimo-ejb-jar.xml	19 Nov 2003 00:33:59 -0000	1.5
  +++ simple-geronimo-ejb-jar.xml	19 Nov 2003 08:01:53 -0000	1.6
  @@ -145,4 +145,68 @@
               </update>
           </entity>
       </enterprise-beans>
  +    <relationships>
  +        <ejb-relation>
  +            <ejb-relation-name>ab-relationship</ejb-relation-name>
  +            <ejb-relationship-role>
  +                <multiplicity>One</multiplicity>
  +                <relationship-role-source>
  +                    <ejb-name>Something</ejb-name>
  +                </relationship-role-source>
  +                <cmr-field>
  +                    <cmr-field-name>field</cmr-field-name>
  +                </cmr-field>
  +                <query>
  +                    <sql>select something from somewhere</sql>
  +                    <input-binding>
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.IntBinding"
param="1"/>
  +                    </input-binding>
  +                    <output-binding abstract-schema-name="OtherThingy" multiplicity="Many">
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                    </output-binding>
  +                </query>
  +                <update>
  +                    <sql>select something from somewhere</sql>
  +                    <input-binding>
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.IntBinding"
param="1"/>
  +                    </input-binding>
  +                    <output-binding abstract-schema-name="OtherThingy" multiplicity="Many">
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                    </output-binding>
  +                </update>
  +            </ejb-relationship-role>
  +            <ejb-relationship-role>
  +                <multiplicity>Many</multiplicity>
  +                <relationship-role-source>
  +                    <ejb-name>SomethingElse</ejb-name>
  +                </relationship-role-source>
  +                <cmr-field>
  +                    <cmr-field-name>field2</cmr-field-name>
  +                </cmr-field>
  +                <query>
  +                    <sql>select something from somewhere</sql>
  +                    <input-binding>
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.IntBinding"
param="1"/>
  +                    </input-binding>
  +                    <output-binding abstract-schema-name="OtherThingy" multiplicity="Many">
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                    </output-binding>
  +                </query>
  +                <update>
  +                    <sql>select something from somewhere</sql>
  +                    <input-binding>
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.IntBinding"
param="1"/>
  +                    </input-binding>
  +                    <output-binding abstract-schema-name="OtherThingy" multiplicity="Many">
  +                        <binding type="org.openejb.nova.persistence.binding.jdbc.StringBinding"
param="0"/>
  +                    </output-binding>
  +                </update>
  +            </ejb-relationship-role>
  +        </ejb-relation>
  +
  +    </relationships>
   </ejb-jar>
  
  
  

Mime
View raw message