geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r546411 - in /geronimo/server/trunk/modules: geronimo-connector/src/main/java/org/apache/geronimo/connector/ geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ geronimo-management/src/main/java/org/apache/geronimo/mana...
Date Tue, 12 Jun 2007 08:09:43 GMT
Author: djencks
Date: Tue Jun 12 01:09:40 2007
New Revision: 546411

URL: http://svn.apache.org/viewvc?view=rev&rev=546411
Log:
GERONIMO-3175 clean up some unused code left over from not proxying connection factories

Removed:
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/ConnectorMethodInterceptor.java
Modified:
    geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
    geronimo/server/trunk/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/JCAManagedConnectionFactory.java

Modified: geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java?view=diff&rev=546411&r1=546410&r2=546411
==============================================================================
--- geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
(original)
+++ geronimo/server/trunk/modules/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
Tue Jun 12 01:09:40 2007
@@ -19,24 +19,21 @@
 
 import java.lang.reflect.Constructor;
 import java.util.HashMap;
-import java.util.Map;
 import java.util.LinkedHashSet;
+import java.util.Map;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.ManagedConnectionFactory;
 import javax.resource.spi.ResourceAdapterAssociation;
 import javax.transaction.SystemException;
 
-import net.sf.cglib.proxy.Callback;
-import net.sf.cglib.proxy.Enhancer;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import org.apache.geronimo.connector.ConnectorMethodInterceptor;
 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.gbean.AbstractName;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.management.geronimo.JCAManagedConnectionFactory;
 import org.apache.geronimo.transaction.manager.NamedXAResource;
@@ -56,25 +53,20 @@
     private final String connectionInterface;
     private final String connectionImplClass;
 
-    private final Class[] allImplementedInterfaces;
+    private final LinkedHashSet<Class> allImplementedInterfaces = new LinkedHashSet<Class>();
 
     private final ResourceAdapterWrapper resourceAdapterWrapper;
     private final ConnectionManagerContainer connectionManagerContainer;
 
     private ManagedConnectionFactory managedConnectionFactory;
 
-    private Object connectionFactory;
-
     private DynamicGBeanDelegate delegate;
 
 
     private boolean registered = false;
-    private Object proxy;
-    private ConnectorMethodInterceptor interceptor;
     private final Kernel kernel;
     private final AbstractName abstractName;
     private final String objectName;
-    private final boolean isProxyable;
     private final ClassLoader classLoader;
 
     //default constructor for enhancement proxy endpoint
@@ -88,8 +80,6 @@
         kernel = null;
         abstractName = null;
         objectName = null;
-        allImplementedInterfaces = null;
-        isProxyable = false;
         classLoader = null;
         resourceAdapterWrapper = null;
         connectionManagerContainer = null;
@@ -114,22 +104,10 @@
         this.connectionInterface = connectionInterface;
         this.connectionImplClass = connectionImplClass;
 
-        LinkedHashSet allInterfaceSet = new LinkedHashSet();
-        allInterfaceSet.add(cl.loadClass(connectionFactoryInterface));
-        for (int i = 0; i < implementedInterfaces.length; i++) {
-            allInterfaceSet.add(cl.loadClass(implementedInterfaces[i]));
-        }
-        allImplementedInterfaces = (Class[])allInterfaceSet.toArray(new Class[allInterfaceSet.size()]);
-        
-        boolean mightBeProxyable = true;
-        for (int i = 0; i < allImplementedInterfaces.length; i++) {
-            Class implementedInterface = allImplementedInterfaces[i];
-            if (!implementedInterface.isInterface()) {
-                mightBeProxyable = false;
-                break;
-            }
+        allImplementedInterfaces.add(cl.loadClass(connectionFactoryInterface));
+        for (String interfaceName: implementedInterfaces) {
+            allImplementedInterfaces.add(cl.loadClass(interfaceName));
         }
-        isProxyable = mightBeProxyable;
 
         this.resourceAdapterWrapper = resourceAdapterWrapper;
         this.connectionManagerContainer = connectionManagerContainer;
@@ -188,33 +166,9 @@
             log.debug("Registered managedConnectionFactory with ResourceAdapter " + resourceAdapterWrapper.toString());
         }
 
-        //create a new ConnectionFactory
-        connectionFactory = connectionManagerContainer.createConnectionFactory(managedConnectionFactory);
-
-        //build proxy
-        if (isProxyable) {
-            Enhancer enhancer = new Enhancer();
-            enhancer.setInterfaces(allImplementedInterfaces);
-            enhancer.setCallbackType(net.sf.cglib.proxy.MethodInterceptor.class);
-            enhancer.setUseFactory(false);//????
-            interceptor = new ConnectorMethodInterceptor(kernel.getKernelName(), abstractName);
-            enhancer.setCallbacks(new Callback[]{interceptor});
-            proxy = enhancer.create(new Class[0], new Object[0]);
-        } else {
-            proxy = connectionFactory;
-        }
-
-        //connect proxy
-        if (interceptor != null) {
-            interceptor.setInternalProxy(connectionFactory);
-        }
     }
 
     public void doStop() {
-        if (interceptor != null) {
-            interceptor.setInternalProxy(null);
-        }
-        connectionFactory = null;
     }
 
     public void doFail() {
@@ -258,8 +212,13 @@
     }
 
     public Object $getConnectionFactory() throws ResourceException {
-        return connectionManagerContainer.createConnectionFactory(managedConnectionFactory);
-
+        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() {
@@ -268,14 +227,13 @@
 
     /**
      * 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 String not a Class).
+     * property name and the value is property type (as a Class).
      */
-    public Map getConfigProperties() {
+    public Map<String, Class> getConfigProperties() {
         String[] props = delegate.getProperties();
-        Map map = new HashMap();
-        for (int i = 0; i < props.length; i++) {
-            String prop = props[i];
-            if(prop.equals("logWriter")) {
+        Map<String, Class> map = new HashMap<String, Class>();
+        for (String prop : props) {
+            if (prop.equals("logWriter")) {
                 continue;
             }
             map.put(prop, delegate.getPropertyType(prop));

Modified: geronimo/server/trunk/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/JCAManagedConnectionFactory.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/JCAManagedConnectionFactory.java?view=diff&rev=546411&r1=546410&r2=546411
==============================================================================
--- geronimo/server/trunk/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/JCAManagedConnectionFactory.java
(original)
+++ geronimo/server/trunk/modules/geronimo-management/src/main/java/org/apache/geronimo/management/geronimo/JCAManagedConnectionFactory.java
Tue Jun 12 01:09:40 2007
@@ -17,6 +17,7 @@
 package org.apache.geronimo.management.geronimo;
 
 import java.util.Map;
+import java.util.List;
 
 /**
  * @version $Rev$ $Date$
@@ -36,9 +37,11 @@
 
     /**
      * 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 String not a Class).
+     * property name and the value is property type (as a Class).
+     *
+     * @return map of config property name to config property type name
      */
-    public Map getConfigProperties();
+    public Map<String, Class> getConfigProperties();
 
     public void setConfigProperty(String property, Object value) throws Exception;
 
@@ -49,6 +52,7 @@
      * connection factory.  This object should implement
      * javax.resource.spi.ConnectionManager and
      * org.apache.geronimo.connector.outbound.PoolingAttributes
+     * @return ConnectionManager and PoolingAttributes implementation
      */
     public Object getConnectionManagerContainer();
     



Mime
View raw message