tomee-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jgallim...@apache.org
Subject svn commit: r1134482 - in /openejb/trunk/openejb3: ./ container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/ container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/ container/openejb-core/src/main/java/org/apache/open...
Date Fri, 10 Jun 2011 23:35:22 GMT
Author: jgallimore
Date: Fri Jun 10 23:35:21 2011
New Revision: 1134482

URL: http://svn.apache.org/viewvc?rev=1134482&view=rev
Log:
OPENEJB-1534 adding support for connector 1.6 rars

Modified:
    openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsProxyTest.java
    openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsTest.java
    openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/MdbTest.java
    openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/SimpleJmsTest.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/FinderFactory.java
    openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/GeronimoConnectionManagerFactory.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/JmsProxyTest.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/JmsTest.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/MdbTest.java
    openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/SimpleJmsTest.java
    openejb/trunk/openejb3/pom.xml

Modified: openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsProxyTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsProxyTest.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsProxyTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsProxyTest.java Fri Jun 10 23:35:21 2011
@@ -17,6 +17,7 @@
  */
 package org.apache.openejb.core.mdb;
 
+import java.util.Collections;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 import javax.jms.Connection;
@@ -32,6 +33,8 @@ import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.geronimo.connector.GeronimoBootstrapContext;
 import org.apache.geronimo.connector.work.GeronimoWorkManager;
+import org.apache.geronimo.connector.work.TransactionContextHandler;
+import org.apache.geronimo.connector.work.WorkContextHandler;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.resource.activemq.ActiveMQResourceAdapter;
@@ -58,10 +61,11 @@ public class JmsProxyTest extends TestCa
         Executor threadPool = Executors.newFixedThreadPool(30);
 
         // create a work manager which ActiveMQ uses to dispatch message delivery jobs
-        WorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, transactionManager);
+        TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(transactionManager);
+        GeronimoWorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
 
         // wrap the work mananger and transaction manager in a bootstrap context (connector spec thing)
-        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager);
+        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager, transactionManager);
 
         // start the resource adapter
         try {

Modified: openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsTest.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/JmsTest.java Fri Jun 10 23:35:21 2011
@@ -18,6 +18,7 @@
 package org.apache.openejb.core.mdb;
 
 import java.io.Serializable;
+import java.util.Collections;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.Executor;
@@ -40,6 +41,8 @@ import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.geronimo.connector.GeronimoBootstrapContext;
 import org.apache.geronimo.connector.work.GeronimoWorkManager;
+import org.apache.geronimo.connector.work.TransactionContextHandler;
+import org.apache.geronimo.connector.work.WorkContextHandler;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.resource.activemq.ActiveMQResourceAdapter;
@@ -67,10 +70,11 @@ public class JmsTest extends TestCase {
         Executor threadPool = Executors.newFixedThreadPool(30);
 
         // create a work manager which ActiveMQ uses to dispatch message delivery jobs
-        WorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, transactionManager);
+        TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(transactionManager);
+        GeronimoWorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
 
         // wrap the work mananger and transaction manager in a bootstrap context (connector spec thing)
-        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager);
+        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager, transactionManager);
 
         // start the resource adapter
         try {

Modified: openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/MdbTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/MdbTest.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/MdbTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/MdbTest.java Fri Jun 10 23:35:21 2011
@@ -19,6 +19,7 @@ package org.apache.openejb.core.mdb;
 
 import java.io.Serializable;
 import java.lang.reflect.Method;
+import java.util.Collections;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.Executor;
@@ -47,6 +48,8 @@ import org.apache.activemq.ActiveMQConne
 import org.apache.activemq.ra.ActiveMQActivationSpec;
 import org.apache.geronimo.connector.GeronimoBootstrapContext;
 import org.apache.geronimo.connector.work.GeronimoWorkManager;
+import org.apache.geronimo.connector.work.TransactionContextHandler;
+import org.apache.geronimo.connector.work.WorkContextHandler;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.resource.activemq.ActiveMQResourceAdapter;
@@ -73,10 +76,11 @@ public class MdbTest extends TestCase {
         Executor threadPool = Executors.newFixedThreadPool(30);
 
         // create a work manager which ActiveMQ uses to dispatch message delivery jobs
-        WorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, transactionManager);
+        TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(transactionManager);
+        GeronimoWorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
 
         // wrap the work mananger and transaction manager in a bootstrap context (connector spec thing)
-        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager);
+        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager, transactionManager);
 
         // start the resource adapter
         try {

Modified: openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/SimpleJmsTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/SimpleJmsTest.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/SimpleJmsTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-activemq4/src/test/java/org/apache/openejb/core/mdb/SimpleJmsTest.java Fri Jun 10 23:35:21 2011
@@ -17,6 +17,7 @@
  */
 package org.apache.openejb.core.mdb;
 
+import java.util.Collections;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 import javax.jms.Connection;
@@ -32,6 +33,8 @@ import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.geronimo.connector.GeronimoBootstrapContext;
 import org.apache.geronimo.connector.work.GeronimoWorkManager;
+import org.apache.geronimo.connector.work.TransactionContextHandler;
+import org.apache.geronimo.connector.work.WorkContextHandler;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.resource.activemq.ActiveMQResourceAdapter;
@@ -58,10 +61,11 @@ public class SimpleJmsTest extends TestC
         Executor threadPool = Executors.newFixedThreadPool(30);
 
         // create a work manager which ActiveMQ uses to dispatch message delivery jobs
-        WorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, transactionManager);
+        TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(transactionManager);
+        GeronimoWorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
 
         // wrap the work mananger and transaction manager in a bootstrap context (connector spec thing)
-        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager);
+        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager, transactionManager);
 
         // start the resource adapter
         try {

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java Fri Jun 10 23:35:21 2011
@@ -49,7 +49,10 @@ import javax.transaction.TransactionSync
 import javax.validation.ValidatorFactory;
 
 import org.apache.geronimo.connector.work.GeronimoWorkManager;
+import org.apache.geronimo.connector.work.TransactionContextHandler;
+import org.apache.geronimo.connector.work.WorkContextHandler;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
+import org.apache.geronimo.transaction.manager.XAWork;
 import org.apache.openejb.AppContext;
 import org.apache.openejb.BeanContext;
 import org.apache.openejb.BeanType;
@@ -1276,7 +1279,8 @@ public class Assembler extends Assembler
             WorkManager workManager;
             if (transactionManager instanceof GeronimoTransactionManager) {
                 GeronimoTransactionManager geronimoTransactionManager = (GeronimoTransactionManager) transactionManager;
-                workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, geronimoTransactionManager);
+                TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(geronimoTransactionManager);
+                workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
             } else {
                 workManager = new SimpleWorkManager(threadPool);
             }
@@ -1310,6 +1314,7 @@ public class Assembler extends Assembler
             connectionManagerRecipe.allow(Option.IGNORE_MISSING_PROPERTIES);
             connectionManagerRecipe.setAllProperties(serviceInfo.properties);
             connectionManagerRecipe.setProperty("name", serviceInfo.id);
+            connectionManagerRecipe.setProperty("mcf", managedConnectionFactory);
 
             // standard properties
             connectionManagerRecipe.setProperty("transactionManager", transactionManager);

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/AnnotationDeployer.java Fri Jun 10 23:35:21 2011
@@ -20,6 +20,10 @@ import static java.lang.reflect.Modifier
 import static java.util.Arrays.asList;
 import static org.apache.openejb.util.Join.join;
 
+import java.beans.BeanInfo;
+import java.beans.IntrospectionException;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
 import java.lang.annotation.Annotation;
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -28,6 +32,7 @@ import java.lang.reflect.Modifier;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.Comparator;
@@ -97,6 +102,13 @@ import javax.persistence.PersistenceCont
 import javax.persistence.PersistenceContexts;
 import javax.persistence.PersistenceUnit;
 import javax.persistence.PersistenceUnits;
+import javax.resource.spi.Activation;
+import javax.resource.spi.AdministeredObject;
+import javax.resource.spi.ConnectionDefinition;
+import javax.resource.spi.ConnectionDefinitions;
+import javax.resource.spi.Connector;
+import javax.resource.spi.SecurityPermission;
+import javax.resource.spi.work.WorkContext;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceProvider;
 import javax.xml.ws.WebServiceRef;
@@ -109,15 +121,19 @@ import org.apache.openejb.api.RemoteClie
 import org.apache.openejb.cdi.CdiBeanInfo;
 import org.apache.openejb.core.webservices.JaxWsUtils;
 import org.apache.openejb.jee.ActivationConfig;
+import org.apache.openejb.jee.ActivationSpec;
+import org.apache.openejb.jee.AdminObject;
 import org.apache.openejb.jee.ApplicationClient;
 import org.apache.openejb.jee.AroundInvoke;
 import org.apache.openejb.jee.AroundTimeout;
 import org.apache.openejb.jee.AssemblyDescriptor;
 import org.apache.openejb.jee.AsyncMethod;
+import org.apache.openejb.jee.AuthenticationMechanism;
 import org.apache.openejb.jee.Beans;
 import org.apache.openejb.jee.ConcurrencyManagementType;
 import org.apache.openejb.jee.ConcurrentLockType;
 import org.apache.openejb.jee.ConcurrentMethod;
+import org.apache.openejb.jee.ConfigProperty;
 import org.apache.openejb.jee.ContainerConcurrency;
 import org.apache.openejb.jee.ContainerTransaction;
 import org.apache.openejb.jee.EjbJar;
@@ -133,6 +149,8 @@ import org.apache.openejb.jee.FacesManag
 import org.apache.openejb.jee.Filter;
 import org.apache.openejb.jee.Handler;
 import org.apache.openejb.jee.HandlerChains;
+import org.apache.openejb.jee.Icon;
+import org.apache.openejb.jee.InboundResourceadapter;
 import org.apache.openejb.jee.InitMethod;
 import org.apache.openejb.jee.Injectable;
 import org.apache.openejb.jee.InjectionTarget;
@@ -141,14 +159,18 @@ import org.apache.openejb.jee.Intercepto
 import org.apache.openejb.jee.Invokable;
 import org.apache.openejb.jee.JndiConsumer;
 import org.apache.openejb.jee.JndiReference;
+import org.apache.openejb.jee.License;
 import org.apache.openejb.jee.Lifecycle;
 import org.apache.openejb.jee.LifecycleCallback;
 import org.apache.openejb.jee.Listener;
+import org.apache.openejb.jee.MessageAdapter;
 import org.apache.openejb.jee.MessageDrivenBean;
+import org.apache.openejb.jee.MessageListener;
 import org.apache.openejb.jee.MethodAttribute;
 import org.apache.openejb.jee.MethodParams;
 import org.apache.openejb.jee.MethodPermission;
 import org.apache.openejb.jee.NamedMethod;
+import org.apache.openejb.jee.OutboundResourceAdapter;
 import org.apache.openejb.jee.PersistenceContextRef;
 import org.apache.openejb.jee.PersistenceContextType;
 import org.apache.openejb.jee.PersistenceUnitRef;
@@ -158,6 +180,7 @@ import org.apache.openejb.jee.RemoteBean
 import org.apache.openejb.jee.RemoveMethod;
 import org.apache.openejb.jee.ResAuth;
 import org.apache.openejb.jee.ResSharingScope;
+import org.apache.openejb.jee.ResourceAdapter;
 import org.apache.openejb.jee.ResourceEnvRef;
 import org.apache.openejb.jee.ResourceRef;
 import org.apache.openejb.jee.SecurityIdentity;
@@ -170,12 +193,14 @@ import org.apache.openejb.jee.SingletonB
 import org.apache.openejb.jee.StatefulBean;
 import org.apache.openejb.jee.StatelessBean;
 import org.apache.openejb.jee.Tag;
+import org.apache.openejb.jee.Text;
 import org.apache.openejb.jee.Timeout;
 import org.apache.openejb.jee.Timer;
 import org.apache.openejb.jee.TimerConsumer;
 import org.apache.openejb.jee.TimerSchedule;
 import org.apache.openejb.jee.TldTaglib;
 import org.apache.openejb.jee.TransAttribute;
+import org.apache.openejb.jee.TransactionSupportType;
 import org.apache.openejb.jee.TransactionType;
 import org.apache.openejb.jee.WebApp;
 import org.apache.openejb.jee.WebserviceDescription;
@@ -186,6 +211,7 @@ import org.apache.openejb.util.LogCatego
 import org.apache.openejb.util.Logger;
 import org.apache.xbean.finder.Annotated;
 import org.apache.xbean.finder.AnnotationFinder;
+import org.apache.xbean.finder.ClassFinder;
 import org.apache.xbean.finder.IAnnotationFinder;
 import org.apache.xbean.finder.MetaAnnotatedClass;
 import org.apache.xbean.finder.archive.ClassesArchive;
@@ -384,9 +410,509 @@ public class AnnotationDeployer implemen
         }
 
         public ConnectorModule deploy(ConnectorModule connectorModule) throws OpenEJBException {
+        	
+        	org.apache.openejb.jee.Connector connector = connectorModule.getConnector();
+        	if (connector == null) {
+        		connector = new org.apache.openejb.jee.Connector();
+        	}
+        	
+        	// JCA 1.6 - 18.3.1 do not look at annotations if the provided connector
+        	// deployment descriptor is "meta-data complete".
+        	
+        	float specVersion = 0;
+        	try {
+        		specVersion = Float.parseFloat(connector.getVersion());
+        	} catch (Exception e) {
+        	}
+        	
+			if (specVersion < 1.6 || Boolean.TRUE.equals(connector.isMetadataComplete())) {
+				return connectorModule;
+			}
+        	
+        	
+        	IAnnotationFinder finder = connectorModule.getFinder();
+        	if (finder == null) {
+        		try {
+        			finder = FinderFactory.createFinder(connectorModule);
+					connectorModule.setFinder(finder);
+				} catch (Exception e) {
+					// TODO: some sort of error
+					return connectorModule;
+				}
+        	}
+        	
+        	List<Class<?>> connectorClasses = finder.findAnnotatedClasses(Connector.class);
+        	
+        	// are we allowed to have more than one connector class? Not without a deployment descriptor
+        	if (connector.getResourceAdapter() == null || connector.getResourceAdapter().getResourceAdapterClass() == null ||  connector.getResourceAdapter().getResourceAdapterClass().length() == 0) {
+        		if (connectorClasses.size() == 0) {
+        			// fail some validation here too
+        		}
+        		
+        		if (connectorClasses.size() > 1) {
+        			// too many connector classes, this is against the spec
+        			// something like connectorModule.getValidation().fail(ejbName, "abstractAnnotatedAsBean", annotationClass.getSimpleName(), beanClass.get().getName());
+        		}
+        	}
+        	
+        	Class<?> connectorClass = null;
+        	if (connectorClasses.size() == 1) {
+        		connectorClass = connectorClasses.get(0);
+        	}
+        	
+        	if (connectorClasses.size() > 1) {
+        		for (Class<?> cls : connectorClasses) {
+        			if (cls.getName().equals(connector.getResourceAdapter().getResourceAdapterClass())) {
+        				connectorClass = cls;
+        				break;
+        			}
+        		}
+        	}
+        	
+        	if (connectorClass != null) {
+	    		if (connector.getResourceAdapter() == null) {
+	    			connector.setResourceAdapter(new ResourceAdapter());
+	    		}
+	    			
+	    		if (connector.getResourceAdapter().getResourceAdapterClass() == null || connector.getResourceAdapter().getResourceAdapterClass().length() == 0) {
+	    			connector.getResourceAdapter().setResourceAdapterClass(connectorClass.getName().toString());
+	    		}
+	    		
+	    		Connector connectorAnnotation = connectorClass.getAnnotation(Connector.class);
+	    		
+	    		connector.setDisplayNames(getTexts(connector.getDisplayNames(), connectorAnnotation.displayName()));
+	    		connector.setDescriptions(getTexts(connector.getDescriptions(), connectorAnnotation.description()));
+	    		
+	    		connector.setEisType(getString(connector.getEisType(), connectorAnnotation.eisType()));
+	    		connector.setVendorName(getString(connector.getVendorName(), connectorAnnotation.vendorName()));
+	    		connector.setResourceAdapterVersion(getString(connector.getResourceAdapterVersion(), connectorAnnotation.version()));
+	    		
+	    		if (connector.getIcons().isEmpty()) {
+	    			int smallIcons = connectorAnnotation.smallIcon().length;
+	    			int largeIcons = connectorAnnotation.largeIcon().length;
+	    			
+	    			for (int i = 0; i < smallIcons && i < largeIcons; i++) {
+	    				Icon icon = new Icon();
+	    				if (i < smallIcons) {
+	    					icon.setSmallIcon(connectorAnnotation.smallIcon()[i]);
+	    				}
+	    				
+	    				if (i < largeIcons) {
+	    					icon.setLargeIcon(connectorAnnotation.largeIcon()[i]);
+	    				}
+	    				
+	    				connector.getIcons().add(icon);
+	    			}
+	    		}
+	    		
+	    		if (connector.getLicense() == null) {
+	    			License license = new License();
+					connector.setLicense(license);
+					license.setLicenseRequired(connectorAnnotation.licenseRequired());
+	    		}
+	    		
+	    		connector.getLicense().setDescriptions(getTexts(connector.getLicense().getDescriptions(), connectorAnnotation.licenseDescription()));
+	    		
+	    		
+	    		SecurityPermission[] annotationSecurityPermissions = connectorAnnotation.securityPermissions();
+				List<org.apache.openejb.jee.SecurityPermission> securityPermission = connector.getResourceAdapter().getSecurityPermission();
+				if (securityPermission == null || securityPermission.size() == 0) {
+					for (SecurityPermission sp : annotationSecurityPermissions) {
+						org.apache.openejb.jee.SecurityPermission permission = new org.apache.openejb.jee.SecurityPermission();
+						permission.setSecurityPermissionSpec(sp.permissionSpec());
+						permission.setDescriptions(stringsToTexts(sp.description()));
+						securityPermission.add(permission);
+					}
+				}
+				
+				Class<? extends WorkContext>[] annotationRequiredWorkContexts = connectorAnnotation.requiredWorkContexts();
+				List<String> requiredWorkContext = connector.getRequiredWorkContext();
+				if (requiredWorkContext.size() == 0) {
+					for (Class<? extends WorkContext> cls : annotationRequiredWorkContexts) {
+						requiredWorkContext.add(cls.getName());
+					}
+				}
+				
+				OutboundResourceAdapter outboundResourceAdapter = connector.getResourceAdapter().getOutboundResourceAdapter();
+				if (outboundResourceAdapter == null) {
+					outboundResourceAdapter = new OutboundResourceAdapter();
+					connector.getResourceAdapter().setOutboundResourceAdapter(outboundResourceAdapter);
+				}
+				
+				List<AuthenticationMechanism> authenticationMechanisms = outboundResourceAdapter.getAuthenticationMechanism();
+				javax.resource.spi.AuthenticationMechanism[] authMechanisms = connectorAnnotation.authMechanisms();
+				if (authenticationMechanisms.size() == 0) {
+					for (javax.resource.spi.AuthenticationMechanism am : authMechanisms) {
+						AuthenticationMechanism authMechanism = new AuthenticationMechanism();
+						authMechanism.setAuthenticationMechanismType(am.authMechanism());
+						authMechanism.setCredentialInterface(am.credentialInterface().toString());
+						authMechanism.setDescriptions(stringsToTexts(am.description()));
+						
+						authenticationMechanisms.add(authMechanism);
+					}
+				}
+				
+				if (outboundResourceAdapter.getTransactionSupport() == null) {
+					outboundResourceAdapter.setTransactionSupport(TransactionSupportType.fromValue(connectorAnnotation.transactionSupport().toString()));
+				}
+				
+				if (outboundResourceAdapter.isReauthenticationSupport() == null) {
+					outboundResourceAdapter.setReauthenticationSupport(connectorAnnotation.reauthenticationSupport());
+				}
+        	} else {
+        		// we couldn't process a connector class - probably a validation issue which we should warn about.
+        	}
+
+        	// process @ConnectionDescription(s)
+        	List<Class<?>> classes = finder.findAnnotatedClasses(ConnectionDefinitions.class);
+        	for (Class<?> cls : classes) {
+				ConnectionDefinitions connectionDefinitionsAnnotation = cls.getAnnotation(ConnectionDefinitions.class);
+				ConnectionDefinition[] definitions = connectionDefinitionsAnnotation.value();
+				
+				for (ConnectionDefinition definition : definitions) {
+					processConnectionDescription(connector.getResourceAdapter(), definition, cls);
+				}
+			}
+        	
+        	classes = finder.findAnnotatedClasses(ConnectionDefinition.class);
+        	for (Class<?> cls : classes) {
+				ConnectionDefinition connectionDefinitionAnnotation = cls.getAnnotation(ConnectionDefinition.class);
+				processConnectionDescription(connector.getResourceAdapter(), connectionDefinitionAnnotation, cls);
+			}
+        	
+        	
+        	InboundResourceadapter inboundResourceAdapter = connector.getResourceAdapter().getInboundResourceAdapter();
+        	if (inboundResourceAdapter == null) {
+        		inboundResourceAdapter = new InboundResourceadapter();
+        		connector.getResourceAdapter().setInboundResourceAdapter(inboundResourceAdapter);
+        	}
+        	
+        	MessageAdapter messageAdapter = inboundResourceAdapter.getMessageAdapter();
+        	if (messageAdapter == null) {
+        		messageAdapter = new MessageAdapter();
+        		inboundResourceAdapter.setMessageAdapter(messageAdapter);
+        	}
+        	
+        	classes = finder.findAnnotatedClasses(Activation.class);
+        	for (Class<?> cls : classes) {
+        		MessageListener messageListener = null;
+        		Activation activationAnnotation = cls.getAnnotation(Activation.class);
+
+        		List<MessageListener> messageListeners = messageAdapter.getMessageListener();
+				for (MessageListener ml : messageListeners) {
+					if (cls.getName().equals(ml.getActivationSpec().getActivationSpecClass())) {
+						messageListener = ml;
+						break;
+					}
+				}
+				
+				if (messageListener == null) {
+					Class<?>[] listeners = activationAnnotation.messageListeners();
+					for (Class<?> listener : listeners) {
+						messageAdapter.addMessageListener(new MessageListener(listener.getName(), cls.getName()));	
+					}
+				}
+			}
+        	
+        	classes = finder.findAnnotatedClasses(AdministeredObject.class);
+        	List<AdminObject> adminObjects = connector.getResourceAdapter().getAdminObject();
+        	for (Class<?> cls : classes) {
+				AdministeredObject administeredObjectAnnotation = cls.getAnnotation(AdministeredObject.class);
+				Class[] adminObjectInterfaces = administeredObjectAnnotation.adminObjectInterfaces();
+				
+				AdminObject adminObject = null;
+				for (AdminObject admObj : adminObjects) {
+					if (admObj.getAdminObjectClass().equals(cls.getName())) {
+						adminObject = admObj;
+					}
+				}
+				
+				if (adminObject == null) {
+					for (Class iface : adminObjectInterfaces) {
+						AdminObject newAdminObject = new AdminObject();
+						newAdminObject.setAdminObjectClass(cls.getName());
+						newAdminObject.setAdminObjectInterface(iface.getName());
+						adminObjects.add(newAdminObject);	
+					}
+				}
+			}
+        	
+        	// need to make a list of classes to process for config properties
+        	
+        	// resource adapter
+        	String raCls = connector.getResourceAdapter().getResourceAdapterClass();
+        	process(connectorModule.getClassLoader(), raCls, connector.getResourceAdapter());
+        	
+        	// managedconnectionfactory
+        	if (connector.getResourceAdapter() != null && connector.getResourceAdapter().getOutboundResourceAdapter() != null) {
+	        	List<org.apache.openejb.jee.ConnectionDefinition> connectionDefinitions = connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition();
+	        	for (org.apache.openejb.jee.ConnectionDefinition connectionDefinition : connectionDefinitions) {
+	        		process(connectorModule.getClassLoader(), connectionDefinition.getManagedConnectionFactoryClass(), connectionDefinition);
+				}
+        	}
+        	
+        	// administeredobject
+        	if (connector.getResourceAdapter() != null) {
+	        	List<AdminObject> raAdminObjects = connector.getResourceAdapter().getAdminObject();
+	        	for (AdminObject raAdminObject : raAdminObjects) {
+					process(connectorModule.getClassLoader(), raAdminObject.getAdminObjectClass(), raAdminObject);
+				}
+        	}
+        	
+        	// activationspec
+        	if (connector.getResourceAdapter() != null && connector.getResourceAdapter().getInboundResourceAdapter() != null && connector.getResourceAdapter().getInboundResourceAdapter().getMessageAdapter() != null) {
+	        	List<MessageListener> messageListeners = connector.getResourceAdapter().getInboundResourceAdapter().getMessageAdapter().getMessageListener();
+	        	for (MessageListener messageListener : messageListeners) {
+					ActivationSpec activationSpec = messageListener.getActivationSpec();
+					process(connectorModule.getClassLoader(), activationSpec.getActivationSpecClass(), activationSpec);
+				}
+        	}
+        	
             return connectorModule;
         }
 
+		void process(ClassLoader cl, String cls, Object object) {
+
+			List<ConfigProperty> configProperties = null;
+			try {
+			// grab a list of ConfigProperty objects
+				configProperties = (List<ConfigProperty>) object.getClass().getDeclaredMethod("getConfigProperty").invoke(object);
+			} catch (Exception e) {
+			}
+			
+			if (configProperties == null) {
+				// can't get config properties
+				return;
+			}
+			
+			ClassLoader classLoader = cl;
+			if (classLoader == null) {
+				classLoader = Thread.currentThread().getContextClassLoader();
+			}
+			
+			final List<String> allowedTypes = Arrays.asList(new String[] { Boolean.class.getName(), String.class.getName(), Integer.class.getName(), Double.class.getName(), Byte.class.getName(), Short.class.getName(), Long.class.getName(), Float.class.getName(), Character.class.getName()});
+			
+			try {
+				Class<?> clazz = classLoader.loadClass(cls);
+				
+				// add any annotated method/fields
+				Field[] declaredFields = clazz.getDeclaredFields();
+				for (Field field : declaredFields) {
+					javax.resource.spi.ConfigProperty annotation = field.getAnnotation(javax.resource.spi.ConfigProperty.class);
+					if (annotation == null) {
+						continue;
+					}
+					
+					String name = field.getName();
+					if (! containsConfigProperty(configProperties, name)) {
+						String type = getConfigPropertyType(annotation, field.getType());
+						
+						if (type != null) {
+							ConfigProperty configProperty = new ConfigProperty();
+							configProperties.add(configProperty);
+							
+							configProperty.setConfigPropertyName(name);
+							configProperty.setConfigPropertyType(type);
+							configProperty.setConfigPropertyConfidential(annotation.confidential());
+							configProperty.setConfigPropertyIgnore(annotation.ignore());
+							configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
+							configProperty.setConfigPropertyValue(annotation.defaultValue());
+						}
+					}
+				}
+				
+				Method[] declaredMethods = clazz.getDeclaredMethods();
+				for (Method method : declaredMethods) {
+					if (! method.getName().startsWith("set")) {
+						continue;
+					}
+					
+					if (! (method.getParameterTypes().length == 1)) {
+						continue;
+					}
+					
+					javax.resource.spi.ConfigProperty annotation = method.getAnnotation(javax.resource.spi.ConfigProperty.class);
+					if (annotation == null) {
+						continue;
+					}
+					
+					String name = method.getName();
+					
+					
+					if (! containsConfigProperty(configProperties, name)) {
+						String type = getConfigPropertyType(annotation, method.getParameterTypes()[0]);
+						
+						if (type != null) {
+							ConfigProperty configProperty = new ConfigProperty();
+							configProperties.add(configProperty);
+							
+							configProperty.setConfigPropertyName(name);
+							configProperty.setConfigPropertyType(type);
+							configProperty.setConfigPropertyConfidential(annotation.confidential());
+							configProperty.setConfigPropertyIgnore(annotation.ignore());
+							configProperty.setConfigPropertySupportsDynamicUpdates(annotation.supportsDynamicUpdates());
+							configProperty.setConfigPropertyValue(annotation.defaultValue());
+							configProperty.setDescriptions(stringsToTexts(annotation.description()));
+						}
+					}
+				}
+				
+				// add any introspected properties
+				BeanInfo beanInfo = Introspector.getBeanInfo(clazz);
+				PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
+				
+				for (PropertyDescriptor propertyDescriptor : propertyDescriptors) {
+					String name = propertyDescriptor.getName();
+					Class<?> type = propertyDescriptor.getPropertyType();
+					if (type.isPrimitive()) {
+						type = getWrapper(type.getName());
+					}
+					
+					if (! allowedTypes.contains(type.getName())) {
+						continue;
+					}
+					
+					if (! containsConfigProperty(configProperties, name)) {
+						if (type != null) {
+							ConfigProperty configProperty = new ConfigProperty();
+							configProperties.add(configProperty);
+							
+							configProperty.setConfigPropertyName(name);
+							configProperty.setConfigPropertyType(type.getName());
+							configProperty.setConfigPropertyConfidential(false);
+							configProperty.setConfigPropertyIgnore(false);
+							configProperty.setConfigPropertySupportsDynamicUpdates(false);
+						}
+					}
+				}
+			} catch (Exception  e) {
+				e.printStackTrace();
+			}
+		}
+
+		private String getConfigPropertyType(javax.resource.spi.ConfigProperty annotation, Class<?> type) {
+			Class<?> t = annotation.type();
+			if (t == null || t.equals(Object.class)) {
+				t = type;
+			}
+			
+			if (t.isPrimitive()) {
+				t = getWrapper(t.getName());
+			}
+			
+			return t.getName();
+		}
+
+		private boolean containsConfigProperty(List<ConfigProperty> configProperties, String name) {
+			for (ConfigProperty configProperty : configProperties) {
+				if (configProperty.getConfigPropertyName().equals(name)) {
+					return true;
+				}
+			}
+			
+			return false;
+		}
+
+		private Class<?> getWrapper(String primitiveType) {
+			final Map<String,Class<?>> builtInMap = new HashMap<String,Class<?>>();{
+			       builtInMap.put("int", Integer.class);
+			       builtInMap.put("long", Long.class);
+			       builtInMap.put("double", Double.class);
+			       builtInMap.put("float", Float.class);
+			       builtInMap.put("bool", Boolean.class);
+			       builtInMap.put("char", Character.class);
+			       builtInMap.put("byte", Byte.class);
+			       builtInMap.put("void", Void.class);
+			       builtInMap.put("short", Short.class);
+			}
+			
+			return builtInMap.get(primitiveType);
+		}
+
+		private void processConnectionDescription(ResourceAdapter resourceAdapter, ConnectionDefinition connectionDefinitionAnnotation, Class<?> cls) {
+			// try and find the managed connection factory
+			
+			OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.getOutboundResourceAdapter();
+			if (outboundResourceAdapter == null) {
+				outboundResourceAdapter = new OutboundResourceAdapter();
+				resourceAdapter.setOutboundResourceAdapter(outboundResourceAdapter);
+			}
+			
+			List<org.apache.openejb.jee.ConnectionDefinition> connectionDefinition = outboundResourceAdapter.getConnectionDefinition();
+			
+			org.apache.openejb.jee.ConnectionDefinition definition = null;
+			for (org.apache.openejb.jee.ConnectionDefinition cd : connectionDefinition) {
+				if (cd.getManagedConnectionFactoryClass().equals(cls.getName())) {
+					definition = cd;
+					break;
+				}
+			}
+			
+			if (definition == null) {
+				definition = new org.apache.openejb.jee.ConnectionDefinition();
+				outboundResourceAdapter.getConnectionDefinition().add(definition);
+			}
+			
+			if (definition.getManagedConnectionFactoryClass() == null) {
+				definition.setManagedConnectionFactoryClass(cls.getName());
+			}
+			
+			if (definition.getConnectionInterface() == null) {
+				definition.setConnectionInterface(connectionDefinitionAnnotation.connection().getName());
+			}
+			
+			if (definition.getConnectionImplClass() == null) {
+				definition.setConnectionImplClass(connectionDefinitionAnnotation.connectionImpl().getName());
+			}
+			
+			if (definition.getConnectionFactoryInterface() == null) {
+				definition.setConnectionFactoryInterface(connectionDefinitionAnnotation.connectionFactory().getName());
+			}
+			
+			if (definition.getConnectionFactoryImplClass() == null) {
+				definition.setConnectionFactoryImplClass(connectionDefinitionAnnotation.connectionFactoryImpl().getName());
+			}
+		}
+
+		private Text[] stringsToTexts(String[] strings) {
+			if (strings == null) {
+				return null;
+			}
+			
+			Text[] result = new Text[strings.length];
+			for (int i = 0; i < result.length; i++) {
+				result[i] = new Text();
+				result[i].setValue(strings[i]);
+			}
+			
+			return result;
+		}
+
+		private String getString(String descriptorString, String annotationString) {
+			if (descriptorString != null && descriptorString.length() > 0) {
+				return descriptorString;
+			}
+			
+			if (annotationString != null && annotationString.length() > 0) {
+				return annotationString;
+			}
+			
+			return null;
+		}
+
+		private Text[] getTexts(Text[] originalTexts, String[] newStrings) {
+			if (newStrings != null && newStrings.length > 0 && (originalTexts == null || originalTexts.length == 0)) {
+				Text[] texts = new Text[newStrings.length];
+				for (int i = 0; i < newStrings.length; i++) {
+					texts[i] = new Text(null, newStrings[i]);
+				}
+
+				return texts;
+			} else {
+				return originalTexts;
+			}
+		}
+
         public WebModule deploy(WebModule webModule) throws OpenEJBException {
             WebApp webApp = webModule.getWebApp();
             if (webApp != null && (webApp.isMetadataComplete())) return webModule;

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/ConnectorModule.java Fri Jun 10 23:35:21 2011
@@ -17,6 +17,7 @@
 package org.apache.openejb.config;
 
 import org.apache.openejb.jee.Connector;
+import org.apache.xbean.finder.IAnnotationFinder;
 
 import java.io.File;
 import java.net.URI;
@@ -40,6 +41,8 @@ public class ConnectorModule extends Mod
     private final Set<String> watchedResources = new TreeSet<String>();
 
     private ID id;
+
+	private IAnnotationFinder finder;
     
     public ConnectorModule(Connector connector) {
         this(connector, Thread.currentThread().getContextClassLoader(), null, null);
@@ -105,5 +108,11 @@ public class ConnectorModule extends Mod
                 '}';
     }
 
-
+	public IAnnotationFinder getFinder() {
+		return finder;
+	}
+
+	public void setFinder(IAnnotationFinder finder) {
+		this.finder = finder;
+	}
 }

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/FinderFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/FinderFactory.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/FinderFactory.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/config/FinderFactory.java Fri Jun 10 23:35:21 2011
@@ -49,6 +49,12 @@ public class FinderFactory {
             final ClassLoader webClassLoader = webModule.getClassLoader();
             return new AnnotationFinder(new ClasspathArchive(webClassLoader, webModule.getUrls())).link();
         }
+        
+        if (module instanceof ConnectorModule) {
+        	ConnectorModule connectorModule = (ConnectorModule) module;
+        	final ClassLoader connectorClassLoader = connectorModule.getClassLoader();
+        	return new AnnotationFinder(new ClasspathArchive(connectorClassLoader, connectorModule.getLibraries())).link();
+        }
 
         if (module.getJarLocation() != null) {
             String location = module.getJarLocation();

Modified: openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/GeronimoConnectionManagerFactory.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/GeronimoConnectionManagerFactory.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/GeronimoConnectionManagerFactory.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/main/java/org/apache/openejb/resource/GeronimoConnectionManagerFactory.java Fri Jun 10 23:35:21 2011
@@ -28,6 +28,7 @@ import org.apache.geronimo.connector.out
 import org.apache.geronimo.connector.outbound.connectionmanagerconfig.XATransactions;
 import org.apache.geronimo.transaction.manager.RecoverableTransactionManager;
 
+import javax.resource.spi.ManagedConnectionFactory;
 import javax.transaction.TransactionManager;
 
 public class GeronimoConnectionManagerFactory   {
@@ -48,8 +49,19 @@ public class GeronimoConnectionManagerFa
     private boolean allConnectionsEqual = true;
     private int connectionMaxWaitMilliseconds = 5000;
     private int connectionMaxIdleMinutes = 15;
+    private ManagedConnectionFactory mcf;
 
-    public String getName() {
+    
+    
+    public ManagedConnectionFactory getMcf() {
+		return mcf;
+	}
+
+	public void setMcf(ManagedConnectionFactory mcf) {
+		this.mcf = mcf;
+	}
+
+	public String getName() {
         return name;
     }
 
@@ -150,6 +162,7 @@ public class GeronimoConnectionManagerFa
                 null,
                 new AutoConnectionTracker(),
                 (RecoverableTransactionManager)transactionManager,
+                mcf,
                 name,
                 classLoader);
         return connectionManager;

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/config/AnnotationDeployerTest.java Fri Jun 10 23:35:21 2011
@@ -16,18 +16,62 @@
  */
 package org.apache.openejb.config;
 
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+
+import javax.annotation.Resource;
+import javax.ejb.ApplicationException;
+import javax.ejb.Local;
+import javax.ejb.LocalBean;
+import javax.ejb.Stateless;
+import javax.naming.NamingException;
+import javax.naming.Reference;
+import javax.resource.Referenceable;
+import javax.resource.ResourceException;
+import javax.resource.cci.MessageListener;
+import javax.resource.cci.Record;
+import javax.resource.spi.Activation;
+import javax.resource.spi.ActivationSpec;
+import javax.resource.spi.AdministeredObject;
+import javax.resource.spi.AuthenticationMechanism;
+import javax.resource.spi.AuthenticationMechanism.CredentialInterface;
+import javax.resource.spi.BootstrapContext;
+import javax.resource.spi.ConnectionDefinition;
+import javax.resource.spi.ConnectionManager;
+import javax.resource.spi.ConnectionRequestInfo;
+import javax.resource.spi.InvalidPropertyException;
+import javax.resource.spi.ManagedConnection;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import javax.resource.spi.ResourceAdapterInternalException;
+import javax.resource.spi.SecurityPermission;
+import javax.resource.spi.TransactionSupport.TransactionSupportLevel;
+import javax.resource.spi.endpoint.MessageEndpointFactory;
+import javax.resource.spi.work.WorkContext;
+import javax.security.auth.Subject;
+import javax.transaction.xa.XAResource;
+
 import org.apache.openejb.assembler.classic.AppInfo;
 import org.apache.openejb.assembler.classic.Assembler;
 import org.apache.openejb.assembler.classic.ClientInfo;
-import org.apache.openejb.assembler.classic.EjbJarInfo;
 import org.apache.openejb.jee.AssemblyDescriptor;
+import org.apache.openejb.jee.ConfigProperty;
+import org.apache.openejb.jee.Connector;
 import org.apache.openejb.jee.EjbJar;
-
-import static org.hamcrest.CoreMatchers.*;
-import static org.junit.Assert.*;
-
 import org.apache.openejb.jee.EnterpriseBean;
 import org.apache.openejb.jee.SessionBean;
+import org.apache.openejb.jee.TransactionSupportType;
 import org.apache.xbean.finder.Annotated;
 import org.apache.xbean.finder.AnnotationFinder;
 import org.apache.xbean.finder.ClassFinder;
@@ -35,14 +79,6 @@ import org.apache.xbean.finder.archive.C
 import org.junit.Assert;
 import org.junit.Test;
 
-import javax.annotation.Resource;
-import javax.ejb.ApplicationException;
-import javax.ejb.Local;
-import javax.ejb.LocalBean;
-import javax.ejb.Stateless;
-import java.lang.reflect.Method;
-import java.util.List;
-
 /**
  * @version $Rev$ $Date$
  */
@@ -182,8 +218,79 @@ public class AnnotationDeployerTest {
         assert bean != null;
         assert (((SessionBean)bean).getLocalBean() == null);        
     }
+    
+    @Test
+    public void testResourceAdapter() throws Exception {
+    	ConnectorModule connectorModule = testConnectorModule();
+    	AnnotationDeployer.DiscoverAnnotatedBeans discvrAnnBeans = new AnnotationDeployer.DiscoverAnnotatedBeans();
+    	discvrAnnBeans.deploy(connectorModule);
+    	
+    	Connector connector = connectorModule.getConnector();
+    	Assert.assertEquals("displayName", connector.getDisplayName());
+    	Assert.assertEquals("description", connector.getDescription());
+    	Assert.assertEquals("eisType", connector.getEisType());
+    	Assert.assertEquals("vendorName", connector.getVendorName());
+    	Assert.assertEquals("version", connector.getResourceAdapterVersion());
+    	Assert.assertEquals("smallIcon", connector.getIcon().getSmallIcon());
+    	Assert.assertEquals("largeIcon", connector.getIcon().getLargeIcon());
+    	Assert.assertEquals("licenseDescription", connector.getLicense().getDescription());
+    	Assert.assertEquals(true, connector.getLicense().isLicenseRequired());
+    	
+    	List<org.apache.openejb.jee.SecurityPermission> securityPermission = connector.getResourceAdapter().getSecurityPermission();
+    	Assert.assertEquals("description", securityPermission.get(0).getDescription());
+    	Assert.assertEquals("permissionSpec", securityPermission.get(0).getSecurityPermissionSpec());
+    	
+    	List<String> requiredWorkContext = connector.getRequiredWorkContext();
+    	Assert.assertEquals(TestWorkContext.class.getName(), requiredWorkContext.get(0));
+    	
+    	List<org.apache.openejb.jee.AuthenticationMechanism> authenticationMechanism = connector.getResourceAdapter().getOutboundResourceAdapter().getAuthenticationMechanism();
+    	Assert.assertEquals("authMechanism", authenticationMechanism.get(0).getAuthenticationMechanismType());
+    	Assert.assertEquals(CredentialInterface.GenericCredential.toString(), authenticationMechanism.get(0).getCredentialInterface());
+    	Assert.assertEquals("description", authenticationMechanism.get(0).getDescription());
+    	
+    	Assert.assertEquals(TransactionSupportType.NO_TRANSACTION, connector.getResourceAdapter().getOutboundResourceAdapter().getTransactionSupport());
+    	Assert.assertEquals(true, connector.getResourceAdapter().getOutboundResourceAdapter().isReauthenticationSupport());
+    	
+    	Assert.assertEquals(Connection.class.getName(), connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition().get(0).getConnectionInterface());
+    	Assert.assertEquals(ConnectionImpl.class.getName(), connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition().get(0).getConnectionImplClass());
+    	Assert.assertEquals(ConnectionFactory.class.getName(), connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition().get(0).getConnectionFactoryInterface());
+    	Assert.assertEquals(ConnectionFactoryImpl.class.getName(), connector.getResourceAdapter().getOutboundResourceAdapter().getConnectionDefinition().get(0).getConnectionFactoryImplClass());
+    	
+    	Assert.assertEquals(TestActivation.class.getName(), connector.getResourceAdapter().getInboundResourceAdapter().getMessageAdapter().getMessageListener().get(0).getActivationSpec().getActivationSpecClass());
+    	Assert.assertEquals(TestMessageListener.class.getName(), connector.getResourceAdapter().getInboundResourceAdapter().getMessageAdapter().getMessageListener().get(0).getMessageListenerType());
+    	
+    	Assert.assertEquals(TestAdminObject.class.getName(), connector.getResourceAdapter().getAdminObject().get(0).getAdminObjectClass());
+    	Assert.assertEquals(TestAdminObjectInterface.class.getName(), connector.getResourceAdapter().getAdminObject().get(0).getAdminObjectInterface());
+    }
+
+    private ConnectorModule testConnectorModule() {
+    	Connector connector = new Connector();
+    	ConnectorModule connectorModule = new ConnectorModule(connector);
+        connectorModule.setFinder(new ClassFinder(TestConnector.class, TestManagedConnectionFactory.class, TestActivation.class, TestAdminObject.class));
+        return connectorModule;
+    }
+    
+    @Test
+    public void testConfigProperties() throws Exception {
+    	ClassFinder finder = new ClassFinder(TestAdminObject.class);
+    	
+    	final List<ConfigProperty> configProperty = new ArrayList<ConfigProperty>();
+    	
+		Object object = new Object() {
+			 public List<ConfigProperty> getConfigProperty() {
+		        return configProperty;
+		    }
+		};
+		
+		new AnnotationDeployer.DiscoverAnnotatedBeans().process(null, TestAdminObject.class.getName(), object);
+		Assert.assertEquals(2, configProperty.size());
+		Assert.assertEquals("myNumber", configProperty.get(0).getConfigPropertyName());
+		Assert.assertEquals("java.lang.Integer", configProperty.get(0).getConfigPropertyType());
+		Assert.assertEquals("myProperty", configProperty.get(1).getConfigPropertyName());
+		Assert.assertEquals("java.lang.String", configProperty.get(1).getConfigPropertyType());
+    }
 
-    @ApplicationException(rollback = true)
+	@ApplicationException(rollback = true)
     public abstract class BusinessException extends Exception {
     }
 
@@ -233,4 +340,143 @@ public class AnnotationDeployerTest {
         public void emerald(){}
     }
 
-}
+    @javax.resource.spi.Connector(description="description", 
+		displayName="displayName", smallIcon="smallIcon",
+		largeIcon="largeIcon", vendorName="vendorName",
+		eisType="eisType",
+		version="version",
+		licenseDescription={"licenseDescription"},
+		licenseRequired=true,
+		authMechanisms = {@AuthenticationMechanism(authMechanism="authMechanism", 
+				credentialInterface=CredentialInterface.GenericCredential, description={"description"})},
+		reauthenticationSupport=true,
+		securityPermissions = {@SecurityPermission(permissionSpec="permissionSpec", description="description")},
+		transactionSupport = TransactionSupportLevel.NoTransaction,
+		requiredWorkContexts = {TestWorkContext.class}
+    )
+    public static class TestConnector implements ResourceAdapter {
+
+		public void endpointActivation(MessageEndpointFactory mef, ActivationSpec spec) throws ResourceException {
+		}
+
+		public void endpointDeactivation(MessageEndpointFactory mef, ActivationSpec spec) {
+		}
+
+		public XAResource[] getXAResources(ActivationSpec[] specs) throws ResourceException {
+			return null;
+		}
+
+		public void start(BootstrapContext ctx) throws ResourceAdapterInternalException {
+		}
+
+		public void stop() {
+		}
+    }
+    
+    @ConnectionDefinition(connection=Connection.class, connectionFactory=ConnectionFactory.class, connectionImpl=ConnectionImpl.class, connectionFactoryImpl=ConnectionFactoryImpl.class)
+    public static class TestManagedConnectionFactory implements ManagedConnectionFactory {
+
+		public Object createConnectionFactory() throws ResourceException {
+			return null;
+		}
+
+		public Object createConnectionFactory(ConnectionManager connectionManager) throws ResourceException {
+			return null;
+		}
+
+		public ManagedConnection createManagedConnection(Subject subject, ConnectionRequestInfo connectionRequestInfo) throws ResourceException {
+			return null;
+		}
+
+		public PrintWriter getLogWriter() throws ResourceException {
+			return null;
+		}
+
+		public ManagedConnection matchManagedConnections(Set managedConnections, Subject subject, ConnectionRequestInfo connectionRequestInfo) throws ResourceException {
+			return null;
+		}
+
+		public void setLogWriter(PrintWriter writer) throws ResourceException {
+		}
+    	
+    }
+    
+    public static class TestWorkContext implements WorkContext {
+		public String getDescription() {
+			return "Description";
+		}
+
+		public String getName() {
+			return "Name";
+		}
+    }
+ 
+    public static interface Connection {
+    }
+    
+    public static class ConnectionImpl implements Connection {
+    }
+    
+    public static interface ConnectionFactory extends Serializable, Referenceable {
+    }
+    
+    public static class ConnectionFactoryImpl implements ConnectionFactory {
+
+		public void setReference(Reference reference) {
+		}
+
+		public Reference getReference() throws NamingException {
+			return null;
+		}
+    }
+    
+    @Activation(messageListeners={TestMessageListener.class})
+    public static class TestActivation implements ActivationSpec, Serializable {
+
+		public ResourceAdapter getResourceAdapter() {
+			return null;
+		}
+
+		public void setResourceAdapter(ResourceAdapter arg0) throws ResourceException {
+		}
+
+		public void validate() throws InvalidPropertyException {
+		}
+    }
+    
+    public static class TestMessageListener implements MessageListener {
+		public Record onMessage(Record arg0) throws ResourceException {
+			return null;
+		}
+    }
+    
+    public static interface TestAdminObjectInterface {
+    }
+    
+    public static interface SomeOtherInterface {
+    }
+    
+    @AdministeredObject(adminObjectInterfaces={TestAdminObjectInterface.class})
+    public static class TestAdminObject implements TestAdminObjectInterface, SomeOtherInterface {
+    	private String myProperty;
+    	
+    	@javax.resource.spi.ConfigProperty(ignore=true)
+    	private int myNumber;
+
+		public String getMyProperty() {
+			return myProperty;
+		}
+
+		public void setMyProperty(String myProperty) {
+			this.myProperty = myProperty;
+		}
+
+		public int getMyNumber() {
+			return myNumber;
+		}
+
+		public void setMyNumber(int myNumber) {
+			this.myNumber = myNumber;
+		}
+    }
+ }

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/JmsProxyTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/JmsProxyTest.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/JmsProxyTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/JmsProxyTest.java Fri Jun 10 23:35:21 2011
@@ -17,6 +17,7 @@
  */
 package org.apache.openejb.core.mdb;
 
+import java.util.Collections;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 import javax.jms.Connection;
@@ -32,6 +33,8 @@ import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.geronimo.connector.GeronimoBootstrapContext;
 import org.apache.geronimo.connector.work.GeronimoWorkManager;
+import org.apache.geronimo.connector.work.TransactionContextHandler;
+import org.apache.geronimo.connector.work.WorkContextHandler;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.resource.activemq.ActiveMQResourceAdapter;
@@ -58,10 +61,12 @@ public class JmsProxyTest extends TestCa
         Executor threadPool = Executors.newFixedThreadPool(30);
 
         // create a work manager which ActiveMQ uses to dispatch message delivery jobs
-        WorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, transactionManager);
+        
+        TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(transactionManager);
+        GeronimoWorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
 
         // wrap the work mananger and transaction manager in a bootstrap context (connector spec thing)
-        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager);
+        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager, transactionManager);
 
         // start the resource adapter
         try {

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/JmsTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/JmsTest.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/JmsTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/JmsTest.java Fri Jun 10 23:35:21 2011
@@ -18,6 +18,7 @@
 package org.apache.openejb.core.mdb;
 
 import java.io.Serializable;
+import java.util.Collections;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.Executor;
@@ -40,6 +41,8 @@ import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.geronimo.connector.GeronimoBootstrapContext;
 import org.apache.geronimo.connector.work.GeronimoWorkManager;
+import org.apache.geronimo.connector.work.TransactionContextHandler;
+import org.apache.geronimo.connector.work.WorkContextHandler;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.resource.activemq.ActiveMQResourceAdapter;
@@ -67,10 +70,12 @@ public class JmsTest extends TestCase {
         Executor threadPool = Executors.newFixedThreadPool(30);
 
         // create a work manager which ActiveMQ uses to dispatch message delivery jobs
-        WorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, transactionManager);
+        
+        TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(transactionManager);
+        GeronimoWorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
 
         // wrap the work mananger and transaction manager in a bootstrap context (connector spec thing)
-        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager);
+        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager, transactionManager);
 
         // start the resource adapter
         try {

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/MdbTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/MdbTest.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/MdbTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/MdbTest.java Fri Jun 10 23:35:21 2011
@@ -19,6 +19,7 @@ package org.apache.openejb.core.mdb;
 
 import java.io.Serializable;
 import java.lang.reflect.Method;
+import java.util.Collections;
 import java.util.Map;
 import java.util.TreeMap;
 import java.util.concurrent.Executor;
@@ -47,6 +48,8 @@ import org.apache.activemq.ActiveMQConne
 import org.apache.activemq.ra.ActiveMQActivationSpec;
 import org.apache.geronimo.connector.GeronimoBootstrapContext;
 import org.apache.geronimo.connector.work.GeronimoWorkManager;
+import org.apache.geronimo.connector.work.TransactionContextHandler;
+import org.apache.geronimo.connector.work.WorkContextHandler;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.resource.activemq.ActiveMQResourceAdapter;
@@ -73,10 +76,11 @@ public class MdbTest extends TestCase {
         Executor threadPool = Executors.newFixedThreadPool(30);
 
         // create a work manager which ActiveMQ uses to dispatch message delivery jobs
-        WorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, transactionManager);
+        TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(transactionManager);
+        GeronimoWorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
 
         // wrap the work mananger and transaction manager in a bootstrap context (connector spec thing)
-        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager);
+        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager, transactionManager);
 
         // start the resource adapter
         try {

Modified: openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/SimpleJmsTest.java
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/SimpleJmsTest.java?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/SimpleJmsTest.java (original)
+++ openejb/trunk/openejb3/container/openejb-core/src/test/java/org/apache/openejb/core/mdb/SimpleJmsTest.java Fri Jun 10 23:35:21 2011
@@ -17,6 +17,7 @@
  */
 package org.apache.openejb.core.mdb;
 
+import java.util.Collections;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
 import javax.jms.Connection;
@@ -32,6 +33,8 @@ import junit.framework.TestCase;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.geronimo.connector.GeronimoBootstrapContext;
 import org.apache.geronimo.connector.work.GeronimoWorkManager;
+import org.apache.geronimo.connector.work.TransactionContextHandler;
+import org.apache.geronimo.connector.work.WorkContextHandler;
 import org.apache.geronimo.transaction.manager.GeronimoTransactionManager;
 import org.apache.openejb.OpenEJBException;
 import org.apache.openejb.resource.activemq.ActiveMQResourceAdapter;
@@ -58,10 +61,12 @@ public class SimpleJmsTest extends TestC
         Executor threadPool = Executors.newFixedThreadPool(30);
 
         // create a work manager which ActiveMQ uses to dispatch message delivery jobs
-        WorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, transactionManager);
+
+        TransactionContextHandler txWorkContextHandler = new TransactionContextHandler(transactionManager);
+        GeronimoWorkManager workManager = new GeronimoWorkManager(threadPool, threadPool, threadPool, Collections.<WorkContextHandler>singletonList(txWorkContextHandler));
 
         // wrap the work mananger and transaction manager in a bootstrap context (connector spec thing)
-        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager);
+        BootstrapContext bootstrapContext = new GeronimoBootstrapContext(workManager, transactionManager, transactionManager);
 
         // start the resource adapter
         try {

Modified: openejb/trunk/openejb3/pom.xml
URL: http://svn.apache.org/viewvc/openejb/trunk/openejb3/pom.xml?rev=1134482&r1=1134481&r2=1134482&view=diff
==============================================================================
--- openejb/trunk/openejb3/pom.xml (original)
+++ openejb/trunk/openejb3/pom.xml Fri Jun 10 23:35:21 2011
@@ -131,7 +131,7 @@
     <junit.version>4.8.1</junit.version>
     <org.apache.axis2.version>1.4.1</org.apache.axis2.version>
     <org.apache.openwebbeans.version>1.1.1-SNAPSHOT</org.apache.openwebbeans.version>
-    <geronimo.connector.version>2.2.2-SNAPSHOT</geronimo.connector.version>
+    <geronimo.connector.version>3.1.1-SNAPSHOT</geronimo.connector.version>
   </properties>
 
   <build>



Mime
View raw message