geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r706357 [3/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/outbound/connectiontracking/ConnectionTrackingCoordinatorGBean.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/connectiontracking/ConnectionTrackingCoordinatorGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/connectiontracking/ConnectionTrackingCoordinatorGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,71 @@
+/**
+ *  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.connectiontracking;
+
+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.transaction.manager.MonitorableTransactionManager;
+
+/**
+ * 
+ * @version $Revision$
+ */
+public class ConnectionTrackingCoordinatorGBean extends ConnectionTrackingCoordinator implements GBeanLifecycle {
+    private final MonitorableTransactionManager monitorableTm;
+    private final GeronimoTransactionListener listener;
+
+    public ConnectionTrackingCoordinatorGBean(MonitorableTransactionManager monitorableTm, boolean lazyConnect) {
+        super(lazyConnect);
+        this.monitorableTm = monitorableTm;
+        listener = new GeronimoTransactionListener(this);
+    }
+
+    public void doStart() throws Exception {
+        monitorableTm.addTransactionAssociationListener(listener);
+    }
+
+    public void doStop() throws Exception {
+        monitorableTm.removeTransactionAssociationListener(listener);
+    }
+
+    public void doFail() {
+        monitorableTm.removeTransactionAssociationListener(listener);
+    }
+
+    public final static GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(ConnectionTrackingCoordinatorGBean.class, NameFactory.JCA_CONNECTION_TRACKER);
+
+        infoFactory.addReference("TransactionManager", MonitorableTransactionManager.class, NameFactory.JTA_RESOURCE);
+        infoFactory.addAttribute("lazyConnect", boolean.class, true);
+
+        infoFactory.addInterface(TrackedConnectionAssociator.class);
+        infoFactory.addInterface(ConnectionTracker.class);
+
+        infoFactory.setConstructor(new String[] {"TransactionManager", "lazyConnect"});
+        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/connectiontracking/ConnectionTrackingCoordinatorGBean.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/connectiontracking/ConnectionTrackingCoordinatorGBean.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/connectiontracking/ConnectionTrackingCoordinatorGBean.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/security/CallerIdentityPasswordCredentialLoginModule.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/security/CallerIdentityPasswordCredentialLoginModule.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/security/CallerIdentityPasswordCredentialLoginModule.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/security/CallerIdentityPasswordCredentialLoginModule.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,129 @@
+/**
+ *  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.security;
+
+import java.io.IOException;
+import java.util.Map;
+
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.security.PasswordCredential;
+import javax.security.auth.Subject;
+import javax.security.auth.callback.Callback;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.callback.NameCallback;
+import javax.security.auth.callback.PasswordCallback;
+import javax.security.auth.callback.UnsupportedCallbackException;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+
+/**
+ * CallerIdentityPasswordCredentialLoginModule uses the username and password from the CallbackHandler
+ * and a ManagedConnectionFactory from the Options to construct a j2ca PasswordCredential that can be
+ * used for j2ca container managed security.
+ *
+ * This login module does not check credentials so it should never be able to cause a login to succeed.
+ * Therefore the lifecycle methods must return false to indicate success or throw a LoginException to indicate failure.
+ *
+ * @version $Rev$ $Date$
+ *
+ * */
+public class CallerIdentityPasswordCredentialLoginModule implements LoginModule {
+
+    private Subject subject;
+    private CallbackHandler callbackHandler;
+
+    private ManagedConnectionFactory managedConnectionFactory;
+
+    private String resourcePrincipalName;
+    private String userName;
+    private char[] password;
+    private ResourcePrincipal resourcePrincipal;
+    private PasswordCredential passwordCredential;
+
+    public void initialize(Subject subject, CallbackHandler callbackHandler,
+            Map sharedState, Map options) {
+        this.subject = subject;
+        this.callbackHandler = callbackHandler;
+        managedConnectionFactory = (ManagedConnectionFactory) options.get(PasswordCredentialLoginModuleWrapper.MANAGED_CONNECTION_FACTORY_OPTION);
+        if (managedConnectionFactory == null) {
+            throw new IllegalArgumentException("No ManagedConnectionFactory supplied in options");
+        }
+    }
+
+    public boolean login() throws LoginException {
+        if (managedConnectionFactory == null) {
+            return false;
+        }
+        Callback[] callbacks = new Callback[2];
+
+        callbacks[0] = new NameCallback("User name");
+        callbacks[1] = new PasswordCallback("Password", false);
+        try {
+            callbackHandler.handle(callbacks);
+        } catch (IOException ioe) {
+            throw (LoginException) new LoginException().initCause(ioe);
+        } catch (UnsupportedCallbackException uce) {
+            throw (LoginException) new LoginException().initCause(uce);
+        }
+        resourcePrincipalName = ((NameCallback) callbacks[0]).getName();
+        userName = ((NameCallback) callbacks[0]).getName();
+        password = ((PasswordCallback) callbacks[1]).getPassword();
+        return false;
+    }
+
+    public boolean commit() throws LoginException {
+        if (resourcePrincipalName == null || userName == null || password == null) {
+            return false;
+        }
+        resourcePrincipal = new ResourcePrincipal(resourcePrincipalName);
+        subject.getPrincipals().add(resourcePrincipal);
+        passwordCredential = new PasswordCredential(userName, password);
+        passwordCredential.setManagedConnectionFactory(managedConnectionFactory);
+        subject.getPrivateCredentials().add(passwordCredential);
+        
+        // Clear private state
+        resourcePrincipalName = null;
+        userName = null;
+        password = null;
+        return false;
+    }
+
+    public boolean abort() throws LoginException {
+        resourcePrincipalName = null;
+        userName = null;
+        password = null;
+        return false;
+    }
+
+    public boolean logout() throws LoginException {
+        if(!subject.isReadOnly()) {
+            subject.getPrincipals().remove(resourcePrincipal);
+            subject.getPrivateCredentials().remove(passwordCredential);
+        }
+        
+        // TODO: Destroy the credential when subject is read-only.
+        resourcePrincipal = null;
+        passwordCredential = null;
+
+        // Clear private state
+        resourcePrincipalName = null;
+        userName = null;
+        password = null;
+        return false;
+    }
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/security/CallerIdentityPasswordCredentialLoginModule.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/security/CallerIdentityPasswordCredentialLoginModule.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/security/CallerIdentityPasswordCredentialLoginModule.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/security/PasswordCredentialLoginModuleWrapper.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/security/PasswordCredentialLoginModuleWrapper.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/security/PasswordCredentialLoginModuleWrapper.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/security/PasswordCredentialLoginModuleWrapper.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,47 @@
+/**
+ *  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.security;
+
+import java.util.Map;
+import java.util.HashMap;
+
+import javax.resource.spi.ManagedConnectionFactory;
+
+import org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper;
+import org.apache.geronimo.security.jaas.LoginModuleGBean;
+import net.sf.cglib.beans.BeanMap;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PasswordCredentialLoginModuleWrapper extends LoginModuleGBean {
+    public static final String MANAGED_CONNECTION_FACTORY_OPTION = "geronimo.managedconnectionfactory.option";
+
+    public PasswordCredentialLoginModuleWrapper(String loginModuleClass, String objectName, boolean wrapPrincipals, Map<String, Object> options, String loginDomainName, ManagedConnectionFactoryWrapper managedConnectionFactoryWrapper, ClassLoader classLoader) {
+        super(loginModuleClass, objectName, wrapPrincipals, getOptions(options, managedConnectionFactoryWrapper), loginDomainName, classLoader);
+    }
+
+    private static Map<String, Object> getOptions(Map<String, Object> options, ManagedConnectionFactoryWrapper managedConnectionFactoryWrapper) {
+        if (options == null) {
+            options = new HashMap<String, Object>();
+        }
+        ManagedConnectionFactory managedConnectionFactory = managedConnectionFactoryWrapper.$getManagedConnectionFactory();
+        options.put(MANAGED_CONNECTION_FACTORY_OPTION, managedConnectionFactory);
+        return options;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/security/PasswordCredentialLoginModuleWrapper.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/security/PasswordCredentialLoginModuleWrapper.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/security/PasswordCredentialLoginModuleWrapper.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/security/PasswordCredentialLoginModuleWrapperGBean.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/security/PasswordCredentialLoginModuleWrapperGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/security/PasswordCredentialLoginModuleWrapperGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/security/PasswordCredentialLoginModuleWrapperGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,46 @@
+/**
+ *  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.security;
+
+import org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.security.jaas.LoginModuleGBean;
+import org.apache.geronimo.security.SecurityNames;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class PasswordCredentialLoginModuleWrapperGBean {
+
+    private static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(PasswordCredentialLoginModuleWrapper.class, LoginModuleGBean.GBEAN_INFO, SecurityNames.LOGIN_MODULE);
+
+        infoBuilder.addReference("ManagedConnectionFactoryWrapper", ManagedConnectionFactoryWrapper.class, NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
+        infoBuilder.setConstructor(new String[] {"loginModuleClass", "objectName", "wrapPrincipals", "options", "loginDomainName", "ManagedConnectionFactoryWrapper", "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/outbound/security/PasswordCredentialLoginModuleWrapperGBean.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/security/PasswordCredentialLoginModuleWrapperGBean.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/security/PasswordCredentialLoginModuleWrapperGBean.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/transactionlog/JDBCLog.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/transactionlog/JDBCLog.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/JDBCLog.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/JDBCLog.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,202 @@
+/**
+ *  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.transactionlog;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.resource.ResourceException;
+import javax.sql.DataSource;
+import javax.transaction.xa.Xid;
+
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.naming.ResourceSource;
+import org.apache.geronimo.transaction.manager.LogException;
+import org.apache.geronimo.transaction.manager.Recovery;
+import org.apache.geronimo.transaction.manager.TransactionBranchInfo;
+import org.apache.geronimo.transaction.manager.TransactionBranchInfoImpl;
+import org.apache.geronimo.transaction.manager.TransactionLog;
+import org.apache.geronimo.transaction.manager.XidFactory;
+
+/**
+ * "Last Resource optimization" for single servers wishing to have valid xa transactions with
+ * a single 1-pc datasource.  The database is used for the log, and the database work is
+ * committed when the log writes its prepare record.
+ *
+ * @version $Rev$ $Date$
+ */
+public class JDBCLog implements TransactionLog, GBeanLifecycle {
+    private final static String INSERT_XID = "INSERT INTO TXLOG (SYSTEMID, FORMATID, GLOBALID, GLOBALBRANCHID, BRANCHBRANCHID, NAME) VALUES (?, ?, ?, ?, ?)";
+    private final static String DELETE_XID = "DELETE FROM TXLOG WHERE SYSTEMID = ? AND FORMATID = ? AND GLOBALID = ?  AND GLOBALBRANCHID = ?";
+    private final static String RECOVER = "SELECT FORMATID, GLOBALID, GLOBALBRANCHID, BRANCHBRANCHID, NAME FROM TXLOG WHERE SYSTEMID = ? ORDER BY FORMATID, GLOBALID, GLOBALBRANCHID, BRANCHBRANCHID, NAME";
+
+    private DataSource dataSource;
+    private final String systemId;
+    private final ResourceSource<ResourceException> managedConnectionFactoryWrapper;
+
+    public JDBCLog(String systemId, ResourceSource<ResourceException> managedConnectionFactoryWrapper) {
+        this.systemId = systemId;
+        this.managedConnectionFactoryWrapper = managedConnectionFactoryWrapper;
+    }
+
+    public JDBCLog(String systemId, DataSource dataSource) {
+        this.systemId = systemId;
+        this.managedConnectionFactoryWrapper = null;
+        this.dataSource = dataSource;
+    }
+
+    public void doStart() throws Exception {
+        dataSource = (DataSource) managedConnectionFactoryWrapper.$getResource();
+    }
+
+    public void doStop() throws Exception {
+        dataSource = null;
+    }
+
+    public void doFail() {
+    }
+
+    public void begin(Xid xid) throws LogException {
+    }
+
+    public Object prepare(Xid xid, List branches) throws LogException {
+        int formatId = xid.getFormatId();
+        byte[] globalTransactionId = xid.getGlobalTransactionId();
+        byte[] branchQualifier = xid.getBranchQualifier();
+        try {
+            Connection connection = dataSource.getConnection();
+            try {
+                PreparedStatement ps = connection.prepareStatement(INSERT_XID);
+                try {
+                    for (Iterator iterator = branches.iterator(); iterator.hasNext();) {
+                        TransactionBranchInfo branch = (TransactionBranchInfo) iterator.next();
+                        ps.setString(0, systemId);
+                        ps.setInt(1, formatId);
+                        ps.setBytes(2, globalTransactionId);
+                        ps.setBytes(3, branchQualifier);
+                        ps.setBytes(4, branch.getBranchXid().getBranchQualifier());
+                        ps.setString(5, branch.getResourceName());
+                        ps.execute();
+                    }
+                } finally {
+                    ps.close();
+                }
+                if (!connection.getAutoCommit()) {
+                    connection.commit();
+                }
+            } finally {
+                connection.close();
+            }
+        } catch (SQLException e) {
+            throw new LogException("Failure during prepare or commit", e);
+        }
+        return null;
+    }
+
+    public void commit(Xid xid, Object logMark) throws LogException {
+        try {
+            Connection connection = dataSource.getConnection();
+            try {
+                PreparedStatement ps = connection.prepareStatement(DELETE_XID);
+                try {
+                    ps.setString(0, systemId);
+                    ps.setInt(1, xid.getFormatId());
+                    ps.setBytes(2, xid.getGlobalTransactionId());
+                    ps.setBytes(3, xid.getBranchQualifier());
+                    ps.execute();
+                } finally {
+                    ps.close();
+                }
+                if (!connection.getAutoCommit()) {
+                    connection.commit();
+                }
+            } finally {
+                connection.close();
+            }
+        } catch (SQLException e) {
+            throw new LogException("Failure during prepare or commit", e);
+        }
+    }
+
+    public void rollback(Xid xid, Object logMark) throws LogException {
+        throw new LogException("JDBCLog does not support rollback of prepared transactions.  Use it only on servers that do not import transactions");
+    }
+
+    public Collection recover(XidFactory xidFactory) throws LogException {
+        try {
+            Connection connection = dataSource.getConnection();
+            try {
+                Collection recovered = new ArrayList();
+                PreparedStatement ps = connection.prepareStatement(RECOVER);
+                try {
+                    ps.setString(0, systemId);
+                    ResultSet rs = ps.executeQuery();
+                    try {
+                        Xid lastXid = null;
+                        Xid currentXid = null;
+                        Recovery.XidBranchesPair xidBranchesPair = null;
+                        while (rs.next()) {
+                            int formatId = rs.getInt(0);
+                            byte[] globalId = rs.getBytes(1);
+                            byte[] globalBranchId = rs.getBytes(2);
+                            byte[] branchBranchId = rs.getBytes(3);
+                            String name = rs.getString(4);
+                            currentXid = xidFactory.recover(formatId, globalId, globalBranchId);
+                            Xid branchXid = xidFactory.recover(formatId, globalId, branchBranchId);
+                            if (!currentXid.equals(lastXid)) {
+                                xidBranchesPair = new Recovery.XidBranchesPair(currentXid, null);
+                                recovered.add(xidBranchesPair);
+                                lastXid = currentXid;
+                            }
+                            xidBranchesPair.addBranch(new TransactionBranchInfoImpl(branchXid, name));
+                        }
+                        return recovered;
+                    } finally {
+                        rs.close();
+                    }
+                } finally {
+                    ps.close();
+                }
+            } finally {
+                connection.close();
+            }
+        } catch (SQLException e) {
+            throw new LogException("Recovery failure", e);
+        }
+
+    }
+
+    public String getXMLStats() {
+        return null;
+    }
+
+    public int getAverageForceTime() {
+        return 0;
+    }
+
+    public int getAverageBytesPerForce() {
+        return 0;
+    }
+
+}

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/JDBCLog.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/transactionlog/JDBCLog.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/transactionlog/JDBCLog.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/transactionlog/JDBCLogGBean.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/transactionlog/JDBCLogGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/JDBCLogGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/outbound/transactionlog/JDBCLogGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,52 @@
+/**
+ *  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.transactionlog;
+
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.naming.ResourceSource;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.transaction.manager.TransactionLog;
+
+/**
+ * 
+ * @version $Revision$
+ */
+public class JDBCLogGBean {
+    
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(JDBCLogGBean.class, JDBCLog.class, NameFactory.JCA_RESOURCE);
+
+        infoFactory.addAttribute("systemId", String.class, true);
+
+        infoFactory.addInterface(TransactionLog.class);
+
+        infoFactory.addReference("ConnectionFactorySource", ResourceSource.class, NameFactory.JCA_MANAGED_CONNECTION_FACTORY);
+
+        infoFactory.setConstructor(new String[]{"systemId", "ConnectionFactorySource"});
+
+        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/transactionlog/JDBCLogGBean.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/transactionlog/JDBCLogGBean.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/transactionlog/JDBCLogGBean.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/work/GeronimoWorkManagerGBean.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/work/GeronimoWorkManagerGBean.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/main/java/org/apache/geronimo/connector/work/GeronimoWorkManagerGBean.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,68 @@
+/**
+ *  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.work;
+
+import java.util.concurrent.Executor;
+
+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.transaction.manager.XAWork;
+
+/**
+ * 
+ * @version $Revision$
+ */
+public class GeronimoWorkManagerGBean extends GeronimoWorkManager implements GBeanLifecycle {
+
+    public GeronimoWorkManagerGBean() {
+    }
+
+    public GeronimoWorkManagerGBean(Executor sync, Executor start, Executor sched, XAWork xaWork) {
+        super(sync, start, sched, xaWork);
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(GeronimoWorkManagerGBean.class, NameFactory.JCA_WORK_MANAGER);
+        infoFactory.addInterface(GeronimoWorkManager.class);
+
+        infoFactory.addReference("SyncPool", Executor.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+        infoFactory.addReference("StartPool", Executor.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+        infoFactory.addReference("ScheduledPool", Executor.class, GBeanInfoBuilder.DEFAULT_J2EE_TYPE);
+
+        infoFactory.addReference("TransactionManager", XAWork.class, NameFactory.JTA_RESOURCE);
+
+        infoFactory.setConstructor(new String[]{
+            "SyncPool",
+            "StartPool",
+            "ScheduledPool",
+            "TransactionManager"});
+
+        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/work/GeronimoWorkManagerGBean.java
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/AdminObjectWrapperTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/AdminObjectWrapperTest.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/AdminObjectWrapperTest.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/AdminObjectWrapperTest.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,110 @@
+/**
+ *  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.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.util.HashMap;
+import java.util.Map;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.connector.mock.MockAdminObject;
+import org.apache.geronimo.connector.mock.MockAdminObjectImpl;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContext;
+import org.apache.geronimo.j2ee.j2eeobjectnames.J2eeContextImpl;
+import org.apache.geronimo.j2ee.j2eeobjectnames.NameFactory;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelFactory;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class AdminObjectWrapperTest extends TestCase {
+
+    private Kernel kernel;
+    private AbstractName selfName;
+    private static final String TARGET_NAME = "testAOName";
+
+    public void testProxy() throws Exception {
+        Object proxy = kernel.invoke(selfName, "$getResource");
+        assertNotNull(proxy);
+        assertTrue(proxy instanceof MockAdminObject);
+        MockAdminObject mockAdminObject = ((MockAdminObject) proxy).getSomething();
+        assertNotNull(mockAdminObject);
+    }
+
+    public void testSerialization() throws Exception {
+        MockAdminObject proxy = (MockAdminObject) kernel.invoke(selfName, "$getResource");
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos = new ObjectOutputStream(baos);
+        oos.writeObject(proxy);
+        oos.flush();
+        byte[] bytes = baos.toByteArray();
+        oos.close();
+        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
+        Object proxy2 = ois.readObject();
+        assertNotNull(proxy2);
+        assertTrue(proxy instanceof MockAdminObject);
+        MockAdminObject mockAdminObject = proxy.getSomething();
+        assertNotNull(mockAdminObject);
+        kernel.stopGBean(selfName);
+        ObjectInputStream ois2 = new ObjectInputStream(new ByteArrayInputStream(bytes));
+        MockAdminObject proxy3 = (MockAdminObject) ois2.readObject();
+        kernel.startGBean(selfName);
+        proxy3.getSomething();
+
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        J2eeContext j2eeContext = new J2eeContextImpl("test.domain", "geronimo.server", "testapp", NameFactory.RESOURCE_ADAPTER_MODULE, "testmodule", TARGET_NAME, NameFactory.JMS_RESOURCE);
+        kernel = KernelFactory.newInstance().createKernel(j2eeContext.getJ2eeDomainName());
+        kernel.boot();
+
+        GBeanData aow = buildGBeanData("name", TARGET_NAME, AdminObjectWrapperGBean.getGBeanInfo());
+        selfName = aow.getAbstractName();
+        aow.setAttribute("adminObjectInterface", MockAdminObject.class.getName());
+        aow.setAttribute("adminObjectClass", MockAdminObjectImpl.class.getName());
+        kernel.loadGBean(aow, this.getClass().getClassLoader());
+
+        kernel.startGBean(selfName);
+    }
+
+    private GBeanData buildGBeanData(String key, String value, GBeanInfo info) {
+        AbstractName abstractName = buildAbstractName(key, value);
+        return new GBeanData(abstractName, info);
+    }
+
+    private AbstractName buildAbstractName(String key, String value) {
+        Map names = new HashMap();
+        names.put(key, value);
+        return new AbstractName(new Artifact("test", "foo", "1", "car"), names);
+    }
+
+    protected void tearDown() throws Exception {
+        kernel.stopGBean(selfName);
+        kernel.shutdown();
+        super.tearDown();
+    }
+}

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

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

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

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBeanSerializationTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBeanSerializationTest.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBeanSerializationTest.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/GenericConnectionManagerGBeanSerializationTest.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,63 @@
+/*
+ * 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.net.URI;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ObjectInputStream;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.basic.BasicKernel;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.connector.outbound.connectionmanagerconfig.NoTransactions;
+import org.apache.geronimo.connector.outbound.connectionmanagerconfig.SinglePool;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GenericConnectionManagerGBeanSerializationTest extends TestCase {
+
+    public void testSerialization() throws Exception {
+        Kernel kernel = new BasicKernel("test");
+        kernel.boot();
+        AbstractName abstractName = new AbstractName(URI.create("foo/bar/1/car?name=ConnectionManager"));
+        GBeanData data = new GBeanData(abstractName, GenericConnectionManagerGBean.GBEAN_INFO);
+        data.setAttribute("transactionSupport", NoTransactions.INSTANCE);
+        data.setAttribute("pooling", new SinglePool(10, 0, 5000, 5, false, false, true));
+        kernel.loadGBean(data, this.getClass().getClassLoader());
+        kernel.startGBean(abstractName);
+        Object cm = kernel.getGBean(abstractName);
+        assertTrue(cm instanceof GenericConnectionManagerGBean);
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream out = new ObjectOutputStream(baos);
+        out.writeObject(cm);
+        out.flush();
+        byte[] bytes = baos.toByteArray();
+        ByteArrayInputStream bais = new ByteArrayInputStream(bytes);
+        ObjectInputStream in = new ObjectInputStream(bais);
+        Object cm2 = in.readObject();
+        assertSame(cm, cm2);
+    }
+}

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

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

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

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapperTest.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,182 @@
+/**
+ *  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.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.HashMap;
+import java.util.Map;
+import javax.resource.cci.Connection;
+import javax.resource.cci.ConnectionFactory;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.connector.mock.ConnectionFactoryExtension;
+import org.apache.geronimo.connector.mock.MockConnection;
+import org.apache.geronimo.connector.mock.MockConnectionFactory;
+import org.apache.geronimo.connector.mock.MockManagedConnectionFactory;
+import org.apache.geronimo.connector.outbound.connectionmanagerconfig.NoPool;
+import org.apache.geronimo.connector.outbound.connectionmanagerconfig.NoTransactions;
+import org.apache.geronimo.connector.outbound.connectiontracking.ConnectionTracker;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanData;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelFactory;
+import org.apache.geronimo.kernel.repository.Artifact;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ManagedConnectionFactoryWrapperTest extends TestCase {
+
+    private Kernel kernel;
+    private AbstractName managedConnectionFactoryName;
+    private static final String KERNEL_NAME = "testKernel";
+    private static final String TARGET_NAME = "testCFName";
+
+    public void testProxy() throws Exception {
+        Object proxy = kernel.invoke(managedConnectionFactoryName, "$getResource");
+        assertNotNull(proxy);
+        assertTrue(proxy instanceof ConnectionFactory);
+        Connection connection = ((ConnectionFactory) proxy).getConnection();
+        assertNotNull(connection);
+        kernel.stopGBean(managedConnectionFactoryName);
+        try {
+            ((ConnectionFactory) proxy).getConnection();
+//            fail();
+        } catch (IllegalStateException ise) {
+        }
+        kernel.startGBean(managedConnectionFactoryName);
+        ((ConnectionFactory) proxy).getConnection();
+        //check implemented interfaces
+        assertTrue(proxy instanceof Serializable);
+        assertTrue(proxy instanceof ConnectionFactoryExtension);
+        assertEquals("SomethingElse", ((ConnectionFactoryExtension)proxy).doSomethingElse());
+    }
+
+    public void XtestSerialization() throws Exception {
+        ConnectionFactory proxy = (ConnectionFactory) kernel.invoke(managedConnectionFactoryName, "$getResource");
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        ObjectOutputStream oos = new ObjectOutputStream(baos);
+        oos.writeObject(proxy);
+        oos.flush();
+        byte[] bytes = baos.toByteArray();
+        oos.close();
+        ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes));
+        Object proxy2 = ois.readObject();
+        assertNotNull(proxy2);
+        assertTrue(proxy instanceof ConnectionFactory);
+        Connection connection = proxy.getConnection();
+        assertNotNull(connection);
+        kernel.stopGBean(managedConnectionFactoryName);
+        ObjectInputStream ois2 = new ObjectInputStream(new ByteArrayInputStream(bytes));
+        ConnectionFactory proxy3 = (ConnectionFactory) ois2.readObject();
+        try {
+            proxy3.getConnection();
+            fail();
+        } catch (IllegalStateException ise) {
+        }
+        kernel.startGBean(managedConnectionFactoryName);
+        proxy3.getConnection();
+
+    }
+
+    protected void setUp() throws Exception {
+        super.setUp();
+        kernel = KernelFactory.newInstance().createKernel(KERNEL_NAME);
+        kernel.boot();
+        ClassLoader cl = MockConnectionTrackingCoordinator.class.getClassLoader();
+
+        GBeanData ctc = buildGBeanData("name", "ConnectionTrackingCoordinator", MockConnectionTrackingCoordinator.getGBeanInfo());
+        AbstractName ctcName = ctc.getAbstractName();
+        kernel.loadGBean(ctc, cl);
+
+        GBeanData cmf = buildGBeanData("name", "ConnectionManagerContainer", GenericConnectionManagerGBean.getGBeanInfo());
+        AbstractName cmfName = cmf.getAbstractName();
+        cmf.setAttribute("transactionSupport", NoTransactions.INSTANCE);
+        cmf.setAttribute("pooling", new NoPool());
+        cmf.setReferencePattern("ConnectionTracker", ctcName);
+        kernel.loadGBean(cmf, cl);
+
+
+        GBeanData mcfw = buildGBeanData("name", TARGET_NAME, ManagedConnectionFactoryWrapperGBean.getGBeanInfo());
+        managedConnectionFactoryName = mcfw.getAbstractName();
+        mcfw.setAttribute("managedConnectionFactoryClass", MockManagedConnectionFactory.class.getName());
+        mcfw.setAttribute("connectionFactoryInterface", ConnectionFactory.class.getName());
+        mcfw.setAttribute("implementedInterfaces", new String[]{Serializable.class.getName(), ConnectionFactoryExtension.class.getName()});
+        mcfw.setAttribute("connectionFactoryImplClass", MockConnectionFactory.class.getName());
+        mcfw.setAttribute("connectionInterface", Connection.class.getName());
+        mcfw.setAttribute("connectionImplClass", MockConnection.class.getName());
+        //"ResourceAdapterWrapper",
+        mcfw.setReferencePattern("ConnectionManagerContainer", cmfName);
+        //"ManagedConnectionFactoryListener",
+        kernel.loadGBean(mcfw, cl);
+
+        kernel.startGBean(ctcName);
+        kernel.startGBean(cmfName);
+        kernel.startGBean(managedConnectionFactoryName);
+    }
+    private GBeanData buildGBeanData(String key, String value, GBeanInfo info) {
+        AbstractName abstractName = buildAbstractName(key, value);
+        return new GBeanData(abstractName, info);
+    }
+
+    private AbstractName buildAbstractName(String key, String value) {
+        Map names = new HashMap();
+        names.put(key, value);
+        return new AbstractName(new Artifact("test", "foo", "1", "car"), names);
+    }
+
+
+    protected void tearDown() throws Exception {
+        kernel.stopGBean(managedConnectionFactoryName);
+        kernel.shutdown();
+        super.tearDown();
+    }
+
+    public static class MockConnectionTrackingCoordinator implements ConnectionTracker {
+        public void handleObtained(ConnectionTrackingInterceptor connectionTrackingInterceptor,
+                                   ConnectionInfo connectionInfo,
+                                   boolean reassociate) {
+        }
+
+        public void handleReleased(ConnectionTrackingInterceptor connectionTrackingInterceptor,
+                                   ConnectionInfo connectionInfo,
+                                   ConnectionReturnAction connectionReturnAction) {
+        }
+
+        public void setEnvironment(ConnectionInfo connectionInfo, String key) {
+        }
+
+        static final GBeanInfo GBEAN_INFO;
+
+        static {
+            GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic(MockConnectionTrackingCoordinator.class);
+            infoFactory.addInterface(ConnectionTracker.class);
+            GBEAN_INFO = infoFactory.getBeanInfo();
+        }
+
+        public static GBeanInfo getGBeanInfo() {
+            return GBEAN_INFO;
+        }
+    }
+}

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

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

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

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/security/GBeanTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/security/GBeanTest.java?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/security/GBeanTest.java (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-1_6/src/test/java/org/apache/geronimo/connector/outbound/security/GBeanTest.java Mon Oct 20 11:23:36 2008
@@ -0,0 +1,34 @@
+/*
+ * 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.security;
+
+import junit.framework.TestCase;
+import org.apache.geronimo.gbean.GBeanInfo;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class GBeanTest extends TestCase {
+
+    public void testGBeans() throws Exception {
+        GBeanInfo gBeanInfo = PasswordCredentialLoginModuleWrapperGBean.getGBeanInfo();
+    }
+}

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

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

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

Added: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml?rev=706357&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml (added)
+++ geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml Mon Oct 20 11:23:36 2008
@@ -0,0 +1,148 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+    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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.plugins</groupId>
+        <artifactId>connector-1_6</artifactId>
+        <version>2.2-SNAPSHOT</version>
+    </parent>
+
+    <groupId>org.apache.geronimo.modules</groupId>
+    <artifactId>geronimo-connector-builder-1_6</artifactId>
+    <name>Geronimo Plugins, Connector :: Builder</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-connector-1_6</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>geronimo-deploy-config</artifactId>
+            <version>${version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>jee-specs</artifactId>
+            <version>${version}</version>
+            <type>car</type>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-naming-builder</artifactId>
+            <version>${version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.schema</groupId>
+            <artifactId>geronimo-schema-j2ee_1.4</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-test-ddbean</artifactId>
+            <version>${version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.framework</groupId>
+            <artifactId>geronimo-kernel</artifactId>
+            <version>${version}</version>
+            <classifier>tests</classifier>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>xmlbeans-maven-plugin</artifactId>
+            </plugin>
+
+            <!--
+            HACK: Copy XmlBeans generated schemas.
+            -->
+            <plugin>
+                <groupId>org.apache.geronimo.buildsupport</groupId>
+                <artifactId>buildsupport-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>copy-xmlbeans-schemas</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-antrun-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <phase>process-test-resources</phase>
+                        <configuration>
+                            <tasks>
+                                <ant antfile="${pom.basedir}/src/test/script/test-setup.xml"/>
+                            </tasks>
+                        </configuration>
+                        <goals>
+                            <goal>run</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-surefire-plugin</artifactId>
+                <configuration>
+                    <systemProperties>
+                        <property>
+                            <name>java.security.auth.login.config</name>
+                            <value>${basedir}/src/test/resources/data/login.config</value>
+                        </property>
+                    </systemProperties>
+
+                    <excludes>
+                        <exclude>**/Abstract*.java</exclude>
+
+                        <!--
+                        FIXME: This test was disabled because it is failing in non-obvious ways
+                               and requires someone with more insight to resolve
+                        -->
+                        <exclude>**/Connector15DCBTest.java</exclude>
+                    </excludes>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+</project>
+

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/connector-1_6/geronimo-connector-builder-1_6/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml



Mime
View raw message