geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r681269 - in /geronimo/server/branches/2.1/plugins/connector: connector-deployer/src/main/plan/ geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ geronimo-connector-builder/src/test/java/org/apache/geronimo/...
Date Thu, 31 Jul 2008 03:37:33 GMT
Author: gawor
Date: Wed Jul 30 20:37:32 2008
New Revision: 681269

URL: http://svn.apache.org/viewvc?rev=681269&view=rev
Log:
handle geronimo-ra.xml without resourceadapter-instance element (GERONIMO-4218)

Modified:
    geronimo/server/branches/2.1/plugins/connector/connector-deployer/src/main/plan/plan.xml
    geronimo/server/branches/2.1/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/server/branches/2.1/plugins/connector/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java

Modified: geronimo/server/branches/2.1/plugins/connector/connector-deployer/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/connector/connector-deployer/src/main/plan/plan.xml?rev=681269&r1=681268&r2=681269&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/connector/connector-deployer/src/main/plan/plan.xml
(original)
+++ geronimo/server/branches/2.1/plugins/connector/connector-deployer/src/main/plan/plan.xml
Wed Jul 30 20:37:32 2008
@@ -27,6 +27,7 @@
         <attribute name="defaultIdleTimeoutMinutes">15</attribute>
         <attribute name="defaultXATransactionCaching">true</attribute>
         <attribute name="defaultXAThreadCaching">false</attribute>
+        <attribute name="defaultWorkManagerName">DefaultWorkManager</attribute>
         <reference name="ServiceBuilders">
             <name>GBeanBuilder</name>
         </reference>

Modified: geronimo/server/branches/2.1/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=681269&r1=681268&r2=681269&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
(original)
+++ geronimo/server/branches/2.1/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
Wed Jul 30 20:37:32 2008
@@ -108,6 +108,7 @@
 import org.apache.geronimo.xbeans.geronimo.GerConnectorDocument;
 import org.apache.geronimo.xbeans.geronimo.GerConnectorType;
 import org.apache.geronimo.xbeans.geronimo.GerPartitionedpoolType;
+import org.apache.geronimo.xbeans.geronimo.GerResourceadapterInstanceType;
 import org.apache.geronimo.xbeans.geronimo.GerResourceadapterType;
 import org.apache.geronimo.xbeans.geronimo.GerSinglepoolType;
 import org.apache.geronimo.xbeans.j2ee.ActivationspecType;
@@ -167,7 +168,8 @@
     private final boolean defaultXAThreadCaching;
     private final Environment defaultEnvironment;
     private final NamespaceDrivenBuilderCollection serviceBuilders;
-
+    private final String defaultWorkManagerName;
+    
     public ConnectorModuleBuilder(Environment defaultEnvironment,
             int defaultMaxSize,
             int defaultMinSize,
@@ -175,6 +177,7 @@
             int defaultIdleTimeoutMinutes,
             boolean defaultXATransactionCaching,
             boolean defaultXAThreadCaching,
+            String defaultWorkManagerName,
             Collection serviceBuilders) {
         this.defaultEnvironment = defaultEnvironment;
 
@@ -184,6 +187,7 @@
         this.defaultIdleTimeoutMinutes = defaultIdleTimeoutMinutes;
         this.defaultXATransactionCaching = defaultXATransactionCaching;
         this.defaultXAThreadCaching = defaultXAThreadCaching;
+        this.defaultWorkManagerName = defaultWorkManagerName;
         this.serviceBuilders = new NamespaceDrivenBuilderCollection(serviceBuilders, GBeanBuilder.SERVICE_QNAME);
     }
 
@@ -540,16 +544,25 @@
                 GBeanData resourceAdapterGBeanData = locateResourceAdapterGBeanData(resourceAdapterModuleData);
                 GBeanData resourceAdapterInstanceGBeanData = new GBeanData(resourceAdapterGBeanData);
 
-                setDynamicGBeanDataAttributes(resourceAdapterInstanceGBeanData, geronimoResourceAdapter.getResourceadapterInstance().getConfigPropertySettingArray(),
cl);
-
+                String resourceAdapterName;
+                AbstractNameQuery workManagerName;                
+                if (geronimoResourceAdapter.isSetResourceadapterInstance()) {           
        
+                    GerResourceadapterInstanceType resourceAdapterInstance = geronimoResourceAdapter.getResourceadapterInstance();
+                    setDynamicGBeanDataAttributes(resourceAdapterInstanceGBeanData, resourceAdapterInstance.getConfigPropertySettingArray(),
cl);
+                    workManagerName = ENCConfigBuilder.getGBeanQuery(NameFactory.JCA_WORK_MANAGER,
resourceAdapterInstance.getWorkmanager());
+                    resourceAdapterName = resourceAdapterInstance.getResourceadapterName();
+                } else {                 
+                    workManagerName = ENCConfigBuilder.buildAbstractNameQuery(null, null,
defaultWorkManagerName, NameFactory.JCA_WORK_MANAGER, null);
+                    resourceAdapterName = "ResourceAdapterInstance-" + System.currentTimeMillis();
+                    log.warn("Resource adapter instance information was not specified in
Geronimo plan. Using defaults.");
+                }
+                    
                 // set the work manager name
-                AbstractNameQuery workManagerName = ENCConfigBuilder.getGBeanQuery(NameFactory.JCA_WORK_MANAGER,
geronimoResourceAdapter.getResourceadapterInstance().getWorkmanager());
                 resourceAdapterInstanceGBeanData.setReferencePattern("WorkManager", workManagerName);
 
                 // set the xa terminator name which is the same as our transaction manager
                 resourceAdapterInstanceGBeanData.setReferencePattern("XATerminator", earContext.getTransactionManagerName());
 
-                String resourceAdapterName = geronimoResourceAdapter.getResourceadapterInstance().getResourceadapterName();
                 resourceAdapterAbstractName = earContext.getNaming().createChildName(jcaResourceName,
resourceAdapterName, NameFactory.JCA_RESOURCE_ADAPTER);
                 resourceAdapterInstanceGBeanData.setAbstractName(resourceAdapterAbstractName);
                 try {
@@ -1031,6 +1044,7 @@
         infoBuilder.addAttribute("defaultIdleTimeoutMinutes", int.class, true, true);
         infoBuilder.addAttribute("defaultXATransactionCaching", boolean.class, true, true);
         infoBuilder.addAttribute("defaultXAThreadCaching", boolean.class, true, true);
+        infoBuilder.addAttribute("defaultWorkManagerName", String.class, true, true);
 
         infoBuilder.addReference("ServiceBuilders", NamespaceDrivenBuilder.class, NameFactory.MODULE_BUILDER);
 
@@ -1044,6 +1058,7 @@
                 "defaultIdleTimeoutMinutes",
                 "defaultXATransactionCaching",
                 "defaultXAThreadCaching",
+                "defaultWorkManagerName", 
                 "ServiceBuilders"});
         GBEAN_INFO = infoBuilder.getBeanInfo();
     }

Modified: geronimo/server/branches/2.1/plugins/connector/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/2.1/plugins/connector/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java?rev=681269&r1=681268&r2=681269&view=diff
==============================================================================
--- geronimo/server/branches/2.1/plugins/connector/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
(original)
+++ geronimo/server/branches/2.1/plugins/connector/geronimo-connector-builder/src/test/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilderTest.java
Wed Jul 30 20:37:32 2008
@@ -85,6 +85,7 @@
     private int defaultMinSize = 0;
     private int defaultBlockingTimeoutMilliseconds = 5000;
     private int defaultidleTimeoutMinutes = 15;
+    private String defaultWorkManagerName = "DefaultWorkManager";
     private Environment defaultEnvironment;
     private ConfigurationStore configurationStore = new MockConfigStore();
     private MockRepository repository;
@@ -130,7 +131,7 @@
                     Collections.singleton(repository),
                     null,
                     null,
-                    new ConnectorModuleBuilder(defaultEnvironment, defaultMaxSize, defaultMinSize,
defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching,
defaultXAThreadCaching, Collections.singleton(serviceBuilder)),
+                    new ConnectorModuleBuilder(defaultEnvironment, defaultMaxSize, defaultMinSize,
defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes, defaultXATransactionCaching,
defaultXAThreadCaching, defaultWorkManagerName, Collections.singleton(serviceBuilder)),
                     activationSpecInfoLocator,
                     null,
                     null,
@@ -313,7 +314,7 @@
         String resourceAdapterName = "testRA";
 
         try {
-            ConnectorModuleBuilder moduleBuilder = new ConnectorModuleBuilder(defaultEnvironment,
defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes,
defaultXATransactionCaching, defaultXAThreadCaching, Collections.singleton(new GBeanBuilder(null,
null)));
+            ConnectorModuleBuilder moduleBuilder = new ConnectorModuleBuilder(defaultEnvironment,
defaultMaxSize, defaultMinSize, defaultBlockingTimeoutMilliseconds, defaultidleTimeoutMinutes,
defaultXATransactionCaching, defaultXAThreadCaching, defaultWorkManagerName, Collections.singleton(new
GBeanBuilder(null, null)));
             File rarFile = action.getRARFile();
 
             ClassLoader oldCl = Thread.currentThread().getContextClassLoader();



Mime
View raw message