geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r1076881 [1/3] - in /geronimo/sandbox/djencks/txmanager: ./ connector-itests/ connector-itests/src/test/java/org/apache/geronimo/components/connector/itests/ connector-itests/src/test/resources/ connector-itests/src/test/resources/deployert...
Date Thu, 03 Mar 2011 23:29:23 GMT
Author: djencks
Date: Thu Mar  3 23:29:22 2011
New Revision: 1076881

URL: http://svn.apache.org/viewvc?rev=1076881&view=rev
Log:
intermediate commit, some connector-builder compiles, seems to have jaxb classloading problems
running in osgi

Added:
    geronimo/sandbox/djencks/txmanager/connector-itests/src/test/java/org/apache/geronimo/components/connector/itests/DeployerTest.java
      - copied, changed from r1074356, geronimo/sandbox/djencks/txmanager/connector-itests/src/test/java/org/apache/geronimo/components/connector/itests/ConnectorTest.java
    geronimo/sandbox/djencks/txmanager/connector-itests/src/test/resources/
    geronimo/sandbox/djencks/txmanager/connector-itests/src/test/resources/deployertest/
    geronimo/sandbox/djencks/txmanager/connector-itests/src/test/resources/deployertest/geronimo-ra.xml
  (props changed)
      - copied unchanged from r1075183, geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/test/resources/connector_1_6/geronimo-ra.xml
    geronimo/sandbox/djencks/txmanager/connector-itests/src/test/resources/deployertest/ra.xml
  (props changed)
      - copied unchanged from r1074356, geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/test/resources/connector_1_6/ra.xml
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AnnotationProcessor.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/DeploymentExtender.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/ArtifactType.java
  (with props)
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/EnvironmentType.java
  (with props)
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/xsd/geronimo-module-1.2.xsd
      - copied, changed from r1075213, geronimo/server/trunk/framework/modules/geronimo-service-builder/src/main/xsd/geronimo-module-1.2.xsd
Removed:
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorPlanRectifier.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/dconfigbean/
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/jsr88/
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/test/resources/data/old-schema-plan.xml
Modified:
    geronimo/sandbox/djencks/txmanager/connector-itests/pom.xml
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/pom.xml
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/AdminobjectInstanceType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/AdminobjectType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/ConfigPropertySettingType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/ConnectionDefinitionType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/ConnectiondefinitionInstanceType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/ConnectionmanagerType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/ConnectorType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/DescriptionType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/EmptyType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/ObjectFactory.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/OutboundResourceadapterType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/PartitionedpoolType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/ResourceadapterInstanceType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/ResourceadapterType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/SinglepoolType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/XatransactionType.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/plan/package-info.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/xsd/geronimo-connector-1.2.xsd
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/InfoBuilderTest.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/test/java/org/apache/geronimo/connector/deployment/PlanParsingTest.java
    geronimo/sandbox/djencks/txmanager/geronimo-connector/src/main/java/org/apache/geronimo/connector/extender/ConnectorExtender.java
    geronimo/sandbox/djencks/txmanager/org.apache.geronimo.transaction.kar/pom.xml
    geronimo/sandbox/djencks/txmanager/pom.xml

Modified: geronimo/sandbox/djencks/txmanager/connector-itests/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/txmanager/connector-itests/pom.xml?rev=1076881&r1=1076880&r2=1076881&view=diff
==============================================================================
--- geronimo/sandbox/djencks/txmanager/connector-itests/pom.xml (original)
+++ geronimo/sandbox/djencks/txmanager/connector-itests/pom.xml Thu Mar  3 23:29:22 2011
@@ -36,6 +36,11 @@
         </dependency>
         <dependency>
             <groupId>org.apache.geronimo.components</groupId>
+            <artifactId>geronimo-connector-builder-1_6</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.components</groupId>
             <artifactId>geronimo-transaction</artifactId>
             <scope>test</scope>
         </dependency>
@@ -120,7 +125,56 @@
             <scope>test</scope>
         </dependency>
 
-    </dependencies>
+        <dependency>
+             <groupId>org.apache.geronimo.bundles</groupId>
+             <artifactId>jaxb-impl</artifactId>
+            <scope>test</scope>
+         </dependency>
+         <dependency>
+             <groupId>org.apache.geronimo.bundles</groupId>
+             <artifactId>woodstox</artifactId>
+             <scope>test</scope>
+         </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-activation_1.1_spec</artifactId>
+            <scope>test</scope>
+        </dependency>
+         <dependency>
+             <groupId>org.apache.geronimo.specs</groupId>
+             <artifactId>geronimo-jaxb_2.2_spec</artifactId>
+             <scope>test</scope>
+         </dependency>
+         <dependency>
+             <groupId>org.apache.geronimo.specs</groupId>
+             <artifactId>geronimo-stax-api_1.2_spec</artifactId>
+             <scope>test</scope>
+         </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-osgi-registry</artifactId>
+            <version>1.0</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.xbean</groupId>
+            <artifactId>xbean-finder</artifactId>
+            <scope>test</scope>
+            <version>3.8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.xbean</groupId>
+            <artifactId>xbean-bundleutils</artifactId>
+            <scope>test</scope>
+            <version>3.8-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>asm</groupId>
+            <artifactId>asm-all</artifactId>
+            <scope>test</scope>
+            <version>3.2</version>
+        </dependency>
+     </dependencies>
 
     <build>
         <plugins>

Copied: geronimo/sandbox/djencks/txmanager/connector-itests/src/test/java/org/apache/geronimo/components/connector/itests/DeployerTest.java
(from r1074356, geronimo/sandbox/djencks/txmanager/connector-itests/src/test/java/org/apache/geronimo/components/connector/itests/ConnectorTest.java)
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/txmanager/connector-itests/src/test/java/org/apache/geronimo/components/connector/itests/DeployerTest.java?p2=geronimo/sandbox/djencks/txmanager/connector-itests/src/test/java/org/apache/geronimo/components/connector/itests/DeployerTest.java&p1=geronimo/sandbox/djencks/txmanager/connector-itests/src/test/java/org/apache/geronimo/components/connector/itests/ConnectorTest.java&r1=1074356&r2=1076881&rev=1076881&view=diff
==============================================================================
--- geronimo/sandbox/djencks/txmanager/connector-itests/src/test/java/org/apache/geronimo/components/connector/itests/ConnectorTest.java
(original)
+++ geronimo/sandbox/djencks/txmanager/connector-itests/src/test/java/org/apache/geronimo/components/connector/itests/DeployerTest.java
Thu Mar  3 23:29:22 2011
@@ -6,10 +6,13 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.ObjectOutput;
 import java.io.ObjectOutputStream;
+import java.net.URL;
 
 import javax.resource.ResourceException;
 import javax.resource.spi.BootstrapContext;
 import javax.resource.spi.ResourceAdapter;
+import org.apache.geronimo.connector.ConnectionManagerContainer;
+import org.apache.geronimo.connector.ConnectionTracker;
 import org.apache.geronimo.connector.extender.ConnectorExtender;
 import org.apache.geronimo.connector.mock.MockAdminObject;
 import org.apache.geronimo.connector.mock.MockAdminObjectImpl;
@@ -20,8 +23,6 @@ import org.apache.geronimo.connector.mod
 import org.apache.geronimo.connector.model.ManagedConnectionFactoryInfo;
 import org.apache.geronimo.connector.model.ResourceAdapterInfo;
 import org.apache.geronimo.connector.model.ResourceAdapterModuleInfo;
-import org.apache.geronimo.connector.ConnectionManagerContainer;
-import org.apache.geronimo.connector.ConnectionTracker;
 import org.apache.geronimo.transaction.RecoverableTransactionManager;
 import org.junit.Assert;
 import org.junit.Test;
@@ -33,19 +34,19 @@ import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.junit.JUnit4TestRunner;
 import org.ops4j.pax.exam.options.MavenArtifactProvisionOption;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.component.ComponentFactory;
 
-import static org.junit.Assert.assertEquals;
 import static org.ops4j.pax.exam.CoreOptions.equinox;
+import static org.ops4j.pax.exam.CoreOptions.felix;
 import static org.ops4j.pax.exam.CoreOptions.options;
 import static org.ops4j.pax.exam.CoreOptions.systemProperty;
-
-import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.*;
+import static org.ops4j.pax.swissbox.tinybundles.core.TinyBundles.modifyBundle;
 
 
 @RunWith(JUnit4TestRunner.class)
-public class ConnectorTest {
+public class DeployerTest {
 
     @Inject
     private BundleContext bundleContext;
@@ -54,16 +55,17 @@ public class ConnectorTest {
     public static Option[] configuration() {
         Option[] options = options(
 
+
 //            mavenBundle("org.osgi", "org.osgi.compendium"),
                 // Log
-                mavenBundle("org.ops4j.pax.logging", "pax-logging-api"),
-                mavenBundle("org.ops4j.pax.logging", "pax-logging-service"),
+                mavenBundle("org.ops4j.pax.logging", "pax-logging-api").startLevel(1),
+                mavenBundle("org.ops4j.pax.logging", "pax-logging-service").startLevel(1),
                 // Felix Config Admin
-                mavenBundle("org.apache.felix", "org.apache.felix.configadmin"),
+                mavenBundle("org.apache.felix", "org.apache.felix.configadmin").startLevel(1),
 
-                mavenBundle("org.apache.felix", "org.apache.felix.scr"),
+                mavenBundle("org.apache.felix", "org.apache.felix.scr").startLevel(1),
                 // Felix mvn url handler
-                mavenBundle("org.ops4j.pax.url", "pax-url-mvn"),
+                mavenBundle("org.ops4j.pax.url", "pax-url-mvn").startLevel(1),
 //                mavenBundle("org.ops4j.pax.swissbox", "pax-swissbox-tinybundles"),
 
 
@@ -71,20 +73,35 @@ public class ConnectorTest {
                 systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("DEBUG"),
 
                 // Bundles
-                mavenBundle("org.apache.geronimo.components", "geronimo-transaction"),
-                mavenBundle("org.apache.geronimo.components", "geronimo-connector"),
-                mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec"),
-                mavenBundle("org.apache.geronimo.specs", "geronimo-j2ee-connector_1.6_spec"),
-                mavenBundle("org.apache.geronimo.specs", "geronimo-validation_1.0_spec"),
-                mavenBundle("org.apache.geronimo.components", "geronimo-mock-ra"),
+                mavenBundle("org.apache.geronimo.components", "geronimo-transaction").startLevel(1),
+                mavenBundle("org.apache.geronimo.components", "geronimo-connector").startLevel(1),
+                mavenBundle("org.apache.geronimo.specs", "geronimo-osgi-registry").startLevel(1),
+                mavenBundle("org.apache.geronimo.specs", "geronimo-jta_1.1_spec").startLevel(1),
+                mavenBundle("org.apache.geronimo.specs", "geronimo-j2ee-connector_1.6_spec").startLevel(1),
+                mavenBundle("org.apache.geronimo.specs", "geronimo-validation_1.0_spec").startLevel(1),
+                mavenBundle("org.apache.geronimo.specs", "geronimo-activation_1.1_spec").startLevel(1),
+                mavenBundle("org.apache.geronimo.specs", "geronimo-jaxb_2.2_spec").startLevel(1),
+                mavenBundle("org.apache.geronimo.specs", "geronimo-stax-api_1.2_spec").startLevel(1),
+                mavenBundle("org.apache.geronimo.bundles", "woodstox").startLevel(1),
+                mavenBundle("org.apache.geronimo.bundles", "jaxb-impl").startLevel(2),
+                mavenBundle("org.apache.geronimo.framework", "geronimo-common").startLevel(2),
+                mavenBundle("org.apache.openejb", "openejb-jee").startLevel(2),
+                mavenBundle("asm", "asm-all").startLevel(2),
+                mavenBundle("org.apache.xbean", "xbean-finder").startLevel(2),
+                mavenBundle("org.apache.xbean", "xbean-bundleutils").startLevel(2),
+                mavenBundle("org.apache.geronimo.components", "geronimo-connector-builder-1_6").startLevel(3),
+                mavenBundle("org.apache.geronimo.components", "geronimo-mock-ra").startLevel(10),
 
-                //org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
+//                org.ops4j.pax.exam.container.def.PaxRunnerOptions.vmOption("-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"),
 
                 new Customizer() {
                     @Override
                     public InputStream customizeTestProbe(InputStream testProbe) throws Exception
{
                         return modifyBundle( testProbe )
-                                .add(ConnectorExtender.PLAN_LOCATION, new Hide().raInputStream()).build();
+                                .set(Constants.IMPORT_PACKAGE, "org.apache.geronimo.connector.mock")
+                                .add("META-INF/ra.xml", getResource("deployertest/ra.xml"))
+                                .add("META-INF/geronimo-ra.xml", getResource("deployertest/geronimo-ra.xml"))
+                                .build();
                     }
                 },
                 equinox().version("3.5.0")
@@ -93,6 +110,10 @@ public class ConnectorTest {
         return options;
     }
 
+    private static URL getResource(String s) {
+        return DeployerTest.class.getClassLoader().getResource(s);
+    }
+
     public static MavenArtifactProvisionOption mavenBundle(String groupId, String artifactId)
{
         return CoreOptions.mavenBundle().groupId(groupId).artifactId(artifactId).versionAsInProject();
     }
@@ -110,6 +131,7 @@ public class ConnectorTest {
         Assert.assertNotNull(bundleContext.getServiceReference(ComponentFactory.class.getName()));
 
 
+        Thread.sleep(5000);
         //mock connector services
         Assert.assertNotNull(bundleContext.getServiceReference(ResourceAdapter.class.getName()));
         Assert.assertNotNull(bundleContext.getServiceReference(MockAdminObject.class.getName()));
@@ -120,59 +142,4 @@ public class ConnectorTest {
         cf.getConnection();
     }
 
-    private static class Hide {
-    private static InputStream raInputStream() throws ResourceException, IOException {
-        ResourceAdapterModuleInfo module = newResourceAdapterModule();
-        ByteArrayOutputStream baos = new ByteArrayOutputStream();
-        ObjectOutput out = new ObjectOutputStream(baos);
-        out.writeObject(module);
-        out.flush();
-        return new ByteArrayInputStream(baos.toByteArray());
-    }
-
-    private static ResourceAdapterModuleInfo newResourceAdapterModule() throws ResourceException
{
-        ResourceAdapterModuleInfo module = new ResourceAdapterModuleInfo();
-        module.name = "module1";
-
-        ResourceAdapterInfo ra = new ResourceAdapterInfo();
-        ra.name = "ra1";
-        ra.resourceAdapterClass = MockResourceAdapter.class.getName();
-        ra.configProperties.put("RAStringProperty", "value1");
-
-        ra.managedConnectionFactoryInfos.add(newMcf("mcf1"));
-        ra.managedConnectionFactoryInfos.add(newMcf("mcf2"));
-
-
-        ra.adminObjectInfos.add(newAdminObject("ao1"));
-        ra.adminObjectInfos.add(newAdminObject("ao2"));
-
-        module.resourceAdapterInfos.add(ra);
-
-        module.managedConnectionFactoryInfos.add(newMcf("mcf3"));
-        module.adminObjectInfos.add(newAdminObject("ao2"));
-        return module;
-    }
-
-    private static AdminObjectInfo newAdminObject(String name) {
-        AdminObjectInfo ao = new AdminObjectInfo();
-        ao.name = name;
-        ao.adminObjectInterface = MockAdminObject.class.getName();
-        ao.adminObjectClass = MockAdminObjectImpl.class.getName();
-        ao.configProperties.put("Tweedle", "Dum");
-        return ao;
-    }
-
-    private static ManagedConnectionFactoryInfo newMcf(String name) {
-        ManagedConnectionFactoryInfo mcf = new ManagedConnectionFactoryInfo();
-        mcf.name = name;
-        mcf.managedConnectionFactoryClass = MockManagedConnectionFactory.class.getName();
-        mcf.maxPoolSize = 10;
-        mcf.poolCardinality = ManagedConnectionFactoryInfo.PoolCardinality.single;
-        mcf.matchingPolicy = ManagedConnectionFactoryInfo.MatchingPolicy.selectAll;
-        mcf.transactionSupport = ManagedConnectionFactoryInfo.TransactionSupport.xaTxCached;
-        return mcf;
-    }
-    }
-
-
 }

Propchange: geronimo/sandbox/djencks/txmanager/connector-itests/src/test/resources/deployertest/geronimo-ra.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/djencks/txmanager/connector-itests/src/test/resources/deployertest/geronimo-ra.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/djencks/txmanager/connector-itests/src/test/resources/deployertest/geronimo-ra.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Propchange: geronimo/sandbox/djencks/txmanager/connector-itests/src/test/resources/deployertest/ra.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/djencks/txmanager/connector-itests/src/test/resources/deployertest/ra.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/djencks/txmanager/connector-itests/src/test/resources/deployertest/ra.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/pom.xml?rev=1076881&r1=1076880&r2=1076881&view=diff
==============================================================================
--- geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/pom.xml (original)
+++ geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/pom.xml Thu Mar  3 23:29:22
2011
@@ -28,7 +28,6 @@
         <version>3.1.1-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.geronimo.modules</groupId>
     <artifactId>geronimo-connector-builder-1_6</artifactId>
     <packaging>bundle</packaging>
     <name>Geronimo Plugins, Connector 1.6 :: Builder</name>
@@ -44,11 +43,11 @@
             <artifactId>geronimo-j2ee-connector_1.6_spec</artifactId>
         </dependency>
 
-        <!--<dependency>-->
-        <!--<groupId>org.apache.geronimo.modules</groupId>-->
-        <!--<artifactId>geronimo-naming-builder</artifactId>-->
-        <!--<version>${project.version}</version>-->
-        <!--</dependency>-->
+        <dependency>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-naming-builder</artifactId>
+        <version>3.0-SNAPSHOT</version>
+        </dependency>
 
         <dependency>
             <groupId>org.apache.geronimo.framework</groupId>
@@ -82,16 +81,16 @@
             <version>3.2-SNAPSHOT</version>
         </dependency>
 
-        <!--<dependency>-->
-        <!--<groupId>org.apache.geronimo.modules</groupId>-->
-        <!--<artifactId>geronimo-j2ee</artifactId>-->
-        <!--<version>${project.version}</version>-->
-        <!--</dependency>-->
-        <!--<dependency>-->
-        <!--<groupId>org.apache.geronimo.modules</groupId>-->
-        <!--<artifactId>geronimo-j2ee-builder</artifactId>-->
-        <!--<version>${project.version}</version>-->
-        <!--</dependency>-->
+        <dependency>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-j2ee</artifactId>
+        <version>3.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+        <groupId>org.apache.geronimo.modules</groupId>
+        <artifactId>geronimo-j2ee-builder</artifactId>
+        <version>3.0-SNAPSHOT</version>
+        </dependency>
         <!--<dependency>-->
         <!--<groupId>org.apache.geronimo.modules</groupId>-->
         <!--<artifactId>geronimo-j2ee-schema</artifactId>-->
@@ -144,6 +143,12 @@
         </dependency>
 
         <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.apache.felix.scr.annotations</artifactId>
+            <scope>provided</scope>
+        </dependency>
+
+        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-simple</artifactId>
             <scope>test</scope>
@@ -214,6 +219,14 @@
     <build>
         <plugins>
             <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-scr-plugin</artifactId>
+                <version>1.6.1-SNAPSHOT</version>
+                <configuration>
+                    <parseJavadoc>false</parseJavadoc>
+                </configuration>
+            </plugin>
+            <plugin>
                 <groupId>org.ops4j.pax.exam</groupId>
                 <artifactId>maven-paxexam-plugin</artifactId>
                 <version>1.2.3</version>
@@ -236,11 +249,17 @@
                 <configuration>
                     <includes>
                         <include>org/apache/geronimo/connector/deployment/plan/*</include>
-                        <include>org/apache/geronimo/connector/deployment/InfoBuilder.java</include>
+                        <include>org/apache/geronimo/connector/deployment/*.java</include>
+                        <!--<include>org/apache/geronimo/connector/deployment/AnnotationProcessor.java</include>-->
+                        <!--<include>org/apache/geronimo/connector/deployment/InfoBuilder.java</include>-->
+                        <!--<include>org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java</include>-->
                     </includes>
-                    <!--<excludes>-->
-                        <!--<exclude>**/*/java</exclude>-->
-                    <!--</excludes>-->
+                    <excludes>
+                        <exclude>org/apache/geronimo/connector/deployment/AdminObjectRefBuilder.java</exclude>
+                        <exclude>org/apache/geronimo/connector/deployment/RARConfiguration.java</exclude>
+                        <exclude>org/apache/geronimo/connector/deployment/RARConfigurer.java</exclude>
+                        <exclude>org/apache/geronimo/connector/deployment/ResourceRefBuilder.java</exclude>
+                    </excludes>
                     <testIncludes>
                         <include>org/apache/geronimo/connector/deployment/InfoBuilderTest.java</include>
                     </testIncludes>
@@ -249,24 +268,6 @@
                     <!--</testExcludes>-->
                 </configuration>
             </plugin>
-            <!--<plugin>-->
-            <!--<groupId>org.codehaus.mojo</groupId>-->
-            <!--<artifactId>jaxb2-maven-plugin</artifactId>-->
-            <!--<version>1.3</version>-->
-            <!--<executions>-->
-            <!--<execution>-->
-            <!--<goals>-->
-            <!--<goal>xjc</goal>-->
-            <!--</goals>-->
-            <!--</execution>-->
-            <!--</executions>-->
-            <!--<configuration>-->
-            <!--<schemaDirectory>src/main/xsd</schemaDirectory>-->
-            <!--<packageName>org.apache.geronimo.connector.deployment.plan</packageName>-->
-            <!--&lt;!&ndash;<schemaListFileName>src/main/xsdlist/xsdlist.txt</schemaListFileName>&ndash;&gt;-->
-            <!--<extension>true</extension>-->
-            <!--</configuration>-->
-            <!--</plugin>-->
             <plugin>
                 <groupId>org.apache.felix</groupId>
                 <artifactId>maven-bundle-plugin</artifactId>
@@ -274,6 +275,10 @@
                     <instructions>
                         <!--packages containing "impl" or "internal" are excluded by default
-->
                         <Import-Package>
+                            org.apache.geronimo.deployment.*;resolution:=optional,
+                            org.apache.geronimo.gbean.*;resolution:=optional,
+                            org.apache.geronimo.j2ee.*;resolution:=optional,
+                            org.apache.geronimo.kernel.*;resolution:=optional,
                             *
                         </Import-Package>
                         <Export-Package>
@@ -348,6 +353,33 @@
             </plugin>
         </plugins>
     </build>
+    <profiles>
+        <profile>
+            <id>jaxb</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>jaxb2-maven-plugin</artifactId>
+                        <version>1.3</version>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>xjc</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <configuration>
+                            <schemaDirectory>src/main/xsd</schemaDirectory>
+                            <packageName>org.apache.geronimo.connector.deployment.plan</packageName>
+                            <!--<schemaListFileName>src/main/xsdlist/xsdlist.txt</schemaListFileName>-->
+                            <extension>true</extension>
+                        </configuration>
+                    </plugin>
 
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
 </project>
 

Added: geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AnnotationProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AnnotationProcessor.java?rev=1076881&view=auto
==============================================================================
--- geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AnnotationProcessor.java
(added)
+++ geronimo/sandbox/djencks/txmanager/geronimo-connector-builder-1_6/src/main/java/org/apache/geronimo/connector/deployment/AnnotationProcessor.java
Thu Mar  3 23:29:22 2011
@@ -0,0 +1,315 @@
+/*
+ * 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.deployment;
+
+import java.beans.Introspector;
+import java.io.Externalizable;
+import java.io.Serializable;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.resource.spi.Activation;
+import javax.resource.spi.AdministeredObject;
+import javax.resource.spi.ConnectionDefinitions;
+import javax.resource.spi.ManagedConnectionFactory;
+import javax.resource.spi.ResourceAdapter;
+import org.apache.geronimo.common.DeploymentException;
+import org.apache.openejb.jee.ActivationSpec;
+import org.apache.openejb.jee.AdminObject;
+import org.apache.openejb.jee.ConfigProperty;
+import org.apache.openejb.jee.ConnectionDefinition;
+import org.apache.openejb.jee.Connector;
+import org.apache.openejb.jee.InboundResourceadapter;
+import org.apache.openejb.jee.MessageAdapter;
+import org.apache.openejb.jee.MessageListener;
+import org.apache.openejb.jee.OutboundResourceAdapter;
+import org.apache.openejb.jee.TransactionSupportType;
+import org.apache.xbean.finder.BundleAnnotationFinder;
+import org.osgi.framework.Bundle;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public class AnnotationProcessor {
+    private static final Logger log = LoggerFactory.getLogger(AnnotationProcessor.class);
+
+    public Connector mergeMetadata(Bundle bundle, BundleAnnotationFinder classFinder, Connector
connector) throws DeploymentException {
+        Class<? extends ResourceAdapter> raClass = null;
+        if (connector == null) {
+            List<Class<?>> resourceAdapterClasses = classFinder.findAnnotatedClasses(javax.resource.spi.Connector.class);
+            if (resourceAdapterClasses.isEmpty()) {
+                return null;
+            }
+            if (resourceAdapterClasses.size() > 1) {
+                throw new DeploymentException("Not exactly one resource adapter: " + resourceAdapterClasses);
+            }
+            raClass = resourceAdapterClasses.get(0).asSubclass(ResourceAdapter.class);
+            connector = new Connector();
+//          connector.setDescriptions(ra.description());
+            connector.setMetadataComplete(false);
+            connector.setVersion("1.6");
+            org.apache.openejb.jee.ResourceAdapter resourceAdapter = new org.apache.openejb.jee.ResourceAdapter();
+            connector.setResourceAdapter(resourceAdapter);
+            resourceAdapter.setResourceAdapterClass(raClass.getName());
+        } else {
+            String raClassName = connector.getResourceAdapter().getResourceAdapterClass();
+            if (raClassName != null) {
+                try {
+                    raClass = bundle.loadClass(raClassName).asSubclass(ResourceAdapter.class);
+                } catch (ClassNotFoundException e) {
+                    throw new DeploymentException("Can not load resource adapter class: "
+ raClassName, e);
+                }
+            }
+        }
+        if (connector.isMetadataComplete() != null && connector.isMetadataComplete())
{
+            log.info("Connector is metadata complete");
+        } else {
+            org.apache.openejb.jee.ResourceAdapter resourceAdapter = connector.getResourceAdapter();
+            log.info("Reading connector annotations");
+            if (raClass != null/*and not metadata complete */) {
+                javax.resource.spi.Connector ra = raClass.getAnnotation(javax.resource.spi.Connector.class);
+                if (ra != null) {
+
+                    OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.getOutboundResourceAdapter();
+                    if (outboundResourceAdapter == null) {
+                        outboundResourceAdapter = new OutboundResourceAdapter();
+                        resourceAdapter.setOutboundResourceAdapter(outboundResourceAdapter);
+                    }
+                    if (outboundResourceAdapter.isReauthenticationSupport() == null) {
+                        outboundResourceAdapter.setReauthenticationSupport(ra.reauthenticationSupport());
+                    }
+                    if (outboundResourceAdapter.getTransactionSupport() == null) {
+                        outboundResourceAdapter.setTransactionSupport(TransactionSupportType.fromValue(ra.transactionSupport().toString()));
+                    }
+                    connector.getRequiredWorkContext().addAll(toString(ra.requiredWorkContexts()));
+                    setConfigProperties(resourceAdapter.getConfigProperty(), raClass);
+                }
+            }
+
+            //inbound
+            log.info("connector of type: " + connector);
+            InboundResourceadapter inboundResource = resourceAdapter.getInboundResourceAdapter();
+            if (inboundResource == null) {
+                inboundResource = new InboundResourceadapter();
+                inboundResource.setMessageAdapter(new MessageAdapter());
+            }
+            MessageAdapter messageAdapter = inboundResource.getMessageAdapter();
+            List<Class<?>> activationSpecClasses = classFinder.findAnnotatedClasses(Activation.class);
+
+            for (Class<?> asClass : activationSpecClasses) {
+                Activation activation = asClass.getAnnotation(Activation.class);
+                for (Class messageListenerClass : activation.messageListeners()) {
+                    ActivationSpec activationSpec = getActivationSpec(messageAdapter, messageListenerClass);
+
+                    if (activationSpec.getActivationSpecClass() == null) {
+                        activationSpec.setActivationSpecClass(asClass.getName());
+                    }
+                    if (asClass.getName().equals(activationSpec.getActivationSpecClass()))
{
+                        setConfigProperties(activationSpec.getConfigProperty(), asClass);
+                    }
+                    //TODO set required config properties from @NotNull annotations
+                }
+            }
+            if (resourceAdapter.getInboundResourceAdapter() == null && inboundResource.getMessageAdapter().getMessageListener().size()
> 0) {
+                resourceAdapter.setInboundResourceAdapter(inboundResource);
+            }
+
+            //admin objects
+            for (Class adminObjectClass : classFinder.findAnnotatedClasses(AdministeredObject.class))
{
+                AdministeredObject administeredObject = (AdministeredObject) adminObjectClass.getAnnotation(AdministeredObject.class);
+                Class[] interfaces = administeredObject.adminObjectInterfaces();
+                if (interfaces == null || interfaces.length == 0) {
+                    List<Class> allInterfaces = new ArrayList<Class>(Arrays.asList(adminObjectClass.getInterfaces()));
+                    allInterfaces.remove(Serializable.class);
+                    allInterfaces.remove(Externalizable.class);
+                    //TODO check if specified in ra.xml
+                    if (allInterfaces.size() != 1) {
+                        throw new DeploymentException("Interface for admin object not specified
properly: " + allInterfaces);
+                    }
+                    interfaces = allInterfaces.toArray(new Class[1]);
+                }
+                for (Class aoInterface : interfaces) {
+                    AdminObject adminObject = getAdminObject(resourceAdapter, aoInterface);
+                    if (adminObject.getAdminObjectClass() == null) {
+                        adminObject.setAdminObjectClass(adminObjectClass.getName());
+                    }
+                    if (adminObjectClass.getName().equals(adminObject.getAdminObjectClass()))
{
+                        setConfigProperties(adminObject.getConfigProperty(), adminObjectClass);
+                    }
+                }
+            }
+
+            OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.getOutboundResourceAdapter();
+            if (outboundResourceAdapter == null) {
+                outboundResourceAdapter = new OutboundResourceAdapter();
+            }
+
+            //outbound
+            for (Class<?> mcfClass : classFinder.findAnnotatedClasses(javax.resource.spi.ConnectionDefinition.class))
{
+                javax.resource.spi.ConnectionDefinition connectionDefinitionAnnotation =
mcfClass.getAnnotation(javax.resource.spi.ConnectionDefinition.class);
+                buildConnectionDefinition(mcfClass.asSubclass(ManagedConnectionFactory.class),
connectionDefinitionAnnotation, outboundResourceAdapter);
+            }
+            for (Class<?> mcfClass : classFinder.findAnnotatedClasses(ConnectionDefinitions.class))
{
+                ConnectionDefinitions connectionDefinitionAnnotations = mcfClass.getAnnotation(ConnectionDefinitions.class);
+                for (javax.resource.spi.ConnectionDefinition connectionDefinitionAnnotation
: connectionDefinitionAnnotations.value()) {
+                    buildConnectionDefinition(mcfClass.asSubclass(ManagedConnectionFactory.class),
connectionDefinitionAnnotation, outboundResourceAdapter);
+                }
+            }
+            if (outboundResourceAdapter.getConnectionDefinition().size() > 0) {
+                resourceAdapter.setOutboundResourceAdapter(outboundResourceAdapter);
+            }
+        }
+        return connector;
+    }
+
+    /**
+     * Find or create an ActivationSpec object for the supplied messageListenerClass
+     *
+     * @param messageAdapter       MessageAdapter container object
+     * @param messageListenerClass class for the activation spec
+     * @return ActivationSpec data object
+     */
+    private ActivationSpec getActivationSpec(MessageAdapter messageAdapter, Class messageListenerClass)
{
+        for (MessageListener messageListener : messageAdapter.getMessageListener()) {
+            if (messageListenerClass.getName().equals(messageListener.getMessageListenerType()))
{
+                return messageListener.getActivationSpec();
+            }
+        }
+        MessageListener messageListener = new MessageListener();
+        messageListener.setMessageListenerType(messageListenerClass.getName());
+        ActivationSpec activationSpec = new ActivationSpec();
+        messageListener.setActivationSpec(activationSpec);
+        messageAdapter.getMessageListener().add(messageListener);
+        return activationSpec;
+    }
+
+    /**
+     * find or create an AdminObject for the supplied admin object interface
+     *
+     * @param resourceAdapter ResourceAdapter container object
+     * @param aoInterface     admin object interface
+     * @return AdminObject data object
+     */
+    private AdminObject getAdminObject(org.apache.openejb.jee.ResourceAdapter resourceAdapter,
Class aoInterface) {
+        for (AdminObject adminObject : resourceAdapter.getAdminObject()) {
+            if (aoInterface.getName().equals(adminObject.getAdminObjectInterface())) {
+                return adminObject;
+            }
+        }
+        AdminObject adminObject = new AdminObject();
+        adminObject.setAdminObjectInterface(aoInterface.getName());
+        resourceAdapter.getAdminObject().add(adminObject);
+        return adminObject;
+    }
+
+    private void setConfigProperties(List<ConfigProperty> configProperty, Class<?>
aClass) throws DeploymentException {
+        for (Method method : aClass.getMethods()) {
+            if (method.getName().startsWith("set") && method.getParameterTypes().length
== 1) {
+                javax.resource.spi.ConfigProperty cpa = method.getAnnotation(javax.resource.spi.ConfigProperty.class);
+                if (cpa != null) {
+                    setConfigProperty(configProperty, cpa, method.getName().substring(3),
method.getParameterTypes()[0]);
+                }
+            }
+        }
+        do {
+            for (Field field : aClass.getDeclaredFields()) {
+                javax.resource.spi.ConfigProperty cpa = field.getAnnotation(javax.resource.spi.ConfigProperty.class);
+                if (cpa != null) {
+                    setConfigProperty(configProperty, cpa, field.getName(), field.getType());
+                }
+            }
+            aClass = aClass.getSuperclass();
+        } while (aClass != null);
+    }
+
+    private void setConfigProperty(List<ConfigProperty> configProperties, javax.resource.spi.ConfigProperty
cpa, String name, Class<?> type) throws DeploymentException {
+        name = Introspector.decapitalize(name);
+        ConfigProperty target = null;
+        for (ConfigProperty configProperty : configProperties) {
+            if (name.equals(configProperty.getConfigPropertyName())) {
+                target = configProperty;
+                break;
+            }
+        }
+        if (target == null) {
+            target = new ConfigProperty();
+            target.setConfigPropertyName(name);
+            configProperties.add(target);
+        }
+        if (cpa.type() != Object.class && cpa.type() != type) {
+            throw new DeploymentException("wrong type specified: " + cpa.type().getName()
+ " expecting " + type.getName());
+        }
+        if (target.getConfigPropertyType() == null) {
+            target.setConfigPropertyType(type.getName());
+        }
+        if (target.getConfigPropertyValue() == null) {
+            target.setConfigPropertyValue(cpa.defaultValue());
+        }
+        if (target.isConfigPropertyConfidential() == null) {
+            target.setConfigPropertyConfidential(cpa.confidential());
+        }
+        if (target.isConfigPropertyIgnore() == null) {
+            target.setConfigPropertyIgnore(cpa.ignore());
+        }
+        if (target.isConfigPropertySupportsDynamicUpdates() == null) {
+            target.setConfigPropertySupportsDynamicUpdates(cpa.supportsDynamicUpdates());
+        }
+    }
+
+    private List<String> toString(Class<?>[] classes) {
+        List<String> list = new ArrayList<String>(classes.length);
+        for (Class<?> clazz : classes) {
+            list.add(clazz.getName());
+        }
+        return list;
+    }
+
+    private void buildConnectionDefinition(Class<? extends ManagedConnectionFactory>
mcfClass, javax.resource.spi.ConnectionDefinition connectionDefinitionAnnotation, OutboundResourceAdapter
outboundResourceAdapter) throws DeploymentException {
+        ConnectionDefinition connectionDefinition = getConnectionDefinition(connectionDefinitionAnnotation,
outboundResourceAdapter);
+        if (connectionDefinition.getManagedConnectionFactoryClass() == null) {
+            connectionDefinition.setManagedConnectionFactoryClass(mcfClass.getName());
+        }
+        if (mcfClass.getName().equals(connectionDefinition.getManagedConnectionFactoryClass()))
{
+            connectionDefinition.setConnectionFactoryImplClass(connectionDefinitionAnnotation.connectionFactoryImpl().getName());
+            connectionDefinition.setConnectionInterface(connectionDefinitionAnnotation.connection().getName());
+            connectionDefinition.setConnectionImplClass(connectionDefinitionAnnotation.connectionImpl().getName());
+            setConfigProperties(connectionDefinition.getConfigProperty(), mcfClass);
+        }
+    }
+
+    private ConnectionDefinition getConnectionDefinition(javax.resource.spi.ConnectionDefinition
connectionDefinitionAnnotation, OutboundResourceAdapter outboundResourceAdapter) {
+        for (ConnectionDefinition connectionDefinition : outboundResourceAdapter.getConnectionDefinition())
{
+            if (connectionDefinitionAnnotation.connectionFactory().getName().equals(connectionDefinition.getConnectionFactoryInterface()))
{
+                return connectionDefinition;
+            }
+        }
+        ConnectionDefinition connectionDefinition = new ConnectionDefinition();
+        outboundResourceAdapter.getConnectionDefinition().add(connectionDefinition);
+        connectionDefinition.setConnectionFactoryInterface(connectionDefinitionAnnotation.connectionFactory().getName());
+        return connectionDefinition;
+    }
+
+}



Mime
View raw message