dain        2005/02/14 22:24:06

  Modified:    modules/openejb-builder/src/java/org/openejb/deployment
                        CMPEntityBuilder.java StatefulContainerBuilder.java
  Log:

  o Finished GERONIMO-181 Transaction propogation accross calls to stateful 
session beans
  
  o Added code resume and suspend the BMT transaction to 
StatefulInstanceInterceptor.  This code must be here because the instance 
context holds the suspended transaction, and this context is not available in 
the transaction interceptor.  Also the code that "finds" the correct instance 
relies on the transaction context already being established
  
  o Enabled stateful tests for session synchronization callbacks
  
  o Session synchronization callbacks now go through the system interceptor 
chain
  
  o Container policies now setRollbackOnly and throw a 
TransactionRolledbac[Local]Exception when a system exception is thrown in an 
inherited transaction
  
  o Fixed GERONIMO-579 UserTransaction broken after BMT calls BMT
  
  o Added support for ejb-ql back into the openejb-jar.xml file so 1.1 beans 
can use ejb-ql for a query specification
  
  o Fixed client side handle serialization code
  
  o Fixed stateful session ejb object isIdentical code; was not comparing 
primary key
  
  o Fixed handling of remove methods
  
  Revision  Changes    Path
  1.16      +70 -34    
openejb/modules/openejb-builder/src/java/org/openejb/deployment/CMPEntityBuilder.java
  
  Index: CMPEntityBuilder.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/java/org/openejb/deployment/CMPEntityBuilder.java,v
  retrieving revision 1.15
  retrieving revision 1.16
  diff -u -r1.15 -r1.16
  --- CMPEntityBuilder.java     30 Jan 2005 06:02:35 -0000      1.15
  +++ CMPEntityBuilder.java     15 Feb 2005 03:24:06 -0000      1.16
  @@ -84,6 +84,7 @@
   import 
org.openejb.xbeans.ejbjar.OpenejbEntityBeanType.AutomaticKeyGeneration;
   import org.openejb.xbeans.ejbjar.OpenejbEntityBeanType.CmpFieldMapping;
   import org.openejb.xbeans.ejbjar.OpenejbOpenejbJarType;
  +import org.openejb.xbeans.ejbjar.OpenejbQueryType;
   import org.tranql.cache.GlobalSchema;
   import org.tranql.cache.GlobalSchemaLoader;
   import org.tranql.ejb.CMPField;
  @@ -96,7 +97,6 @@
   import org.tranql.ejb.SelectEJBQLQuery;
   import org.tranql.ejb.TransactionManagerDelegate;
   import org.tranql.pkgenerator.PrimaryKeyGeneratorDelegate;
  -import org.tranql.schema.Association;
   import org.tranql.schema.Association.JoinDefinition;
   import org.tranql.sql.Column;
   import org.tranql.sql.EndTable;
  @@ -329,50 +329,86 @@
                   throw new DeploymentException(fields.toString());
               }
               
  -            processQuery(ejb, entityBean, cl);
  +            processQuery(ejb, entityBean, openEjbEntity, cl);
               
               ejbSchema.addEJB(ejb);
               sqlSchema.addTable(table);
           }
       }
   
  -    private void processQuery(EJB ejb, EntityBeanType entityBean, 
ClassLoader cl) throws DeploymentException {
  +    private void processQuery(EJB ejb, EntityBeanType entityBean, 
OpenejbEntityBeanType openEjbEntity, ClassLoader cl) throws DeploymentException 
{
           QueryType[] queryTypes = entityBean.getQueryArray();
  -        if (null == queryTypes) {
  -            return;
  -        }
  -        for (int i = 0; i < queryTypes.length; i++) {
  -            QueryType queryType = queryTypes[i];
  -            String methodName = 
getString(queryType.getQueryMethod().getMethodName());
  -            Class[] parameterTypes = null;
  -            JavaTypeType[] javaTypeTypes = 
queryType.getQueryMethod().getMethodParams().getMethodParamArray();
  -            if (null != javaTypeTypes) {
  -                parameterTypes = new Class[javaTypeTypes.length];
  -                for (int j = 0; j < javaTypeTypes.length; j++) {
  -                    String paramType = getString(javaTypeTypes[j]);
  -                    try {
  -                        parameterTypes[j] = 
ClassLoading.loadClass(paramType, cl);
  -                    } catch (ClassNotFoundException e) {
  -                        throw new DeploymentException("Can not load 
parameter type " + paramType +
  -                                " defined by method " + methodName);
  +        if (null != queryTypes) {
  +            for (int i = 0; i < queryTypes.length; i++) {
  +                QueryType queryType = queryTypes[i];
  +                String methodName = 
getString(queryType.getQueryMethod().getMethodName());
  +                Class[] parameterTypes = null;
  +                JavaTypeType[] javaTypeTypes = 
queryType.getQueryMethod().getMethodParams().getMethodParamArray();
  +                if (null != javaTypeTypes) {
  +                    parameterTypes = new Class[javaTypeTypes.length];
  +                    for (int j = 0; j < javaTypeTypes.length; j++) {
  +                        String paramType = getString(javaTypeTypes[j]);
  +                        try {
  +                            parameterTypes[j] = 
ClassLoading.loadClass(paramType, cl);
  +                        } catch (ClassNotFoundException e) {
  +                            throw new DeploymentException("Can not load 
parameter type " + paramType +
  +                                    " defined by method " + methodName);
  +                        }
  +                    }
  +                }
  +                String ejbQL = queryType.getEjbQl().getStringValue();
  +                if (methodName.startsWith("find")) {
  +                    ejb.addFinder(new FinderEJBQLQuery(methodName, 
parameterTypes, ejbQL));
  +                } else if (methodName.startsWith("ejbSelect")) {
  +                    boolean isLocal = true;
  +                    if (queryType.isSetResultTypeMapping()) {
  +                        String typeMapping = 
getString(queryType.getResultTypeMapping());
  +                        if (typeMapping.equals("Remote")) {
  +                            isLocal = false;
  +                        }
                       }
  +                    ejb.addSelect(new SelectEJBQLQuery(methodName, 
parameterTypes, ejbQL, isLocal));
  +                } else {
  +                    throw new DeploymentException("EJB [" + ejb.getName() + 
"] is misconfigured: method " +
  +                            methodName + " is neiher a finder nor a 
select.");
                   }
               }
  -            String ejbQL = queryType.getEjbQl().getStringValue();
  -            if (methodName.startsWith("find")) {
  -                ejb.addFinder(new FinderEJBQLQuery(methodName, 
parameterTypes, ejbQL));
  -            } else if (methodName.startsWith("ejbSelect")) {
  -                boolean isLocal = true;
  -                if (queryType.isSetResultTypeMapping()) {
  -                    String typeMapping = 
getString(queryType.getResultTypeMapping());
  -                    if (typeMapping.equals("Remote")) {
  -                        isLocal = false;
  +        }
  +        OpenejbQueryType[] openejbQueryTypes = openEjbEntity.getQueryArray();
  +        if (null != openejbQueryTypes) {
  +            for (int i = 0; i < openejbQueryTypes.length; i++) {
  +                OpenejbQueryType openejbQueryType = openejbQueryTypes[i];
  +                String methodName = 
openejbQueryType.getQueryMethod().getMethodName();
  +                Class[] parameterTypes = null;
  +                String[] javaTypeTypes = 
openejbQueryType.getQueryMethod().getMethodParams().getMethodParamArray();
  +                if (null != javaTypeTypes) {
  +                    parameterTypes = new Class[javaTypeTypes.length];
  +                    for (int j = 0; j < javaTypeTypes.length; j++) {
  +                        String paramType = javaTypeTypes[j];
  +                        try {
  +                            parameterTypes[j] = 
ClassLoading.loadClass(paramType, cl);
  +                        } catch (ClassNotFoundException e) {
  +                            throw new DeploymentException("Can not load 
parameter type " + paramType +
  +                                    " defined by method " + methodName);
  +                        }
                       }
                   }
  -                ejb.addSelect(new SelectEJBQLQuery(methodName, 
parameterTypes, ejbQL, isLocal));
  -            } else {
  -                throw new DeploymentException("EJB [" + ejb.getName() + "] 
is misconfigured: method " +
  -                        methodName + " is neiher a finder nor a select.");
  +                String ejbQL = openejbQueryType.getEjbQl();
  +                if (methodName.startsWith("find")) {
  +                    ejb.addFinder(new FinderEJBQLQuery(methodName, 
parameterTypes, ejbQL));
  +                } else if (methodName.startsWith("ejbSelect")) {
  +                    boolean isLocal = true;
  +                    if (openejbQueryType.isSetResultTypeMapping()) {
  +                        String typeMapping = 
openejbQueryType.getResultTypeMapping();
  +                        if (typeMapping.equals("Remote")) {
  +                            isLocal = false;
  +                        }
  +                    }
  +                    ejb.addSelect(new SelectEJBQLQuery(methodName, 
parameterTypes, ejbQL, isLocal));
  +                } else {
  +                    throw new DeploymentException("EJB [" + ejb.getName() + 
"] is misconfigured: method " +
  +                            methodName + " is neiher a finder nor a 
select.");
  +                }
               }
           }
       }
  
  
  
  1.2       +22 -7     
openejb/modules/openejb-builder/src/java/org/openejb/deployment/StatefulContainerBuilder.java
  
  Index: StatefulContainerBuilder.java
  ===================================================================
  RCS file: 
/home/projects/openejb/scm/openejb/modules/openejb-builder/src/java/org/openejb/deployment/StatefulContainerBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StatefulContainerBuilder.java     10 Nov 2004 01:35:08 -0000      1.1
  +++ StatefulContainerBuilder.java     15 Feb 2005 03:24:06 -0000      1.2
  @@ -64,6 +64,9 @@
   import org.openejb.sfsb.StatefulInstanceContextFactory;
   import org.openejb.sfsb.StatefulInstanceFactory;
   import org.openejb.sfsb.StatefulInterceptorBuilder;
  +import org.openejb.sfsb.AfterBegin;
  +import org.openejb.sfsb.BeforeCompletion;
  +import org.openejb.sfsb.AfterCompletion;
   import org.openejb.slsb.dispatch.EJBActivateOperation;
   import org.openejb.slsb.dispatch.EJBPassivateOperation;
   import org.openejb.slsb.dispatch.SetSessionContextOperation;
  @@ -148,16 +151,28 @@
                           new RemoveMethod(beanClass, signature, isBMT));
               } else if (name.equals("ejbActivate")) {
                   vopMap.put(
  -                        MethodHelper.translateToInterface(signature)
  -                        , EJBActivateOperation.INSTANCE);
  +                        MethodHelper.translateToInterface(signature),
  +                        EJBActivateOperation.INSTANCE);
               } else if (name.equals("ejbPassivate")) {
                   vopMap.put(
  -                        MethodHelper.translateToInterface(signature)
  -                        , EJBPassivateOperation.INSTANCE);
  +                        MethodHelper.translateToInterface(signature),
  +                        EJBPassivateOperation.INSTANCE);
               } else if (setSessionContext.equals(beanMethod)) {
                   vopMap.put(
  -                        MethodHelper.translateToInterface(signature)
  -                        , SetSessionContextOperation.INSTANCE);
  +                        MethodHelper.translateToInterface(signature),
  +                        SetSessionContextOperation.INSTANCE);
  +            } else if (name.equals("afterBegin") && 
signature.getParameterTypes().length == 0) {
  +                vopMap.put(
  +                        MethodHelper.translateToInterface(signature),
  +                        AfterBegin.INSTANCE);
  +            } else if (name.equals("beforeCompletion") && 
signature.getParameterTypes().length == 0) {
  +                vopMap.put(
  +                        MethodHelper.translateToInterface(signature),
  +                        BeforeCompletion.INSTANCE);
  +            } else if (name.equals("afterCompletion") && 
signature.getParameterTypes().length == 1 && 
signature.getParameterTypes()[0].equals(boolean.class.getName())) {
  +                vopMap.put(
  +                        MethodHelper.translateToInterface(signature),
  +                        AfterCompletion.INSTANCE);
               } else if (name.startsWith("ejb")) {
                   continue;
               } else {
  
  
  

Reply via email to