djencks     2004/01/14 00:29:39

  Modified:    modules/core/src/java/org/apache/geronimo/connector/deployment
                        ConnectorDeploymentPlanner.java
                        ManagedConnectionFactoryHelper.java
               modules/core/src/java/org/apache/geronimo/connector/outbound
                        ConnectionManagerDeployment.java
               
modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/connector
                        GeronimoConnectionDefinition.java
                        GeronimoConnectionManagerFactory.java
               modules/core/src/java/org/apache/geronimo/xml/deployment
                        GeronimoConnectorLoader.java
               modules/core/src/schema geronimo-connector_1_5.xsd
               modules/core/src/test/org/apache/geronimo/xml/deployment
                        GeronimoConnectorLoaderTest.java
               modules/core/src/test-data/xml/deployment/connector_1_5
                        geronimo-ra.xml
  Log:
  Add ability to bind connection factory in global ger context
  
  Revision  Changes    Path
  1.11      +4 -1      
incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/ConnectorDeploymentPlanner.java
  
  Index: ConnectorDeploymentPlanner.java
  ===================================================================
  RCS file: 
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/ConnectorDeploymentPlanner.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- ConnectorDeploymentPlanner.java   2 Jan 2004 04:31:44 -0000       1.10
  +++ ConnectorDeploymentPlanner.java   14 Jan 2004 08:29:38 -0000      1.11
  @@ -224,6 +224,9 @@
               attributes.put("ResourceAdapterName", resourceAdapterName);
           }
           attributes.put("ConnectionManagerFactoryName", cmfMD.getName());
  +        if (gcd.getGlobalJndiName() != null) {
  +            attributes.put("GlobalJNDIName", gcd.getGlobalJndiName());
  +        }
           addTasks(mcfMD, deploymentPlan);
       }
   
  
  
  
  1.3       +41 -45    
incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/ManagedConnectionFactoryHelper.java
  
  Index: ManagedConnectionFactoryHelper.java
  ===================================================================
  RCS file: 
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/deployment/ManagedConnectionFactoryHelper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ManagedConnectionFactoryHelper.java       13 Nov 2003 22:22:30 -0000      
1.2
  +++ ManagedConnectionFactoryHelper.java       14 Jan 2004 08:29:38 -0000      
1.3
  @@ -59,6 +59,7 @@
   import javax.management.ObjectName;
   import javax.resource.ResourceException;
   import javax.resource.spi.ManagedConnectionFactory;
  +import javax.naming.NamingException;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  @@ -67,6 +68,8 @@
   import org.apache.geronimo.kernel.service.GeronimoMBeanEndpoint;
   import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
   import org.apache.geronimo.kernel.service.GeronimoMBeanTarget;
  +import org.apache.geronimo.kernel.service.GeronimoOperationInfo;
  +import org.apache.geronimo.naming.ger.GerContextManager;
   
   /**
    * ManagedConnectionFactoryHelper
  @@ -88,6 +91,8 @@
   
       private String managedConnectionFactoryClass;
   
  +    private String globalJNDIName;
  +
       private ResourceAdapterHelper resourceAdapterHelper;
       private ConnectionManagerFactory connectionManagerFactory;
   
  @@ -159,62 +164,60 @@
           } catch (ResourceException re) {
               throw new RuntimeException(re);
           }
  +        if (globalJNDIName != null) {
  +            try {
  +                GerContextManager.bind(globalJNDIName, connectionFactory);
  +            } catch (NamingException e) {
  +                throw new RuntimeException(e);
  +            }
  +        }
       }
   
       /* (non-Javadoc)
        * @see org.apache.geronimo.kernel.service.GeronimoMBeanTarget#doStop()
        */
       public void doStop() {
  -        // TODO Auto-generated method stub
  +        if (globalJNDIName != null) {
  +            try {
  +                GerContextManager.unbind(globalJNDIName);
  +            } catch (NamingException e) {
  +                throw new RuntimeException(e);
  +            }
  +        }
   
       }
   
  -    /**
  -     * @jmx.managed-attribute
  -     */
       public String getConnectionFactoryImplClass() {
           return connectionFactoryImplClass;
       }
   
  -    /**
  -     * @jmx.managed-attribute
  -     */
       public String getConnectionFactoryInterface() {
           return connectionFactoryInterface;
       }
   
  -    /**
  -     * @jmx.managed-attribute
  -     */
       public String getConnectionImplClass() {
           return connectionImplClass;
       }
   
  -    /**
  -     * @jmx.managed-attribute
  -     */
       public String getConnectionInterface() {
           return connectionInterface;
       }
   
       /**
        * @return Returns the connectionManagerFactoryClass.
  -     * @jmx.managed-attribute
        */
       public String getConnectionManagerFactoryClass() {
           return ConnectionManagerFactoryClass;
       }
   
       /**
  -     * @jmx.managed-attribute
        */
       public String getManagedConnectionFactoryClass() {
           return managedConnectionFactoryClass;
       }
   
       /**
  -     * @param string
  -     * @jmx.managed-attribute
  +     * @param clazz
        */
       public void setConnectionFactoryImplClass(String clazz) {
           connectionFactoryImplClass = clazz;
  @@ -222,8 +225,7 @@
       }
   
       /**
  -     * @param string
  -     * @jmx.managed-attribute
  +     * @param clazz
        */
       public void setConnectionFactoryInterface(String clazz) {
           connectionFactoryInterface = clazz;
  @@ -231,8 +233,7 @@
       }
   
       /**
  -     * @param string
  -     * @jmx.managed-attribute
  +     * @param clazz
        */
       public void setConnectionImplClass(String clazz) {
           connectionImplClass = clazz;
  @@ -240,8 +241,7 @@
       }
   
       /**
  -     * @param string
  -     * @jmx.managed-attribute
  +     * @param clazz
        */
       public void setConnectionInterface(String clazz) {
           connectionInterface = clazz;
  @@ -250,25 +250,30 @@
   
       /**
        * @param connectionManagerFactoryClass The 
connectionManagerFactoryClass to set.
  -     * @jmx.managed-attribute
        */
       public void setConnectionManagerFactoryClass(String 
connectionManagerFactoryClass) {
           ConnectionManagerFactoryClass = connectionManagerFactoryClass;
       }
   
       /**
  -     * @param string
  -     * @jmx.managed-attribute
  +     * @param clazz
        */
       public void setManagedConnectionFactoryClass(String clazz) {
           managedConnectionFactoryClass = clazz;
   
       }
   
  +    public String getGlobalJNDIName() {
  +        return globalJNDIName;
  +    }
  +
  +    public void setGlobalJNDIName(String globalJNDIName) {
  +        this.globalJNDIName = globalJNDIName;
  +    }
  +
   
       /**
        * @return Returns the connectionFactory.
  -     * @jmx.managed-attribute
        */
       public Object getConnectionFactory() {
           return connectionFactory;
  @@ -283,7 +288,7 @@
       }
   
       /**
  -     * @param resourceAdapter The resourceAdapter to set.
  +     * @param resourceAdapterHelper The resourceAdapterHelper to set.
        */
       public void setResourceAdapterHelper(ResourceAdapterHelper 
resourceAdapterHelper) {
           this.resourceAdapterHelper = resourceAdapterHelper;
  @@ -310,24 +315,15 @@
   
           mbeanInfo.setTargetClass(TARGET_NAME, 
ManagedConnectionFactoryHelper.class.getName());
   
  -        GeronimoAttributeInfo attributeInfo;
           //These should all be read only, but this would need values set from 
attribute info on startup
  -        attributeInfo = new 
GeronimoAttributeInfo("ConnectionFactoryInterface", true, true, "Interface 
implemented by the ConnectionFactory", TARGET_NAME);
  -        mbeanInfo.addAttributeInfo(attributeInfo);
  -
  -        attributeInfo = new 
GeronimoAttributeInfo("ConnectionFactoryImplClass", true, true, "Class of the 
the ConnectionFactory", TARGET_NAME);
  -        mbeanInfo.addAttributeInfo(attributeInfo);
  -
  -        attributeInfo = new GeronimoAttributeInfo("ConnectionInterface", 
true, true, "Interface implemented by the Connection", TARGET_NAME);
  -        mbeanInfo.addAttributeInfo(attributeInfo);
  -
  -        attributeInfo = new GeronimoAttributeInfo("ConnectionImplClass", 
true, true, "Class of the Connection", TARGET_NAME);
  -        mbeanInfo.addAttributeInfo(attributeInfo);
  -
  -        attributeInfo = new 
GeronimoAttributeInfo("ManagedConnectionFactoryClass", true, true, "Class of 
the ManagedConnectionFactory", TARGET_NAME);
  -        mbeanInfo.addAttributeInfo(attributeInfo);
  +        mbeanInfo.addAttributeInfo(new 
GeronimoAttributeInfo("ConnectionFactoryInterface", true, true, "Interface 
implemented by the ConnectionFactory", TARGET_NAME));
  +        mbeanInfo.addAttributeInfo(new 
GeronimoAttributeInfo("ConnectionFactoryImplClass", true, true, "Class of the 
the ConnectionFactory", TARGET_NAME));
  +        mbeanInfo.addAttributeInfo(new 
GeronimoAttributeInfo("ConnectionInterface", true, true, "Interface implemented 
by the Connection", TARGET_NAME));
  +        mbeanInfo.addAttributeInfo(new 
GeronimoAttributeInfo("ConnectionImplClass", true, true, "Class of the 
Connection", TARGET_NAME));
  +        mbeanInfo.addAttributeInfo(new 
GeronimoAttributeInfo("ManagedConnectionFactoryClass", true, true, "Class of 
the ManagedConnectionFactory", TARGET_NAME));
  +        mbeanInfo.addAttributeInfo(new 
GeronimoAttributeInfo("GlobalJNDIName", true, true, "Optional name to bind 
ConnectionFactory under in ger: context"));
   
  -        mbeanInfo.addAttributeInfo(new 
GeronimoAttributeInfo("ConnectionFactory", true, false, "The ConnectionFactory 
we deployed", TARGET_NAME));
  +        mbeanInfo.addOperationInfo(new 
GeronimoOperationInfo("getConnectionFactory", null, GeronimoOperationInfo.INFO, 
"Retrieve the ConnectionFactory we deployed", TARGET_NAME));
   
           if (resourceAdapterName != null) {
               mbeanInfo.addEndpoint(new 
GeronimoMBeanEndpoint("ResourceAdapterHelper", 
ResourceAdapterHelper.class.getName(), resourceAdapterName, true, TARGET_NAME));
  
  
  
  1.9       +4 -1      
incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ConnectionManagerDeployment.java
  
  Index: ConnectionManagerDeployment.java
  ===================================================================
  RCS file: 
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/connector/outbound/ConnectionManagerDeployment.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ConnectionManagerDeployment.java  11 Jan 2004 08:28:15 -0000      1.8
  +++ ConnectionManagerDeployment.java  14 Jan 2004 08:29:38 -0000      1.9
  @@ -108,6 +108,8 @@
       private RealmBridge realmBridge;
       private ConnectionTracker connectionTracker;
   
  +    private String globalJNDIName;
  +
       //GeronimoMBeanTarget support.
       private GeronimoMBeanContext context;
   
  @@ -347,6 +349,7 @@
           mBeanInfo.addAttributeInfo(new 
GeronimoAttributeInfo("UseLocalTransactions", true, true, "Use local rather 
than xa transactions"));
           mBeanInfo.addAttributeInfo(new 
GeronimoAttributeInfo("UseTransactionCaching", true, true, "Always use the same 
connection in a transaction"));
           mBeanInfo.addAttributeInfo(new GeronimoAttributeInfo("UseSubject", 
true, true, "Select pool using SecurityDomain supplied subject"));
  +        mBeanInfo.addAttributeInfo(new 
GeronimoAttributeInfo("GlobalJNDIName", true, true, "Optional name to bind 
ConnectionFactory under in ger: context"));
   
           mBeanInfo.addOperationInfo(new GeronimoOperationInfo("getStack"));
   
  
  
  
  1.4       +8 -12     
incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/connector/GeronimoConnectionDefinition.java
  
  Index: GeronimoConnectionDefinition.java
  ===================================================================
  RCS file: 
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/connector/GeronimoConnectionDefinition.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GeronimoConnectionDefinition.java 11 Jan 2004 08:28:15 -0000      1.3
  +++ GeronimoConnectionDefinition.java 14 Jan 2004 08:29:38 -0000      1.4
  @@ -67,7 +67,8 @@
   
       private String name;
       private GeronimoConnectionManagerFactory 
geronimoConnectionManagerFactory;
  -    private String realmBridge;
  +    private String globalJndiName;
  +
   
       public GeronimoConnectionDefinition(ConnectionDefinition 
connectionDefinition) {
           
setManagedConnectionFactoryClass(connectionDefinition.getManagedConnectionFactoryClass());
  @@ -106,18 +107,13 @@
           this.name = name;
       }
   
  -    /**
  -     * @return Returns the realmBridge.
  -     */
  -    public String getRealmBridge() {
  -        return realmBridge;
  +
  +    public String getGlobalJndiName() {
  +        return globalJndiName;
       }
   
  -    /**
  -     * @param realmBridge The realmBridge to set.
  -     */
  -    public void setRealmBridge(String realmBridge) {
  -        this.realmBridge = realmBridge;
  +    public void setGlobalJndiName(String globalJndiName) {
  +        this.globalJndiName = globalJndiName;
       }
   
   }
  
  
  
  1.3       +11 -1     
incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/connector/GeronimoConnectionManagerFactory.java
  
  Index: GeronimoConnectionManagerFactory.java
  ===================================================================
  RCS file: 
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/deployment/model/geronimo/connector/GeronimoConnectionManagerFactory.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GeronimoConnectionManagerFactory.java     13 Nov 2003 22:22:30 -0000      
1.2
  +++ GeronimoConnectionManagerFactory.java     14 Jan 2004 08:29:38 -0000      
1.3
  @@ -68,6 +68,8 @@
   
       private String connectionManagerFactoryDescriptor;
   
  +    private String realmBridge;
  +
       private ConfigProperty[] configProperty = new ConfigProperty[0];
   
       /* (non-Javadoc)
  @@ -110,6 +112,14 @@
        */
       public void setConnectionManagerFactoryDescriptor(String 
connectionManagerFactoryDescriptor) {
           this.connectionManagerFactoryDescriptor = 
connectionManagerFactoryDescriptor;
  +    }
  +
  +    public String getRealmBridge() {
  +        return realmBridge;
  +    }
  +
  +    public void setRealmBridge(String realmBridge) {
  +        this.realmBridge = realmBridge;
       }
   
   }
  
  
  
  1.3       +3 -1      
incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoConnectorLoader.java
  
  Index: GeronimoConnectorLoader.java
  ===================================================================
  RCS file: 
/home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/xml/deployment/GeronimoConnectorLoader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- GeronimoConnectorLoader.java      11 Jan 2004 08:28:15 -0000      1.2
  +++ GeronimoConnectorLoader.java      14 Jan 2004 08:29:38 -0000      1.3
  @@ -166,9 +166,11 @@
                           ConfigProperty[] configProperty = 
conDefinition[i].getConfigProperty();
                           loadConfigSettings(root, configProperty);
                           
conDefinition[i].setName(LoaderUtil.getChildContent(root, "name"));
  +                        
conDefinition[i].setGlobalJndiName(LoaderUtil.getChildContent(root, 
"global-jndi-name"));
                           GeronimoConnectionManagerFactory 
connectionManagerFactory = new GeronimoConnectionManagerFactory();
                           Element ecmf = LoaderUtil.getChild(root, 
"connectionmanager-factory");
                           
connectionManagerFactory.setConnectionManagerFactoryDescriptor(LoaderUtil.getChildContent(ecmf,
 "connectionmanagerfactory-descriptor"));
  +                        
connectionManagerFactory.setRealmBridge(LoaderUtil.getChildContent(ecmf, 
"realm-bridge"));
                           
connectionManagerFactory.setConfigProperty(loadConfigPropertySettings(ecmf));
                           
conDefinition[i].setGeronimoConnectionManagerFactory(connectionManagerFactory);
                           break loaded;
  
  
  
  1.2       +11 -6     
incubator-geronimo/modules/core/src/schema/geronimo-connector_1_5.xsd
  
  Index: geronimo-connector_1_5.xsd
  ===================================================================
  RCS file: 
/home/cvs/incubator-geronimo/modules/core/src/schema/geronimo-connector_1_5.xsd,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- geronimo-connector_1_5.xsd        11 Nov 2003 21:11:58 -0000      1.1
  +++ geronimo-connector_1_5.xsd        14 Jan 2004 08:29:38 -0000      1.2
  @@ -25,7 +25,7 @@
   
        This is the XML Schema for the geronimo Connector 1.5 deployment
        descriptor.  The deployment descriptor must be named
  -     "META-INF/geronimo-ra.xml" in the connector's rar file.  
  +     "META-INF/geronimo-ra.xml" in the connector's rar file.
              ...
            </connector>
   
  @@ -232,7 +232,7 @@
       <xsd:annotation>
         <xsd:documentation>
   
  -     The config-property-settingType contains a name-value pair for a 
  +     The config-property-settingType contains a name-value pair for a
        config-property or required-config-property
   
         </xsd:documentation>
  @@ -254,7 +254,7 @@
        type. This also includes configurable properties for
        ManagedConnectionFactory instances that may be produced out
        of this set.
  -     
  +
        The name element uniquely identifies this instance
   
         </xsd:documentation>
  @@ -281,9 +281,10 @@
         <xsd:element name="connectionmanager-factory"
                   type="connectionmanager-factoryType">
         </xsd:element>
  -      <xsd:element name="security-domain"
  -                type="j2ee:string"
  -                minOccurs="0"/>
  +        <!-- will be bound in ger: context if present -->
  +      <xsd:element name="global-jndi-name"
  +                   type="j2ee:xsdStringType"
  +                   minOccurs="0"/>
   
       </xsd:sequence>
       <xsd:attribute name="id" type="xsd:ID"/>
  @@ -310,6 +311,10 @@
          </xsd:documentation>
        </xsd:annotation>
         </xsd:element>
  +        <!--realm-bridge is an object name-->
  +      <xsd:element name="realm-bridge"
  +                   type="j2ee:xsdStringType"
  +                   minOccurs="0"/>
         <xsd:element name="config-property-setting"
                   type="config-property-settingType"
                   minOccurs="0"
  
  
  
  1.4       +3 -1      
incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoConnectorLoaderTest.java
  
  Index: GeronimoConnectorLoaderTest.java
  ===================================================================
  RCS file: 
/home/cvs/incubator-geronimo/modules/core/src/test/org/apache/geronimo/xml/deployment/GeronimoConnectorLoaderTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- GeronimoConnectorLoaderTest.java  2 Jan 2004 23:32:39 -0000       1.3
  +++ GeronimoConnectorLoaderTest.java  14 Jan 2004 08:29:39 -0000      1.4
  @@ -120,6 +120,8 @@
           GeronimoConnectionManagerFactory gcmf = 
goutboundResourceAdapter.getGeronimoConnectionDefinition()[0].getGeronimoConnectionManagerFactory();
           assertTrue("Expected a GeronimoConnectionManagerFactory", gcmf != 
null);
           assertTrue("Expected a descriptor for 
GeronimoConnectionManagerFactory", gcmf.getConnectionManagerFactoryDescriptor() 
!= null);
  +        assertNotNull("realm-bridge", gcmf.getRealmBridge());
  +        assertNotNull("global-jndi-name", 
goutboundResourceAdapter.getGeronimoConnectionDefinition()[0].getGlobalJndiName());
           assertEquals("Wrong ConfigProperty count:", 1, 
gcmf.getConfigProperty().length);
       }
       /*
  
  
  
  1.2       +8 -7      
incubator-geronimo/modules/core/src/test-data/xml/deployment/connector_1_5/geronimo-ra.xml
  
  Index: geronimo-ra.xml
  ===================================================================
  RCS file: 
/home/cvs/incubator-geronimo/modules/core/src/test-data/xml/deployment/connector_1_5/geronimo-ra.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- geronimo-ra.xml   11 Nov 2003 21:11:59 -0000      1.1
  +++ geronimo-ra.xml   14 Jan 2004 08:29:39 -0000      1.2
  @@ -15,11 +15,12 @@
             <config-property-setting 
name="OutboundStringProperty1">newvalue1</config-property-setting>
             <config-property-setting 
name="OutboundStringProperty3">newvalue2</config-property-setting>
           <connectionmanager-factory>
  -          
<connectionmanagerfactory-descriptor>org/apache/geronimo/connector/outbound/ConnectionManagerDeployer.xml</connectionmanagerfactory-descriptor>
  +          
<connectionmanagerfactory-descriptor>org.apache.geronimo.connector.outbound.ConnectionManagerDeployer</connectionmanagerfactory-descriptor>
  +          
<realm-bridge>geronimo.security:role=RealmBridge,target=TargetRealm</realm-bridge>
             <config-property-setting 
name="CacheByTransaction">true</config-property-setting>
           </connectionmanager-factory>
  -          
  -        <security-domain>MySecurityDomain</security-domain>            
  +
  +        <global-jndi-name>connectionfactories/testcf</global-jndi-name>
         </connection-definition>
         <connection-definition>
           
<connectionfactory-interface>javax.resource.cci.ConnectionFactory</connectionfactory-interface>
  @@ -30,8 +31,8 @@
             
<connectionmanagerfactory-class>org.apache.geronimo.connector.outbound.ConnectionManagerDeployer</connectionmanagerfactory-class>
             <config-property-setting 
name="CacheByTransaction">true</config-property-setting>
           </connectionmanager-factory>
  -          
  -        <security-domain>YourSecurityDomain</security-domain>            
  +
  +        <security-domain>YourSecurityDomain</security-domain>
         </connection-definition>
         <connection-definition>
           
<connectionfactory-interface>org.apache.geronimo.test.ConnectionFactory</connectionfactory-interface>
  @@ -41,8 +42,8 @@
             
<connectionmanagerfactory-class>org.apache.geronimo.connector.outbound.ConnectionManagerDeployer</connectionmanagerfactory-class>
             <config-property-setting 
name="CacheByTransaction">true</config-property-setting>
           </connectionmanager-factory>
  -          
  -        <security-domain>TheirSecurityDomain</security-domain>            
  +
  +        <security-domain>TheirSecurityDomain</security-domain>
         </connection-definition>
         <transaction-support>XATransaction</transaction-support>
       </outbound-resourceadapter>
  
  
  

Reply via email to