geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r705102 - in /geronimo/server/trunk/plugins/connector: geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ geronimo-connector-builder/src/main/xsd/ geronimo-connector/src/main/java/org/apache/geronimo/connecto...
Date Thu, 16 Oct 2008 00:08:34 GMT
Author: djencks
Date: Wed Oct 15 17:08:34 2008
New Revision: 705102

URL: http://svn.apache.org/viewvc?rev=705102&view=rev
Log:
GERONIMO-4360 connector 1.6 support for ResourceAdapter aware Admin objects.  Does not use
1.6 implementation features or api.  Also modifies our 1.2 vendor schema without changing
the namespace

Modified:
    geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
    geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/xsd/geronimo-connector-1.2.xsd
    geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/AdminObjectWrapper.java
    geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/AdminObjectWrapperGBean.java
    geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java

Modified: geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java?rev=705102&r1=705101&r2=705102&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
(original)
+++ geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/java/org/apache/geronimo/connector/deployment/ConnectorModuleBuilder.java
Wed Oct 15 17:08:34 2008
@@ -137,6 +137,7 @@
     static {
         NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/connector", "http://geronimo.apache.org/xml/ns/j2ee/connector-1.2");
         NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/connector-1.1", "http://geronimo.apache.org/xml/ns/j2ee/connector-1.2");
+//        NAMESPACE_UPDATES.put("http://geronimo.apache.org/xml/ns/j2ee/connector-1.2", "http://geronimo.apache.org/xml/ns/j2ee/connector-1.3");
     }
 
     private static final Map<String, Class> TYPE_LOOKUP = new HashMap<String, Class>();
@@ -580,8 +581,7 @@
                     throw new DeploymentException("Geronimo plan configures an outbound resource
adapter but ra.xml does not describe any");
                 }
                 String transactionSupport = resourceadapter.getOutboundResourceadapter().getTransactionSupport().getStringValue().trim();
-                for (int i = 0; i < geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray().length;
i++) {
-                    GerConnectionDefinitionType geronimoConnectionDefinition = geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray(i);
+                for (GerConnectionDefinitionType geronimoConnectionDefinition : geronimoResourceAdapter.getOutboundResourceadapter().getConnectionDefinitionArray())
{
                     assert geronimoConnectionDefinition != null : "Null GeronimoConnectionDefinition";
 
                     String connectionFactoryInterfaceName = geronimoConnectionDefinition.getConnectionfactoryInterface().trim();
@@ -598,13 +598,16 @@
                     }
                 }
             }
+            addAdminObjectGBeans(earContext, jcaResourceName, resourceAdapterModuleData,
cl, resourceAdapterAbstractName, geronimoResourceAdapter.getAdminobjectArray());
         }
         // admin objects (think message queues and topics)
 
         // add configured admin objects
-        for (int i = 0; i < geronimoConnector.getAdminobjectArray().length; i++) {
-            GerAdminobjectType gerAdminObject = geronimoConnector.getAdminobjectArray()[i];
+        addAdminObjectGBeans(earContext, jcaResourceName, resourceAdapterModuleData, cl,
null, geronimoConnector.getAdminobjectArray());
+    }
 
+    private void addAdminObjectGBeans(EARContext earContext, AbstractName jcaResourceName,
GBeanData resourceAdapterModuleData, ClassLoader cl, AbstractName resourceAdapterAbstractName,
GerAdminobjectType[] adminObjects) throws DeploymentException {
+        for (GerAdminobjectType gerAdminObject : adminObjects) {
             String adminObjectInterface = gerAdminObject.getAdminobjectInterface().trim();
             GBeanData adminObjectGBeanData = locateAdminObjectInfo(resourceAdapterModuleData,
adminObjectInterface);
 
@@ -612,12 +615,15 @@
                 throw new DeploymentException("No admin object declared for interface: "
+ adminObjectInterface);
             }
 
-            for (GerAdminobjectInstanceType gerAdminObjectInstance: gerAdminObject.getAdminobjectInstanceArray())
{
+            for (GerAdminobjectInstanceType gerAdminObjectInstance : gerAdminObject.getAdminobjectInstanceArray())
{
                 GBeanData adminObjectInstanceGBeanData = new GBeanData(adminObjectGBeanData);
                 setDynamicGBeanDataAttributes(adminObjectInstanceGBeanData, gerAdminObjectInstance.getConfigPropertySettingArray(),
cl);
                 // add it
                 AbstractName adminObjectAbstractName = earContext.getNaming().createChildName(jcaResourceName,
gerAdminObjectInstance.getMessageDestinationName().trim(), NameFactory.JCA_ADMIN_OBJECT);
                 adminObjectInstanceGBeanData.setAbstractName(adminObjectAbstractName);
+                if (resourceAdapterAbstractName != null) {
+                    adminObjectInstanceGBeanData.setReferencePattern("ResourceAdapterWrapper",
resourceAdapterAbstractName);
+                }
                 try {
                     earContext.addGBean(adminObjectInstanceGBeanData);
                 } catch (GBeanAlreadyExistsException e) {

Modified: geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/xsd/geronimo-connector-1.2.xsd
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/xsd/geronimo-connector-1.2.xsd?rev=705102&r1=705101&r2=705102&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/xsd/geronimo-connector-1.2.xsd
(original)
+++ geronimo/server/trunk/plugins/connector/geronimo-connector-builder/src/main/xsd/geronimo-connector-1.2.xsd
Wed Oct 15 17:08:34 2008
@@ -586,6 +586,7 @@
                         administer object defined in ra.xml. For example, if
                         topic is declared in the ra.xml this could provide topic
                         instance information.
+                        An admin object configured here cannot implement ResourceAdapterAssociation.
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
@@ -681,6 +682,19 @@
                     </xs:documentation>
                 </xs:annotation>
             </xs:element>
+            <xs:element name="adminobject" type="ger:adminobjectType"
+                minOccurs="0" maxOccurs="unbounded">
+                <xs:annotation>
+                    <xs:documentation>
+                        The element adminobject maps back to adminobject defined
+                        in ra.xml. It provides specific instance information for
+                        administer object defined in ra.xml. For example, if
+                        topic is declared in the ra.xml this could provide topic
+                        instance information.
+                        An admin object configured here can implement ResourceAdapterAssociation.
+                    </xs:documentation>
+                </xs:annotation>
+            </xs:element>
         </xs:sequence>
     </xs:complexType>
 

Modified: geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/AdminObjectWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/AdminObjectWrapper.java?rev=705102&r1=705101&r2=705102&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/AdminObjectWrapper.java
(original)
+++ geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/AdminObjectWrapper.java
Wed Oct 15 17:08:34 2008
@@ -21,9 +21,12 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import javax.resource.spi.ResourceAdapterAssociation;
+
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.gbean.DynamicGBean;
 import org.apache.geronimo.gbean.DynamicGBeanDelegate;
+import org.apache.geronimo.gbean.GBeanLifecycle;
 import org.apache.geronimo.naming.ResourceSource;
 import org.apache.geronimo.kernel.Kernel;
 import org.apache.geronimo.management.geronimo.JCAAdminObject;
@@ -34,10 +37,11 @@
  *
  * @version $Rev$ $Date$
  */
-public class AdminObjectWrapper implements DynamicGBean, JCAAdminObject, ResourceSource<RuntimeException>
{
+public class AdminObjectWrapper implements DynamicGBean, JCAAdminObject, ResourceSource<RuntimeException>,
GBeanLifecycle {
 
     private final String adminObjectInterface;
     private final String adminObjectClass;
+    private final ResourceAdapterWrapper resourceAdapterWrapper;
 
     private final DynamicGBeanDelegate delegate;
     private final Object adminObject;
@@ -48,19 +52,6 @@
     private final String objectName;
 
     /**
-     * Default constructor required when a class is used as a GBean Endpoint.
-     */
-    public AdminObjectWrapper() {
-        adminObjectInterface = null;
-        adminObjectClass = null;
-        adminObject = null;
-        delegate = null;
-        kernel = null;
-        abstractName = null;
-        objectName = null;
-    }
-
-    /**
      * Normal managed constructor.
      *
      * @param adminObjectInterface Interface the proxy will implement.
@@ -70,12 +61,14 @@
      */
     public AdminObjectWrapper(final String adminObjectInterface,
                               final String adminObjectClass,
+                              final ResourceAdapterWrapper resourceAdapterWrapper,
                               final Kernel kernel,
                               final AbstractName abstractName,
                               final String objectName,
                               final ClassLoader cl) throws IllegalAccessException, InstantiationException,
ClassNotFoundException {
         this.adminObjectInterface = adminObjectInterface;
         this.adminObjectClass = adminObjectClass;
+        this.resourceAdapterWrapper = resourceAdapterWrapper;
         this.kernel = kernel;
         this.abstractName = abstractName;
         this.objectName = objectName;
@@ -205,4 +198,32 @@
     public boolean isEventProvider() {
         return false;
     }
+
+    /**
+     * Starts the GBean.  This informs the GBean that it is about to transition to the running
state.
+     *
+     * @throws Exception if the target failed to start; this will cause a transition to the
failed state
+     */
+    public void doStart() throws Exception {
+        if (adminObject instanceof ResourceAdapterAssociation) {
+            if (resourceAdapterWrapper == null) {
+                throw new IllegalStateException("Admin object expects to be registered with
a ResourceAdapter, but there is no ResourceAdapter");
+            }
+            resourceAdapterWrapper.registerResourceAdapterAssociation((ResourceAdapterAssociation)
adminObject);
+        }
+    }
+
+    /**
+     * Stops the target.  This informs the GBean that it is about to transition to the stopped
state.
+     *
+     * @throws Exception if the target failed to stop; this will cause a transition to the
failed state
+     */
+    public void doStop() throws Exception {
+    }
+
+    /**
+     * Fails the GBean.  This informs the GBean that it is about to transition to the failed
state.
+     */
+    public void doFail() {
+    }
 }

Modified: geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/AdminObjectWrapperGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/AdminObjectWrapperGBean.java?rev=705102&r1=705101&r2=705102&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/AdminObjectWrapperGBean.java
(original)
+++ geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/AdminObjectWrapperGBean.java
Wed Oct 15 17:08:34 2008
@@ -25,7 +25,6 @@
 import org.apache.geronimo.management.geronimo.JCAAdminObject;
 
 /**
- * 
  * @version $Revision$
  */
 public class AdminObjectWrapperGBean {
@@ -36,6 +35,7 @@
         GBeanInfoBuilder infoBuilder = GBeanInfoBuilder.createStatic(AdminObjectWrapperGBean.class,
AdminObjectWrapper.class, NameFactory.JCA_ADMIN_OBJECT);
         infoBuilder.addAttribute("adminObjectInterface", String.class, true);
         infoBuilder.addAttribute("adminObjectClass", String.class, true);
+        infoBuilder.addReference("ResourceAdapterWrapper", ResourceAdapterWrapper.class,
NameFactory.JCA_RESOURCE_ADAPTER);
         infoBuilder.addAttribute("kernel", Kernel.class, false);
         infoBuilder.addAttribute("abstractName", AbstractName.class, false);
         infoBuilder.addAttribute("objectName", String.class, false);
@@ -45,12 +45,13 @@
         infoBuilder.addInterface(JCAAdminObject.class);
 
         infoBuilder.setConstructor(new String[]{
-            "adminObjectInterface",
-            "adminObjectClass",
-            "kernel",
-            "abstractName",
-            "objectName",
-            "classLoader"
+                "adminObjectInterface",
+                "adminObjectClass",
+                "ResourceAdapterWrapper",
+                "kernel",
+                "abstractName",
+                "objectName",
+                "classLoader"
         });
 
         GBEAN_INFO = infoBuilder.getBeanInfo();

Modified: geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java?rev=705102&r1=705101&r2=705102&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
(original)
+++ geronimo/server/trunk/plugins/connector/geronimo-connector/src/main/java/org/apache/geronimo/connector/outbound/ManagedConnectionFactoryWrapper.java
Wed Oct 15 17:08:34 2008
@@ -61,7 +61,6 @@
     private DynamicGBeanDelegate delegate;
 
 
-    private boolean registered = false;
     private final Kernel kernel;
     private final AbstractName abstractName;
     private final String objectName;
@@ -154,13 +153,12 @@
     }
 
     public void doStart() throws Exception {
-        //register with resource adapter if not yet done
-        if (!registered && (managedConnectionFactory instanceof ResourceAdapterAssociation))
{
+        //register with resource adapter
+        if (managedConnectionFactory instanceof ResourceAdapterAssociation) {
             if (resourceAdapterWrapper == null) {
                 throw new IllegalStateException("Managed connection factory expects to be
registered with a ResourceAdapter, but there is no ResourceAdapter");
             }
             resourceAdapterWrapper.registerResourceAdapterAssociation((ResourceAdapterAssociation)
managedConnectionFactory);
-            registered = true;
             log.debug("Registered managedConnectionFactory with ResourceAdapter " + resourceAdapterWrapper.toString());
         }
         connectionManagerContainer.doRecovery(managedConnectionFactory);



Mime
View raw message