dain        2004/10/14 21:48:51

  Modified:    modules/core/src/java/org/openejb EJBModuleImpl.java
  Log:

  Committed Gianny's massive patch:
      http://jira.codehaus.org/browse/OPENEJB-13
  
  This adds support for the following:
   * CMP sql mapping
   * CMR support
   * Compound primary key
   * Unknown primary key
  
  There are still a few weirdisms...
   * Full sql mapping is now required
   * SQL is now compiled against physical schema names instead of logical schema names
  
  Revision  Changes    Path
  1.8       +23 -4     openejb/modules/core/src/java/org/openejb/EJBModuleImpl.java
  
  Index: EJBModuleImpl.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/core/src/java/org/openejb/EJBModuleImpl.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- EJBModuleImpl.java        17 Sep 2004 19:44:38 -0000      1.7
  +++ EJBModuleImpl.java        15 Oct 2004 01:48:43 -0000      1.8
  @@ -50,6 +50,7 @@
   import java.util.Hashtable;
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
  +import javax.transaction.TransactionManager;
   
   import org.apache.geronimo.gbean.GBeanInfo;
   import org.apache.geronimo.gbean.GBeanInfoFactory;
  @@ -62,6 +63,7 @@
   import org.apache.geronimo.kernel.Kernel;
   import org.apache.geronimo.kernel.jmx.JMXUtil;
   import org.openejb.entity.cmp.ConnectionProxyFactory;
  +import org.tranql.ejb.TransactionManagerDelegate;
   import org.tranql.query.ConnectionFactoryDelegate;
   
   /**
  @@ -75,8 +77,10 @@
       private final String deploymentDescriptor;
       private final ConnectionFactoryDelegate delegate;
       private final ConnectionProxyFactory connectionFactory;
  -
  -    public EJBModuleImpl(Kernel kernel, String objectName, J2EEServer server, 
J2EEApplication application, String deploymentDescriptor, ConnectionFactoryDelegate 
delegate, ConnectionProxyFactory connectionFactory) {
  +    private final TransactionManagerDelegate tmDelegate;
  +    private final TransactionManager tm;
  +    
  +    public EJBModuleImpl(Kernel kernel, String objectName, J2EEServer server, 
J2EEApplication application, String deploymentDescriptor, ConnectionFactoryDelegate 
delegate, ConnectionProxyFactory connectionFactory, TransactionManagerDelegate 
tmDelegate, TransactionManager tm) {
           ObjectName myObjectName = JMXUtil.getObjectName(objectName);
           verifyObjectName(myObjectName);
   
  @@ -93,6 +97,8 @@
           this.deploymentDescriptor = deploymentDescriptor;
           this.delegate = delegate;
           this.connectionFactory = connectionFactory;
  +        this.tmDelegate = tmDelegate;
  +        this.tm = tm;
       }
   
       public String getDeploymentDescriptor() {
  @@ -151,18 +157,27 @@
           if (delegate != null) {
               delegate.setConnectionFactory(connectionFactory.getProxy());
           }
  +        if ( null != tmDelegate ) {
  +            tmDelegate.setTransactionManager(tm);
  +        }
       }
   
       public void doStop() throws WaitingException, Exception {
           if (delegate != null) {
               delegate.setConnectionFactory(null);
           }
  +        if ( null != tmDelegate ) {
  +            tmDelegate.setTransactionManager(null);
  +        }
       }
   
       public void doFail() {
           if (delegate != null) {
               delegate.setConnectionFactory(null);
           }
  +        if ( null != tmDelegate ) {
  +            tmDelegate.setTransactionManager(null);
  +        }
       }
   
       public static final GBeanInfo GBEAN_INFO;
  @@ -175,6 +190,8 @@
           infoFactory.addAttribute("deploymentDescriptor", String.class, true);
           infoFactory.addReference("ConnectionFactory", ConnectionProxyFactory.class);
           infoFactory.addAttribute("Delegate", ConnectionFactoryDelegate.class, true);
  +        infoFactory.addReference("TransactionManager", TransactionManager.class);
  +        infoFactory.addAttribute("TMDelegate", TransactionManagerDelegate.class, 
true);
   
           infoFactory.addAttribute("kernel", Kernel.class, false);
           infoFactory.addAttribute("objectName", String.class, false);
  @@ -190,7 +207,9 @@
               "J2EEApplication",
               "deploymentDescriptor",
               "Delegate",
  -            "ConnectionFactory"});
  +            "ConnectionFactory",
  +            "TMDelegate",
  +            "TransactionManager"});
   
           GBEAN_INFO = infoFactory.getBeanInfo();
       }
  
  
  

Reply via email to