You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by am...@apache.org on 2004/02/15 18:46:21 UTC

cvs commit: incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin XmlBeanSupport.java DConfigBeanSupport.java

ammulder    2004/02/15 09:46:21

  Modified:    modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean
                        ConnectionDefinitionDConfigBean.java
               modules/connector/src/test/org/apache/geronimo/connector/deployment
                        Connector_1_5Test.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin
                        DConfigBeanSupport.java
  Added:       modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean
                        ConfigPropertySettings.java
                        ConnectionDefinitionInstance.java
               modules/deployment/src/java/org/apache/geronimo/deployment/plugin
                        XmlBeanSupport.java
  Log:
  Non-DConfigBean versions of ConnectionDefinitionInstance and its
    config settings
  
  Revision  Changes    Path
  1.2       +43 -27    incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/ConnectionDefinitionDConfigBean.java
  
  Index: ConnectionDefinitionDConfigBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/ConnectionDefinitionDConfigBean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ConnectionDefinitionDConfigBean.java	9 Feb 2004 23:13:27 -0000	1.1
  +++ ConnectionDefinitionDConfigBean.java	15 Feb 2004 17:46:21 -0000	1.2
  @@ -61,6 +61,7 @@
   import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
   import org.apache.geronimo.xbeans.geronimo.GerConnectionDefinitionType;
   import org.apache.geronimo.xbeans.geronimo.GerConnectiondefinitionInstanceType;
  +import org.apache.geronimo.xbeans.geronimo.GerConnectionmanagerType;
   import org.apache.xmlbeans.SchemaTypeLoader;
   import org.apache.xmlbeans.XmlBeans;
   
  @@ -69,10 +70,11 @@
    *
    * @version $Revision$ $Date$
    *
  - * */
  + **/
   public class ConnectionDefinitionDConfigBean extends DConfigBeanSupport {
       private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
       private final static String[] CONNECTION_DEFINITION_XPATHS = {};
  +    private ConnectionDefinitionInstance[] instances = new ConnectionDefinitionInstance[0];
   
       public ConnectionDefinitionDConfigBean(DDBean ddBean, GerConnectionDefinitionType connectionDefinition) {
           super(ddBean, connectionDefinition, SCHEMA_TYPE_LOADER);
  @@ -82,42 +84,56 @@
           } else {
               assert connectionfactoryInterface.equals(connectionDefinition.getConnectionfactoryInterface().getStringValue());
           }
  +        // Get initial list of instances
  +        instances = new ConnectionDefinitionInstance[getConnectionDefinition().getConnectiondefinitionInstanceArray().length];
  +        for (int i = 0; i < instances.length; i++) {
  +            instances[i] = new ConnectionDefinitionInstance();
  +            instances[i].initialize(getConnectionDefinition().getConnectiondefinitionInstanceArray(i), this);
  +        }
       }
   
       GerConnectionDefinitionType getConnectionDefinition() {
           return (GerConnectionDefinitionType)getXmlObject();
       }
   
  -    public ConnectionDefinitionInstanceDConfigBean[] getConnectionDefinitionInstance() {
  -        GerConnectiondefinitionInstanceType[] connectiondefinitionInstances = getConnectionDefinition().getConnectiondefinitionInstanceArray();
  -        ConnectionDefinitionInstanceDConfigBean[] connectiondefinitionInstanceDConfigBeans = new ConnectionDefinitionInstanceDConfigBean[connectiondefinitionInstances.length];
  -        for (int i = 0; i < connectiondefinitionInstances.length; i++) {
  -            GerConnectiondefinitionInstanceType connectiondefinitionInstance = connectiondefinitionInstances[i];
  -            connectiondefinitionInstanceDConfigBeans[i] = new ConnectionDefinitionInstanceDConfigBean(getDDBean(), connectiondefinitionInstance);
  -        }
  -        return connectiondefinitionInstanceDConfigBeans;
  +    public ConnectionDefinitionInstance[] getConnectionDefinitionInstance() {
  +        return instances;
       }
   
  -    public void setConnectionDefinitionInstance(ConnectionDefinitionInstanceDConfigBean[] connectiondefinitionInstanceDConfigBeans) {
  -        GerConnectiondefinitionInstanceType[] connectiondefinitionInstances = new GerConnectiondefinitionInstanceType[connectiondefinitionInstanceDConfigBeans.length];
  -        for (int i = 0; i < connectiondefinitionInstanceDConfigBeans.length; i++) {
  -            ConnectionDefinitionInstanceDConfigBean connectiondefinitionInstanceDConfigBean = connectiondefinitionInstanceDConfigBeans[i];
  -            if (connectiondefinitionInstanceDConfigBean == null) {
  -                throw new IllegalStateException("the " + i + "th connectiondefinition instance was null");
  -            }
  -            connectiondefinitionInstances[i] = connectiondefinitionInstanceDConfigBean.getConnectiondefinitionInstance();
  -            if (connectiondefinitionInstances[i] == null) {
  -                connectiondefinitionInstances[i] = GerConnectiondefinitionInstanceType.Factory.newInstance();
  +    public void setConnectionDefinitionInstance(ConnectionDefinitionInstance[] instances) {
  +        ConnectionDefinitionInstance[] old = getConnectionDefinitionInstance();
  +        this.instances = instances;
  +        for (int i = 0; i < instances.length; i++) { // catch additions
  +            ConnectionDefinitionInstance instance = instances[i];
  +            if(!instance.hasParent()) {
  +                GerConnectiondefinitionInstanceType xmlObject = getConnectionDefinition().addNewConnectiondefinitionInstance();
  +                xmlObject.setConnectionmanager(GerConnectionmanagerType.Factory.newInstance());
  +                instance.initialize(xmlObject, this);
               }
           }
  -        //this will copy all the xmlobjects.
  -        getConnectionDefinition().setConnectiondefinitionInstanceArray(connectiondefinitionInstances);
  -        //get the new copies
  -        GerConnectiondefinitionInstanceType[] newconnectiondefinitionInstances = getConnectionDefinition().getConnectiondefinitionInstanceArray();
  -        for (int i = 0; i < newconnectiondefinitionInstances.length; i++) {
  -            GerConnectiondefinitionInstanceType newconnectiondefinitionInstance = newconnectiondefinitionInstances[i];
  -            connectiondefinitionInstanceDConfigBeans[i].setParent(getDDBean(), newconnectiondefinitionInstance);
  +        for (int i = 0; i < old.length; i++) { // catch removals
  +            ConnectionDefinitionInstance instance = old[i];
  +            boolean found = false;
  +            for (int j = 0; j < instances.length; j++) {
  +                if(instances[j] == instance) {
  +                    found = true;
  +                    break;
  +                }
  +            }
  +            if(!found) {
  +                // remove the XmlBean
  +                for (int j = 0; j < getConnectionDefinition().getConnectiondefinitionInstanceArray().length; j++) {
  +                    GerConnectiondefinitionInstanceType test = getConnectionDefinition().getConnectiondefinitionInstanceArray(j);
  +                    if(test == instance.getConnectiondefinitionInstance()) {
  +                        getConnectionDefinition().removeConnectiondefinitionInstance(j);
  +                        break;
  +                    }
  +                }
  +                // clean up the removed JavaBean
  +                instance.dispose();
  +            }
           }
  +        pcs.firePropertyChange("connectionDefinitionInstance", old, instances);
       }
   
       public String[] getXpaths() {
  
  
  
  1.1                  incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/ConfigPropertySettings.java
  
  Index: ConfigPropertySettings.java
  ===================================================================
  package org.apache.geronimo.connector.deployment.dconfigbean;
  
  import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
  import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
  import org.apache.xmlbeans.XmlObject;
  import org.apache.xmlbeans.SchemaTypeLoader;
  import org.apache.xmlbeans.XmlBeans;
  
  import javax.enterprise.deploy.model.DDBean;
  import javax.enterprise.deploy.model.XpathListener;
  import javax.enterprise.deploy.model.XpathEvent;
  
  /**
   * @version $Revision 1.0$
   */
  public class ConfigPropertySettings extends XmlBeanSupport {
      private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
      private String type;
      private DDBean ddBean;
      private XpathListener typeListener;
      private XpathListener nameListener;
  
      public ConfigPropertySettings() {
          super(null, SCHEMA_TYPE_LOADER);
      }
  
      void initialize(GerConfigPropertySettingType xmlObject, DDBean configPropertyBean) {
          setXmlObject(xmlObject);
          ddBean = configPropertyBean;
          DDBean[] child = configPropertyBean.getChildBean("config-property-type");
          if(child.length == 1) {
              setConfigPropertyType(child[0]);
          }
          child = configPropertyBean.getChildBean("config-property-name");
          if(child.length == 1) {
              setConfigPropertyName(child[0]);
          }
          configPropertyBean.addXpathListener("config-property-type", typeListener = new XpathListener() {
              public void fireXpathEvent(XpathEvent xpe) {
                  if(xpe.isChangeEvent() || xpe.isAddEvent()) {
                      setConfigPropertyType(xpe.getBean());
                  } else if(xpe.isRemoveEvent()) {
                      setConfigPropertyType((String)null);
                  }
              }
          });
          configPropertyBean.addXpathListener("config-property-name", nameListener = new XpathListener() {
              public void fireXpathEvent(XpathEvent xpe) {
                  if(xpe.isChangeEvent() || xpe.isAddEvent()) {
                      setConfigPropertyName(xpe.getBean());
                  } else if(xpe.isRemoveEvent()) {
                      setConfigPropertyName((String)null);
                  }
              }
          });
      }
  
      boolean matches(DDBean target) {
          return target.equals(ddBean);
      }
  
      void dispose() {
          if(ddBean != null) {
              ddBean.removeXpathListener("config-property-type", typeListener);
              ddBean.removeXpathListener("config-property-name", nameListener);
          }
          nameListener = null;
          typeListener = null;
          ddBean = null;
      }
  
      GerConfigPropertySettingType getConfigPropertySetting() {
          return (GerConfigPropertySettingType)getXmlObject();
      }
  
      public String getConfigPropertyName() {
          return getConfigPropertySetting().getName();
      }
  
      private void setConfigPropertyName(DDBean configPropertyBean) {
          if(configPropertyBean == null) {
              setConfigPropertyName((String)null);
          } else {
              setConfigPropertyName(configPropertyBean.getText());
          }
      }
  
      private void setConfigPropertyName(String name) {
          String old = getConfigPropertyName();
          getConfigPropertySetting().setName(name);
          pcs.firePropertyChange("configPropertyName", old, name);
      }
  
      public String getConfigPropertyType() {
          return type;
      }
  
      private void setConfigPropertyType(DDBean configPropertyBean) {
          if(configPropertyBean == null) {
              setConfigPropertyType((String)null);
          } else {
              setConfigPropertyType(configPropertyBean.getText());
          }
      }
  
      private void setConfigPropertyType(String type) {
          String old = getConfigPropertyType();
          this.type = type;
          pcs.firePropertyChange("configPropertyType", old, type);
      }
  
      public String getConfigPropertyValue() {
          return getConfigPropertySetting().getStringValue();
      }
  
      public void setConfigPropertyValue(String configPropertyValue) {
          String old = getConfigPropertyValue();
          getConfigPropertySetting().setStringValue(configPropertyValue);
          pcs.firePropertyChange("configPropertyValue", old, configPropertyValue);
      }
  }
  
  
  
  1.1                  incubator-geronimo/modules/connector/src/java/org/apache/geronimo/connector/deployment/dconfigbean/ConnectionDefinitionInstance.java
  
  Index: ConnectionDefinitionInstance.java
  ===================================================================
  package org.apache.geronimo.connector.deployment.dconfigbean;
  
  import org.apache.xmlbeans.SchemaTypeLoader;
  import org.apache.xmlbeans.XmlBeans;
  import org.apache.geronimo.xbeans.geronimo.GerConnectiondefinitionInstanceType;
  import org.apache.geronimo.xbeans.geronimo.GerConnectionmanagerType;
  import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
  import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
  
  import javax.enterprise.deploy.model.DDBean;
  import javax.enterprise.deploy.model.XpathListener;
  import javax.enterprise.deploy.model.XpathEvent;
  import java.math.BigInteger;
  import java.util.Set;
  import java.util.HashSet;
  import java.util.Arrays;
  import java.util.Iterator;
  
  /**
   * @version $Revision 1.0$
   */
  public class ConnectionDefinitionInstance extends XmlBeanSupport {
      private final static SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.getContextTypeLoader();
      private ConfigPropertySettings[] configs = new ConfigPropertySettings[0];
      private ConnectionDefinitionDConfigBean parent;
      private XpathListener configListener;
  
      public ConnectionDefinitionInstance() {
          super(null, SCHEMA_TYPE_LOADER);
      }
  
      void initialize(GerConnectiondefinitionInstanceType xmlObject, ConnectionDefinitionDConfigBean parent) {
          setXmlObject(xmlObject);
          this.parent = parent;
          DDBean[] beans = parent.getDDBean().getChildBean("config-property");
          configs = new ConfigPropertySettings[beans.length];
          Set xmlBeans = new HashSet(Arrays.asList(getConnectiondefinitionInstance().getConfigPropertySettingArray()));
          for (int i = 0; i < beans.length; i++) {
              DDBean bean = beans[i];
              String[] names = bean.getText("config-property-name");
              String name = names.length == 1 ? names[0] : "";
              GerConfigPropertySettingType target = null;
              for (Iterator it = xmlBeans.iterator(); it.hasNext();) {
                  GerConfigPropertySettingType setting = (GerConfigPropertySettingType) it.next();
                  if(setting.getName().equals(name)) {
                      target = setting;
                      xmlBeans.remove(target);
                      break;
                  }
              }
              if(target == null) {
                  target = getConnectiondefinitionInstance().addNewConfigPropertySetting();
              }
              configs[i] = new ConfigPropertySettings();
              configs[i].initialize(target, bean);
          }
          for (Iterator it = xmlBeans.iterator(); it.hasNext();) { // used to be in XmlBeans, no longer anything matching in J2EE DD
              GerConfigPropertySettingType target = (GerConfigPropertySettingType) it.next();
              for (int i = 0; i < getConnectiondefinitionInstance().getConfigPropertySettingArray().length; i++) {
                  if(getConnectiondefinitionInstance().getConfigPropertySettingArray(i) == target) {
                      getConnectiondefinitionInstance().removeConfigPropertySetting(i);
                      break;
                  }
              }
          }
          parent.getDDBean().addXpathListener("config-property", configListener = new XpathListener() {
              public void fireXpathEvent(XpathEvent xpe) {
                  if(xpe.isAddEvent()) {
                      ConfigPropertySettings[] bigger = new ConfigPropertySettings[configs.length+1];
                      System.arraycopy(configs, 0, bigger, 0, configs.length);
                      bigger[configs.length] = new ConfigPropertySettings();
                      bigger[configs.length].initialize(getConnectiondefinitionInstance().addNewConfigPropertySetting(), xpe.getBean());
                      setConfigProperty(bigger);
                  } else if(xpe.isRemoveEvent()) {
                      int index = -1;
                      for (int i = 0; i < configs.length; i++) {
                          if(configs[i].matches(xpe.getBean())) {
                              // remove the XMLBean
                              for (int j = 0; j < getConnectiondefinitionInstance().getConfigPropertySettingArray().length; j++) {
                                  GerConfigPropertySettingType test = getConnectiondefinitionInstance().getConfigPropertySettingArray(j);
                                  if(test == configs[i].getConfigPropertySetting()) {
                                      getConnectiondefinitionInstance().removeConfigPropertySetting(j);
                                      break;
                                  }
                              }
                              // clean up the JavaBean
                              configs[i].dispose();
                              index = i;
                              break;
                          }
                      }
                      // remove the JavaBean from my list
                      if(index > -1) {
                          ConfigPropertySettings[] smaller = new ConfigPropertySettings[configs.length-1];
                          System.arraycopy(configs, 0, smaller, 0, index);
                          System.arraycopy(configs, index+1, smaller, index, smaller.length-index);
                          setConfigProperty(smaller);
                      }
                  }
                  // ignore change event (no contents, no attributes)
              }
          });
      }
  
      boolean hasParent() {
          return parent != null;
      }
  
      void dispose() {
          if(configs != null) {
              for (int i = 0; i < configs.length; i++) {
                  configs[i].dispose();
              }
          }
          if(parent != null) {
              parent.getDDBean().removeXpathListener("config-property", configListener);
          }
          configs = null;
          configListener = null;
          parent = null;
      }
  
  // JavaBean properties for this object (with a couple helper methods)
  
      GerConnectiondefinitionInstanceType getConnectiondefinitionInstance() {
          return (GerConnectiondefinitionInstanceType)getXmlObject();
      }
  
      GerConnectionmanagerType getConnectionManager() {
          return getConnectiondefinitionInstance().getConnectionmanager();
      }
  
      public ConfigPropertySettings[] getConfigProperty() {
          return configs;
      }
  
      private void setConfigProperty(ConfigPropertySettings[] configs) { // can only be changed by adding a new DDBean
          ConfigPropertySettings[] old = getConfigProperty();
          this.configs = configs;
          pcs.firePropertyChange("configProperty", old, configs);
      }
  
      public String getName() {
          return getConnectiondefinitionInstance().getName();
      }
  
      public void setName(String name) {
          String old = getName();
          getConnectiondefinitionInstance().setName(name);
          pcs.firePropertyChange("name", old, name);
      }
  
      public String getGlobalJNDIName() {
          return getConnectiondefinitionInstance().getGlobalJndiName();
      }
  
      public void setGlobalJNDIName(String globalJNDIName) {
          String old = getGlobalJNDIName();
          getConnectiondefinitionInstance().setGlobalJndiName(globalJNDIName);
          pcs.firePropertyChange("globalJNDIName", old, globalJNDIName);
      }
  
      public boolean isUseConnectionRequestInfo() {
          return getConnectionManager().getUseConnectionRequestInfo();
      }
  
      public void setUseConnectionRequestInfo(boolean useConnectionRequestInfo) {
          boolean old = isUseConnectionRequestInfo();
          getConnectionManager().setUseConnectionRequestInfo(useConnectionRequestInfo);
          pcs.firePropertyChange("useConnectionRequestInfo", old, useConnectionRequestInfo);
      }
  
      public boolean isUseSubject() {
          return getConnectionManager().getUseSubject();
      }
  
      public void setUseSubject(boolean useSubject) {
          boolean old = isUseSubject();
          getConnectionManager().setUseSubject(useSubject);
          pcs.firePropertyChange("useSubject", old, useSubject);
      }
  
      public boolean isUseTransactionCaching() {
          return getConnectionManager().getUseTransactionCaching();
      }
  
      public void setUseTransactionCaching(boolean useTransactionCaching) {
          boolean old = isUseTransactionCaching();
          getConnectionManager().setUseTransactionCaching(useTransactionCaching);
          pcs.firePropertyChange("useTransactionCaching", old, useTransactionCaching);
      }
  
      public boolean isUseLocalTransactions() {
          return getConnectionManager().getUseLocalTransactions();
      }
  
      public void setUseLocalTransactions(boolean useLocalTransactions) {
          boolean old = isUseLocalTransactions();
          getConnectionManager().setUseLocalTransactions(useLocalTransactions);
          pcs.firePropertyChange("useLocalTransactions", old, useLocalTransactions);
      }
  
      public boolean isUseTransactions() {
          return getConnectionManager().getUseTransactions();
      }
  
      public void setUseTransactions(boolean useTransactions) {
          boolean old = isUseTransactions();
          getConnectionManager().setUseTransactions(useTransactions);
          pcs.firePropertyChange("useTransactions", old, useTransactions);
      }
  
      public int getMaxSize() {
          BigInteger test = getConnectionManager().getMaxSize();
          return test == null ? 0 : test.intValue();
      }
  
      public void setMaxSize(int maxSize) {
          int old = getMaxSize();
          getConnectionManager().setMaxSize(BigInteger.valueOf(maxSize));
          pcs.firePropertyChange("maxSize", old, maxSize);
      }
  
      public int getBlockingTimeout() {
          BigInteger test = getConnectionManager().getBlockingTimeout();
          return test == null ? 0 : test.intValue();
      }
  
      public void setBlockingTimeout(int blockingTimeout) {
          int old = getBlockingTimeout();
          getConnectionManager().setBlockingTimeout(BigInteger.valueOf(blockingTimeout));
          pcs.firePropertyChange("blockingTimeout", old, blockingTimeout);
      }
  
      public String getRealmBridgeName() {
          return getConnectionManager().getRealmBridge();
      }
  
      public void setRealmBridgeName(String realmBridgeName) {
          String old = getRealmBridgeName();
          getConnectionManager().setRealmBridge(realmBridgeName);
          pcs.firePropertyChange("realmBridgeName", old, realmBridgeName);
      }
  
  }
  
  
  
  1.7       +9 -14     incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/deployment/Connector_1_5Test.java
  
  Index: Connector_1_5Test.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/connector/src/test/org/apache/geronimo/connector/deployment/Connector_1_5Test.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- Connector_1_5Test.java	10 Feb 2004 19:59:14 -0000	1.6
  +++ Connector_1_5Test.java	15 Feb 2004 17:46:21 -0000	1.7
  @@ -95,12 +95,7 @@
   import org.apache.geronimo.deployment.ConfigurationCallback;
   import org.apache.geronimo.deployment.tools.DDBeanRootImpl;
   import org.apache.geronimo.gbean.jmx.GBeanMBean;
  -import org.apache.geronimo.connector.deployment.dconfigbean.ResourceAdapterDConfigBean;
  -import org.apache.geronimo.connector.deployment.dconfigbean.ConfigPropertySettingDConfigBean;
  -import org.apache.geronimo.connector.deployment.dconfigbean.AdminObjectDConfigBean;
  -import org.apache.geronimo.connector.deployment.dconfigbean.AdminObjectInstanceDConfigBean;
  -import org.apache.geronimo.connector.deployment.dconfigbean.ConnectionDefinitionDConfigBean;
  -import org.apache.geronimo.connector.deployment.dconfigbean.ConnectionDefinitionInstanceDConfigBean;
  +import org.apache.geronimo.connector.deployment.dconfigbean.*;
   import org.apache.xmlbeans.XmlOptions;
   
   /**
  @@ -177,14 +172,14 @@
           assertEquals(2, connectionDefinitiondds.length);
           ConnectionDefinitionDConfigBean connectionDefinitionDConfigBean = (ConnectionDefinitionDConfigBean)resourceAdapterDConfigBean.getDConfigBean(connectionDefinitiondds[0]);
           assertNotNull(connectionDefinitionDConfigBean);
  -        ConnectionDefinitionInstanceDConfigBean connectionDefinitionInstanceDConfigBean1 = new ConnectionDefinitionInstanceDConfigBean();
  -        connectionDefinitionDConfigBean.setConnectionDefinitionInstance(new ConnectionDefinitionInstanceDConfigBean[] {connectionDefinitionInstanceDConfigBean1});
  -        DDBean[] connectionDefinitionConfigPropDDs = connectionDefinitiondds[0].getChildBean(connectionDefinitionInstanceDConfigBean1.getXpaths()[0]);
  +        ConnectionDefinitionInstance connectionDefinitionInstance1 = new ConnectionDefinitionInstance();
  +        connectionDefinitionDConfigBean.setConnectionDefinitionInstance(new ConnectionDefinitionInstance[] {connectionDefinitionInstance1});
  +        DDBean[] connectionDefinitionConfigPropDDs = connectionDefinitiondds[0].getChildBean("config-property");
           assertEquals(4, connectionDefinitionConfigPropDDs.length);
  -        ConfigPropertySettingDConfigBean connectionDefinitionSetting1 = (ConfigPropertySettingDConfigBean) connectionDefinitionInstanceDConfigBean1.getDConfigBean(connectionDefinitionConfigPropDDs[0]);
  +        ConfigPropertySettings connectionDefinitionSetting1 = (ConfigPropertySettings) connectionDefinitionInstance1.getConfigProperty()[0];
           connectionDefinitionSetting1.setConfigPropertyValue("TestCDValue1");
           //connection manager properties
  -        connectionDefinitionInstanceDConfigBean1.setBlockingTimeout(3000);
  +        connectionDefinitionInstance1.setBlockingTimeout(3000);
   
           //check the results
           ByteArrayOutputStream baos = new ByteArrayOutputStream();
  @@ -239,8 +234,8 @@
           //outbound
           connectionDefinitionDConfigBean = (ConnectionDefinitionDConfigBean)resourceAdapterDConfigBean.getDConfigBean(connectionDefinitiondds[0]);
           assertNotNull(connectionDefinitionDConfigBean);
  -        ConnectionDefinitionInstanceDConfigBean[] connectionDefinitionInstanceDConfigBeans = connectionDefinitionDConfigBean.getConnectionDefinitionInstance();
  -        connectionDefinitionSetting1 = (ConfigPropertySettingDConfigBean) connectionDefinitionInstanceDConfigBeans[0].getDConfigBean(connectionDefinitionConfigPropDDs[0]);
  +        ConnectionDefinitionInstance[] connectionDefinitionInstanceDConfigBeans = connectionDefinitionDConfigBean.getConnectionDefinitionInstance();
  +        connectionDefinitionSetting1 = (ConfigPropertySettings) connectionDefinitionInstanceDConfigBeans[0].getConfigProperty()[0];
           assertEquals("TestCDValue1", connectionDefinitionSetting1.getConfigPropertyValue());
           //connection manager
           assertEquals(3000, connectionDefinitionInstanceDConfigBeans[0].getBlockingTimeout());
  
  
  
  1.7       +6 -37     incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanSupport.java
  
  Index: DConfigBeanSupport.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanSupport.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- DConfigBeanSupport.java	9 Feb 2004 23:11:04 -0000	1.6
  +++ DConfigBeanSupport.java	15 Feb 2004 17:46:21 -0000	1.7
  @@ -55,12 +55,6 @@
    */
   package org.apache.geronimo.deployment.plugin;
   
  -import java.beans.PropertyChangeListener;
  -import java.beans.PropertyChangeSupport;
  -import java.io.IOException;
  -import java.io.InputStream;
  -import java.io.OutputStream;
  -
   import javax.enterprise.deploy.model.DDBean;
   import javax.enterprise.deploy.model.XpathEvent;
   import javax.enterprise.deploy.spi.DConfigBean;
  @@ -68,7 +62,6 @@
   import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
   
   import org.apache.xmlbeans.SchemaTypeLoader;
  -import org.apache.xmlbeans.XmlException;
   import org.apache.xmlbeans.XmlObject;
   
   /**
  @@ -76,37 +69,29 @@
    *
    * @version $Revision$ $Date$
    */
  -public abstract class DConfigBeanSupport implements DConfigBean {
  -    protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
  +public abstract class DConfigBeanSupport extends XmlBeanSupport implements DConfigBean {
       private DDBean ddBean;
  -    private XmlObject xmlObject;
  -    private final SchemaTypeLoader schemaTypeLoader;
   
       public DConfigBeanSupport(DDBean ddBean, XmlObject xmlObject, SchemaTypeLoader schemaTypeLoader) {
  +        super(xmlObject, schemaTypeLoader);
           this.ddBean = ddBean;
  -        this.xmlObject = xmlObject;
  -        this.schemaTypeLoader = schemaTypeLoader;
       }
   
       protected void setParent(DDBean ddBean, XmlObject xmlObject) {
           this.ddBean = ddBean;
  -        this.xmlObject = xmlObject;
  +        setXmlObject(xmlObject);
       }
   
       public DDBean getDDBean() {
           return ddBean;
       }
   
  -    protected XmlObject getXmlObject() {
  -        return xmlObject;
  -    }
  -
       public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
  -        return null;
  +        throw new ConfigurationException("No DConfigBean matching DDBean "+bean);
       }
   
       public String[] getXpaths() {
  -        return null;
  +        return new String[0];
       }
   
       public void removeDConfigBean(DConfigBean bean) throws BeanNotFoundException {
  @@ -114,21 +99,5 @@
       }
   
       public void notifyDDChange(XpathEvent event) {
  -    }
  -
  -    public void addPropertyChangeListener(PropertyChangeListener pcl) {
  -        pcs.addPropertyChangeListener(pcl);
  -    }
  -
  -    public void removePropertyChangeListener(PropertyChangeListener pcl) {
  -        pcs.removePropertyChangeListener(pcl);
  -    }
  -
  -    public void toXML(OutputStream outputStream) throws IOException {
  -        xmlObject.save(outputStream);
  -    }
  -
  -    public void fromXML(InputStream inputStream) throws XmlException, IOException {
  -        xmlObject = schemaTypeLoader.parse(inputStream, null, null);
       }
   }
  
  
  
  1.1                  incubator-geronimo/modules/deployment/src/java/org/apache/geronimo/deployment/plugin/XmlBeanSupport.java
  
  Index: XmlBeanSupport.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.plugin;
  
  import java.beans.PropertyChangeListener;
  import java.beans.PropertyChangeSupport;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.OutputStream;
  
  import org.apache.xmlbeans.SchemaTypeLoader;
  import org.apache.xmlbeans.XmlException;
  import org.apache.xmlbeans.XmlObject;
  
  /**
   *
   *
   * @version $Revision: 1.1 $ $Date: 2004/02/15 17:46:21 $
   */
  public abstract class XmlBeanSupport { // should implement Serializable or Externalizable
      protected final PropertyChangeSupport pcs = new PropertyChangeSupport(this);
      private XmlObject xmlObject;
      private final SchemaTypeLoader schemaTypeLoader;
  
      public XmlBeanSupport(XmlObject xmlObject, SchemaTypeLoader schemaTypeLoader) {
          this.xmlObject = xmlObject;
          this.schemaTypeLoader = schemaTypeLoader;
      }
  
      protected void setXmlObject(XmlObject xmlObject) {
          this.xmlObject = xmlObject;
      }
  
      protected XmlObject getXmlObject() {
          return xmlObject;
      }
  
      public void addPropertyChangeListener(PropertyChangeListener pcl) {
          pcs.addPropertyChangeListener(pcl);
      }
  
      public void removePropertyChangeListener(PropertyChangeListener pcl) {
          pcs.removePropertyChangeListener(pcl);
      }
  
      public void toXML(OutputStream outputStream) throws IOException {
          xmlObject.save(outputStream);
      }
  
      public void fromXML(InputStream inputStream) throws XmlException, IOException {
          xmlObject = schemaTypeLoader.parse(inputStream, null, null);
      }
  }