dev@glassfish.java.net

Please review changes to pom.xml

From: Mitesh Meswani <Mitesh.Meswani_at_Sun.COM>
Date: Tue, 21 Jul 2009 18:12:45 -0700
The changes are required to hook cmp into connector resource rebind events.

Thanks,
Mitesh

Index: pom.xml
===================================================================
--- pom.xml    (revision 29367)
+++ pom.xml    (working copy)
@@ -134,6 +134,11 @@
             <version>${project.version}</version>
         </dependency>
         <dependency>
+            <groupId>org.glassfish.connectors</groupId>
+            <artifactId>connectors-runtime</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
             <groupId>org.glassfish.ejb</groupId>
             <artifactId>ejb-container</artifactId>
             <version>${project.version}</version>

[pom  reviewers can ignore following changes]

Index: src/main/java/com/sun/jdo/spi/persistence/support/sqlstore/ejb/SunTransactionHelper.java
===================================================================
--- src/main/java/com/sun/jdo/spi/persistence/support/sqlstore/ejb/SunTransactionHelper.java    (revision 29367)
+++ src/main/java/com/sun/jdo/spi/persistence/support/sqlstore/ejb/SunTransactionHelper.java    (working copy)
@@ -52,9 +52,13 @@
 
 
 import com.sun.appserv.jdbc.DataSource;
+import com.sun.appserv.connectors.internal.api.ConnectorsUtil;
 
 import com.sun.jdo.api.persistence.support.JDOFatalInternalException;
 import com.sun.jdo.api.persistence.support.PersistenceManagerFactory;
+import com.sun.enterprise.connectors.naming.ConnectorResourceNamingEventNotifier;
+import com.sun.enterprise.connectors.naming.ConnectorNamingEventListener;
+import com.sun.enterprise.connectors.naming.ConnectorNamingEvent;
 import org.glassfish.persistence.common.I18NHelper;
 
 
@@ -65,8 +69,8 @@
 * any bean's beforeCompletion method.
 */
 public class SunTransactionHelper extends TransactionHelperImpl  
-//        implements ApplicationLoaderEventListener,
-//                   ConnectorNamingEventListener
+        implements //ApplicationLoaderEventListener,
+                   ConnectorNamingEventListener
     {
 
     /** I18N message handler */
@@ -92,7 +96,7 @@
         // Register with ApplicationLoaderEventNotifier to receive Sun
         // Application Server specific lifecycle events.
 //        ApplicationLoaderEventNotifier.getInstance().addListener(helper);
-//        ConnectorRuntime.getRuntime().getResourceRebindEventNotifier().addListener(helper);
+        ConnectorResourceNamingEventNotifier.getInstance().addListener(helper);
         pmf_list = new ArrayList();
     }
 
@@ -247,15 +251,15 @@
 //        //Ignore EjbContainerEvents
 //    }
 //
-//    /**
-//     * @inheritDoc
-//     */
-//    public void connectorNamingEventPerformed(ConnectorNamingEvent event){
-//        if(event.getEventType() == ConnectorNamingEvent.EVENT_OBJECT_REBIND){
-//            String dsName = ResourceInstaller.getPMJndiName(event.getJndiName());
-//            cleanUpResources(dsName);
-//        } // Ignore all other events.
-//    }
+    /**
+     * @inheritDoc
+     */
+    public void connectorNamingEventPerformed(ConnectorNamingEvent event){
+        if(event.getEventType() == ConnectorNamingEvent.EVENT_OBJECT_REBIND){
+            String dsName = ConnectorsUtil.getPMJndiName(event.getJndiName());
+            cleanUpResources(dsName);
+        } // Ignore all other events.
+    }
 
     /**
      * Removes all entries that correspond to the same connection factory name.