geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r706357 [2/13] - in /geronimo/server/trunk/plugins/connector-1_6: ./ client-transaction-1_6/ client-transaction-1_6/src/ client-transaction-1_6/src/main/ client-transaction-1_6/src/main/history/ client-transaction-1_6/src/main/plan/ client-...
Date Mon, 20 Oct 2008 18:23:42 GMT
Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/DatabaseInitializationGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/DatabaseInitializationGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/DatabaseInitializationGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/DatabaseInitializationGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,134 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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;
+
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import javax.resource.ResourceException;
+import javax.sql.DataSource;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.naming.ResourceSource;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DatabaseInitializationGBean {
+    private static final Logger log = LoggerFactory.getLogger(DatabaseInitializationGBean.class);
+
+    public DatabaseInitializationGBean(String testSQL, String path, ResourceSource<ResourceException> cfSource, ClassLoader classLoader) throws Exception {
+
+        DataSource ds = (DataSource) cfSource.$getResource();
+        Connection c = ds.getConnection();
+        try {
+            Statement s = c.createStatement();
+            try {
+                boolean pass = true;
+                // SQL statement in testSQL can be used to determine if the sql script in path attribute should be executed.
+                // This attribute can be left blank or skipped altogether.
+                if (testSQL != null && !testSQL.trim().equals("")) {
+                    ResultSet rs = null;
+                    try {
+                        rs = s.executeQuery(testSQL);
+                        // passes sql test when there are one or more elements
+                        pass = !rs.next();
+                    } catch (SQLException e) {
+                        log.info("Exception running test query, executing script: " + e.getMessage());
+                    }
+                    if (rs != null) {
+                        rs.close();
+                    }
+                }
+
+                if (pass) {
+                    //script needs to be run
+                    log.debug("Executing script: " + path);
+                    URL sourceURL = classLoader.getResource(path);
+                    InputStream ins = sourceURL.openStream();
+                    BufferedReader r = new BufferedReader(new InputStreamReader(ins));
+                    try {
+                        String line;
+                        StringBuffer buf = new StringBuffer();
+                        while ((line = r.readLine()) != null) {
+                            line = line.trim();
+                            if (!line.startsWith("--") && line.length() > 0) {
+                                buf.append(line).append(" ");
+                                if (line.endsWith(";")) {
+                                    int size = buf.length();
+                                    buf.delete(size - 2, size - 1);
+                                    String sql = buf.toString();
+                                    s.execute(sql);
+                                    buf = new StringBuffer();
+                                }
+                            }
+                        }
+                    }
+                    catch (Exception ex) {
+                        log.error(ex.getMessage());
+                    }
+                    finally {
+                        r.close();
+                    }
+                } else {
+                    //script need not be run
+                    log.debug("Script did not run");
+                }
+            }
+            catch (SQLException e) {
+                log.error(e.getMessage());
+            }
+            finally {
+                s.close();
+            }
+        }
+        finally {
+            c.close();
+        }
+
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(DatabaseInitializationGBean.class, "GBean");
+        infoBuilder.addAttribute("testSQL", String.class, false);
+        infoBuilder.addAttribute("path", String.class, true);
+        infoBuilder.addReference("DataSource", ResourceSource.class, NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
+        infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
+
+        infoBuilder.setConstructor(new String[]{"testSQL", "path", "DataSource", "classLoader"});
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/DatabaseInitializationGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/DatabaseInitializationGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/DatabaseInitializationGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,50 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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;
+
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.work.WorkManager;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+
+/**
+ * 
+ * @version $Revision$
+ */
+public class GeronimoBootstrapContextGBean {
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(GeronimoBootstrapContextGBean.class, GeronimoBootstrapContext.class, NameFactory.JCA_BOOTSTRAP_CONTEXT);
+
+        infoFactory.addReference("WorkManager", WorkManager.class, NameFactory.JCA_WORK_MANAGER);
+        infoFactory.addReference("XATerminator", XATerminator.class, NameFactory.JCA_XA_TERMINATOR);
+
+        infoFactory.setConstructor(new String[]{"WorkManager", "XATerminator"});
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/GeronimoBootstrapContextGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImpl.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImpl.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImpl.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,151 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.apache.geronimo.j2ee.management.impl.Util;
+import org.apache.geronimo.management.geronimo.JCAAdminObject;
+import org.apache.geronimo.management.geronimo.JCAConnectionFactory;
+import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
+import org.apache.geronimo.management.geronimo.JCAResource;
+import org.apache.geronimo.management.geronimo.JCAResourceAdapter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JCAResourceImpl implements JCAResource  {
+    private final String objectName;
+
+    private final Collection connectionFactories;
+    private final Collection resourceAdapters;
+    private final Collection adminObjects;
+
+    public JCAResourceImpl(String objectName, Collection connectionFactories, Collection resourceAdapters, Collection adminObjects) {
+        this.objectName = objectName;
+        this.connectionFactories = connectionFactories;
+        this.resourceAdapters = resourceAdapters;
+        this.adminObjects = adminObjects;
+    }
+
+    public String[] getConnectionFactories() {
+        return Util.getObjectNames(getConnectionFactoryInstances());
+    }
+
+    public String[] getResourceAdapterInstanceNames() {
+        ArrayList temp = new ArrayList();
+        for (Iterator iterator = resourceAdapters.iterator(); iterator.hasNext();) {
+            JCAResourceAdapter resourceAdapter = (JCAResourceAdapter) iterator.next();
+            temp.add(resourceAdapter.getObjectName());
+        }
+        return (String[])temp.toArray(new String[temp.size()]);
+    }
+
+    public JCAResourceAdapter[] getResourceAdapterInstances() {
+        return (JCAResourceAdapter[])resourceAdapters.toArray(new JCAResourceAdapter[resourceAdapters.size()]);
+    }
+
+    public JCAConnectionFactory[] getConnectionFactoryInstances() {
+        return (JCAConnectionFactory[])connectionFactories.toArray(new JCAConnectionFactory[connectionFactories.size()]);
+    }
+
+    public JCAManagedConnectionFactory[] getOutboundFactories() {
+        return getOutboundFactories((String[]) null);
+    }
+
+    public JCAManagedConnectionFactory[] getOutboundFactories(String connectionFactoryInterface) {
+        return getOutboundFactories(new String[]{connectionFactoryInterface});
+    }
+
+    public JCAManagedConnectionFactory[] getOutboundFactories(String[] connectionFactoryInterfaces) {
+        Set interfaceFilter = null;
+        if (connectionFactoryInterfaces != null) {
+            interfaceFilter = new HashSet(Arrays.asList(connectionFactoryInterfaces));
+        }
+
+        List list = new ArrayList();
+        for (Iterator iterator = connectionFactories.iterator(); iterator.hasNext();) {
+            JCAConnectionFactory jcaConnectionFactory = (JCAConnectionFactory) iterator.next();
+            JCAManagedConnectionFactory mcf = jcaConnectionFactory.getManagedConnectionFactoryInstance();
+            if (interfaceFilter == null || interfaceFilter.contains(mcf.getConnectionFactoryInterface())) {
+                list.add(mcf);
+                continue;
+            }
+            for (int m = 0; m < mcf.getImplementedInterfaces().length; m++) {
+                String iface = mcf.getImplementedInterfaces()[m];
+                if (interfaceFilter == null || interfaceFilter.contains(iface)) {
+                    list.add(mcf);
+                    break;
+                }
+            }
+        }
+        return (JCAManagedConnectionFactory[]) list.toArray(new JCAManagedConnectionFactory[list.size()]);
+    }
+
+    public String[] getAdminObjects() {
+        return Util.getObjectNames(getAdminObjectInstances());
+    }
+
+    public JCAAdminObject[] getAdminObjectInstances() {
+        return (JCAAdminObject[]) adminObjects.toArray(new JCAAdminObject[adminObjects.size()]);
+    }
+
+    public JCAAdminObject[] getAdminObjectInstances(String adminObjectInterface) {
+        return getAdminObjectInstances(new String[] {adminObjectInterface});
+    }
+
+    public JCAAdminObject[] getAdminObjectInstances(String[] adminObjectInterfaces) {
+        Set interfaceFilter = null;
+        if (adminObjectInterfaces != null) {
+            interfaceFilter = new HashSet(Arrays.asList(adminObjectInterfaces));
+        }
+
+        List list = new ArrayList();
+
+        for (Iterator iterator = adminObjects.iterator(); iterator.hasNext();) {
+            JCAAdminObject adminObject = (JCAAdminObject) iterator.next();
+            if (interfaceFilter == null || interfaceFilter.contains(adminObject.getAdminObjectInterface())) {
+                list.add(adminObject);
+            }
+        }
+
+        return (JCAAdminObject[]) list.toArray(new JCAAdminObject[list.size()]);
+    }
+
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isStateManageable() {
+        return false;
+    }
+
+    public boolean isStatisticsProvider() {
+        return false;
+    }
+
+    public boolean isEventProvider() {
+        return false;
+    }
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImplGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImplGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImplGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImplGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,54 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.management.geronimo.JCAAdminObject;
+import org.apache.geronimo.management.geronimo.JCAConnectionFactory;
+import org.apache.geronimo.management.geronimo.JCAResource;
+import org.apache.geronimo.management.geronimo.JCAResourceAdapter;
+
+public class JCAResourceImplGBean {
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(JCAResourceImplGBean.class, JCAResourceImpl.class, NameFactory.JCA_RESOURCE);
+        infoBuilder.addAttribute("objectName", String.class, false);
+        infoBuilder.addReference("ConnectionFactories", JCAConnectionFactory.class, NameFactory.JCA_CONNECTION_FACTORY);
+        infoBuilder.addReference("ResourceAdapters", JCAResourceAdapter.class, NameFactory.JCA_RESOURCE_ADAPTER);
+        infoBuilder.addReference("AdminObjects", JCAAdminObject.class, NameFactory.JCA_ADMIN_OBJECT);
+        infoBuilder.addInterface(JCAResource.class);
+
+        infoBuilder.setConstructor(new String[]{
+            "objectName",
+            "ConnectionFactories",
+            "ResourceAdapters",
+            "AdminObjects"
+        });
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImplGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImplGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/JCAResourceImplGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImpl.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImpl.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImpl.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,57 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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;
+
+import org.apache.geronimo.management.geronimo.JCAResource;
+import org.apache.geronimo.management.geronimo.ResourceAdapter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceAdapterImpl implements ResourceAdapter {
+    private final String objectName;
+    private final JCAResource jcaResource;
+
+    public ResourceAdapterImpl(String objectName, JCAResource jcaResource) {
+        this.objectName = objectName;
+        this.jcaResource = jcaResource;
+    }
+
+    public String[] getJCAResources() {
+        return new String[] {jcaResource.getObjectName()};
+    }
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isStateManageable() {
+        return false;
+    }
+
+    public boolean isStatisticsProvider() {
+        return false;
+    }
+
+    public boolean isEventProvider() {
+        return false;
+    }
+
+    public JCAResource[] getJCAResourceImplementations() {
+        return new JCAResource[] {jcaResource};
+    }
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImplGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImplGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImplGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImplGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,49 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.management.geronimo.JCAResource;
+import org.apache.geronimo.management.geronimo.ResourceAdapter;
+
+public class ResourceAdapterImplGBean {
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(ResourceAdapterImplGBean.class, ResourceAdapterImpl.class, NameFactory.RESOURCE_ADAPTER);
+        infoBuilder.addAttribute("objectName", String.class, false);
+        infoBuilder.addReference("JCAResource", JCAResource.class, NameFactory.JCA_RESOURCE);
+        infoBuilder.addAttribute("JCAResources", String[].class, false);
+        infoBuilder.addInterface(ResourceAdapter.class);
+
+        infoBuilder.setConstructor(new String[]{
+            "objectName",
+            "JCAResource"
+        });
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImplGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImplGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterImplGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,192 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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;
+
+import java.util.Hashtable;
+import java.util.Map;
+
+import javax.management.ObjectName;
+
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.j2ee.management.impl.InvalidObjectNameException;
+import org.apache.geronimo.kernel.ObjectNameUtil;
+import org.apache.geronimo.management.J2EEApplication;
+import org.apache.geronimo.management.J2EEServer;
+import org.apache.geronimo.management.geronimo.ResourceAdapter;
+import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ResourceAdapterModuleImpl implements ResourceAdapterModule {
+    private final J2EEServer server;
+    private final J2EEApplication application;
+    private final String deploymentDescriptor;
+    private final ResourceAdapter resourceAdapter;
+
+    private final GBeanData resourceAdapterGBeanData;
+    private final Map activationSpecInfoMap;
+    private final Map adminObjectInfoMap;
+    private final Map managedConnectionFactoryInfoMap;
+    private final String objectName;
+    private final String displayName;
+    private final String description;
+    private final String vendorName;
+    private final String resourceAdapterVersion;
+    private final String eisType;
+
+    public ResourceAdapterModuleImpl(String objectName,
+                                     ResourceAdapter resourceAdapter,
+                                     J2EEServer server,
+                                     J2EEApplication application,
+                                     String deploymentDescriptor,
+                                     GBeanData resourceAdapterGBeanData,
+                                     Map activationSpecInfoMap,
+                                     Map adminObjectInfoMap,
+                                     Map managedConnectionFactoryInfoMap,
+                                     String displayName,
+                                     String description,
+                                     String vendorName,
+                                     String resourceAdapterVersion,
+                                     String eisType) {
+        this.objectName = objectName;
+        ObjectName myObjectName = ObjectNameUtil.getObjectName(objectName);
+        verifyObjectName(myObjectName);
+
+        this.resourceAdapter = resourceAdapter;
+
+        this.server = server;
+        this.application = application;
+        this.deploymentDescriptor = deploymentDescriptor;
+
+        this.resourceAdapterGBeanData = resourceAdapterGBeanData;
+        this.activationSpecInfoMap = activationSpecInfoMap;
+        this.adminObjectInfoMap = adminObjectInfoMap;
+        this.managedConnectionFactoryInfoMap = managedConnectionFactoryInfoMap;
+        this.description = description;
+        this.displayName = displayName;
+        this.vendorName = vendorName;
+        this.resourceAdapterVersion = resourceAdapterVersion;
+        this.eisType = eisType;
+    }
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isStateManageable() {
+        return true;
+    }
+
+    public boolean isStatisticsProvider() {
+        return false;
+    }
+
+    public boolean isEventProvider() {
+        return true;
+    }
+
+    public String getDeploymentDescriptor() {
+        return deploymentDescriptor;
+    }
+
+    public String getServer() {
+        return server.getObjectName();
+    }
+
+    public String getApplication() {
+        if (application == null) {
+            return null;
+        }
+        return application.getObjectName();
+    }
+
+    public String[] getJavaVMs() {
+        return server.getJavaVMs();
+    }
+
+    public String[] getResourceAdapters() {
+        return new String[]{resourceAdapter.getObjectName()};
+    }
+
+    public GBeanData getResourceAdapterGBeanData() {
+        return resourceAdapterGBeanData;
+    }
+
+    public Map getActivationSpecInfoMap() {
+        return activationSpecInfoMap;
+    }
+
+    public Map getAdminObjectInfoMap() {
+        return adminObjectInfoMap;
+    }
+
+    public Map getManagedConnectionFactoryInfoMap() {
+        return managedConnectionFactoryInfoMap;
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public String getVendorName() {
+        return vendorName;
+    }
+
+    public String getResourceAdapterVersion() {
+        return resourceAdapterVersion;
+    }
+
+    public String getEISType() {
+        return eisType;
+    }
+
+    public ResourceAdapter[] getResourceAdapterInstances() {
+        return new ResourceAdapter[] {resourceAdapter};
+    }
+
+    /**
+     * ObjectName must match this pattern:
+     * <p/>
+     * domain:j2eeType=ResourceAdapterModule,name=MyName,J2EEServer=MyServer,J2EEApplication=MyApplication
+     */
+    private void verifyObjectName(ObjectName objectName) {
+        if (objectName.isPattern()) {
+            throw new InvalidObjectNameException("ObjectName can not be a pattern", objectName);
+        }
+        Hashtable keyPropertyList = objectName.getKeyPropertyList();
+        if (!"ResourceAdapterModule".equals(keyPropertyList.get("j2eeType"))) {
+            throw new InvalidObjectNameException("ResourceAdapterModule object name j2eeType property must be 'ResourceAdapterModule'", objectName);
+        }
+        if (!keyPropertyList.containsKey("name")) {
+            throw new InvalidObjectNameException("ResourceAdapterModule object must contain a name property", objectName);
+        }
+        if (!keyPropertyList.containsKey("J2EEServer")) {
+            throw new InvalidObjectNameException("ResourceAdapterModule object name must contain a J2EEServer property", objectName);
+        }
+        if (!keyPropertyList.containsKey("J2EEApplication")) {
+            throw new InvalidObjectNameException("ResourceAdapterModule object name must contain a J2EEApplication property", objectName);
+        }
+        if (keyPropertyList.size() != 4) {
+            throw new InvalidObjectNameException("ResourceAdapterModule object name can only have j2eeType, name, J2EEApplication, and J2EEServer properties", objectName);
+        }
+    }
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImplGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImplGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImplGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImplGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,90 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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;
+
+import java.util.Map;
+
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.management.J2EEApplication;
+import org.apache.geronimo.management.J2EEServer;
+import org.apache.geronimo.management.geronimo.ResourceAdapter;
+import org.apache.geronimo.management.geronimo.ResourceAdapterModule;
+
+/**
+ * @version $Revision$
+ */
+public class ResourceAdapterModuleImplGBean {
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(ResourceAdapterModuleImplGBean.class, ResourceAdapterModuleImpl.class, NameFactory.RESOURCE_ADAPTER_MODULE);
+        infoBuilder.addReference("J2EEServer", J2EEServer.class, null);
+        infoBuilder.addReference("J2EEApplication", J2EEApplication.class, null);
+
+        infoBuilder.addAttribute("deploymentDescriptor", String.class, true);
+
+        infoBuilder.addReference("ResourceAdapter", ResourceAdapter.class, NameFactory.RESOURCE_ADAPTER);
+        infoBuilder.addAttribute("objectName", String.class, false);
+        infoBuilder.addAttribute("server", String.class, false);
+        infoBuilder.addAttribute("application", String.class, false);
+        infoBuilder.addAttribute("javaVMs", String[].class, false);
+        infoBuilder.addAttribute("resourceAdapters", String[].class, false);
+
+        infoBuilder.addAttribute("resourceAdapterGBeanData", GBeanData.class, true);
+        infoBuilder.addAttribute("activationSpecInfoMap", Map.class, true);
+        infoBuilder.addAttribute("adminObjectInfoMap", Map.class, true);
+        infoBuilder.addAttribute("managedConnectionFactoryInfoMap", Map.class, true);
+
+        infoBuilder.addAttribute("displayName", String.class, true, false);
+        infoBuilder.addAttribute("description", String.class, true, false);
+        infoBuilder.addAttribute("vendorName", String.class, true, false);
+        infoBuilder.addAttribute("EISType", String.class, true, false);
+        infoBuilder.addAttribute("resourceAdapterVersion", String.class, true, false);
+
+
+        infoBuilder.addInterface(ResourceAdapterModule.class);
+
+        infoBuilder.setConstructor(new String[]{
+                "objectName",
+                "ResourceAdapter",
+                "J2EEServer",
+                "J2EEApplication",
+                "deploymentDescriptor",
+                "resourceAdapterGBeanData",
+                "activationSpecInfoMap",
+                "adminObjectInfoMap",
+                "managedConnectionFactoryInfoMap",
+                "displayName",
+                "description",
+                "vendorName",
+                "resourceAdapterVersion",
+                "EISType"
+        });
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImplGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImplGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterModuleImplGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,113 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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;
+
+import java.util.Map;
+
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterAssociation;
+import javax.resource.spi.XATerminator;
+import javax.resource.spi.work.WorkManager;
+
+import org.apache.geronimo.gbean.DynamicGBean;
+import org.apache.geronimo.gbean.DynamicGBeanDelegate;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.management.geronimo.JCAResourceAdapter;
+import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
+
+/**
+ * 
+ * @version $Revision$
+ */
+public class ResourceAdapterWrapperGBean extends ResourceAdapterWrapper implements GBeanLifecycle, DynamicGBean, JCAResourceAdapter {
+
+    private final DynamicGBeanDelegate delegate;
+    private final String objectName;
+
+    public ResourceAdapterWrapperGBean() {
+        delegate=null;
+        objectName = null;
+    }
+
+    public ResourceAdapterWrapperGBean(String resourceAdapterClass, Map<String, String> messageListenerToActivationSpecMap, WorkManager workManager, XATerminator xaTerminator, RecoverableTransactionManager transactionManager, ClassLoader cl, String objectName) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+        super(objectName, resourceAdapterClass, messageListenerToActivationSpecMap, new GeronimoBootstrapContext (workManager, xaTerminator), transactionManager, cl);
+        delegate = new DynamicGBeanDelegate();
+        delegate.addAll(resourceAdapter);
+        this.objectName = objectName;
+    }
+
+    public Object getAttribute(String name) throws Exception {
+        return delegate.getAttribute(name);
+    }
+
+    public void setAttribute(String name, Object value) throws Exception {
+        delegate.setAttribute(name, value);
+    }
+
+    public Object invoke(String name, Object[] arguments, String[] types) throws Exception {
+        //we have no dynamic operations
+        return null;
+    }
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isStateManageable() {
+        return false;
+    }
+
+    public boolean isStatisticsProvider() {
+        return false;                 
+    }
+
+    public boolean isEventProvider() {
+        return false;
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(ResourceAdapterWrapperGBean.class, NameFactory.JCA_RESOURCE_ADAPTER);
+        infoBuilder.addAttribute("resourceAdapterClass", String.class, true);
+        infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
+        infoBuilder.addAttribute("objectName", String.class, false);
+        infoBuilder.addAttribute("messageListenerToActivationSpecMap", Map.class, true);
+
+        infoBuilder.addReference("WorkManager", WorkManager.class, NameFactory.JCA_WORK_MANAGER);
+        infoBuilder.addReference("XATerminator", XATerminator.class, NameFactory.JCA_WORK_MANAGER);
+        infoBuilder.addReference("TransactionManager", RecoverableTransactionManager.class, NameFactory.JTA_RESOURCE);
+
+        infoBuilder.addOperation("registerResourceAdapterAssociation", new Class[]{ResourceAdapterAssociation.class});
+
+        infoBuilder.addInterface(ResourceAdapter.class);
+        infoBuilder.addInterface(JCAResourceAdapter.class);
+
+        infoBuilder.setConstructor(new String[]{"resourceAdapterClass", "messageListenerToActivationSpecMap", "WorkManager", "XATerminator", "TransactionManager", "classLoader", "objectName"});
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/ResourceAdapterWrapperGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManagerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManagerGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManagerGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManagerGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,49 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.outbound;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+
+/**
+ *
+ * @version $Revision$
+ */
+public class AbstractConnectionManagerGBean {
+
+    protected static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(AbstractConnectionManagerGBean.class, AbstractConnectionManager.class, NameFactory.JCA_CONNECTION_MANAGER);
+
+        infoBuilder.addInterface(ConnectionManagerContainer.class);
+
+        infoBuilder.addInterface(PoolingAttributes.class,
+                new String[]{"partitionMaxSize",
+                             "partitionMinSize",
+                             "blockingTimeoutMilliseconds",
+                             "idleTimeoutMinutes"},
+                new String[]{"partitionMaxSize",
+                             "partitionMinSize",
+                             "blockingTimeoutMilliseconds",
+                             "idleTimeoutMinutes"});
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManagerGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManagerGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/AbstractConnectionManagerGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,163 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.outbound;
+
+import java.io.Externalizable;
+import java.io.IOException;
+import java.io.InvalidObjectException;
+import java.io.ObjectInput;
+import java.io.ObjectOutput;
+import java.io.ObjectStreamException;
+import java.io.Serializable;
+
+import javax.resource.spi.ConnectionManager;
+import javax.security.auth.Subject;
+
+import org.apache.geronimo.connector.outbound.connectionmanagerconfig.PoolingSupport;
+import org.apache.geronimo.connector.outbound.connectionmanagerconfig.TransactionSupport;
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTracker;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.GBeanNotFoundException;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+import org.apache.geronimo.kernel.proxy.ProxyManager;
+import org.apache.geronimo.security.ContextManager;
+import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
+
+/**
+ * @version $Revision$
+ */
+public class GenericConnectionManagerGBean extends GenericConnectionManager implements GBeanLifecycle, Serializable, Externalizable {
+    private Kernel kernel;
+    private AbstractName abstractName;
+    //externalizable format version
+    private static final int VERSION = 1;
+
+    public GenericConnectionManagerGBean() {
+        super();
+        kernel = null;
+        abstractName = null;
+    }
+
+    public GenericConnectionManagerGBean(TransactionSupport transactionSupport,
+                                         PoolingSupport pooling,
+                                         boolean containerManagedSecurity,
+                                         ConnectionTracker connectionTracker,
+                                         RecoverableTransactionManager transactionManager,
+                                         String objectName,
+                                         AbstractName abstractName,
+                                         ClassLoader classLoader,
+                                         Kernel kernel) {
+        super(transactionSupport, pooling, getSubjectSource(containerManagedSecurity), connectionTracker, transactionManager, objectName, classLoader);
+        this.kernel = kernel;
+        this.abstractName = abstractName;
+    }
+
+    public ConnectionManager getConnectionManager() {
+        ConnectionManager unproxied = super.getConnectionManager();
+        ProxyManager pm = kernel.getProxyManager();
+        if (pm.isProxy(unproxied)) {
+            return unproxied;
+        } else {
+            return (ConnectionManager) pm.createProxy(kernel.getAbstractNameFor(unproxied), unproxied.getClass().getClassLoader());
+        }
+    }
+
+    private static SubjectSource getSubjectSource(boolean containerManagedSecurity) {
+        if (containerManagedSecurity) {
+            return new SubjectSource() {
+                public Subject getSubject() {
+                    return ContextManager.getNextCaller();
+                }
+            };
+        } else {
+            return null;
+        }
+    }
+
+    private Object readResolve() throws ObjectStreamException {
+        try {
+            return kernel.getGBean(abstractName);
+        } catch (GBeanNotFoundException e) {
+            throw (ObjectStreamException) new InvalidObjectException("Could not locate connection manager gbean").initCause(e);
+        }
+    }
+
+    public void writeExternal(ObjectOutput out) throws IOException {
+        out.writeInt(VERSION);
+        out.writeObject(kernel.getKernelName());
+        out.writeObject(abstractName);
+    }
+
+    public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException {
+        int version = in.readInt();
+        if (version != VERSION) {
+            throw new IOException("Wrong version, expected " + VERSION + ", got: " + version);
+        }
+        String kernelName = (String) in.readObject();
+        kernel = KernelRegistry.getKernel(kernelName);
+        if (kernel == null) {
+            kernel = KernelRegistry.getSingleKernel();
+        }
+        if (kernel == null) {
+            throw new IOException("No kernel named: '" + kernelName + "' found");
+        }
+        abstractName = (AbstractName) in.readObject();
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(GenericConnectionManagerGBean.class, AbstractConnectionManagerGBean.GBEAN_INFO);
+
+        infoBuilder.addAttribute("transactionSupport", TransactionSupport.class, true);
+        infoBuilder.addAttribute("pooling", PoolingSupport.class, true);
+        infoBuilder.addAttribute("containerManagedSecurity", Boolean.TYPE, true);
+
+        infoBuilder.addAttribute("objectName", String.class, false);
+        infoBuilder.addAttribute("abstractName", AbstractName.class, false);
+        infoBuilder.addAttribute("classLoader", ClassLoader.class, false);
+        infoBuilder.addAttribute("kernel", Kernel.class, false);
+
+        infoBuilder.addReference("ConnectionTracker", ConnectionTracker.class, NameFactory.JCA_CONNECTION_TRACKER);
+        infoBuilder.addReference("TransactionManager", RecoverableTransactionManager.class, NameFactory.JTA_RESOURCE);
+
+
+        infoBuilder.setConstructor(new String[]{
+                "transactionSupport",
+                "pooling",
+                "containerManagedSecurity",
+                "ConnectionTracker",
+                "TransactionManager",
+                "objectName",
+                "abstractName",
+                "classLoader",
+                "kernel"
+        });
+
+        GBEAN_INFO = infoBuilder.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,94 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.outbound;
+
+import java.util.Hashtable;
+
+import javax.management.ObjectName;
+
+import org.apache.geronimo.j2ee.management.impl.InvalidObjectNameException;
+import org.apache.geronimo.kernel.ObjectNameUtil;
+import org.apache.geronimo.management.geronimo.JCAConnectionFactory;
+import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class JCAConnectionFactoryImpl implements JCAConnectionFactory  {
+    private final String objectName;
+    private final JCAManagedConnectionFactory managedConnectionFactory;
+
+    public JCAConnectionFactoryImpl(String objectName, JCAManagedConnectionFactory managedConnectionFactory) {
+        // todo do we really need to do this at runtime - shouldn't the builder set this up correctly?
+        ObjectName myObjectName = ObjectNameUtil.getObjectName(objectName);
+        verifyObjectName(myObjectName);
+
+        this.objectName = objectName;
+        this.managedConnectionFactory = managedConnectionFactory;
+    }
+
+    public String getManagedConnectionFactory() {
+        return managedConnectionFactory.getObjectName();
+    }
+
+    public JCAManagedConnectionFactory getManagedConnectionFactoryInstance() {
+        return managedConnectionFactory;
+    }
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isStateManageable() {
+        return false;
+    }
+
+    public boolean isStatisticsProvider() {
+        return false;
+    }
+
+    public boolean isEventProvider() {
+        return false;
+    }
+
+    /**
+     * ObjectName must match this pattern:
+     * <p/>
+     * domain:j2eeType=JCAConnectionFactory,name=MyName,J2EEServer=MyServer,JCAResource=MyJCAResource
+     */
+    private void verifyObjectName(ObjectName objectName) {
+        if (objectName.isPattern()) {
+            throw new InvalidObjectNameException("ObjectName can not be a pattern", objectName);
+        }
+        Hashtable keyPropertyList = objectName.getKeyPropertyList();
+        if (!"JCAConnectionFactory".equals(keyPropertyList.get("j2eeType"))) {
+            throw new InvalidObjectNameException("JCAConnectionFactory object name j2eeType property must be 'JCAConnectionFactory'", objectName);
+        }
+        if (!keyPropertyList.containsKey("name")) {
+            throw new InvalidObjectNameException("JCAConnectionFactory object must contain a name property", objectName);
+        }
+        if (!keyPropertyList.containsKey("J2EEServer")) {
+            throw new InvalidObjectNameException("JCAConnectionFactory object name must contain a J2EEServer property", objectName);
+        }
+        if (!keyPropertyList.containsKey("JCAResource")) {
+            throw new InvalidObjectNameException("JCAResource object name must contain a JCAResource property", objectName);
+        }
+//        if (keyPropertyList.size() != 4) {
+//            throw new InvalidObjectNameException("JCAConnectionFactory object name can only have j2eeType, name, JCAResource, and J2EEServer properties", objectName);
+//        }
+    }
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImpl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImplGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImplGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImplGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImplGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,49 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.outbound;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.management.geronimo.JCAConnectionFactory;
+import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
+
+/**
+ * 
+ * @version $Revision$
+ */
+public class JCAConnectionFactoryImplGBean {
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(JCAConnectionFactoryImplGBean.class, JCAConnectionFactoryImpl.class, NameFactory.JCA_CONNECTION_FACTORY);
+
+        infoFactory.addAttribute("objectName", String.class, false);
+        infoFactory.addReference("JCAManagedConnectionFactory", JCAManagedConnectionFactory.class, NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
+        infoFactory.addInterface(JCAConnectionFactory.class);
+
+        infoFactory.setConstructor(new String[]{"objectName", "JCAManagedConnectionFactory"});
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImplGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImplGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/JCAConnectionFactoryImplGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,287 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.outbound;
+
+import java.lang.reflect.Constructor;
+import java.util.HashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+
+import javax.resource.ResourceException;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapterAssociation;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.apache.geronimo.connector.ResourceAdapterWrapper;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.DynamicGBean;
+import org.apache.geronimo.gbean.DynamicGBeanDelegate;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.naming.ResourceSource;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ManagedConnectionFactoryWrapper implements GBeanLifecycle, DynamicGBean, JCAManagedConnectionFactory, ResourceSource<ResourceException> {
+
+    private static final Logger log = LoggerFactory.getLogger(ManagedConnectionFactoryWrapper.class);
+
+    private final String managedConnectionFactoryClass;
+    private final String connectionFactoryInterface;
+    private final String[] implementedInterfaces;
+    private final String connectionFactoryImplClass;
+    private final String connectionInterface;
+    private final String connectionImplClass;
+
+    private final LinkedHashSet<Class> allImplementedInterfaces = new LinkedHashSet<Class>();
+
+    private final ResourceAdapterWrapper resourceAdapterWrapper;
+    private final ConnectionManagerContainer connectionManagerContainer;
+
+    private ManagedConnectionFactory managedConnectionFactory;
+
+    private DynamicGBeanDelegate delegate;
+
+
+    private final Kernel kernel;
+    private final AbstractName abstractName;
+    private final String objectName;
+    private final ClassLoader classLoader;
+
+    //default constructor for enhancement proxy endpoint
+    public ManagedConnectionFactoryWrapper() {
+        managedConnectionFactoryClass = null;
+        connectionFactoryInterface = null;
+        implementedInterfaces = null;
+        connectionFactoryImplClass = null;
+        connectionInterface = null;
+        connectionImplClass = null;
+        kernel = null;
+        abstractName = null;
+        objectName = null;
+        classLoader = null;
+        resourceAdapterWrapper = null;
+        connectionManagerContainer = null;
+    }
+
+    public ManagedConnectionFactoryWrapper(String managedConnectionFactoryClass,
+                                           String connectionFactoryInterface,
+                                           String[] implementedInterfaces,
+                                           String connectionFactoryImplClass,
+                                           String connectionInterface,
+                                           String connectionImplClass,
+                                           ResourceAdapterWrapper resourceAdapterWrapper,
+                                           ConnectionManagerContainer connectionManagerContainer,
+                                           Kernel kernel,
+                                           AbstractName abstractName,
+                                           String objectName,
+                                           ClassLoader cl) throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+        this.managedConnectionFactoryClass = managedConnectionFactoryClass;
+        this.connectionFactoryInterface = connectionFactoryInterface;
+        this.implementedInterfaces = implementedInterfaces;
+        this.connectionFactoryImplClass = connectionFactoryImplClass;
+        this.connectionInterface = connectionInterface;
+        this.connectionImplClass = connectionImplClass;
+
+        allImplementedInterfaces.add(cl.loadClass(connectionFactoryInterface));
+        for (String interfaceName: implementedInterfaces) {
+            allImplementedInterfaces.add(cl.loadClass(interfaceName));
+        }
+
+        this.resourceAdapterWrapper = resourceAdapterWrapper;
+        this.connectionManagerContainer = connectionManagerContainer;
+
+        //set up that must be done before start
+        classLoader = cl;
+        Class clazz = cl.loadClass(managedConnectionFactoryClass);
+        managedConnectionFactory = (ManagedConnectionFactory) clazz.newInstance();
+        delegate = new DynamicGBeanDelegate();
+        delegate.addAll(managedConnectionFactory);
+        this.kernel = kernel;
+        this.abstractName = abstractName;
+        this.objectName = objectName;
+    }
+
+    public String getManagedConnectionFactoryClass() {
+        return managedConnectionFactoryClass;
+    }
+
+    public String getConnectionFactoryInterface() {
+        return connectionFactoryInterface;
+    }
+
+    public String[] getImplementedInterfaces() {
+        return implementedInterfaces;
+    }
+
+    public String getConnectionFactoryImplClass() {
+        return connectionFactoryImplClass;
+    }
+
+    public String getConnectionInterface() {
+        return connectionInterface;
+    }
+
+    public String getConnectionImplClass() {
+        return connectionImplClass;
+    }
+
+    public ResourceAdapterWrapper getResourceAdapterWrapper() {
+        return resourceAdapterWrapper;
+    }
+
+    public Object getConnectionManagerContainer() {
+        return connectionManagerContainer;
+    }
+
+    public void doStart() throws Exception {
+        //register with resource adapter
+        if (managedConnectionFactory instanceof ResourceAdapterAssociation) {
+            if (resourceAdapterWrapper == null) {
+                throw new IllegalStateException("Managed connection factory expects to be registered with a ResourceAdapter, but there is no ResourceAdapter");
+            }
+            resourceAdapterWrapper.registerResourceAdapterAssociation((ResourceAdapterAssociation) managedConnectionFactory);
+            log.debug("Registered managedConnectionFactory with ResourceAdapter " + resourceAdapterWrapper.toString());
+        }
+        connectionManagerContainer.doRecovery(managedConnectionFactory);
+    }
+
+    public void doStop() {
+    }
+
+    public void doFail() {
+        doStop();
+    }
+
+    //DynamicGBean implementation
+    public Object getAttribute(String name) throws Exception {
+        Thread thread = Thread.currentThread();
+        ClassLoader oldTCL = thread.getContextClassLoader();
+        thread.setContextClassLoader(classLoader);
+        try {
+            return delegate.getAttribute(name);
+        } finally {
+            thread.setContextClassLoader(oldTCL);
+        }
+    }
+
+    public void setAttribute(String name, Object value) throws Exception {
+        Thread thread = Thread.currentThread();
+        ClassLoader oldTCL = thread.getContextClassLoader();
+        thread.setContextClassLoader(classLoader);
+        try {
+            delegate.setAttribute(name, value);
+        } finally {
+            thread.setContextClassLoader(oldTCL);
+        }
+    }
+
+    public Object invoke(String name, Object[] arguments, String[] types) throws Exception {
+        //we have no dynamic operations.
+        return null;
+    }
+
+    public Object getConnectionFactory() throws ResourceException {
+        return $getConnectionFactory();
+    }
+
+    public Object $getResource() throws ResourceException {
+        return $getConnectionFactory();
+    }
+
+    public Object $getConnectionFactory() throws ResourceException {
+        Object connectionFactory =  connectionManagerContainer.createConnectionFactory(managedConnectionFactory);
+        for (Class intf: allImplementedInterfaces) {
+            if (!intf.isAssignableFrom(connectionFactory.getClass())) {
+                throw new ResourceException("ConnectionFactory does not implement expected interface: " + intf.getName());
+            }
+        }
+        return connectionFactory;
+    }
+
+    public ManagedConnectionFactory $getManagedConnectionFactory() {
+        return managedConnectionFactory;
+    }
+
+    /**
+     * Gets the config properties in the form of a map where the key is the
+     * property name and the value is property type (as a Class).
+     */
+    public Map<String, Class> getConfigProperties() {
+        String[] props = delegate.getProperties();
+        Map<String, Class> map = new HashMap<String, Class>();
+        for (String prop : props) {
+            if (prop.equals("logWriter")) {
+                continue;
+            }
+            map.put(prop, delegate.getPropertyType(prop));
+        }
+        return map;
+    }
+
+    public void setConfigProperty(String property, Object value) throws Exception {
+        Class cls = delegate.getPropertyType(property);
+        if(value != null && value instanceof String && !cls.getName().equals("java.lang.String")) {
+            if(cls.isPrimitive()) {
+                if(cls.equals(int.class)) {
+                    cls = Integer.class;
+                } else if(cls.equals(boolean.class)) {
+                    cls = Boolean.class;
+                } else if(cls.equals(float.class)) {
+                    cls = Float.class;
+                } else if(cls.equals(double.class)) {
+                    cls = Double.class;
+                } else if(cls.equals(long.class)) {
+                    cls = Long.class;
+                } else if(cls.equals(short.class)) {
+                    cls = Short.class;
+                } else if(cls.equals(byte.class)) {
+                    cls = Byte.class;
+                } else if(cls.equals(char.class)) {
+                    cls = Character.class;
+                }
+            }
+            Constructor con = cls.getConstructor(new Class[]{String.class});
+            value = con.newInstance(new Object[]{value});
+        }
+        kernel.setAttribute(abstractName, property, value);
+    }
+
+    public Object getConfigProperty(String property) throws Exception {
+        return delegate.getAttribute(property);
+    }
+
+    public String getObjectName() {
+        return objectName;
+    }
+
+    public boolean isStateManageable() {
+        return false;
+    }
+
+    public boolean isStatisticsProvider() {
+        return false;
+    }
+
+    public boolean isEventProvider() {
+        return false;
+    }
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,76 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You 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.outbound;
+
+import org.apache.geronimo.connector.ResourceAdapterWrapper;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
+
+/**
+ *
+ * @version $Revision$
+ */
+public class ManagedConnectionFactoryWrapperGBean {
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ManagedConnectionFactoryWrapperGBean.class, ManagedConnectionFactoryWrapper.class, NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
+
+        infoFactory.addAttribute("managedConnectionFactoryClass", String.class, true);
+        infoFactory.addAttribute("connectionFactoryInterface", String.class, true);
+        infoFactory.addAttribute("implementedInterfaces", String[].class, true);
+        infoFactory.addAttribute("connectionFactoryImplClass", String.class, true);
+        infoFactory.addAttribute("connectionInterface", String.class, true);
+        infoFactory.addAttribute("connectionImplClass", String.class, true);
+        infoFactory.addAttribute("kernel", Kernel.class, false);
+        infoFactory.addAttribute("abstractName", AbstractName.class, false);
+        infoFactory.addAttribute("objectName", String.class, false);
+        infoFactory.addAttribute("classLoader", ClassLoader.class, false);
+
+        infoFactory.addOperation("$getResource");
+        infoFactory.addOperation("$getConnectionFactory");
+        infoFactory.addOperation("$getManagedConnectionFactory");
+
+        infoFactory.addReference("ResourceAdapterWrapper", ResourceAdapterWrapper.class, NameFactory.RESOURCE_ADAPTER);
+        infoFactory.addReference("ConnectionManagerContainer", ConnectionManagerContainer.class, NameFactory.JCA_CONNECTION_MANAGER);
+
+        infoFactory.setConstructor(new String[]{
+            "managedConnectionFactoryClass",
+            "connectionFactoryInterface",
+            "implementedInterfaces",
+            "connectionFactoryImplClass",
+            "connectionInterface",
+            "connectionImplClass",
+            "ResourceAdapterWrapper",
+            "ConnectionManagerContainer",
+            "kernel",
+            "abstractName",
+            "objectName",
+            "classLoader"});
+
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperGBean.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperGBean.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message