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/naming/src/test/org/apache/geronimo/naming/deployment ContextBuilderTest.java
Date Wed, 18 Feb 2004 20:58:43 GMT
djencks     2004/02/18 12:58:43

  Modified:    modules/jetty/src/java/org/apache/geronimo/jetty/deployment
                        WebAppDConfigBean.java
               modules/jetty/src/test/org/apache/geronimo/jetty/deployment
                        WebAppDConfigTest.java
               modules/naming project.xml
               modules/naming/src/test/org/apache/geronimo/naming/deployment
                        ContextBuilderTest.java
  Added:       modules/naming/src/java/org/apache/geronimo/naming/deployment
                        EJBLocalRefDConfigBean.java EJBRefDConfigBean.java
                        ENCHelper.java
                        MessageDestinationRefDConfigBean.java
                        ResourceEnvRefDConfigBean.java
                        ResourceRefDConfigBean.java
  Removed:     modules/deployment/src/java/org/apache/geronimo/deployment/plugin/j2ee
                        ENCHelper.java URIRefConfigBean.java
  Log:
  move naming dconfig beans to naming and implement using xmlbeans
  
  Revision  Changes    Path
  1.9       +71 -5     incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WebAppDConfigBean.java
  
  Index: WebAppDConfigBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/java/org/apache/geronimo/jetty/deployment/WebAppDConfigBean.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- WebAppDConfigBean.java	14 Feb 2004 01:50:15 -0000	1.8
  +++ WebAppDConfigBean.java	18 Feb 2004 20:58:43 -0000	1.9
  @@ -61,8 +61,13 @@
   import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
   
   import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
  -import org.apache.geronimo.deployment.plugin.j2ee.ENCHelper;
  +import org.apache.geronimo.naming.deployment.ENCHelper;
   import org.apache.geronimo.xbeans.geronimo.jetty.JettyWebAppType;
  +import org.apache.geronimo.xbeans.geronimo.GerEjbRefType;
  +import org.apache.geronimo.xbeans.geronimo.GerEjbLocalRefType;
  +import org.apache.geronimo.xbeans.geronimo.GerMessageDestinationRefType;
  +import org.apache.geronimo.xbeans.geronimo.GerResourceEnvRefType;
  +import org.apache.geronimo.xbeans.geronimo.GerResourceRefType;
   import org.apache.xmlbeans.SchemaTypeLoader;
   import org.apache.xmlbeans.XmlBeans;
   
  @@ -74,14 +79,75 @@
   public class WebAppDConfigBean extends DConfigBeanSupport {
       private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
   
  -    private final ENCHelper encHelper;
  +    private ENCHelper encHelper;
   
       WebAppDConfigBean(DDBean ddBean, JettyWebAppType webApp) {
           super(ddBean, webApp, SCHEMA_TYPE_LOADER);
           if (webApp.getContextRoot() == null) {
               webApp.addNewContextRoot();
           }
  -        encHelper = new ENCHelper(ddBean);
  +        encHelper = new ENCHelper(ddBean, new ENCHelper.XmlEnvRefs() {
  +            public GerEjbRefType[] getEjbRefs() {
  +                return getWebApp().getEjbRefArray();
  +            }
  +
  +            public GerEjbRefType addNewEjbRef() {
  +                return getWebApp().addNewEjbRef();
  +            }
  +
  +            public void removeEjbRef(int i) {
  +                getWebApp().removeEjbRef(i);
  +            }
  +
  +            public GerEjbLocalRefType[] getEjbLocalRefs() {
  +                return getWebApp().getEjbLocalRefArray();
  +            }
  +
  +            public GerEjbLocalRefType addNewEjbLocalRef() {
  +                return getWebApp().addNewEjbLocalRef();
  +            }
  +
  +            public void removeEjbLocalRef(int i) {
  +                getWebApp().removeEjbLocalRef(i);
  +            }
  +
  +            public GerMessageDestinationRefType[] getMessageDestinationRefs() {
  +                return getWebApp().getMessageDestinationRefArray();
  +            }
  +
  +            public GerMessageDestinationRefType addNewMessageDestinationRef() {
  +                return getWebApp().addNewMessageDestinationRef();
  +            }
  +
  +            public void removeMessageDestinationRef(int i) {
  +                getWebApp().removeMessageDestinationRef(i);
  +            }
  +
  +            public GerResourceEnvRefType[] getResourceEnvRefs() {
  +                return getWebApp().getResourceEnvRefArray();
  +            }
  +
  +            public GerResourceEnvRefType addNewResourceEnvRef() {
  +                return getWebApp().addNewResourceEnvRef();
  +            }
  +
  +            public void removeResourceEnvRef(int i) {
  +                getWebApp().removeResourceEnvRef(i);
  +            }
  +
  +            public GerResourceRefType[] getResourceRefs() {
  +                return getWebApp().getResourceRefArray();
  +            }
  +
  +            public GerResourceRefType addNewResourceRef() {
  +                return getWebApp().addNewResourceRef();
  +            }
  +
  +            public void removeResourceRef(int i) {
  +                getWebApp().removeResourceRef(i);
  +            }
  +
  +        });
       }
   
       JettyWebAppType getWebApp() {
  @@ -119,7 +185,7 @@
       }
   
       public void removeDConfigBean(DConfigBean dcBean) throws BeanNotFoundException {
  -        encHelper.removeDConfigBean(dcBean);
  +        //encHelper.removeDConfigBean(dcBean);
       }
   
       public String[] getXpaths() {
  
  
  
  1.7       +21 -13    incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WebAppDConfigTest.java
  
  Index: WebAppDConfigTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/jetty/src/test/org/apache/geronimo/jetty/deployment/WebAppDConfigTest.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- WebAppDConfigTest.java	4 Feb 2004 05:54:08 -0000	1.6
  +++ WebAppDConfigTest.java	18 Feb 2004 20:58:43 -0000	1.7
  @@ -56,11 +56,13 @@
   package org.apache.geronimo.jetty.deployment;
   
   import java.util.Arrays;
  +
   import javax.enterprise.deploy.model.DDBean;
   import javax.enterprise.deploy.model.DDBeanRoot;
   import javax.enterprise.deploy.spi.DeploymentConfiguration;
   
  -import org.apache.geronimo.deployment.plugin.j2ee.URIRefConfigBean;
  +import org.apache.geronimo.naming.deployment.EJBRefDConfigBean;
  +import org.apache.geronimo.naming.deployment.EJBLocalRefDConfigBean;
   import org.apache.geronimo.deployment.tools.loader.WebDeployable;
   
   /**
  @@ -87,7 +89,13 @@
           assertNotNull(webApp);
           String[] xpaths = webApp.getXpaths();
           assertTrue(Arrays.equals(
  -                new String[]{"ejb-ref/ejb-ref-name", "ejb-local-ref/ejb-ref-name", "service-ref/service-ref-name", "resource-ref/res-ref-name", },
  +                new String[]{
  +                    "ejb-ref",
  +                    "ejb-local-ref",
  +                    "message-destination-ref",
  +                    "resource-env-ref",
  +                    "resource-ref",
  +                },
                   xpaths)
           );
       }
  @@ -95,13 +103,13 @@
       public void testEJBRef() throws Exception {
           DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
           WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
  -        DDBean[] ddBeans = ddBean.getChildBean("ejb-ref/ejb-ref-name");
  +        DDBean[] ddBeans = ddBean.getChildBean(webApp.getXpaths()[0]);
           assertEquals(2, ddBeans.length);
  -        assertEquals("fake-ejb-ref", ddBeans[0].getText());
  -        assertEquals("another-ejb-ref", ddBeans[1].getText());
  +        assertEquals("fake-ejb-ref", ddBeans[0].getChildBean("ejb-ref-name")[0].getText());
  +        assertEquals("another-ejb-ref", ddBeans[1].getChildBean("ejb-ref-name")[0].getText());
   
  -        URIRefConfigBean ejbRef0 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[0]);
  -        URIRefConfigBean ejbRef1 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[1]);
  +        EJBRefDConfigBean ejbRef0 = (EJBRefDConfigBean) webApp.getDConfigBean(ddBeans[0]);
  +        EJBRefDConfigBean ejbRef1 = (EJBRefDConfigBean) webApp.getDConfigBean(ddBeans[1]);
           assertNotNull(ejbRef0);
           assertEquals(ddBeans[0], ejbRef0.getDDBean());
           assertNotNull(ejbRef1);
  @@ -112,13 +120,13 @@
       public void testEJBLocalRef() throws Exception {
           DDBean ddBean = ddBeanRoot.getChildBean("web-app")[0];
           WebAppDConfigBean webApp = (WebAppDConfigBean) configRoot.getDConfigBean(ddBean);
  -        DDBean[] ddBeans = ddBean.getChildBean("ejb-local-ref/ejb-ref-name");
  +        DDBean[] ddBeans = ddBean.getChildBean(webApp.getXpaths()[1]);
           assertEquals(2, ddBeans.length);
  -        assertEquals("fake-ejb-local-ref", ddBeans[0].getText());
  -        assertEquals("another-ejb-local-ref", ddBeans[1].getText());
  +        assertEquals("fake-ejb-local-ref", ddBeans[0].getChildBean("ejb-ref-name")[0].getText());
  +        assertEquals("another-ejb-local-ref", ddBeans[1].getChildBean("ejb-ref-name")[0].getText());
   
  -        URIRefConfigBean ejbRef0 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[0]);
  -        URIRefConfigBean ejbRef1 = (URIRefConfigBean) webApp.getDConfigBean(ddBeans[1]);
  +        EJBLocalRefDConfigBean ejbRef0 = (EJBLocalRefDConfigBean) webApp.getDConfigBean(ddBeans[0]);
  +        EJBLocalRefDConfigBean ejbRef1 = (EJBLocalRefDConfigBean) webApp.getDConfigBean(ddBeans[1]);
           assertNotNull(ejbRef0);
           assertEquals(ddBeans[0], ejbRef0.getDDBean());
           assertNotNull(ejbRef1);
  
  
  
  1.4       +9 -3      incubator-geronimo/modules/naming/project.xml
  
  Index: project.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/naming/project.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- project.xml	17 Feb 2004 07:26:47 -0000	1.3
  +++ project.xml	18 Feb 2004 20:58:43 -0000	1.4
  @@ -67,6 +67,12 @@
   
           <dependency>
               <groupId>geronimo-spec</groupId>
  +            <artifactId>geronimo-spec-j2ee-deployment</artifactId>
  +            <version>DEV</version>
  +        </dependency>
  +
  +        <dependency>
  +            <groupId>geronimo-spec</groupId>
               <artifactId>geronimo-spec-j2eeschema</artifactId>
               <version>DEV</version>
               <properties>
  @@ -84,14 +90,14 @@
           </dependency>
   
           <!-- Thirdparty Dependencies -->
  -        <dependency>
  +        <!--dependency>
               <groupId>mx4j</groupId>
               <artifactId>mx4j</artifactId>
               <version>SNAPSHOT</version>
               <properties>
                   <runtime>false</runtime>
               </properties>
  -        </dependency>
  +        </dependency-->
   
       </dependencies>
   
  
  
  
  1.1                  incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/deployment/EJBLocalRefDConfigBean.java
  
  Index: EJBLocalRefDConfigBean.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.naming.deployment;
  
  import javax.enterprise.deploy.model.DDBean;
  
  import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
  import org.apache.geronimo.xbeans.geronimo.GerEjbRefType;
  import org.apache.geronimo.xbeans.geronimo.GerEjbLocalRefType;
  import org.apache.xmlbeans.SchemaTypeLoader;
  import org.apache.xmlbeans.XmlBeans;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/02/18 20:58:43 $
   */
  public class EJBLocalRefDConfigBean extends DConfigBeanSupport {
      private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
  
      public EJBLocalRefDConfigBean(DDBean ddBean, GerEjbLocalRefType ejbLocalRef) {
          super(ddBean, ejbLocalRef, SCHEMA_TYPE_LOADER);
          assert ddBean.getChildBean("ejb-ref-name")[0].equals(getEjbRefName());
      }
  
      GerEjbLocalRefType getEjbRef() {
          return (GerEjbLocalRefType)getXmlObject();
      }
  
      String getEjbRefName() {
          return getEjbRef().getEjbRefName().getStringValue();
      }
  
      public String getTargetURI() {
          return getEjbRef().getUri();
      }
  
      public void setTargetURI(String targetURI) {
          getEjbRef().setUri(targetURI);
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/deployment/EJBRefDConfigBean.java
  
  Index: EJBRefDConfigBean.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.naming.deployment;
  
  import javax.enterprise.deploy.model.DDBean;
  
  import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
  import org.apache.geronimo.xbeans.geronimo.GerEjbRefType;
  import org.apache.xmlbeans.SchemaTypeLoader;
  import org.apache.xmlbeans.XmlBeans;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/02/18 20:58:43 $
   */
  public class EJBRefDConfigBean extends DConfigBeanSupport {
      private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
  
      public EJBRefDConfigBean(DDBean ddBean, GerEjbRefType ejbRef) {
          super(ddBean, ejbRef, SCHEMA_TYPE_LOADER);
          assert ddBean.getChildBean("ejb-ref-name")[0].equals(getEjbRefName());
      }
  
      GerEjbRefType getEjbRef() {
          return (GerEjbRefType)getXmlObject();
      }
  
      String getEjbRefName() {
          return getEjbRef().getEjbRefName().getStringValue();
      }
  
      public String getTargetURI() {
          return getEjbRef().getUri();
      }
  
      public void setTargetURI(String targetURI) {
          getEjbRef().setUri(targetURI);
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/deployment/ENCHelper.java
  
  Index: ENCHelper.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.naming.deployment;
  
  import java.util.HashMap;
  import java.util.Map;
  
  import javax.enterprise.deploy.model.DDBean;
  import javax.enterprise.deploy.spi.DConfigBean;
  import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
  
  import org.apache.geronimo.xbeans.geronimo.GerEjbLocalRefType;
  import org.apache.geronimo.xbeans.geronimo.GerEjbRefType;
  import org.apache.geronimo.xbeans.geronimo.GerMessageDestinationRefType;
  import org.apache.geronimo.xbeans.geronimo.GerResourceEnvRefType;
  import org.apache.geronimo.xbeans.geronimo.GerResourceRefType;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/02/18 20:58:43 $
   */
  public class ENCHelper {
  
  
      public static final String[] ENC_XPATHS = {
          "ejb-ref",
          "ejb-local-ref",
          "message-destination-ref",
          "resource-env-ref",
          "resource-ref",
      };
  
      private final DDBean ddBean;
  
      private final XmlEnvRefs envRefs;
  
      private EJBRefDConfigBean[] ejbRefs;
  
      private EJBLocalRefDConfigBean[] ejbLocalRefs;
      private MessageDestinationRefDConfigBean[] messageDestinationRefs;
      private ResourceEnvRefDConfigBean[] resourceEnvRefs;
      private ResourceRefDConfigBean[] resourceRefs;
  
      public ENCHelper(DDBean ddBean, XmlEnvRefs envRefs) {
          this.ddBean = ddBean;
          this.envRefs = envRefs;
          DDBean[] ddEjbRefs = ddBean.getChildBean(ENC_XPATHS[0]);
          if (ddEjbRefs == null) {
              ddEjbRefs = new DDBean[0];
          }
          ejbRefs = new EJBRefDConfigBean[ddEjbRefs.length];
          GerEjbRefType[] xmlEjbRefs = envRefs.getEjbRefs();
          Map ejbRefMap = new HashMap();
          for (int i = 0; i < xmlEjbRefs.length; i++) {
              GerEjbRefType xmlEjbRef = xmlEjbRefs[i];
              ejbRefMap.put(xmlEjbRef.getEjbRefName().getStringValue(), xmlEjbRef.getUri());
              envRefs.removeEjbRef(0);
          }
          for (int i = 0; i < ddEjbRefs.length; i++) {
              DDBean ddEjbRef = ddEjbRefs[i];
              String name = ddEjbRef.getText("ejb-ref-name")[0];
              GerEjbRefType xmlEjbRef = envRefs.addNewEjbRef();
              xmlEjbRef.addNewEjbRefName().setStringValue(name);
              if (ejbRefMap.get(name) != null) {
                  xmlEjbRef.setUri((String)ejbRefMap.get(name));
              }
              ejbRefs[i] = new EJBRefDConfigBean(ddEjbRef,  xmlEjbRef);
          }
  
          DDBean[] ddEjbLocalRefs = ddBean.getChildBean(ENC_XPATHS[1]);
          if (ddEjbLocalRefs == null) {
              ddEjbLocalRefs = new DDBean[0];
          }
          ejbLocalRefs = new EJBLocalRefDConfigBean[ddEjbLocalRefs.length];
          GerEjbLocalRefType[] xmlEjbLocalRefs = envRefs.getEjbLocalRefs();
          Map EjbLocalRefMap = new HashMap();
          for (int i = 0; i < xmlEjbLocalRefs.length; i++) {
              GerEjbLocalRefType xmlEjbLocalRef = xmlEjbLocalRefs[i];
              EjbLocalRefMap.put(xmlEjbLocalRef.getEjbRefName().getStringValue(), xmlEjbLocalRef.getUri());
              envRefs.removeEjbLocalRef(0);
          }
          for (int i = 0; i < ddEjbLocalRefs.length; i++) {
              DDBean ddEjbLocalRef = ddEjbLocalRefs[i];
              String name = ddEjbLocalRef.getText("ejb-ref-name")[0];
              GerEjbLocalRefType xmlEjbLocalRef = envRefs.addNewEjbLocalRef();
              xmlEjbLocalRef.addNewEjbRefName().setStringValue(name);
              if (EjbLocalRefMap.get(name) != null) {
                  xmlEjbLocalRef.setUri((String)EjbLocalRefMap.get(name));
              }
              ejbLocalRefs[i] = new EJBLocalRefDConfigBean(ddEjbLocalRef,  xmlEjbLocalRef);
          }
  
          DDBean[] ddMessageDestinationRefs = ddBean.getChildBean(ENC_XPATHS[2]);
          if (ddMessageDestinationRefs == null) {
              ddMessageDestinationRefs = new DDBean[0];
          }
          messageDestinationRefs = new MessageDestinationRefDConfigBean[ddMessageDestinationRefs.length];
          GerMessageDestinationRefType[] xmlMessageDestinationRefs = envRefs.getMessageDestinationRefs();
          Map MessageDestinationRefMap = new HashMap();
          for (int i = 0; i < xmlMessageDestinationRefs.length; i++) {
              GerMessageDestinationRefType xmlMessageDestinationRef = xmlMessageDestinationRefs[i];
              MessageDestinationRefMap.put(xmlMessageDestinationRef.getMessageDestinationRefName().getStringValue(), xmlMessageDestinationRef.getUri());
              envRefs.removeMessageDestinationRef(0);
          }
          for (int i = 0; i < ddMessageDestinationRefs.length; i++) {
              DDBean ddMessageDestinationRef = ddMessageDestinationRefs[i];
              String name = ddMessageDestinationRef.getText("message-destination-ref-name")[0];
              GerMessageDestinationRefType xmlMessageDestinationRef = envRefs.addNewMessageDestinationRef();
              xmlMessageDestinationRef.addNewMessageDestinationRefName().setStringValue(name);
              if (MessageDestinationRefMap.get(name) != null) {
                  xmlMessageDestinationRef.setUri((String)MessageDestinationRefMap.get(name));
              }
              messageDestinationRefs[i] = new MessageDestinationRefDConfigBean(ddMessageDestinationRef,  xmlMessageDestinationRef);
           }
  
          DDBean[] ddResourceEnvRefs = ddBean.getChildBean(ENC_XPATHS[3]);
          if (ddResourceEnvRefs == null) {
              ddResourceEnvRefs = new DDBean[0];
          }
          resourceEnvRefs = new ResourceEnvRefDConfigBean[ddResourceEnvRefs.length];
          GerResourceEnvRefType[] xmlResourceEnvRefs = envRefs.getResourceEnvRefs();
          Map ResourceEnvRefMap = new HashMap();
          for (int i = 0; i < xmlResourceEnvRefs.length; i++) {
              GerResourceEnvRefType xmlResourceEnvRef = xmlResourceEnvRefs[i];
              ResourceEnvRefMap.put(xmlResourceEnvRef.getResourceEnvRefName().getStringValue(), xmlResourceEnvRef.getUri());
              envRefs.removeResourceEnvRef(0);
          }
          for (int i = 0; i < ddResourceEnvRefs.length; i++) {
              DDBean ddResourceEnvRef = ddResourceEnvRefs[i];
              String name = ddResourceEnvRef.getText("resource-env-ref-name")[0];
              GerResourceEnvRefType xmlResourceEnvRef = envRefs.addNewResourceEnvRef();
              xmlResourceEnvRef.addNewResourceEnvRefName().setStringValue(name);
              if (ResourceEnvRefMap.get(name) != null) {
                  xmlResourceEnvRef.setUri((String)ResourceEnvRefMap.get(name));
              }
              resourceEnvRefs[i] = new ResourceEnvRefDConfigBean(ddResourceEnvRef,  xmlResourceEnvRef);
          }
  
          DDBean[] ddResourceRefs = ddBean.getChildBean(ENC_XPATHS[4]);
          if (ddResourceRefs == null) {
              ddResourceRefs = new DDBean[0];
          }
          resourceRefs = new ResourceRefDConfigBean[ddResourceRefs.length];
          GerResourceRefType[] xmlResourceRefs = envRefs.getResourceRefs();
          Map ResourceRefMap = new HashMap();
          for (int i = 0; i < xmlResourceRefs.length; i++) {
              GerResourceRefType xmlResourceRef = xmlResourceRefs[i];
              ResourceRefMap.put(xmlResourceRef.getResRefName().getStringValue(), xmlResourceRef.getUri());
              envRefs.removeResourceRef(0);
          }
          for (int i = 0; i < ddResourceRefs.length; i++) {
              DDBean ddResourceRef = ddResourceRefs[i];
              String name = ddResourceRef.getText("res-ref-name")[0];
              GerResourceRefType xmlResourceRef = envRefs.addNewResourceRef();
              xmlResourceRef.addNewResRefName().setStringValue(name);
              if (ResourceRefMap.get(name) != null) {
                  xmlResourceRef.setUri((String)ResourceRefMap.get(name));
              }
              resourceRefs[i] = new ResourceRefDConfigBean(ddResourceRef,  xmlResourceRef);
          }
  
      }
  
      public DConfigBean getDConfigBean(DDBean ddBean) throws ConfigurationException {
          String xpath = ddBean.getXpath();
          if (xpath.equals(ENC_XPATHS[0])) {
              String name = ddBean.getText("ejb-ref-name")[0];
              for (int i = 0; i < ejbRefs.length; i++) {
                  EJBRefDConfigBean ejbRef = ejbRefs[i];
                  if (ejbRef.getEjbRefName().equals(name)) {
                      return ejbRef;
                  }
              }
              throw new ConfigurationException("no such ejb-ref-name" + name);
          } else if (xpath.equals(ENC_XPATHS[1])) {
              String name = ddBean.getText("ejb-ref-name")[0];
              for (int i = 0; i < ejbLocalRefs.length; i++) {
                  EJBLocalRefDConfigBean ejbLocalRef = ejbLocalRefs[i];
                  if (ejbLocalRef.getEjbRefName().equals(name)) {
                      return ejbLocalRef;
                  }
              }
              throw new ConfigurationException("no such ejb-ref-name" + name);
          } else if (xpath.equals(ENC_XPATHS[2])) {
              String name = ddBean.getText("message-destination-ref-name")[0];
              for (int i = 0; i < messageDestinationRefs.length; i++) {
                  MessageDestinationRefDConfigBean messageDestinationRef = messageDestinationRefs[i];
                  if (messageDestinationRef.getMessageDestinationRefName().equals(name)) {
                      return messageDestinationRef;
                  }
              }
              throw new ConfigurationException("no such ejb-ref-name" + name);
          } else if (xpath.equals(ENC_XPATHS[3])) {
              String name = ddBean.getText("resource-env-ref-name")[0];
              for (int i = 0; i < resourceEnvRefs.length; i++) {
                  ResourceEnvRefDConfigBean resourceEnvRef = resourceEnvRefs[i];
                  if (resourceEnvRef.getResourceEnvRefName().equals(name)) {
                      return resourceEnvRef;
                  }
              }
              throw new ConfigurationException("no such ejb-ref-name" + name);
          } else if (xpath.equals(ENC_XPATHS[4])) {
              String name = ddBean.getText("res-ref-name")[0];
              for (int i = 0; i < resourceRefs.length; i++) {
                  ResourceRefDConfigBean resourceRef = resourceRefs[i];
                  if (resourceRef.getResourceRefName().equals(name)) {
                      return resourceRef;
                  }
              }
              throw new ConfigurationException("no such res-ref-name" + name);
          } else {
              throw new ConfigurationException("Unrecognized XPath: " + ddBean.getXpath());
          }
      }
    /*
      public void removeDConfigBean(DConfigBean dcBean) throws BeanNotFoundException {
          DDBean ddBean = dcBean.getDDBean();
          String xpath = ddBean.getXpath();
          String name = ddBean.getText();
  
          if (xpath.endsWith("ejb-ref/ejb-ref-name")) {
              if (ejbRefs.remove(name) == null) {
                  throw new BeanNotFoundException("No DConfigBean found with name: " + name);
              }
          } else if (xpath.endsWith("ejb-local-ref/ejb-ref-name")) {
              if (ejbLocalRefs.remove(name) == null) {
                  throw new BeanNotFoundException("No DConfigBean found with name: " + name);
              }
          } else if (xpath.endsWith("service-ref/service-ref-name")) {
              if (serviceRefs.remove(name) == null) {
                  throw new BeanNotFoundException("No DConfigBean found with name: " + name);
              }
          } else if (xpath.endsWith("resource-ref/res-ref-name")) {
              if (resourceRefs.remove(name) == null) {
                  throw new BeanNotFoundException("No DConfigBean found with name: " + name);
              }
          } else {
              throw new BeanNotFoundException("Unrecognized XPath: " + xpath);
          }
      }
  
       */
  
      public interface XmlEnvRefs {
          GerEjbRefType[] getEjbRefs();
          GerEjbRefType addNewEjbRef();
          void removeEjbRef(int i);
  
          GerEjbLocalRefType[] getEjbLocalRefs();
          GerEjbLocalRefType addNewEjbLocalRef();
          void removeEjbLocalRef(int i);
  
          GerMessageDestinationRefType[] getMessageDestinationRefs();
          GerMessageDestinationRefType addNewMessageDestinationRef();
          void removeMessageDestinationRef(int i);
  
          GerResourceEnvRefType[] getResourceEnvRefs();
          GerResourceEnvRefType addNewResourceEnvRef();
          void removeResourceEnvRef(int i);
  
          GerResourceRefType[] getResourceRefs();
          GerResourceRefType addNewResourceRef();
          void removeResourceRef(int i);
  
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/deployment/MessageDestinationRefDConfigBean.java
  
  Index: MessageDestinationRefDConfigBean.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.naming.deployment;
  
  import javax.enterprise.deploy.model.DDBean;
  
  import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
  import org.apache.geronimo.xbeans.geronimo.GerMessageDestinationRefType;
  import org.apache.xmlbeans.SchemaTypeLoader;
  import org.apache.xmlbeans.XmlBeans;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/02/18 20:58:43 $
   */
  public class MessageDestinationRefDConfigBean extends DConfigBeanSupport {
      private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
  
      public MessageDestinationRefDConfigBean(DDBean ddBean, GerMessageDestinationRefType messageDestinationRef) {
          super(ddBean, messageDestinationRef, SCHEMA_TYPE_LOADER);
          assert ddBean.getChildBean("message-destination-ref-name")[0].equals(getMessageDestinationRefName());
      }
  
      GerMessageDestinationRefType getMessageDestinationRef() {
          return (GerMessageDestinationRefType)getXmlObject();
      }
  
      String getMessageDestinationRefName() {
          return getMessageDestinationRef().getMessageDestinationRefName().getStringValue();
      }
  
      public String getTargetURI() {
          return getMessageDestinationRef().getUri();
      }
  
      public void setTargetURI(String targetURI) {
          getMessageDestinationRef().setUri(targetURI);
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/deployment/ResourceEnvRefDConfigBean.java
  
  Index: ResourceEnvRefDConfigBean.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.naming.deployment;
  
  import javax.enterprise.deploy.model.DDBean;
  
  import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
  import org.apache.geronimo.xbeans.geronimo.GerEjbRefType;
  import org.apache.geronimo.xbeans.geronimo.GerResourceEnvRefType;
  import org.apache.xmlbeans.SchemaTypeLoader;
  import org.apache.xmlbeans.XmlBeans;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/02/18 20:58:43 $
   */
  public class ResourceEnvRefDConfigBean extends DConfigBeanSupport {
      private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
  
      public ResourceEnvRefDConfigBean(DDBean ddBean, GerResourceEnvRefType resourceEnvRef) {
          super(ddBean, resourceEnvRef, SCHEMA_TYPE_LOADER);
          assert ddBean.getChildBean("resource-env-ref-name")[0].equals(getResourceEnvRefName());
      }
  
      GerResourceEnvRefType getResourceEnvRef() {
          return (GerResourceEnvRefType)getXmlObject();
      }
  
      String getResourceEnvRefName() {
          return getResourceEnvRef().getResourceEnvRefName().getStringValue();
      }
  
      public String getTargetURI() {
          return getResourceEnvRef().getUri();
      }
  
      public void setTargetURI(String targetURI) {
          getResourceEnvRef().setUri(targetURI);
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/naming/src/java/org/apache/geronimo/naming/deployment/ResourceRefDConfigBean.java
  
  Index: ResourceRefDConfigBean.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.naming.deployment;
  
  import javax.enterprise.deploy.model.DDBean;
  
  import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
  import org.apache.geronimo.xbeans.geronimo.GerResourceRefType;
  import org.apache.xmlbeans.SchemaTypeLoader;
  import org.apache.xmlbeans.XmlBeans;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/02/18 20:58:43 $
   */
  public class ResourceRefDConfigBean extends DConfigBeanSupport {
      private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
  
      public ResourceRefDConfigBean(DDBean ddBean, GerResourceRefType resourceRef) {
          super(ddBean, resourceRef, SCHEMA_TYPE_LOADER);
          assert ddBean.getChildBean("res-ref-name")[0].equals(getResourceRefName());
      }
  
      GerResourceRefType getResourceRef() {
          return (GerResourceRefType)getXmlObject();
      }
  
      String getResourceRefName() {
          return getResourceRef().getResRefName().getStringValue();
      }
  
      public String getTargetURI() {
          return getResourceRef().getUri();
      }
  
      public void setTargetURI(String targetURI) {
          getResourceRef().setUri(targetURI);
      }
  }
  
  
  
  1.3       +2 -6      incubator-geronimo/modules/naming/src/test/org/apache/geronimo/naming/deployment/ContextBuilderTest.java
  
  Index: ContextBuilderTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/naming/src/test/org/apache/geronimo/naming/deployment/ContextBuilderTest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ContextBuilderTest.java	15 Feb 2004 16:33:44 -0000	1.2
  +++ ContextBuilderTest.java	18 Feb 2004 20:58:43 -0000	1.3
  @@ -57,10 +57,6 @@
   
   import java.net.URL;
   
  -import javax.management.InstanceAlreadyExistsException;
  -import javax.management.MBeanRegistrationException;
  -import javax.management.MalformedObjectNameException;
  -import javax.management.NotCompliantMBeanException;
   import javax.naming.Context;
   import javax.naming.NameNotFoundException;
   import javax.naming.NamingException;
  @@ -117,7 +113,7 @@
       private static final String RESOURCE_REF1_NAME = "url/testURL";
       private static final String RESOURCE_REF2_NAME = "DefaultCF";
   
  -    protected void setUpContext(UserTransaction userTransaction) throws InstanceAlreadyExistsException, MBeanRegistrationException, NotCompliantMBeanException, MalformedObjectNameException, DeploymentException {
  +    protected void setUpContext(UserTransaction userTransaction) throws DeploymentException {
   
           proxyFactory = new ProxyFactory() {
               public Object getProxy(Class homeInterface, Class remoteInterface, Object targetId) throws NamingException {
  
  
  

Mime
View raw message