geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r370976 [1/2] - in /geronimo/branches/1.0/modules: connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ connector-builder/src/test-resources/ connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/ n...
Date Sat, 21 Jan 2006 04:24:31 GMT
Author: ammulder
Date: Fri Jan 20 20:22:22 2006
New Revision: 370976

URL: http://svn.apache.org/viewcvs?rev=370976&view=rev
Log:
More complete tests for connector builder DConfigBeans
Fix a couple bugs and add missing beans
Fixes GERONIMO-1510 and contributes to GERONIMO-1137

Added:
    geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java   (with props)
    geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java   (with props)
    geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java   (with props)
    geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapterInstance.java   (with props)
    geronimo/branches/1.0/modules/connector-builder/src/test-resources/jms-plan.xml   (with props)
    geronimo/branches/1.0/modules/connector-builder/src/test-resources/jms.rar   (with props)
    geronimo/branches/1.0/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/
    geronimo/branches/1.0/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/GBeanLocator.java   (with props)
    geronimo/branches/1.0/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/ObjectNameGroup.java   (with props)
Modified:
    geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java
    geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java
    geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java
    geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java
    geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java
    geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapter.java
    geronimo/branches/1.0/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java

Added: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java?rev=370976&view=auto
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java (added)
+++ geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java Fri Jan 20 20:22:22 2006
@@ -0,0 +1,116 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerAdminobjectType;
+import org.apache.geronimo.xbeans.geronimo.GerAdminobjectInstanceType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+import javax.enterprise.deploy.model.DDBean;
+
+/**
+ * Represents /connector/adminobject in a Geronimo Connector deployment plan.
+ * Corresponds to /connector/resourceadapter/adminobject in the J2EE deployment plan.
+ * Note that in an arbitrary Geronimo connector plan, there can be multiple
+ * adminobject entries per adminobject from the J2EE plan.  When we load such
+ * a plan, we combine all the adminobject-instances from those adminobjects
+ * into a single Geronimo adminobject per J2EE adminobject, so if we write it
+ * out again it'll be a little different, but that way this can be a DConfigBean
+ * instead of a POJO (the loading code is in ConnectorDCB).
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class AdminObjectDCB extends DConfigBeanSupport {
+    private AdminObjectInstance[] adminObjectInstance = new AdminObjectInstance[0];
+
+    public AdminObjectDCB(DDBean adminobjectDDBean, final GerAdminobjectType adminobject) {
+        super(adminobjectDDBean, adminobject);
+        //todo: listen for property changes on the admin object
+        configure(adminobjectDDBean, adminobject);
+    }
+
+    private void configure(DDBean adminDDBean, GerAdminobjectType adminXml) {
+        adminXml.setAdminobjectClass(adminDDBean.getText("adminobject-class")[0]);
+        adminXml.setAdminobjectInterface(adminDDBean.getText("adminobject-interface")[0]);
+        GerAdminobjectInstanceType[] xmls = adminXml.getAdminobjectInstanceArray();
+        adminObjectInstance = new AdminObjectInstance[xmls.length];
+        for (int i = 0; i < xmls.length; i++) {
+            adminObjectInstance[i] = new AdminObjectInstance(adminDDBean, xmls[i]);
+        }
+    }
+
+    GerAdminobjectType getAdminObject() {
+        return (GerAdminobjectType) getXmlObject();
+    }
+
+    void addAdminObjectInstance(GerAdminobjectInstanceType xml) {
+        AdminObjectInstance instance = new AdminObjectInstance(getDDBean(), xml);
+        AdminObjectInstance[] result = new AdminObjectInstance[adminObjectInstance.length+1];
+        System.arraycopy(adminObjectInstance, 0, result, 0, adminObjectInstance.length);
+        result[adminObjectInstance.length] = instance;
+        setAdminObjectInstance(result);
+    }
+
+    // ----------------------- JavaBean Properties for /adminobject ----------------------
+
+    public String getAdminObjectInterface() {
+        return getAdminObject().getAdminobjectInterface();
+    }
+
+    public String getAdminObjectClass() {
+        return getAdminObject().getAdminobjectClass();
+    }
+
+    public AdminObjectInstance[] getAdminObjectInstance() {
+        return adminObjectInstance;
+    }
+
+    public void setAdminObjectInstance(AdminObjectInstance[] adminObjectInstance) {
+        AdminObjectInstance[] old = getAdminObjectInstance();
+        //todo: whack all the old ones
+        for (int i = 0; i < adminObjectInstance.length; i++) {
+            AdminObjectInstance instance = adminObjectInstance[i];
+            if(instance.getAdminInstance() == null) {
+                instance.configure(getDDBean(), getAdminObject().addNewAdminobjectInstance());
+            }
+        }
+        this.adminObjectInstance = adminObjectInstance;
+        pcs.firePropertyChange("adminObjectInstance", old, adminObjectInstance);
+    }
+
+    public AdminObjectInstance getAdminObjectInstance(int index) {
+        return adminObjectInstance[index];
+    }
+
+    public void setAdminObjectInstance(int index, AdminObjectInstance adminObjectInstance) {
+        AdminObjectInstance[] old = getAdminObjectInstance();
+        //todo: whack the old one
+        if(adminObjectInstance.getAdminInstance() == null) {
+            adminObjectInstance.configure(getDDBean(), getAdminObject().addNewAdminobjectInstance());
+        }
+        this.adminObjectInstance[index] = adminObjectInstance;
+        //todo: deep copy of array for "old"
+        pcs.firePropertyChange("adminObjectInstance", old, adminObjectInstance);
+    }
+
+    // ----------------------- End of JavaBean Properties ----------------------
+
+    protected SchemaTypeLoader getSchemaTypeLoader() {
+        return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+    }
+}

Propchange: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectDCB.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java?rev=370976&view=auto
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java (added)
+++ geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java Fri Jan 20 20:22:22 2006
@@ -0,0 +1,82 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import org.apache.geronimo.xbeans.geronimo.GerAdminobjectInstanceType;
+import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import javax.enterprise.deploy.model.DDBean;
+
+/**
+ * Represents /connector/adminobject/adminobject-instance in the
+ * Geronimo Connector deployment plan.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class AdminObjectInstance extends ConfigHolder {
+    private DDBean adminObject;
+
+    public AdminObjectInstance() {
+    }
+
+    public AdminObjectInstance(DDBean adminObject, GerAdminobjectInstanceType instance) {
+        configure(adminObject, instance);
+    }
+
+    protected GerAdminobjectInstanceType getAdminInstance() {
+        return (GerAdminobjectInstanceType) getXmlObject();
+    }
+
+    public void reconfigure() {
+        configure(adminObject, getAdminInstance());
+    }
+
+    void configure(DDBean adminObject, GerAdminobjectInstanceType definition) {
+        this.adminObject = adminObject;
+        super.configure(adminObject, definition);
+    }
+
+    protected GerConfigPropertySettingType createConfigProperty() {
+        return getAdminInstance().addNewConfigPropertySetting();
+    }
+
+    protected GerConfigPropertySettingType[] getConfigProperties() {
+        return getAdminInstance().getConfigPropertySettingArray();
+    }
+
+    protected void removeConfigProperty(int index) {
+        getAdminInstance().removeConfigPropertySetting(index);
+    }
+
+    // ----------------------- JavaBean Properties for /adminobject-instance ----------------------
+
+    public String getMessageDestinationName() {
+        return getAdminInstance().getMessageDestinationName();
+    }
+
+    public void setMessageDestinationName(String name) {
+        String old = getMessageDestinationName();
+        getAdminInstance().setMessageDestinationName(name);
+        pcs.firePropertyChange("messageDestinationName", old, name);
+    }
+
+    // ----------------------- End of JavaBean Properties ----------------------
+
+    protected SchemaTypeLoader getSchemaTypeLoader() {
+        return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+    }
+}

Propchange: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/AdminObjectInstance.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java?rev=370976&view=auto
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java (added)
+++ geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java Fri Jan 20 20:22:22 2006
@@ -0,0 +1,144 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.xmlbeans.XmlObject;
+
+import javax.enterprise.deploy.model.XpathListener;
+import javax.enterprise.deploy.model.XpathEvent;
+import javax.enterprise.deploy.model.DDBean;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Iterator;
+
+/**
+ * Base class for beans that hold an array of config property settings.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public abstract class ConfigHolder extends XmlBeanSupport  {
+    final XpathListener xpathListener = new XpathListener() {
+                    public void fireXpathEvent(XpathEvent event) {
+                        if(event.isAddEvent()) {
+                            //todo: add new config-property-setting, fire change event
+                        } else if(event.isRemoveEvent()) {
+                            //todo: remove config-property-setting, fire change event
+                        } else if(event.isChangeEvent()) {
+                            if(event.getChangeEvent().getPropertyName().equals("config-property-name")) {
+                                String old = (String) event.getChangeEvent().getOldValue();
+                                for (int i = 0; i < settings.length; i++) {
+                                    ConfigPropertySetting setting = settings[i];
+                                    if(setting.getName().equals(old)) {
+                                        setting.setName((String) event.getChangeEvent().getNewValue());
+                                        break;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                };
+    private DDBean ddBean;
+    private ConfigPropertySetting[] settings = new ConfigPropertySetting[0];
+
+    public ConfigHolder() {
+        super(null);
+    }
+
+    public void clearNullSettings() {
+        List list = new ArrayList();
+        Set saved = new HashSet();
+        for (int i = 0; i < settings.length; i++) {
+            ConfigPropertySetting setting = settings[i];
+            if(setting.getValue() != null && !setting.isSetToDefault()) {
+                list.add(setting);
+                saved.add(setting.getName());
+            }
+        }
+        settings = (ConfigPropertySetting[]) list.toArray(new ConfigPropertySetting[list.size()]);
+        GerConfigPropertySettingType[] configs = getConfigProperties();
+        for (int i = configs.length-1; i>=0; --i) {
+            GerConfigPropertySettingType type = configs[i];
+            if(!saved.contains(type.getName())) {
+                removeConfigProperty(i);
+            }
+        }
+    }
+
+    protected void configure(DDBean ddBean, XmlObject xml) {
+        ConfigPropertySetting[] old = null;
+        if(this.ddBean != null) {
+            this.ddBean.removeXpathListener("config-property", xpathListener);
+            old = settings;
+        }
+        this.ddBean = ddBean;
+        setXmlObject(xml);
+
+        // Prepare the ConfigPropertySetting array
+        List list = new ArrayList();
+        DDBean[] all = ddBean == null ? new DDBean[0] : ddBean.getChildBean("config-property");
+        if(all == null) {
+            all = new DDBean[0];
+        }
+        Map byName = new HashMap();
+        for (int i = 0; i < all.length; i++) {
+            DDBean item = all[i];
+            byName.put(item.getText("config-property-name")[0], item);
+        }
+        GerConfigPropertySettingType[] previous = getConfigProperties();
+        for (int i = 0; i < previous.length; i++) {
+            GerConfigPropertySettingType setting = previous[i];
+            DDBean item = (DDBean) byName.remove(setting.getName());
+            if(item != null) {
+                list.add(new ConfigPropertySetting(item, setting, false));
+            } else {
+                System.out.println("Ignoring connectiondefinition-instance/config-setting "+setting.getName()+" (no matching config-property in J2EE DD)");
+                //todo: delete it from the XMLBeans tree
+            }
+        }
+        for (Iterator it = byName.keySet().iterator(); it.hasNext();) {
+            String name = (String) it.next();
+            DDBean bean = (DDBean) byName.get(name);
+            list.add(new ConfigPropertySetting(bean, createConfigProperty(), true));
+        }
+        settings = (ConfigPropertySetting[]) list.toArray(new ConfigPropertySetting[list.size()]);
+        if(old != null) {
+            pcs.firePropertyChange("configPropertySetting", old, settings);
+        }
+        if(ddBean != null) {
+            ddBean.addXpathListener("config-property", xpathListener);
+        }
+    }
+
+    public ConfigPropertySetting[] getConfigPropertySetting() {
+        return settings;
+    }
+
+    public ConfigPropertySetting getConfigPropertySetting(int index) {
+        return settings[index];
+    }
+
+    protected abstract GerConfigPropertySettingType createConfigProperty();
+    protected abstract GerConfigPropertySettingType[] getConfigProperties();
+    protected abstract void removeConfigProperty(int index);
+    public abstract void reconfigure();
+}

Propchange: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigHolder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java?rev=370976&r1=370975&r2=370976&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java (original)
+++ geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java Fri Jan 20 20:22:22 2006
@@ -31,6 +31,7 @@
  */
 public class ConfigPropertySetting extends XmlBeanSupport {
     private DDBean configProperty;
+    private String defaultValue;
 
     public ConfigPropertySetting() {
         super(null);
@@ -54,14 +55,21 @@
         setXmlObject(property);
         final String name = configProperty.getText("config-property-name")[0];
         getPropertySetting().setName(name);
+        String[] test = configProperty.getText("config-property-value");
+        if(test != null && test.length == 1) {
+            defaultValue = test[0];
+        } else {
+            defaultValue = null;
+        }
         if(setDefault) {
-            String[] test = configProperty.getText("config-property-value");
-            if(test != null && test.length == 1) {
-                getPropertySetting().setStringValue(test[0]);
-            } else {
-                getPropertySetting().setStringValue(null);
-            }
+            getPropertySetting().setStringValue(defaultValue);
         }
+    }
+
+    boolean isSetToDefault() {
+        String value = getValue();
+        return (defaultValue == null && value == null) ||
+                (defaultValue != null && value != null && defaultValue.equals(value));
     }
 
     // ----------------------- JavaBean Properties for config-property-setting ----------------------

Modified: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java?rev=370976&r1=370975&r2=370976&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java (original)
+++ geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java Fri Jan 20 20:22:22 2006
@@ -16,17 +16,10 @@
  */
 package org.apache.geronimo.connector.deployment.jsr88;
 
-import java.util.Iterator;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.HashMap;
 import javax.enterprise.deploy.model.DDBean;
-import javax.enterprise.deploy.model.XpathListener;
-import javax.enterprise.deploy.model.XpathEvent;
-import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
 import org.apache.geronimo.xbeans.geronimo.GerConnectiondefinitionInstanceType;
 import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.geronimo.naming.deployment.jsr88.GBeanLocator;
 import org.apache.xmlbeans.SchemaTypeLoader;
 
 /**
@@ -35,37 +28,14 @@
  *
  * @version $Rev$ $Date$
  */
-public class ConnectionDefinitionInstance extends XmlBeanSupport {
-    final XpathListener xpathListener = new XpathListener() {
-                    public void fireXpathEvent(XpathEvent event) {
-                        if(event.isAddEvent()) {
-                            //todo: add new config-property-setting, fire change event
-                        } else if(event.isRemoveEvent()) {
-                            //todo: remove config-property-setting, fire change event
-                        } else if(event.isChangeEvent()) {
-                            if(event.getChangeEvent().getPropertyName().equals("config-property-name")) {
-                                String old = (String) event.getChangeEvent().getOldValue();
-                                for (int i = 0; i < settings.length; i++) {
-                                    ConfigPropertySetting setting = settings[i];
-                                    if(setting.getName().equals(old)) {
-                                        setting.setName((String) event.getChangeEvent().getNewValue());
-                                        break;
-                                    }
-                                }
-                            }
-                        }
-                    }
-                };
+public class ConnectionDefinitionInstance extends ConfigHolder {
     private DDBean connectionDefinition;
-    private ConfigPropertySetting[] settings = new ConfigPropertySetting[0];
     private ConnectionManager manager;
 
     public ConnectionDefinitionInstance() {
-        super(null);
     }
 
     public ConnectionDefinitionInstance(DDBean connectionDefinition, GerConnectiondefinitionInstanceType instance) {
-        super(null);
         configure(connectionDefinition, instance);
     }
 
@@ -73,68 +43,13 @@
         return (GerConnectiondefinitionInstanceType) getXmlObject();
     }
 
-    void clearNullSettings() {
-        List list = new ArrayList();
-        for (int i = 0; i < settings.length; i++) {
-            ConfigPropertySetting setting = settings[i];
-            if(setting.getValue() != null) {
-                list.add(setting);
-            }
-        }
-        settings = (ConfigPropertySetting[]) list.toArray(new ConfigPropertySetting[list.size()]);
-        GerConnectiondefinitionInstanceType instance = getConnectionInstance();
-        for (int i = instance.getConfigPropertySettingArray().length-1; i>=0; --i) {
-            GerConfigPropertySettingType type = instance.getConfigPropertySettingArray(i);
-            if(type.isNil() || type.getStringValue() == null) {
-                instance.removeConfigPropertySetting(i);
-            }
-        }
-    }
-
-    void reconfigure() {
+    public void reconfigure() {
         configure(connectionDefinition, getConnectionInstance());
     }
 
     void configure(DDBean connectionDefinition, GerConnectiondefinitionInstanceType definition) {
-        ConfigPropertySetting[] old = null;
-        if(this.connectionDefinition != null) {
-            this.connectionDefinition.removeXpathListener("config-property", xpathListener);
-            old = settings;
-        }
         this.connectionDefinition = connectionDefinition;
-        setXmlObject(definition);
-
-        // Prepare the ConfigPropertySetting array
-        List list = new ArrayList();
-        DDBean[] all = connectionDefinition == null ? new DDBean[0] : connectionDefinition.getChildBean("config-property");
-        Map byName = new HashMap();
-        for (int i = 0; i < all.length; i++) {
-            DDBean ddBean = all[i];
-            byName.put(ddBean.getText("config-property-name")[0], ddBean);
-        }
-        GerConfigPropertySettingType[] previous = definition.getConfigPropertySettingArray();
-        for (int i = 0; i < previous.length; i++) {
-            GerConfigPropertySettingType setting = previous[i];
-            DDBean ddBean = (DDBean) byName.remove(setting.getName());
-            if(ddBean != null) {
-                list.add(new ConfigPropertySetting(ddBean, setting, false));
-            } else {
-                System.out.println("Ignoring connectiondefinition-instance/config-setting "+setting.getName()+" (no matching config-property in J2EE DD)");
-                //todo: delete it from the XMLBeans tree
-            }
-        }
-        for (Iterator it = byName.keySet().iterator(); it.hasNext();) {
-            String name = (String) it.next();
-            DDBean bean = (DDBean) byName.get(name);
-            list.add(new ConfigPropertySetting(bean, getConnectionInstance().addNewConfigPropertySetting(), true));
-        }
-        settings = (ConfigPropertySetting[]) list.toArray(new ConfigPropertySetting[list.size()]);
-        if(old != null) {
-            pcs.firePropertyChange("configPropertySetting", old, settings);
-        }
-        if(connectionDefinition != null) {
-            connectionDefinition.addXpathListener("config-property", xpathListener);
-        }
+        super.configure(connectionDefinition, definition);
         if(connectionDefinition != null) {
             DDBean parent = connectionDefinition.getChildBean("..")[0];
             ConnectionManager oldMgr = manager;
@@ -159,6 +74,18 @@
         return connectionDefinition;
     }
 
+    protected GerConfigPropertySettingType createConfigProperty() {
+        return getConnectionInstance().addNewConfigPropertySetting();
+    }
+
+    protected GerConfigPropertySettingType[] getConfigProperties() {
+        return getConnectionInstance().getConfigPropertySettingArray();
+    }
+
+    protected void removeConfigProperty(int index) {
+        getConnectionInstance().removeConfigPropertySetting(index);
+    }
+
     // ----------------------- JavaBean Properties for /connectiondefinition-instance ----------------------
 
     public String getName() {
@@ -191,18 +118,9 @@
         pcs.firePropertyChange("implementedInterface", old, getImplementedInterface());
     }
 
-    public ConfigPropertySetting[] getConfigPropertySetting() {
-        return settings;
-    }
-
-    public ConfigPropertySetting getConfigPropertySetting(int index) {
-        return settings[index];
-    }
-
     public ConnectionManager getConnectionManager() {
         return manager;
     }
-
 
     // ----------------------- End of JavaBean Properties ----------------------
 

Modified: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java?rev=370976&r1=370975&r2=370976&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java (original)
+++ geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionManager.java Fri Jan 20 20:22:22 2006
@@ -53,8 +53,9 @@
                     manager.addNewNoTransaction();
                 } else if(tx.equalsIgnoreCase("LocalTransaction")) {
                     manager.addNewLocalTransaction();
-                } else if(tx.equalsIgnoreCase("XATranasaction")) {
+                } else if(tx.equalsIgnoreCase("XATransaction")) {
                     manager.addNewXaTransaction();
+                    manager.getXaTransaction().addNewTransactionCaching();
                 }
             }
         }
@@ -203,7 +204,7 @@
     }
 
     public boolean isTransactionXACachingThread() {
-        return isTransactionXA() && getManager().getXaTransaction().isSetTransactionCaching();
+        return isTransactionXA() && getManager().getXaTransaction().isSetThreadCaching();
     }
 
     public void setTransactionXACachingThread(boolean set) {

Modified: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java?rev=370976&r1=370975&r2=370976&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java (original)
+++ geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java Fri Jan 20 20:22:22 2006
@@ -137,10 +137,8 @@
         } finally {
             for (int i = 0; i < parents.size(); i++) {
                 Object parent = parents.get(i);
-                if(parent instanceof ConnectionDefinitionInstance) {
-                    ConnectionDefinitionInstance instance = (ConnectionDefinitionInstance) parent;
-                    instance.reconfigure();
-                } //todo: else if instanceof ResourceAdapterInstance, else if instanceof AdminObjectInstance
+                ConfigHolder instance = (ConfigHolder) parent;
+                instance.reconfigure();
             }
         }
     }
@@ -149,7 +147,10 @@
         ResourceAdapter[] adapters = connector.getResourceAdapter();
         for (int i = 0; i < adapters.length; i++) {
             ResourceAdapter adapter = adapters[i];
-            // todo: check resource adapter instances
+            if(adapter.getResourceAdapterInstance() != null) {
+                parents.add(adapter.getResourceAdapterInstance());
+                adapter.getResourceAdapterInstance().clearNullSettings();
+            }
             ConnectionDefinition defs[] = adapter.getConnectionDefinition();
             for (int j = 0; j < defs.length; j++) {
                 ConnectionDefinition def = defs[j];
@@ -161,6 +162,21 @@
                 }
             }
         }
-        //todo: check admin object instances
+        try {
+            DDBean[] adminDDBs = connector.getDDBean().getChildBean(connector.getXpaths()[0]);
+            if(adminDDBs == null) adminDDBs = new DDBean[0];
+            for (int i = 0; i < adminDDBs.length; i++) {
+                DDBean ddb = adminDDBs[i];
+                AdminObjectDCB dcb = (AdminObjectDCB) connector.getDConfigBean(ddb);
+                AdminObjectInstance[] instances = dcb.getAdminObjectInstance();
+                for (int j = 0; j < instances.length; j++) {
+                    AdminObjectInstance instance = instances[j];
+                    parents.add(instance);
+                    instance.clearNullSettings();
+                }
+            }
+        } catch (ConfigurationException e) {
+            e.printStackTrace();
+        }
     }
 }

Modified: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java?rev=370976&r1=370975&r2=370976&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java (original)
+++ geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java Fri Jan 20 20:22:22 2006
@@ -19,14 +19,26 @@
 import java.util.Set;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.LinkedHashMap;
+import java.util.Arrays;
+import java.util.Collections;
 import javax.enterprise.deploy.model.DDBean;
 import javax.enterprise.deploy.model.XpathListener;
 import javax.enterprise.deploy.model.XpathEvent;
+import javax.enterprise.deploy.spi.DConfigBean;
+import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
+
 import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
 import org.apache.geronimo.deployment.xbeans.DependencyType;
 import org.apache.geronimo.xbeans.geronimo.GerConnectorType;
 import org.apache.geronimo.xbeans.geronimo.GerResourceadapterType;
+import org.apache.geronimo.xbeans.geronimo.GerAdminobjectType;
+import org.apache.geronimo.xbeans.geronimo.GerAdminobjectInstanceType;
 import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlCursor;
 
 /**
  * Represents /connector in a Geronimo Connector deployment plan.
@@ -38,6 +50,7 @@
     private DDBean resourceAdapterDDBean;
     private ResourceAdapter[] resourceAdapter = new ResourceAdapter[0];
     private Dependency[] dependency = new Dependency[0];
+    private AdminObjectDCB[] adminobjects = new AdminObjectDCB[0];
 
     public ConnectorDCB(DDBean connectorDDBean, final GerConnectorType connector) {
         super(connectorDDBean, connector);
@@ -62,6 +75,33 @@
         });
     }
 
+    public String[] getXpaths() {
+        return getXPathsForJ2ee_1_4(new String[][]{{"resourceadapter","adminobject",},});
+    }
+
+    public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
+        if (getXpaths()[0].equals(bean.getXpath())) { // "adminobject"
+            String aoInterface = bean.getText("adminobject-interface")[0];
+            String aoClass = bean.getText("adminobject-class")[0];
+            // Check whether we've seen this one before
+            for(int i=0; i<adminobjects.length; i++) {
+                if(adminobjects[i].getAdminObjectClass().equals(aoClass) &&
+                   adminobjects[i].getAdminObjectInterface().equals(aoInterface)) {
+                    return adminobjects[i];
+                }
+            }
+            // Haven't seen it; create a new DConfigBean
+            GerAdminobjectType ao = getConnector().addNewAdminobject();
+            AdminObjectDCB dcb = new AdminObjectDCB(bean, ao);
+            AdminObjectDCB[] list = new AdminObjectDCB[adminobjects.length+1];
+            System.arraycopy(adminobjects, 0, list, 0, adminobjects.length);
+            list[adminobjects.length] = dcb;
+            return dcb;
+        } else {
+            throw new ConfigurationException("No DConfigBean matching DDBean "+bean.getXpath());
+        }
+    }
+
     private void loadExistingData(GerConnectorType connector) {
         //todo: Handle the import children
         //todo: Handle the hidden-classes children
@@ -89,7 +129,78 @@
                 resourceAdapter[i] = new ResourceAdapter(resourceAdapterDDBean, adapter);
             }
         }
-        //todo: Handle the AdminObject children
+        // Handle the AdminObject children
+        GerAdminobjectType[] admins = connector.getAdminobjectArray();
+        DDBean[] data = getDDBean().getChildBean(getXpaths()[0]);
+        List ddBeans = data == null ? Collections.EMPTY_LIST : new ArrayList(Arrays.asList(data)); // resourceadapter/adminobject
+
+        Map dcbs = new LinkedHashMap();
+        if(admins == null) {
+            adminobjects = new AdminObjectDCB[0];
+        } else {
+            // Match up each Geronimo adminobject with a ra.xml adminobject and create DConfigBeans accordingly
+            for (int i = 0; i < admins.length; i++) {
+                GerAdminobjectType admin = admins[i];
+                String aoClass = admin.getAdminobjectClass();
+                String aoIface = admin.getAdminobjectInterface();
+                AdminObjectDCB dcb = (AdminObjectDCB) dcbs.get("class "+aoClass+" iface "+aoIface);
+                if(dcb != null) {
+                    // this is a second Geronimo adminobject block of the same type; there will not be a matching DDBean any more
+                    // merge the adminobject-instance entries instead!!!
+                    if(admin.getAdminobjectInstanceArray().length > 0) {
+                        GerAdminobjectType old = dcb.getAdminObject();
+                        GerAdminobjectInstanceType[] array = admin.getAdminobjectInstanceArray();
+                        int oldCount = dcb.getAdminObjectInstance().length;
+                        for (int j = 0; j < array.length; j++) {
+                            GerAdminobjectInstanceType instance = array[j];
+                            XmlCursor source = instance.newCursor();
+                            XmlCursor dest = old.newCursor();
+                            dest.toEndToken();
+                            if(!source.moveXml(dest)) {
+                                throw new RuntimeException("Unable to move admin object instance");
+                            }
+                            source.dispose();
+                            dest.dispose();
+                            dcb.addAdminObjectInstance(old.getAdminobjectInstanceArray(oldCount+j));
+                        }
+                    }
+                    continue;
+                }
+                DDBean target = null;
+                for (int j = 0; j < ddBeans.size(); j++) {
+                    DDBean ddBean = (DDBean) ddBeans.get(j);
+                    String ddClass = ddBean.getText("adminobject-class")[0];
+                    String ddIface = ddBean.getText("adminobject-interface")[0];
+                    if(ddClass.equals(aoClass) && ddIface.equals(aoIface)) {
+                        target = ddBean;
+                        ddBeans.remove(j);
+                        break;
+                    }
+                }
+                if(target == null) {
+                    System.out.println("Geronimo connector deployment plan has admin object with interface '"+aoIface+"' and class '"+aoClass+"' but the ra.xml does not have a matching adminobject declared.  Deleting this adminobject from the Geronimo plan.");
+                    continue;
+                }
+                dcb = new AdminObjectDCB(target, admin);
+                dcbs.put("class "+aoClass+" iface "+aoIface, dcb);
+            }
+        }
+        // There are some admin object types in ra.xml with no matching instances; create DConfigBeans for those
+        for (int i = 0; i < ddBeans.size(); i++) {
+            DDBean ddBean = (DDBean) ddBeans.get(i);
+            String ddClass = ddBean.getText("adminobject-class")[0];
+            String ddIface = ddBean.getText("adminobject-interface")[0];
+            GerAdminobjectType admin = connector.addNewAdminobject();
+            dcbs.put("class "+ddClass+" iface "+ddIface, new AdminObjectDCB(ddBean, admin));
+        }
+        List adminResults = new ArrayList();
+        for (Iterator it = dcbs.keySet().iterator(); it.hasNext();) {
+            String key = (String) it.next();
+            DConfigBean value = (DConfigBean) dcbs.get(key);
+            adminResults.add(value);
+        }
+        adminobjects = (AdminObjectDCB[]) adminResults.toArray(new AdminObjectDCB[adminResults.size()]);
+
         //todo: Handle the GBean children
     }
 
@@ -104,7 +215,6 @@
     // import*
     // hidden-classes*
     // non-overridable-classes*
-    // adminobject*
     // gbean*
 
     public String getConfigID() {
@@ -256,7 +366,7 @@
 
     // ----------------------- End of JavaBean Properties ----------------------
 
-    
+
 
     protected SchemaTypeLoader getSchemaTypeLoader() {
         return Connector15DCBRoot.SCHEMA_TYPE_LOADER;

Modified: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapter.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapter.java?rev=370976&r1=370975&r2=370976&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapter.java (original)
+++ geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapter.java Fri Jan 20 20:22:22 2006
@@ -36,6 +36,7 @@
 public class ResourceAdapter extends XmlBeanSupport {
     private DDBean resourceAdapter;
     private ConnectionDefinition[] instances = new ConnectionDefinition[0];
+    private ResourceAdapterInstance resourceAdapterInstance;
 
     public ResourceAdapter() {
         super(null);
@@ -53,6 +54,11 @@
     void configure(DDBean resourceAdapter, GerResourceadapterType ra) {
         this.resourceAdapter = resourceAdapter;
         setXmlObject(ra);
+        if(ra.isSetResourceadapterInstance()) {
+            resourceAdapterInstance = new ResourceAdapterInstance(resourceAdapter, ra.getResourceadapterInstance());
+        } else {
+            resourceAdapterInstance = null;
+        }
         if(ra.isSetOutboundResourceadapter()) {
             DDBean[] test = resourceAdapter.getChildBean("outbound-resourceadapter");
             if(test != null && test.length > 0) {
@@ -72,8 +78,6 @@
     }
 
     // ----------------------- JavaBean Properties for /connector/resourceadapter ----------------------
-    //todo: handle the following properties
-    // resourceadapter-instance?
 
     public ConnectionDefinition[] getConnectionDefinition() {
         return instances;
@@ -129,7 +133,24 @@
         if(definition.getConnectionDefinition() == null) {
             definition.configure(resourceAdapter, getResourceAdapter().getOutboundResourceadapter().addNewConnectionDefinition());
         }
-        pcs.firePropertyChange("resourceAdapter", old, instances);
+        pcs.firePropertyChange("connectionDefinition", old, instances);
+    }
+
+    public ResourceAdapterInstance getResourceAdapterInstance() {
+        return resourceAdapterInstance;
+    }
+
+    public void setResourceAdapterInstance(ResourceAdapterInstance resourceAdapterInstance) {
+        ResourceAdapterInstance old = this.resourceAdapterInstance;
+        this.resourceAdapterInstance = resourceAdapterInstance;
+        if(resourceAdapterInstance.getResourceAdapterInstance() == null) {
+            if(getResourceAdapter().isSetResourceadapterInstance()) {
+                resourceAdapterInstance.configure(resourceAdapter, getResourceAdapter().getResourceadapterInstance());
+            } else {
+                resourceAdapterInstance.configure(resourceAdapter, getResourceAdapter().addNewResourceadapterInstance());
+            }
+        }
+        pcs.firePropertyChange("resourceAdapterInstance", old, instances);
     }
 
     // ----------------------- End of JavaBean Properties ----------------------

Added: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapterInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapterInstance.java?rev=370976&view=auto
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapterInstance.java (added)
+++ geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapterInstance.java Fri Jan 20 20:22:22 2006
@@ -0,0 +1,107 @@
+/**
+ *
+ * Copyright 2005 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+package org.apache.geronimo.connector.deployment.jsr88;
+
+import org.apache.geronimo.xbeans.geronimo.GerResourceadapterInstanceType;
+import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.geronimo.naming.deployment.jsr88.GBeanLocator;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import javax.enterprise.deploy.model.DDBean;
+
+/**
+ * Represents /connector/resourceadapter/resourceadapter-instance in the
+ * Geronimo Connector deployment plan.  The settings here correspond to
+ * /connector/resourceadapter in the J2EE plan, but since there can be
+ * several instances per resource adapter, it's not 1:1 and this is not
+ * a DConfigBean.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ResourceAdapterInstance extends ConfigHolder {
+    private DDBean resourceAdapter;
+    private GBeanLocator workManager;
+
+    /**
+     * Present so a tool can create a new one
+     */
+    public ResourceAdapterInstance() {
+    }
+
+    public ResourceAdapterInstance(DDBean resourceAdapter, GerResourceadapterInstanceType instance) {
+        configure(resourceAdapter, instance);
+    }
+
+    protected GerResourceadapterInstanceType getResourceAdapterInstance() {
+        return (GerResourceadapterInstanceType) getXmlObject();
+    }
+
+    public void reconfigure() {
+        configure(resourceAdapter, getResourceAdapterInstance());
+    }
+
+    void configure(DDBean resourceAdapter, GerResourceadapterInstanceType xml) {
+        this.resourceAdapter = resourceAdapter;
+        super.configure(resourceAdapter, xml);
+    }
+
+    protected GerConfigPropertySettingType createConfigProperty() {
+        return getResourceAdapterInstance().addNewConfigPropertySetting();
+    }
+
+    protected GerConfigPropertySettingType[] getConfigProperties() {
+        return getResourceAdapterInstance().getConfigPropertySettingArray();
+    }
+
+    protected void removeConfigProperty(int index) {
+        getResourceAdapterInstance().removeConfigPropertySetting(index);
+    }
+
+    // ----------------------- JavaBean Properties for /resourceadapter-instance ----------------------
+
+    public String getResourceAdapterName() {
+        return getResourceAdapterInstance().getResourceadapterName();
+    }
+
+    public void setResourceAdapterName(String name) {
+        String old = getResourceAdapterName();
+        getResourceAdapterInstance().setResourceadapterName(name);
+        pcs.firePropertyChange("resourceAdapterName", old, name);
+    }
+
+    public GBeanLocator getWorkManager() {
+        return workManager;
+    }
+
+    public void setWorkManager(GBeanLocator locator) {
+        GBeanLocator old = getWorkManager();
+        if(locator != null && !locator.configured()) {
+            if(getResourceAdapterInstance().getWorkmanager() != null) {
+                locator.configure(getResourceAdapterInstance().getWorkmanager());
+            } else {
+                locator.configure(getResourceAdapterInstance().addNewWorkmanager());
+            }
+        }
+        workManager = locator;
+        pcs.firePropertyChange("workManager", old, workManager);
+    }
+
+    // ----------------------- End of JavaBean Properties ----------------------
+
+    protected SchemaTypeLoader getSchemaTypeLoader() {
+        return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+    }
+}

Propchange: geronimo/branches/1.0/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapterInstance.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/branches/1.0/modules/connector-builder/src/test-resources/jms-plan.xml
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/test-resources/jms-plan.xml?rev=370976&view=auto
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/test-resources/jms-plan.xml (added)
+++ geronimo/branches/1.0/modules/connector-builder/src/test-resources/jms-plan.xml Fri Jan 20 20:22:22 2006
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--Copyright 2004-2005 The Apache Software Foundation
+
+    Licensed under the Apache License, Version 2.0 (the "License");
+    you may not use this file except in compliance with the License.
+    You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing, software
+    distributed under the License is distributed on an "AS IS" BASIS,
+    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+    See the License for the specific language governing permissions and
+    limitations under the License.-->
+<!--$Rev: 356113 $ $Date: 2005-12-11 21:54:02 -0500 (Sun, 11 Dec 2005) $-->
+<connector configId="TestJMSConfig" xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.0">
+  <dep:import xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.0">
+    <dep:groupId>geronimo</dep:groupId>
+    <dep:type>car</dep:type>
+    <dep:artifactId>activemq-broker</dep:artifactId>
+    <dep:version>1.0</dep:version>
+  </dep:import>
+  <resourceadapter>
+    <resourceadapter-instance>
+      <resourceadapter-name>Test ActiveMQ RA</resourceadapter-name>
+      <config-property-setting name="ServerUrl">tcp://localhost:61616</config-property-setting>
+      <config-property-setting name="UserName">geronimo-user</config-property-setting>
+      <config-property-setting name="Password">geronimo-pw</config-property-setting>
+      <workmanager>
+        <gbean-link>DefaultWorkManager</gbean-link>
+      </workmanager>
+    </resourceadapter-instance>
+    <outbound-resourceadapter>
+      <connection-definition>
+        <connectionfactory-interface>javax.jms.ConnectionFactory</connectionfactory-interface>
+        <connectiondefinition-instance>
+          <name>DefaultActiveMQConnectionFactory</name>
+          <implemented-interface>javax.jms.QueueConnectionFactory</implemented-interface>
+          <implemented-interface>javax.jms.TopicConnectionFactory</implemented-interface>
+          <connectionmanager>
+            <xa-transaction>
+              <transaction-caching/>
+            </xa-transaction>
+            <single-pool>
+              <max-size>10</max-size>
+              <blocking-timeout-milliseconds>5000</blocking-timeout-milliseconds>
+              <match-one/>
+            </single-pool>
+          </connectionmanager>
+        </connectiondefinition-instance>
+      </connection-definition>
+    </outbound-resourceadapter>
+  </resourceadapter>
+  <adminobject>
+    <adminobject-interface>javax.jms.Queue</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQQueue</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>TestQueue1Name</message-destination-name>
+      <config-property-setting name="PhysicalName">TestQueue1Physical</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+  <adminobject>
+    <adminobject-interface>javax.jms.Queue</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQQueue</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>TestQueue2Name</message-destination-name>
+      <config-property-setting name="PhysicalName">TestQueue2Physical</config-property-setting>
+    </adminobject-instance>
+    <adminobject-instance>
+      <message-destination-name>TestQueue3Name</message-destination-name>
+      <config-property-setting name="PhysicalName">TestQueue3Physical</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+  <adminobject>
+    <adminobject-interface>javax.jms.Topic</adminobject-interface>
+    <adminobject-class>org.activemq.message.ActiveMQTopic</adminobject-class>
+    <adminobject-instance>
+      <message-destination-name>TestTopic1Name</message-destination-name>
+      <config-property-setting name="PhysicalName">TestTopic1Physical</config-property-setting>
+    </adminobject-instance>
+  </adminobject>
+</connector>
\ No newline at end of file

Propchange: geronimo/branches/1.0/modules/connector-builder/src/test-resources/jms-plan.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: geronimo/branches/1.0/modules/connector-builder/src/test-resources/jms.rar
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/test-resources/jms.rar?rev=370976&view=auto
==============================================================================
Binary file - no diff available.

Propchange: geronimo/branches/1.0/modules/connector-builder/src/test-resources/jms.rar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: geronimo/branches/1.0/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java?rev=370976&r1=370975&r2=370976&view=diff
==============================================================================
--- geronimo/branches/1.0/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java (original)
+++ geronimo/branches/1.0/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java Fri Jan 20 20:22:22 2006
@@ -21,9 +21,12 @@
 import org.apache.geronimo.deployment.tools.loader.ConnectorDeployable;
 import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
 import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.geronimo.naming.deployment.jsr88.GBeanLocator;
 
 import javax.enterprise.deploy.model.DDBeanRoot;
+import javax.enterprise.deploy.model.DDBean;
 import javax.enterprise.deploy.shared.ModuleType;
+import javax.enterprise.deploy.spi.DConfigBean;
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.InputStream;
@@ -69,14 +72,14 @@
         assertNull(connector.getParentID());
         assertNull(connector.getSuppressDefaultParentID());
         connector.setConfigID("MyDatabase");
-        connector.setParentID("org/apache/geronimo/Server");
-        // Try the dependency element
+        connector.setParentID("geronimo/j2ee-server/1.0/car");
+        // Try the /connector/dependency element
         assertNotNull(connector.getDependency());
         assertEquals(0, connector.getDependency().length);
         Dependency dep = new Dependency();
         connector.setDependency(new Dependency[]{dep});
         assertEquals(1, connector.getDependency().length);
-        dep.setURI("postgresql/jars/postgresql-8.0-313.jdbc3.jar");
+        dep.setURI("postgresql/postgresql-8.0/313.jdbc3/jar");
         assertNull(dep.getArtifactId());
         assertNull(dep.getGroupId());
         assertNull(dep.getType());
@@ -86,6 +89,9 @@
         dep.setVersion("313.jdbc3");
         assertNull(dep.getURI());
         assertNull(dep.getType());
+        // todo: Try the /connector/import element
+        // todo: Try the /connector/hidden-classes element
+        // todo: Try the /connector/non-overridable-classes element
         // Try the /connector/resourceadapter element
         assertNotNull(connector.getResourceAdapter());
         assertEquals(1, connector.getResourceAdapter().length);
@@ -215,15 +221,21 @@
         GerConfigPropertySettingType[] settings = doc.getConnector().getResourceadapterArray(0).
                 getOutboundResourceadapter().getConnectionDefinitionArray(0).
                 getConnectiondefinitionInstanceArray(0).getConfigPropertySettingArray();
-        assertEquals(4, settings.length);
+        assertEquals(2, settings.length);
+        Set seen = new HashSet();
         for (int i = 0; i < settings.length; i++) {
             GerConfigPropertySettingType setting = settings[i];
-            if(setting.getName().equals("CommitBeforeAutocommit")) {
-                assertEquals("false", setting.getStringValue());
-            } else if(setting.getName().equals("Driver")) {
+            if(seen.contains(setting.getName())) {
+                fail("Duplicate for config property setting '"+setting.getName()+"'");
+            }
+            seen.add(setting.getName());
+// These two are set to their defaults and now no longer appear
+//            if(setting.getName().equals("CommitBeforeAutocommit")) {
+//                assertEquals("false", setting.getStringValue());
+//            } else if(setting.getName().equals("ExceptionSorterClass")) {
+//                assertEquals("org.tranql.connector.AllExceptionsAreFatalSorter", setting.getStringValue());
+            if(setting.getName().equals("Driver")) {
                 assertEquals("org.apache.derby.jdbc.EmbeddedDriver", setting.getStringValue());
-            } else if(setting.getName().equals("ExceptionSorterClass")) {
-                assertEquals("org.tranql.connector.AllExceptionsAreFatalSorter", setting.getStringValue());
             } else if(setting.getName().equals("ConnectionURL")) {
                 assertEquals("jdbc:derby:TestDatabase;create=true", setting.getStringValue());
             } else fail("Unknown connection setting '"+setting.getName()+"'");
@@ -233,12 +245,12 @@
         // Now set them to blank
         nullCount = 0;
         for (int i = 0; i < 6; i++) {
-            if(instance.getConfigPropertySetting()[i].getValue() == null) {
+            if(instance.getConfigPropertySetting()[i].getValue() == null || instance.getConfigPropertySetting()[i].isSetToDefault()) {
                 instance.getConfigPropertySetting()[i].setValue("");
                 ++nullCount;
             }
         }
-        assertEquals(2, nullCount);
+        assertEquals(4, nullCount);
         // Now make sure we write out with 6
         pout = new ByteArrayOutputStream();
         dcbRoot.toXML(pout);
@@ -250,20 +262,282 @@
                 getOutboundResourceadapter().getConnectionDefinitionArray(0).
                 getConnectiondefinitionInstanceArray(0).getConfigPropertySettingArray();
         assertEquals(6, settings.length);
+        seen.clear();
         for (int i = 0; i < settings.length; i++) {
             GerConfigPropertySettingType setting = settings[i];
+            if(seen.contains(setting.getName())) {
+                fail("Duplicate for config property setting '"+setting.getName()+"'");
+            }
+            seen.add(setting.getName());
             if(setting.getName().equals("UserName")) {
                 assertEquals("", setting.getStringValue());
             } else if(setting.getName().equals("Password")) {
                 assertEquals("", setting.getStringValue());
             } else if(setting.getName().equals("CommitBeforeAutocommit")) {
-                assertEquals("false", setting.getStringValue());
+                assertEquals("", setting.getStringValue());
             } else if(setting.getName().equals("Driver")) {
                 assertEquals("org.apache.derby.jdbc.EmbeddedDriver", setting.getStringValue());
             } else if(setting.getName().equals("ExceptionSorterClass")) {
-                assertEquals("org.tranql.connector.AllExceptionsAreFatalSorter", setting.getStringValue());
+                assertEquals("", setting.getStringValue());
             } else if(setting.getName().equals("ConnectionURL")) {
                 assertEquals("jdbc:derby:TestDatabase;create=true", setting.getStringValue());
+            } else fail("Unknown connection setting '"+setting.getName()+"'");
+        }
+    }
+
+    public void testCreateJMSResource() throws Exception {
+        // Create and test the DDBeanRoot
+        URL resource = classLoader.getResource("jms.rar");
+        assertNotNull(resource);
+        ConnectorDeployable deployable = new ConnectorDeployable(resource);
+        assertEquals(ModuleType.RAR, deployable.getType());
+        Set entrySet = new HashSet(Collections.list(deployable.entries()));
+        assertTrue(entrySet.contains("META-INF/ra.xml"));
+        assertTrue(entrySet.contains("activemq-ra-3.2.1.jar"));
+        DDBeanRoot root = deployable.getDDBeanRoot();
+        assertNotNull(root);
+        assertEquals(ModuleType.RAR, root.getType());
+        assertEquals(deployable, root.getDeployableObject());
+        // Create the DConfigBeanRoot
+        Connector15DCBRoot dcbRoot = new Connector15DCBRoot(root);
+        assertNotNull(dcbRoot.getXpaths());
+        assertEquals(1, dcbRoot.getXpaths().length);
+        assertEquals("connector", dcbRoot.getXpaths()[0]);
+        // Try the /connector element
+        ConnectorDCB connector = (ConnectorDCB) dcbRoot.getDConfigBean(root.getChildBean(dcbRoot.getXpaths()[0])[0]);
+        assertNotNull(connector);
+        assertNull(connector.getConfigID());
+        assertNull(connector.getInverseClassLoading());
+        assertNull(connector.getParentID());
+        assertNull(connector.getSuppressDefaultParentID());
+        connector.setConfigID("MyJMS");
+        connector.setParentID("geronimo/activemq/1.0/car");
+        // Try the /connector/dependency element
+        assertNotNull(connector.getDependency());
+        assertEquals(0, connector.getDependency().length);
+        Dependency dep = new Dependency();
+        connector.setDependency(new Dependency[]{dep});
+        assertEquals(1, connector.getDependency().length);
+        dep.setURI("postgresql/postgresql-8.0/313.jdbc3/jar");
+        assertNull(dep.getArtifactId());
+        assertNull(dep.getGroupId());
+        assertNull(dep.getType());
+        assertNull(dep.getVersion());
+        dep.setGroupId("postgresql");
+        dep.setArtifactId("postgresql-8.0");
+        dep.setVersion("313.jdbc3");
+        assertNull(dep.getURI());
+        assertNull(dep.getType());
+        // todo: Try the /connector/import element
+        // todo: Try the /connector/hidden-classes element
+        // todo: Try the /connector/non-overridable-classes element
+        // Try the /connector/resourceadapter element
+        assertNotNull(connector.getResourceAdapter());
+        assertEquals(1, connector.getResourceAdapter().length);
+        ResourceAdapter adapter = connector.getResourceAdapter()[0];
+        assertNotNull(adapter);
+        // Try the /connector/resourceadapter/resourceadapter-instance element
+        assertNull(adapter.getResourceAdapterInstance());
+        adapter.setResourceAdapterInstance(new ResourceAdapterInstance());
+        ResourceAdapterInstance raInstance = adapter.getResourceAdapterInstance();
+        assertNull(raInstance.getResourceAdapterName());
+        assertNotNull(raInstance.getConfigProperties());
+        assertEquals(7, raInstance.getConfigPropertySetting().length);
+        for (int i = 0; i < raInstance.getConfigPropertySetting().length; i++) {
+            ConfigPropertySetting config = raInstance.getConfigPropertySetting()[i];
+            assertTrue(config.isSetToDefault());
+        }
+        int found = 0;
+        for (int i = 0; i < 7; i++) {
+            ConfigPropertySetting setting = raInstance.getConfigPropertySetting(i);
+            if(setting.getName().equals("ServerUrl")) {
+                setting.setValue("tcp://localhost:12345");
+                ++found;
+            } else if(setting.getName().equals("UserName")) {
+                setting.setValue("test-user");
+                ++found;
+            } else if(setting.getName().equals("Password")) {
+                setting.setValue("test-password");
+                ++found;
+            }
+        }
+        assertEquals(found, 3);
+        // Try the /connector/resourceadapter/resourceadapter-instance/workmanager
+        assertNull(raInstance.getWorkManager());
+        GBeanLocator workManager = new GBeanLocator();
+        raInstance.setWorkManager(workManager);
+        workManager.setGBeanLink("DefaultWorkManager");
+        // Try the /connector/resourceadapter/outbound-resourceadapter/connection-definition element
+        assertNotNull(adapter.getConnectionDefinition());
+        assertEquals(0, adapter.getConnectionDefinition().length);
+        ConnectionDefinition definition = new ConnectionDefinition();
+        adapter.setConnectionDefinition(new ConnectionDefinition[]{definition});
+        assertEquals(1, adapter.getConnectionDefinition().length);
+        definition.setConnectionFactoryInterface("javax.jms.ConnectionFactory");
+        // Try the .../connection-definition/connectiondefinition-instance elements
+        assertNotNull(definition.getConnectionInstances());
+        assertEquals(0, definition.getConnectionInstances().length);
+        ConnectionDefinitionInstance instance = new ConnectionDefinitionInstance();
+        definition.setConnectionInstance(new ConnectionDefinitionInstance[]{instance});
+        assertEquals(1, definition.getConnectionInstances().length);
+        assertNotNull(instance.getDDBean());
+        instance.setName("Test JMS Resource");
+        instance.setImplementedInterface(new String[]{"javax.jms.QueueConnectorFactory","javax.jms.TopicConnectionFactory"});
+        // Try the .../connection-definition/connectiondefinition-instance/config-property-setting elements
+        assertNotNull(instance.getConfigPropertySetting());
+        assertEquals(0, instance.getConfigPropertySetting().length);
+        // Try the .../connection-definition/connectionmanager elements
+        ConnectionManager manager = instance.getConnectionManager();
+        assertNotNull(manager);
+        assertFalse(manager.isContainerManagedSecurity());
+        assertFalse(manager.isPoolNone());
+        assertNotNull(manager.getPoolSingle());
+        assertNull(manager.getPoolPartitioned());
+        assertFalse(manager.isTransactionLog());
+        assertFalse(manager.isTransactionNone());
+        assertTrue(manager.isTransactionXA());
+        assertFalse(manager.isTransactionXACachingThread());
+        assertTrue(manager.isTransactionXACachingTransaction());
+        assertFalse(manager.isTransactionLocal());
+        SinglePool pool = manager.getPoolSingle();
+        assertNull(pool.getMinSize());
+        assertNull(pool.getMaxSize());
+        assertNull(pool.getIdleTimeoutMinutes());
+        assertNull(pool.getBlockingTimeoutMillis());
+        assertTrue(pool.isMatchOne());
+        assertFalse(pool.isMatchAll());
+        assertFalse(pool.isSelectOneAssumeMatch());
+        pool.setMinSize(new Integer(2));
+        pool.setMaxSize(new Integer(30));
+        pool.setBlockingTimeoutMillis(new Integer(5000));
+        DDBean[] ddBeans = connector.getDDBean().getChildBean(connector.getXpaths()[0]);
+        assertNotNull(ddBeans);
+        assertEquals(2, ddBeans.length);
+        DConfigBean[] adminDCBs = new DConfigBean[ddBeans.length];
+        for (int i = 0; i < adminDCBs.length; i++) {
+            adminDCBs[i] = connector.getDConfigBean(ddBeans[i]);
+            AdminObjectDCB dcb = (AdminObjectDCB) adminDCBs[i];
+            if(dcb.getAdminObjectClass().indexOf("Queue") > -1) {
+                assertEquals(0, dcb.getAdminObjectInstance().length);
+                AdminObjectInstance one = new AdminObjectInstance();
+                AdminObjectInstance two = new AdminObjectInstance();
+                dcb.setAdminObjectInstance(new AdminObjectInstance[]{one, two});
+                one.setMessageDestinationName("TestQueue1");
+                one.getConfigPropertySetting()[0].setValue("PhysicalName1");
+                two.setMessageDestinationName("TestQueue2");
+                two.getConfigPropertySetting()[0].setValue("PhysicalName2");
+            } else if(dcb.getAdminObjectClass().indexOf("Topic") > -1) {
+                assertEquals(0, dcb.getAdminObjectInstance().length);
+            } else fail("Unknown AdminobjectDCB admin object class '"+dcb.getAdminObjectClass()+"'");
+        }
+
+
+        //todo: Look at the XmlBeans tree and make sure the right stuff is in there
+        //dcbRoot.toXML(System.out);
+    }
+
+    public void testLoadJMSResources() throws Exception {
+        InputStream in = classLoader.getResource("jms-plan.xml").openStream();
+        // Create and test the DDBeanRoot
+        URL resource = classLoader.getResource("jms.rar");
+        assertNotNull(resource);
+        ConnectorDeployable deployable = new ConnectorDeployable(resource);
+        assertEquals(ModuleType.RAR, deployable.getType());
+        Set entrySet = new HashSet(Collections.list(deployable.entries()));
+        assertTrue(entrySet.contains("META-INF/ra.xml"));
+        assertTrue(entrySet.contains("activemq-ra-3.2.1.jar"));
+        DDBeanRoot root = deployable.getDDBeanRoot();
+        assertNotNull(root);
+        assertEquals(ModuleType.RAR, root.getType());
+        assertEquals(deployable, root.getDeployableObject());
+        // Create the DConfigBeanRoot
+        Connector15DCBRoot dcbRoot = new Connector15DCBRoot(root);
+        RARConfiguration configuration = new RARConfiguration(deployable, dcbRoot);
+        configuration.restore(in);
+        // Try the /connector element
+        ConnectorDCB connector = (ConnectorDCB) dcbRoot.getDConfigBean(root.getChildBean(dcbRoot.getXpaths()[0])[0]);
+        assertNotNull(connector);
+        // Try the /connector/resourceadapter element
+        assertNotNull(connector.getResourceAdapter());
+        assertEquals(1, connector.getResourceAdapter().length);
+        ResourceAdapter adapter = connector.getResourceAdapter()[0];
+        assertNotNull(adapter);
+        // Try the /connector/resourceadapter/resourceadapter-instance element
+        ResourceAdapterInstance raInstance = adapter.getResourceAdapterInstance();
+        assertNotNull(raInstance);
+        assertEquals("Test ActiveMQ RA", raInstance.getResourceAdapterName());
+        assertEquals(7, raInstance.getConfigPropertySetting().length);
+        int found = 0;
+        Set seen = new HashSet();
+        for (int i = 0; i < 7; i++) {
+            ConfigPropertySetting setting = raInstance.getConfigPropertySetting(i);
+            if(seen.contains(setting.getName())) {
+                fail("Duplicate for config property setting '"+setting.getName()+"'");
+            }
+            seen.add(setting.getName());
+            if(setting.getName().equals("ServerUrl")) {
+                assertEquals("tcp://localhost:61616", setting.getValue());
+                ++found;
+            } else if(setting.getName().equals("UserName")) {
+                assertEquals("geronimo-user", setting.getValue());
+                ++found;
+            } else if(setting.getName().equals("Password")) {
+                assertEquals("geronimo-pw", setting.getValue());
+                ++found;
+            }
+        }
+        assertEquals(3, found);
+        //todo: check the work manager
+        // Try the /connector/resourceadapter/outbound-resourceadapter/connection-definition element
+        assertNotNull(adapter.getConnectionDefinition());
+        assertEquals(1, adapter.getConnectionDefinition().length);
+        ConnectionDefinition definition = adapter.getConnectionDefinition(0);
+        // Try the .../connection-definition/connectiondefinition-instance elements
+        assertNotNull(definition.getConnectionInstances());
+        assertEquals(1, definition.getConnectionInstances().length);
+        ConnectionDefinitionInstance instance = definition.getConnectionInstances()[0];
+        // Try the .../connection-definition/connectiondefinition-instance/config-property-setting elements
+        assertNotNull(instance.getConfigPropertySetting());
+        assertEquals(0, instance.getConfigPropertySetting().length);
+        // Try the /connector/adminobject element
+        DDBean[] ddBeans = connector.getDDBean().getChildBean(connector.getXpaths()[0]);
+        assertNotNull(ddBeans);
+        assertEquals(2, ddBeans.length);
+        DConfigBean[] adminDCBs = new DConfigBean[ddBeans.length];
+        for (int i = 0; i < adminDCBs.length; i++) {
+            adminDCBs[i] = connector.getDConfigBean(ddBeans[i]);
+            AdminObjectDCB dcb = (AdminObjectDCB) adminDCBs[i];
+            if(dcb.getAdminObjectClass().indexOf("Queue") > -1) {
+                assertEquals(3, dcb.getAdminObjectInstance().length);
+                assertEquals("TestQueue1Name", dcb.getAdminObjectInstance()[0].getMessageDestinationName());
+                assertEquals("TestQueue2Name", dcb.getAdminObjectInstance()[1].getMessageDestinationName());
+                assertEquals("TestQueue3Name", dcb.getAdminObjectInstance()[2].getMessageDestinationName());
+            } else if(dcb.getAdminObjectClass().indexOf("Topic") > -1) {
+                assertEquals(1, dcb.getAdminObjectInstance().length);
+                assertEquals("TestTopic1Name", dcb.getAdminObjectInstance()[0].getMessageDestinationName());
+            } else fail("Unknown AdminobjectDCB admin object class '"+dcb.getAdminObjectClass()+"'");
+        }
+        // Make sure that saving clears out the null/default values
+        ByteArrayOutputStream pout = new ByteArrayOutputStream();
+        dcbRoot.toXML(pout);
+        pout.close();
+        ByteArrayInputStream pin = new ByteArrayInputStream(pout.toByteArray());
+        GerConnectorDocument doc = GerConnectorDocument.Factory.parse(pin);
+        pin.close();
+        GerConfigPropertySettingType[] settings = doc.getConnector().getResourceadapterArray(0).
+                getResourceadapterInstance().getConfigPropertySettingArray();
+        assertEquals(2, settings.length);
+        seen.clear();
+        for (int i = 0; i < settings.length; i++) {
+            GerConfigPropertySettingType setting = settings[i];
+            if(seen.contains(setting.getName())) {
+                fail("Duplicate for config property setting '"+setting.getName()+"'");
+            }
+            seen.add(setting.getName());
+            if(setting.getName().equals("UserName")) {
+                assertEquals("geronimo-user", setting.getStringValue());
+            } else if(setting.getName().equals("Password")) {
+                assertEquals("geronimo-pw", setting.getStringValue());
             } else fail("Unknown connection setting '"+setting.getName()+"'");
         }
     }

Added: geronimo/branches/1.0/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/GBeanLocator.java
URL: http://svn.apache.org/viewcvs/geronimo/branches/1.0/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/GBeanLocator.java?rev=370976&view=auto
==============================================================================
--- geronimo/branches/1.0/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/GBeanLocator.java (added)
+++ geronimo/branches/1.0/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/GBeanLocator.java Fri Jan 20 20:22:22 2006
@@ -0,0 +1,199 @@
+package org.apache.geronimo.naming.deployment.jsr88;
+
+import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.naming.GerGbeanLocatorType;
+import org.apache.xmlbeans.XmlObject;
+
+/**
+ * Represents an element of the gbean-locatorType in a Geronimo
+ * deployment plan.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class GBeanLocator extends XmlBeanSupport {
+    public GBeanLocator() {
+        super(null);
+    }
+
+    public GBeanLocator(GerGbeanLocatorType xmlObject) {
+        super(xmlObject);
+    }
+
+    protected GerGbeanLocatorType getGBeanLocator() {
+        return (GerGbeanLocatorType) getXmlObject();
+    }
+
+    // Must be public but should not be a JavaBean property -- sigh
+    public boolean configured() {
+        return getXmlObject() != null;
+    }
+
+    public void configure(GerGbeanLocatorType xml) {
+        setXmlObject(xml);
+    }
+
+    public String getGBeanLink() {
+        return getGBeanLocator().getGbeanLink();
+    }
+
+    public void setGBeanLink(String link) {
+        GerGbeanLocatorType locator = getGBeanLocator();
+        if(link != null) {
+            ObjectNameGroup before = null;
+            if(locator.isSetApplication()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetApplication();
+            }
+            if(locator.isSetDomain()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetDomain();
+            }
+            if(locator.isSetModule()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetModule();
+            }
+            if(locator.isSetName()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetName();
+            }
+            if(locator.isSetServer()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetServer();
+            }
+            if(locator.isSetType()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetType();
+            }
+            if(before != null) {
+                pcs.firePropertyChange("objectNameComponents", before, null);
+            }
+            if(locator.isSetTargetName()) {
+                String temp = locator.getTargetName();
+                locator.unsetTargetName();
+                pcs.firePropertyChange("targetName", temp, null);
+            }
+        }
+        String old = getGBeanLink();
+        locator.setGbeanLink(link);
+        pcs.firePropertyChange("GBeanLink", old, link);
+    }
+
+    public String getTargetName() {
+        return getGBeanLocator().getGbeanLink();
+    }
+
+    public void setTargetName(String name) {
+        GerGbeanLocatorType locator = getGBeanLocator();
+        if(name != null) {
+            ObjectNameGroup before = null;
+            if(locator.isSetApplication()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetApplication();
+            }
+            if(locator.isSetDomain()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetDomain();
+            }
+            if(locator.isSetModule()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetModule();
+            }
+            if(locator.isSetName()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetName();
+            }
+            if(locator.isSetServer()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetServer();
+            }
+            if(locator.isSetType()) {
+                if(before == null) before = getObjectNameComponents();
+                locator.unsetType();
+            }
+            if(before != null) {
+                pcs.firePropertyChange("objectNameComponents", before, null);
+            }
+            if(locator.isSetGbeanLink()) {
+                String temp = locator.getGbeanLink();
+                locator.unsetGbeanLink();
+                pcs.firePropertyChange("GBeanLink", temp, null);
+            }
+        }
+        String old = getTargetName();
+        locator.setTargetName(name);
+        pcs.firePropertyChange("targetName", old, name);
+    }
+
+    public ObjectNameGroup getObjectNameComponents() {
+        ObjectNameGroup group = new ObjectNameGroup();
+        GerGbeanLocatorType locator = getGBeanLocator();
+        group.setApplication(locator.getApplication());
+        group.setDomain(locator.getDomain());
+        group.setModule(locator.getModule());
+        group.setName(locator.getName());
+        group.setServer(locator.getServer());
+        group.setType(locator.getType());
+        return group.empty() ? null : group;
+    }
+
+    public void setObjectNamecomponents(ObjectNameGroup group) {
+        GerGbeanLocatorType locator = getGBeanLocator();
+        if(group != null && !group.empty()) {
+            if(locator.isSetGbeanLink()) {
+                String temp = locator.getGbeanLink();
+                locator.unsetGbeanLink();
+                pcs.firePropertyChange("GBeanLink", temp, null);
+            }
+            if(locator.isSetTargetName()) {
+                String temp = locator.getTargetName();
+                locator.unsetTargetName();
+                pcs.firePropertyChange("targetName", temp, null);
+            }
+        }
+        ObjectNameGroup old = getObjectNameComponents();
+        if(group == null) {
+            locator.unsetApplication();
+            locator.unsetDomain();
+            locator.unsetModule();
+            locator.unsetName();
+            locator.unsetServer();
+            locator.unsetType();
+        } else {
+            if(isEmpty(group.getApplication())) {
+                locator.unsetApplication();
+            } else {
+                locator.setApplication(group.getApplication());
+            }
+            if(isEmpty(group.getDomain())) {
+                locator.unsetDomain();
+            } else {
+                locator.setDomain(group.getDomain());
+            }
+            if(isEmpty(group.getModule())) {
+                locator.unsetModule();
+            } else {
+                locator.setModule(group.getModule());
+            }
+            if(isEmpty(group.getName())) {
+                locator.unsetName();
+            } else {
+                locator.setName(group.getName());
+            }
+            if(isEmpty(group.getServer())) {
+                locator.unsetServer();
+            } else {
+                locator.setServer(group.getServer());
+            }
+            if(isEmpty(group.getType())) {
+                locator.unsetType();
+            } else {
+                locator.setType(group.getType());
+            }
+        }
+        pcs.firePropertyChange("objectNameComponents", old, getObjectNameComponents());
+    }
+
+    private static boolean isEmpty(String s) {
+        return s == null || s.trim().equals("");
+    }
+}

Propchange: geronimo/branches/1.0/modules/naming-builder/src/java/org/apache/geronimo/naming/deployment/jsr88/GBeanLocator.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message