geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ammul...@apache.org
Subject svn commit: r331093 - in /geronimo/trunk/modules: connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ connector-builder/src/schema/ connector-builder/src/test-resources/ connector-builder/src/test/org/apache/geronimo/connector/de...
Date Sun, 06 Nov 2005 08:07:57 GMT
Author: ammulder
Date: Sun Nov  6 00:07:38 2005
New Revision: 331093

URL: http://svn.apache.org/viewcvs?rev=331093&view=rev
Log:
Start working on proper DConfigBeans for connectors (GERONIMO-1137)
Make the config-property-setting:name attribute required
Add test connector DDBean

Added:
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java   (with props)
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java   (with props)
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java   (with props)
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java   (with props)
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java   (with props)
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Dependency.java   (with props)
    geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapter.java   (with props)
    geronimo/trunk/modules/connector-builder/src/test-resources/
    geronimo/trunk/modules/connector-builder/src/test-resources/database.rar   (with props)
    geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/
    geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java   (with props)
    geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/ConnectorDeployable.java   (with props)
Modified:
    geronimo/trunk/modules/connector-builder/src/schema/geronimo-connector-1.0.xsd
    geronimo/trunk/modules/deploy-config/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanSupport.java
    geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/DeployableFactory.java

Added: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java?rev=331093&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java (added)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConfigPropertySetting.java Sun Nov  6 00:07:38 2005
@@ -0,0 +1,88 @@
+/**
+ *
+ * Copyright 2003-2004 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 javax.enterprise.deploy.model.DDBean;
+import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+/**
+ * Represents /connector/resourceadapter/resourceadapter-instance/config-property-setting
+ * or /connector/resourceadapter/outbound-resourceadapter/connection-definition/connectiondefinition-instance/config-property-setting
+ * or /connector/adminobject/adminobject-instance/config-property-setting in the
+ * Geronimo Connector deployment plan.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ConfigPropertySetting extends XmlBeanSupport {
+    private DDBean configProperty;
+
+    public ConfigPropertySetting() {
+        super(null);
+    }
+
+    public ConfigPropertySetting(DDBean configProperty, GerConfigPropertySettingType property) {
+        super(null);
+        configure(configProperty, property);
+    }
+
+    protected GerConfigPropertySettingType getPropertySetting() {
+        return (GerConfigPropertySettingType) getXmlObject();
+    }
+
+    DDBean getDDBean() {
+        return configProperty;
+    }
+
+    void configure(DDBean configProperty, GerConfigPropertySettingType property) {
+        this.configProperty = configProperty;
+        setXmlObject(property);
+        final String name = configProperty.getText("config-property-name")[0];
+System.out.println("Initializing ConfigPropertySetting to "+name);
+        getPropertySetting().setName(name);
+    }
+
+    // ----------------------- JavaBean Properties for config-property-setting ----------------------
+
+    public String getName() {
+        return getPropertySetting().getName();
+    }
+
+    // Not public -- should always be kept in sync with matching config-property
+    void setName(String name) {
+        String old = getName();
+        getPropertySetting().setName(name);
+        pcs.firePropertyChange("name", old, name);
+    }
+
+    public String getValue() {
+        return getPropertySetting().getStringValue();
+    }
+
+    public void setValue(String value) {
+        String old = getValue();
+        getPropertySetting().setStringValue(value);
+        pcs.firePropertyChange("value", old, value);
+    }
+
+    // ----------------------- End of JavaBean Properties ----------------------
+
+    protected SchemaTypeLoader getSchemaTypeLoader() {
+        return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+    }
+}

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

Added: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java?rev=331093&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java (added)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinition.java Sun Nov  6 00:07:38 2005
@@ -0,0 +1,126 @@
+/**
+ *
+ * Copyright 2003-2004 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 java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import javax.enterprise.deploy.model.DDBean;
+import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConnectionDefinitionType;
+import org.apache.geronimo.xbeans.geronimo.GerConnectiondefinitionInstanceType;
+
+/**
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ConnectionDefinition extends XmlBeanSupport {
+    private DDBean resourceAdapter;
+    private ConnectionDefinitionInstance[] instances = new ConnectionDefinitionInstance[0];
+
+    public ConnectionDefinition() {
+        super(null);
+    }
+
+    public ConnectionDefinition(DDBean resourceAdapter, GerConnectionDefinitionType definition) {
+        super(null);
+        configure(resourceAdapter, definition);
+    }
+
+    protected GerConnectionDefinitionType getConnectionDefinition() {
+        return (GerConnectionDefinitionType) getXmlObject();
+    }
+
+    void configure(DDBean resourceAdapter, GerConnectionDefinitionType definition) {
+        this.resourceAdapter = resourceAdapter;
+        setXmlObject(definition);
+        //todo: initialize connectiondefinition-instance from definition
+    }
+
+    public String getConnectionFactoryInterface() {
+        return getConnectionDefinition().getConnectionfactoryInterface();
+    }
+
+    public void setConnectionFactoryInterface(String iface) {
+        String old = getConnectionFactoryInterface();
+        getConnectionDefinition().setConnectionfactoryInterface(iface);
+        DDBean match = getConnectionDefinitionDDBean();
+        for (int i = 0; i < instances.length; i++) {
+            ConnectionDefinitionInstance instance = instances[i];
+            if(instance.getDDBean() != match) {
+                instance.configure(match, instance.getConnectionInstance());
+            }
+        }
+        pcs.firePropertyChange("connectionFactoryInterface", old, iface);
+    }
+
+    public ConnectionDefinitionInstance[] getConnectionInstances() {
+        return instances;
+    }
+
+    public void setConnectionInstance(ConnectionDefinitionInstance[] instances) {
+        ConnectionDefinitionInstance[] old = this.instances;
+        Set before = new HashSet();
+        for (int i = 0; i < old.length; i++) {
+            before.add(old[i]);
+        }
+        this.instances = instances;
+        // Handle current or new resource adapters
+        for (int i = 0; i < instances.length; i++) {
+            ConnectionDefinitionInstance instance = instances[i];
+            if(instance.getConnectionInstance() == null) {
+                instance.configure(getConnectionDefinitionDDBean(), getConnectionDefinition().addNewConnectiondefinitionInstance());
+            } else {
+                before.remove(instance);
+            }
+        }
+        // Handle removed resource adapters
+        for (Iterator it = before.iterator(); it.hasNext();) {
+            ConnectionDefinitionInstance instance = (ConnectionDefinitionInstance) it.next();
+            GerConnectiondefinitionInstanceType all[] = getConnectionDefinition().getConnectiondefinitionInstanceArray();
+            for (int i = 0; i < all.length; i++) {
+                if(all[i] == instance) {
+                    getConnectionDefinition().removeConnectiondefinitionInstance(i);
+                    break;
+                }
+            }
+        }
+        pcs.firePropertyChange("connectionInstance", old, instances);
+
+    }
+
+    /**
+     * Look up the J2EE connection definition corresponding to this one (based on connectionfactory-interface)
+     */
+    private DDBean getConnectionDefinitionDDBean() {
+        String iface = getConnectionFactoryInterface();
+        if(iface == null || iface.equals("")) {
+            return null;
+        }
+        DDBean list[] = resourceAdapter.getChildBean("outbound-resourceadapter/connection-definition");
+        for (int i = 0; i < list.length; i++) {
+            DDBean bean = list[i];
+            String[] test = bean.getText("connectionfactory-interface");
+            if(test.length > 0) {
+                String myface = test[0];
+                if(myface.equals(iface)) {
+                    return bean;
+                }
+            }
+        }
+        return null;
+    }
+}

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

Added: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java?rev=331093&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java (added)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectionDefinitionInstance.java Sun Nov  6 00:07:38 2005
@@ -0,0 +1,158 @@
+/**
+ *
+ * Copyright 2003-2004 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 java.util.Set;
+import java.util.HashSet;
+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.GerConnectionDefinitionType;
+import org.apache.geronimo.xbeans.geronimo.GerConnectiondefinitionInstanceType;
+import org.apache.geronimo.xbeans.geronimo.GerConfigPropertySettingType;
+
+/**
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+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;
+                                    }
+                                }
+                            }
+                        }
+                    }
+                };
+    private DDBean connectionDefinition;
+    private ConfigPropertySetting[] settings = new ConfigPropertySetting[0];
+
+    public ConnectionDefinitionInstance() {
+        super(null);
+    }
+
+    public ConnectionDefinitionInstance(DDBean connectionDefinition, GerConnectiondefinitionInstanceType instance) {
+        super(null);
+        configure(connectionDefinition, instance);
+    }
+
+    protected GerConnectiondefinitionInstanceType getConnectionInstance() {
+        return (GerConnectiondefinitionInstanceType) getXmlObject();
+    }
+
+    void configure(DDBean connectionDefinition, GerConnectiondefinitionInstanceType definition) {
+        if(this.connectionDefinition != null) {
+            this.connectionDefinition.removeXpathListener("config-property", xpathListener);
+        }
+        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));
+            } 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);
+System.out.println("Creating DDBean "+name+" "+bean.getText("config-property-name")[0]);
+            list.add(new ConfigPropertySetting(bean, getConnectionInstance().addNewConfigPropertySetting()));
+        }
+        settings = (ConfigPropertySetting[]) list.toArray(new ConfigPropertySetting[list.size()]);
+        if(connectionDefinition != null) {
+            connectionDefinition.addXpathListener("config-property", xpathListener);
+        }
+        // todo: Prepare the ConnectionManager
+
+    }
+
+    DDBean getDDBean() {
+        return connectionDefinition;
+    }
+
+    //todo: the following properties
+    // connection-manager
+
+    public String getName() {
+        return getConnectionInstance().getName();
+    }
+
+    public void setName(String name) {
+        String old = getName();
+        getConnectionInstance().setName(name);
+        pcs.firePropertyChange("name", old, name);
+    }
+
+    public String[] getImplementedInterface() {
+        return getConnectionInstance().getImplementedInterfaceArray();
+    }
+
+    public String getImplementedInterface(int index) {
+        return getConnectionInstance().getImplementedInterfaceArray(index);
+    }
+
+    public void setImplementedInterface(String[] list) {
+        String[] old = getImplementedInterface();
+        getConnectionInstance().setImplementedInterfaceArray(list);
+        pcs.firePropertyChange("implementedInterface", old, list);
+    }
+
+    public void setImplementedInterface(int index, String iface) {
+        String[] old = getImplementedInterface();
+        getConnectionInstance().setImplementedInterfaceArray(index, iface);
+        pcs.firePropertyChange("implementedInterface", old, getImplementedInterface());
+    }
+
+    public ConfigPropertySetting[] getConfigPropertySetting() {
+        return settings;
+    }
+
+    public ConfigPropertySetting getConfigPropertySetting(int index) {
+        return settings[index];
+    }
+}

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

Added: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java?rev=331093&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java (added)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBRoot.java Sun Nov  6 00:07:38 2005
@@ -0,0 +1,95 @@
+/**
+ *
+ * Copyright 2003-2004 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 java.io.InputStream;
+import java.io.IOException;
+import javax.enterprise.deploy.model.DDBeanRoot;
+import javax.enterprise.deploy.model.DDBean;
+import javax.enterprise.deploy.spi.DConfigBean;
+import javax.enterprise.deploy.spi.exceptions.ConfigurationException;
+import org.apache.geronimo.deployment.plugin.DConfigBeanRootSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlBeans;
+
+/**
+ * Represents "/" in a Geronimo Connector deployment plan (geronimo-ra.xml).
+ * The only function here is to navigate to an appropriate "Connector"
+ * DConfigBean.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class Connector15DCBRoot extends DConfigBeanRootSupport {
+    // This may be overcomplicated -- if we don't refer to J2EE types in our schemas
+    // then we should only need to use the GerConnectorDocument loader
+    static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderUnion(new SchemaTypeLoader[] {
+        XmlBeans.typeLoaderForClassLoader(org.apache.geronimo.xbeans.j2ee.String.class.getClassLoader()),
+        XmlBeans.typeLoaderForClassLoader(GerConnectorDocument.class.getClassLoader())
+    });
+
+    private ConnectorDCB connector;
+
+    public Connector15DCBRoot(DDBeanRoot ddBean) {
+        super(ddBean, null);
+        setXmlObject(loadDefaultData(ddBean));
+    }
+
+    private XmlObject loadDefaultData(DDBeanRoot root) {
+        InputStream in = root.getDeployableObject().getEntry("META-INF/geronimo-ra.xml");
+        if(in == null) {
+            GerConnectorDocument doc = GerConnectorDocument.Factory.newInstance();
+            DDBean[] list = root.getChildBean("connector");
+            if(list.length > 0) {
+                connector = new ConnectorDCB(list[0], doc.addNewConnector());
+            }
+            return doc;
+        } else {
+            try {
+                GerConnectorDocument result =  GerConnectorDocument.Factory.parse(in);
+                in.close();
+                DDBean[] list = root.getChildBean("connector");
+                if(list.length > 0) {
+                    connector = new ConnectorDCB(list[0], result.getConnector());
+                }
+                return result;
+            } catch (XmlException e) {
+                throw new RuntimeException("Unable to load default Geronimo RA data", e);
+            } catch (IOException e) {
+                throw new RuntimeException("Unable to load default Geronimo RA data", e);
+            }
+        }
+    }
+
+    public String[] getXpaths() {
+        return getXPathsForJ2ee_1_4(new String[][]{{"connector",},});
+    }
+
+    public DConfigBean getDConfigBean(DDBean bean) throws ConfigurationException {
+        if (getXpaths()[0].equals(bean.getXpath())) { // "connector"
+            return connector;
+        } else {
+            throw new ConfigurationException("No DConfigBean matching DDBean "+bean.getXpath());
+        }
+    }
+
+    protected SchemaTypeLoader getSchemaTypeLoader() {
+        return SCHEMA_TYPE_LOADER;
+    }
+}

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

Added: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java?rev=331093&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java (added)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ConnectorDCB.java Sun Nov  6 00:07:38 2005
@@ -0,0 +1,208 @@
+/**
+ *
+ * Copyright 2003-2004 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 java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import javax.enterprise.deploy.model.DDBean;
+import javax.enterprise.deploy.model.XpathListener;
+import javax.enterprise.deploy.model.XpathEvent;
+import org.apache.geronimo.deployment.plugin.DConfigBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerConnectorType;
+import org.apache.geronimo.xbeans.geronimo.GerResourceadapterType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+/**
+ * Represents /connector in a Geronimo Connector deployment plan.
+ * Corresponds to /connector in the J2EE deployment plan.
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ConnectorDCB extends DConfigBeanSupport {
+    private DDBean resourceAdapterDDBean;
+    private ResourceAdapter[] resourceAdapter = new ResourceAdapter[0];
+
+    public ConnectorDCB(DDBean connectorDDBean, final GerConnectorType connector) {
+        super(connectorDDBean, connector);
+        DDBean[] list = connectorDDBean.getChildBean("resourceadapter");
+        if(list.length > 0) {
+            resourceAdapterDDBean = list[0];
+        }
+        //todo: do something if resourceAdapterDDBean is null
+        loadExistingData(connector);
+        //todo: load defaults from J2EE DD /connector/resourceadapter
+
+        // Make sure we're told if /connector/resourceadapter is replaced!
+        connectorDDBean.addXpathListener("resourceadapter", new XpathListener() {
+            public void fireXpathEvent(XpathEvent event) {
+                if(event.isRemoveEvent()) {
+                    resourceAdapterDDBean = null; //todo: all our info was just invalidated
+                } else if(event.isAddEvent()) {
+                    resourceAdapterDDBean = event.getBean(); //todo: reload defaults from DDBean
+                } else {
+                    System.out.println("Detected change to J2EE DD /connector/resourceadapter property "+event.getChangeEvent().getPropertyName());
+                }
+            }
+        });
+    }
+
+    private void loadExistingData(GerConnectorType connector) {
+        //todo: Handle the import children
+        //todo: Handle the hidden-classes children
+        //todo: Handle the non-overridable-classes children
+        //todo: Handle the dependency children
+        // Handle the resource adapter children
+        GerResourceadapterType[] adapters = connector.getResourceadapterArray();
+        if(adapters == null || adapters.length == 0) {
+            // Make sure there's at least one connector/resourceadapter element
+            if(resourceAdapterDDBean != null) {
+                resourceAdapter = new ResourceAdapter[1];
+                resourceAdapter[0] = new ResourceAdapter(resourceAdapterDDBean, connector.addNewResourceadapter());
+            }
+        } else {
+            resourceAdapter = new ResourceAdapter[adapters.length];
+            for (int i = 0; i < adapters.length; i++) {
+                GerResourceadapterType adapter = adapters[i];
+                resourceAdapter[i] = new ResourceAdapter(resourceAdapterDDBean, adapter);
+            }
+        }
+        //todo: Handle the AdminObject children
+        //todo: Handle the GBean children
+    }
+
+    GerConnectorType getConnector() {
+        return (GerConnectorType) getXmlObject();
+    }
+
+
+    // ----------------------- JavaBean Properties for /connector ----------------------
+
+    //todo: the following child elements
+    // import*
+    // hidden-classes*
+    // non-overridable-classes*
+    // dependency*
+    // adminobject*
+    // gbean*
+
+    public String getConfigID() {
+        return getConnector().getConfigId();
+    }
+
+    public void setConfigID(String configId) {
+        String old = getConfigID();
+        getConnector().setConfigId(configId);
+        pcs.firePropertyChange("configID", old, configId);
+    }
+
+    public String getParentID() {
+        return getConnector().getParentId();
+    }
+
+    public void setParentID(String parentId) {
+        String old = getParentID();
+        if(parentId == null) {
+            getConnector().unsetParentId();
+        } else {
+            getConnector().setParentId(parentId);
+        }
+        pcs.firePropertyChange("parentID", old, parentId);
+    }
+
+    public Boolean getSuppressDefaultParentID() {
+        return getConnector().isSetSuppressDefaultParentId() ? getConnector().getSuppressDefaultParentId() ? Boolean.TRUE : Boolean.FALSE : null;
+    }
+
+    public void setSuppressDefaultParentID(Boolean suppress) {
+        Boolean old = getSuppressDefaultParentID();
+        if(suppress == null) {
+            getConnector().unsetSuppressDefaultParentId();
+        } else {
+            getConnector().setSuppressDefaultParentId(suppress.booleanValue());
+        }
+        pcs.firePropertyChange("suppressDefaultParentID", old, suppress);
+    }
+
+    public Boolean getInverseClassLoading() {
+        return getConnector().isSetInverseClassloading() ? getConnector().getInverseClassloading() ? Boolean.TRUE : Boolean.FALSE : null;
+    }
+
+    public void setInverseClassLoading(Boolean inverse) {
+        Boolean old = getInverseClassLoading();
+        if(inverse == null) {
+            getConnector().unsetInverseClassloading();
+        } else {
+            getConnector().setInverseClassloading(inverse.booleanValue());
+        }
+        pcs.firePropertyChange("inverseClassLoading", old, inverse);
+    }
+
+    public ResourceAdapter[] getResourceAdapter() {
+        return resourceAdapter;
+    }
+
+    public void setResourceAdapter(ResourceAdapter[] resourceAdapter) {
+        ResourceAdapter[] old = this.resourceAdapter;
+        Set before = new HashSet();
+        for (int i = 0; i < old.length; i++) {
+            before.add(old[i]);
+        }
+        this.resourceAdapter = resourceAdapter;
+        // Handle current or new resource adapters
+        for (int i = 0; i < resourceAdapter.length; i++) {
+            ResourceAdapter adapter = resourceAdapter[i];
+            if(adapter.getResourceAdapter() == null) {
+                adapter.configure(resourceAdapterDDBean, getConnector().addNewResourceadapter());
+            } else {
+                before.remove(adapter);
+            }
+        }
+        // Handle removed resource adapters
+        for (Iterator it = before.iterator(); it.hasNext();) {
+            ResourceAdapter adapter = (ResourceAdapter) it.next();
+            GerResourceadapterType all[] = getConnector().getResourceadapterArray();
+            for (int i = 0; i < all.length; i++) {
+                if(all[i] == adapter) {
+                    getConnector().removeResourceadapter(i);
+                    break;
+                }
+            }
+        }
+        pcs.firePropertyChange("resourceAdapter", old, resourceAdapter);
+    }
+
+    public ResourceAdapter getResourceAdapter(int index) {
+        return resourceAdapter[index];
+    }
+
+    public void setResourceAdapter(int index, ResourceAdapter ra) {
+        ResourceAdapter[] old = this.resourceAdapter;
+        resourceAdapter[index] = ra;
+        if(ra.getResourceAdapter() == null) {
+            ra.configure(resourceAdapterDDBean, getConnector().addNewResourceadapter());
+        }
+        pcs.firePropertyChange("resourceAdapter", old, resourceAdapter);
+    }
+
+
+    // ----------------------- End of JavaBean Properties ----------------------
+
+    protected SchemaTypeLoader getSchemaTypeLoader() {
+        return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+    }
+}

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

Added: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Dependency.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Dependency.java?rev=331093&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Dependency.java (added)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/Dependency.java Sun Nov  6 00:07:38 2005
@@ -0,0 +1,129 @@
+/**
+ *
+ * Copyright 2003-2004 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.deployment.xbeans.DependencyType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+import org.apache.xmlbeans.XmlBeans;
+
+/**
+ * Represents /connector/dependency in the Geronimo Connector deployment plan
+ *
+ * //todo: move to service-builder module
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class Dependency extends XmlBeanSupport {
+    static final SchemaTypeLoader SCHEMA_TYPE_LOADER = XmlBeans.typeLoaderForClassLoader(DependencyType.class.getClassLoader());
+
+    public Dependency() {
+        super(null);
+    }
+
+    public Dependency(DependencyType dependency) {
+        super(null);
+        configure(dependency);
+    }
+
+    protected DependencyType getDependency() {
+        return (DependencyType) getXmlObject();
+    }
+
+    void configure(DependencyType dependency) {
+        setXmlObject(dependency);
+        //todo: read in data from dependency object?
+    }
+
+    // ----------------------- JavaBean Properties for /connector/dependency ----------------------
+
+    public String getGroupId() {
+        return getDependency().getGroupId();
+    }
+
+    public void setGroupId(String groupId) {
+        String old = getGroupId();
+        if(groupId == null) {
+            getDependency().unsetGroupId();
+        } else {
+            getDependency().setGroupId(groupId);
+        }
+        pcs.firePropertyChange("groupId", old, groupId);
+    }
+
+    public String getArtifactId() {
+        return getDependency().getArtifactId();
+    }
+
+    public void setArtifactId(String artifact) {
+        String old = getArtifactId();
+        if(artifact == null) {
+            getDependency().unsetArtifactId();
+        } else {
+            getDependency().setArtifactId(artifact);
+        }
+        pcs.firePropertyChange("artifactId", old, artifact);
+    }
+
+    public String getType() {
+        return getDependency().getType();
+    }
+
+    public void setType(String type) {
+        String old = type;
+        if(type == null) {
+            getDependency().unsetType();
+        } else {
+            getDependency().setType(type);
+        }
+        pcs.firePropertyChange("type", old, type);
+    }
+
+    public String getVersion() {
+        return getDependency().getVersion();
+    }
+
+    public void setVersion(String version) {
+        String old = getVersion();
+        if(version == null) {
+            getDependency().unsetVersion();
+        } else {
+            getDependency().setVersion(version);
+        }
+        pcs.firePropertyChange("version", old, version);
+    }
+
+    public String getURI() {
+        return getDependency().getUri();
+    }
+
+    public void setURI(String uri) {
+        String old = getURI();
+        if(uri == null) {
+            getDependency().unsetUri();
+        } else {
+            getDependency().setUri(uri);
+        }
+        pcs.firePropertyChange("URI", old, uri);
+    }
+
+    // ----------------------- End of JavaBean Properties ----------------------
+
+    protected SchemaTypeLoader getSchemaTypeLoader() {
+        return SCHEMA_TYPE_LOADER;
+    }
+}

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

Added: geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapter.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapter.java?rev=331093&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapter.java (added)
+++ geronimo/trunk/modules/connector-builder/src/java/org/apache/geronimo/connector/deployment/jsr88/ResourceAdapter.java Sun Nov  6 00:07:38 2005
@@ -0,0 +1,139 @@
+/**
+ *
+ * Copyright 2003-2004 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 java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import javax.enterprise.deploy.model.DDBean;
+import org.apache.geronimo.deployment.plugin.XmlBeanSupport;
+import org.apache.geronimo.xbeans.geronimo.GerResourceadapterType;
+import org.apache.geronimo.xbeans.geronimo.GerOutboundResourceadapterType;
+import org.apache.geronimo.xbeans.geronimo.GerConnectionDefinitionType;
+import org.apache.xmlbeans.SchemaTypeLoader;
+
+/**
+ * Represents /connector/resourceadapter in the Geronimo Connector deployment plan
+ *
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class ResourceAdapter extends XmlBeanSupport {
+    private DDBean resourceAdapter;
+    private ConnectionDefinition[] instances = new ConnectionDefinition[0];
+
+    public ResourceAdapter() {
+        super(null);
+    }
+
+    public ResourceAdapter(DDBean resourceAdapter, GerResourceadapterType ra) {
+        super(null);
+        configure(resourceAdapter, ra);
+    }
+
+    protected GerResourceadapterType getResourceAdapter() {
+        return (GerResourceadapterType)getXmlObject();
+    }
+
+    void configure(DDBean resourceAdapter, GerResourceadapterType ra) {
+        this.resourceAdapter = resourceAdapter;
+        setXmlObject(ra);
+        //todo: configure myself from the ra
+        if(ra.isSetOutboundResourceadapter()) {
+            DDBean[] test = resourceAdapter.getChildBean("outbound-resourceadapter");
+            if(test != null && test.length > 0) {
+                GerOutboundResourceadapterType outbound = ra.getOutboundResourceadapter();
+                GerConnectionDefinitionType[] defs = outbound.getConnectionDefinitionArray();
+                if(defs != null) {
+                    instances = new ConnectionDefinition[defs.length];
+                    for (int i = 0; i < defs.length; i++) {
+                        GerConnectionDefinitionType def = defs[i];
+                        instances[i] = new ConnectionDefinition(resourceAdapter, def);
+                    }
+                }
+            } else {
+                //todo: clean up the Geronimo deployment info since there's no J2EE outbound RA
+            }
+        }
+    }
+
+    // ----------------------- JavaBean Properties for /connector/resourceadapter ----------------------
+    //todo: handle the following properties
+    // resourceadapter-instance?
+
+    public ConnectionDefinition[] getConnectionDefinition() {
+        return instances;
+    }
+
+    public ConnectionDefinition getConnectionDefinition(int index) {
+        return instances[index];
+    }
+
+    public void setConnectionDefinition(ConnectionDefinition[] definitions) {
+        ConnectionDefinition[] old = getConnectionDefinition();
+
+        if(definitions != null && definitions.length > 0) {
+            if(!getResourceAdapter().isSetOutboundResourceadapter()) {
+                getResourceAdapter().addNewOutboundResourceadapter();
+            }
+        } else {
+            if(getResourceAdapter().isSetOutboundResourceadapter()) {
+                getResourceAdapter().unsetOutboundResourceadapter();
+            }
+        }
+        Set before = new HashSet();
+        for (int i = 0; i < old.length; i++) {
+            before.add(old[i]);
+        }
+        instances = definitions;
+        // Handle current or new definitions
+        for (int i = 0; i < definitions.length; i++) {
+            ConnectionDefinition definition = definitions[i];
+            if(definition.getConnectionDefinition() == null) {
+                definition.configure(resourceAdapter, getResourceAdapter().getOutboundResourceadapter().addNewConnectionDefinition());
+            } else {
+                before.remove(definition);
+            }
+        }
+        // Handle removed definitions
+        for (Iterator it = before.iterator(); it.hasNext();) {
+            ConnectionDefinition definition = (ConnectionDefinition) it.next();
+            GerConnectionDefinitionType all[] = getResourceAdapter().isSetOutboundResourceadapter() ? getResourceAdapter().getOutboundResourceadapter().getConnectionDefinitionArray() : new GerConnectionDefinitionType[0];
+            for (int i = 0; i < all.length; i++) {
+                if(all[i] == definition) {
+                    getResourceAdapter().getOutboundResourceadapter().removeConnectionDefinition(i);
+                    break;
+                }
+            }
+        }
+        pcs.firePropertyChange("connectionDefinition", old, instances);
+    }
+
+    public void setConnectionDefinition(int index, ConnectionDefinition definition) {
+        ConnectionDefinition[] old = instances;
+        instances[index] = definition;
+        if(definition.getConnectionDefinition() == null) {
+            definition.configure(resourceAdapter, getResourceAdapter().getOutboundResourceadapter().addNewConnectionDefinition());
+        }
+        pcs.firePropertyChange("resourceAdapter", old, instances);
+    }
+
+    // ----------------------- End of JavaBean Properties ----------------------
+
+    protected SchemaTypeLoader getSchemaTypeLoader() {
+        return Connector15DCBRoot.SCHEMA_TYPE_LOADER;
+    }
+}

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

Modified: geronimo/trunk/modules/connector-builder/src/schema/geronimo-connector-1.0.xsd
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/schema/geronimo-connector-1.0.xsd?rev=331093&r1=331092&r2=331093&view=diff
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/schema/geronimo-connector-1.0.xsd (original)
+++ geronimo/trunk/modules/connector-builder/src/schema/geronimo-connector-1.0.xsd Sun Nov  6 00:07:38 2005
@@ -155,7 +155,7 @@
         </xs:annotation>
         <xs:simpleContent>
             <xs:extension base="xs:string">
-                <xs:attribute name="name" type="xs:string"/>
+                <xs:attribute name="name" type="xs:string" use="required"/>
             </xs:extension>
         </xs:simpleContent>
     </xs:complexType>

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

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

Added: geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java?rev=331093&view=auto
==============================================================================
--- geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java (added)
+++ geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java Sun Nov  6 00:07:38 2005
@@ -0,0 +1,118 @@
+/**
+ *
+ * Copyright 2003-2004 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 java.net.URL;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Collections;
+import javax.enterprise.deploy.shared.ModuleType;
+import javax.enterprise.deploy.model.DDBeanRoot;
+import junit.framework.TestCase;
+import org.apache.geronimo.deployment.tools.loader.ConnectorDeployable;
+
+/**
+ * @version $Rev: 46019 $ $Date: 2004-09-14 05:56:06 -0400 (Tue, 14 Sep 2004) $
+ */
+public class Connector15DCBTest extends TestCase {
+    private ClassLoader classLoader;
+
+    public void testCreateDatabase() throws Exception {
+        // Create and test the DDBeanRoot
+        URL resource = classLoader.getResource("database.rar");
+        assertNotNull(resource);
+        ConnectorDeployable deployable = new ConnectorDeployable(resource);
+        assertEquals(ModuleType.RAR, deployable.getType());
+        Set entrySet = new HashSet(Collections.list(deployable.entries()));
+        Set resultSet = new HashSet();
+        resultSet.add("META-INF/");
+        resultSet.add("META-INF/MANIFEST.MF");
+        resultSet.add("META-INF/LICENSE.txt");
+        resultSet.add("META-INF/ra.xml");
+        resultSet.add("tranql-connector-1.0.jar");
+        assertEquals(resultSet, entrySet);
+        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("MyDatabase");
+        connector.setParentID("org/apache/geronimo/Server");
+        //todo: Try the dependency element
+        // Try the /connector/resourceadapter element
+        assertNotNull(connector.getResourceAdapter());
+        assertEquals(1, connector.getResourceAdapter().length);
+        ResourceAdapter adapter = connector.getResourceAdapter()[0];
+        assertNotNull(adapter);
+        //todo: 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.sql.DataSource");
+        //todo: 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());
+        //todo: Try the .../connection-definition/connectiondefinition-instance/config-property-setting elements
+        assertNotNull(instance.getConfigPropertySetting());
+        assertEquals(6, instance.getConfigPropertySetting().length);
+        int found = 0;
+        for (int i = 0; i < 6; i++) {
+            ConfigPropertySetting setting = instance.getConfigPropertySetting(i);
+            if(setting.getName().equals("Driver")) {
+                assertEquals("", setting.getValue());
+                setting.setValue("org.postgresql.Driver");
+                ++found;
+            } else if(setting.getName().equals("ConnectionURL")) {
+                assertEquals("", setting.getValue());
+                setting.setValue("jdbc:postgresql://localhost/TestDatabase");
+                ++found;
+            } else if(setting.getName().equals("UserName")) {
+                assertEquals("", setting.getValue());
+                setting.setValue("dbuser");
+                ++found;
+            } else if(setting.getName().equals("Password")) {
+                assertEquals("", setting.getValue());
+                setting.setValue("dbpass");
+                ++found;
+            }
+        }
+        assertEquals(4, found);
+        //todo: Try the .../connection-definition/connectionmanager elements
+        //todo: Look at the XmlBeans tree and make sure the right stuff is in there
+    }
+
+    protected void setUp() throws Exception {
+        classLoader = Thread.currentThread().getContextClassLoader();
+    }
+}

Propchange: geronimo/trunk/modules/connector-builder/src/test/org/apache/geronimo/connector/deployment/jsr88/Connector15DCBTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/trunk/modules/deploy-config/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanSupport.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/deploy-config/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanSupport.java?rev=331093&r1=331092&r2=331093&view=diff
==============================================================================
--- geronimo/trunk/modules/deploy-config/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanSupport.java (original)
+++ geronimo/trunk/modules/deploy-config/src/java/org/apache/geronimo/deployment/plugin/DConfigBeanSupport.java Sun Nov  6 00:07:38 2005
@@ -100,6 +100,11 @@
         return getXPathsWithPrefix(null , xpathSegments);
     }
 
+    /**
+     * Each entry in the first array is an XPath.
+     * Each entry in the enclosed array is a component of that XPath (slashes omitted).
+     * so {{"foo","bar"},{"baz","foo"}} would represent "foo/bar" and "baz/foo"
+     */ 
     protected String[] getXPathsForJ2ee_1_4(String[][] xpathSegments) {
         return getXPathsFromNamespace("http://java.sun.com/xml/ns/j2ee", xpathSegments);
     }

Added: geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/ConnectorDeployable.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/ConnectorDeployable.java?rev=331093&view=auto
==============================================================================
--- geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/ConnectorDeployable.java (added)
+++ geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/ConnectorDeployable.java Sun Nov  6 00:07:38 2005
@@ -0,0 +1,53 @@
+/**
+ *
+ * Copyright 2003-2004 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.deployment.tools.loader;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import javax.enterprise.deploy.model.exceptions.DDBeanCreateException;
+import javax.enterprise.deploy.shared.ModuleType;
+
+/**
+ *
+ *
+ * @version $Rev$ $Date$
+ */
+public class ConnectorDeployable extends AbstractDeployable {
+    private final ClassLoader rarLoader;
+
+    public ConnectorDeployable(URL moduleURL) throws DDBeanCreateException {
+        super(ModuleType.RAR, moduleURL, "META-INF/ra.xml");
+        ClassLoader parent = super.getModuleLoader();
+        List path = new ArrayList();
+        Enumeration e = entries();
+        while (e.hasMoreElements()) {
+            String entry = (String) e.nextElement();
+            if (entry.endsWith(".jar")) {
+                path.add(parent.getResource(entry));
+            }
+        }
+        rarLoader = new URLClassLoader((URL[]) path.toArray(new URL[path.size()]), parent);
+    }
+
+    protected ClassLoader getModuleLoader() {
+        return rarLoader;
+    }
+}

Propchange: geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/ConnectorDeployable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/DeployableFactory.java
URL: http://svn.apache.org/viewcvs/geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/DeployableFactory.java?rev=331093&r1=331092&r2=331093&view=diff
==============================================================================
--- geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/DeployableFactory.java (original)
+++ geronimo/trunk/modules/test-ddbean/src/java/org/apache/geronimo/deployment/tools/loader/DeployableFactory.java Sun Nov  6 00:07:38 2005
@@ -39,13 +39,13 @@
             return new ClientDeployable(moduleURL);
         } else if (cl.getResource("WEB-INF/web.xml") != null) {
             // WAR
-            throw new UnsupportedOperationException();
+            return new WebDeployable(moduleURL);
         } else if (cl.getResource("META-INF/ejb-jar.xml") != null) {
             // EJB Jar
             throw new UnsupportedOperationException();
         } else if (cl.getResource("META-INF/ra.xml") != null) {
             // Connector
-            throw new UnsupportedOperationException();
+            return new ConnectorDeployable(moduleURL);
         } else {
             throw new DDBeanCreateException("Unrecognized archive: " + moduleURL);
         }



Mime
View raw message