User: ejort   
  Date: 02/03/05 10:44:24

  Modified:    src/main/org/jboss/verifier/strategy AbstractVerifier.java
                        EJBVerifier11.java EJBVerifier20.java
                        VerificationContext.java
  Log:
  Add support for create<METHOD> and add a warning that the V2 verifier is missing
  
  Revision  Changes    Path
  1.27      +35 -36    jboss/src/main/org/jboss/verifier/strategy/AbstractVerifier.java
  
  Index: AbstractVerifier.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/verifier/strategy/AbstractVerifier.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- AbstractVerifier.java     10 Feb 2002 17:19:50 -0000      1.26
  +++ AbstractVerifier.java     5 Mar 2002 18:44:23 -0000       1.27
  @@ -19,7 +19,7 @@
    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    *
    * This package and its source code is available at www.jboss.org
  - * $Id: AbstractVerifier.java,v 1.26 2002/02/10 17:19:50 luke_t Exp $
  + * $Id: AbstractVerifier.java,v 1.27 2002/03/05 18:44:23 ejort Exp $
    */
   
   // standard imports
  @@ -77,7 +77,7 @@
    * </ul>
    * </p>
    *
  - * @version $Revision: 1.26 $
  + * @version $Revision: 1.27 $
    * @since    JDK 1.3
    */
   public abstract class AbstractVerifier implements VerificationStrategy {
  @@ -137,7 +137,6 @@
               ClassLoader parent = Thread.currentThread().getContextClassLoader();
               this.classloader   = new URLClassLoader(list, parent);
           }
  -
       }
   
   
  @@ -149,6 +148,11 @@
    *************************************************************************
    */
   
  +    public abstract boolean isCreateMethod(Method m);
  +
  +    public abstract boolean isEjbCreateMethod(Method m);
  +
  +
       public boolean hasLegalRMIIIOPArguments(Method method) {
   
           Class[] params = method.getParameterTypes();
  @@ -424,11 +428,6 @@
           return (m.getName().startsWith("find"));
       }
   
  -    public boolean isCreateMethod(Method m) {
  -        return (m.getName().equals(CREATE_METHOD));
  -    }
  -
  -
       /**
        * Checks for at least one non-static field.
        */
  @@ -451,11 +450,9 @@
   
           Method[] method = c.getMethods();
   
  -        for (int i = 0; i < method.length; ++i) {
  -
  -            String name = method[i].getName();
  -
  -            if (name.equals(CREATE_METHOD))
  +        for (int i = 0; i < method.length; ++i) 
  +        {
  +            isCreateMethod(method[i]);
                   return true;
           }
   
  @@ -469,11 +466,9 @@
   
           Method[] method = c.getMethods();
   
  -        for (int i = 0; i < method.length; ++i) {
  -
  -            String name = method[i].getName();
  -
  -            if (name.equals(EJB_CREATE_METHOD))
  +        for (int i = 0; i < method.length; ++i)
  +        {
  +            if (isEjbCreateMethod(method[i]))
                   if (!isStatic(method[i])
                           && !isFinal(method[i])
                           && ((isSession && hasVoidReturnType(method[i]))
  @@ -498,9 +493,8 @@
   
           for (int i = 0; i < method.length; ++i) {
   
  -            String name = method[i].getName();
  -
  -            if (name.equals(CREATE_METHOD)) {
  +            if (isCreateMethod(method[i]))
  +            {
                   Class[] params = method[i].getParameterTypes();
   
                   if (params.length == 0)
  @@ -623,7 +617,7 @@
           Method[] method = c.getMethods();
   
           for (int i = 0; i < method.length; ++i)
  -            if (method[i].getName().equals(EJB_CREATE_METHOD))
  +            if (isEjbCreateMethod(method[i]))
                   ejbCreates.add(method[i]);
   
           return ejbCreates.iterator();
  @@ -650,9 +644,8 @@
   
           for (int i = 0; i < method.length; ++i) {
   
  -            String name = method[i].getName();
  -
  -            if (name.equals(CREATE_METHOD)) {
  +            if (isCreateMethod(method[i]))
  +            {
                   ++count;
               }
           }
  @@ -707,9 +700,9 @@
           return (a.getReturnType() == b.getReturnType());
       }
   
  -    public boolean hasMatchingEJBPostCreate(Class bean, Method ejbCreate) {
  +    public boolean hasMatchingEJBPostCreate(Class bean, Method create) {
           try {
  -            return (bean.getMethod(EJB_POST_CREATE_METHOD, 
ejbCreate.getParameterTypes()) != null);
  +            return (bean.getMethod(getMatchingEJBPostCreateName(create.getName()), 
create.getParameterTypes()) != null);
           }
           catch (NoSuchMethodException e) {
               return false;
  @@ -719,17 +712,17 @@
   
       public boolean hasMatchingEJBCreate(Class bean, Method create) {
           try {
  -            return (bean.getMethod(EJB_CREATE_METHOD, create.getParameterTypes()) 
!= null);
  +            return (bean.getMethod(getMatchingEJBCreateName(create.getName()), 
create.getParameterTypes()) != null);
           }
           catch (NoSuchMethodException e) {
               return false;
           }
       }
   
  -    public Method getMatchingEJBPostCreate(Class bean, Method ejbCreate) {
  +    public Method getMatchingEJBPostCreate(Class bean, Method create) {
   
           try {
  -            return bean.getMethod(EJB_POST_CREATE_METHOD, 
ejbCreate.getParameterTypes());
  +            return bean.getMethod(getMatchingEJBPostCreateName(create.getName()), 
create.getParameterTypes());
           }
           catch (NoSuchMethodException e) {
               return null;
  @@ -739,7 +732,7 @@
       public Method getMatchingEJBCreate(Class bean, Method create) {
   
           try {
  -            return bean.getMethod(EJB_CREATE_METHOD, create.getParameterTypes());
  +            return bean.getMethod(getMatchingEJBCreateName(create.getName()), 
create.getParameterTypes());
           }
           catch (NoSuchMethodException e) {
               return null;
  @@ -1032,6 +1025,15 @@
           return true;
       }
   
  +    private String getMatchingEJBCreateName(String createName)
  +    {
  +       return "ejb" + createName.substring(0,1).toUpperCase() + 
createName.substring(1);
  +    }
  +    private String getMatchingEJBPostCreateName(String createName)
  +    {
  +       int createIdx = createName.indexOf("Create");
  +       return "ejbPost" + createName.substring(createIdx>=0?createIdx:0);
  +    }
   
   /*
    *************************************************************************
  @@ -1063,16 +1065,13 @@
       private final static String EJB_FIND_BY_PRIMARY_KEY =
           "ejbFindByPrimaryKey";
   
  -    private final static String EJB_CREATE_METHOD     =
  +    protected final static String EJB_CREATE_METHOD     =
           "ejbCreate";
   
       private final static String EJB_POST_CREATE_METHOD =
           "ejbPostCreate";
   
  -    private final static String EJB_POST_METHOD       =
  -        "ejbCreate";
  -
  -    private final static String CREATE_METHOD         =
  +    protected final static String CREATE_METHOD         =
           "create";
   
       private final static String FINALIZE_METHOD       =
  
  
  
  1.29      +11 -2     jboss/src/main/org/jboss/verifier/strategy/EJBVerifier11.java
  
  Index: EJBVerifier11.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/verifier/strategy/EJBVerifier11.java,v
  retrieving revision 1.28
  retrieving revision 1.29
  diff -u -r1.28 -r1.29
  --- EJBVerifier11.java        18 Jun 2001 20:01:29 -0000      1.28
  +++ EJBVerifier11.java        5 Mar 2002 18:44:24 -0000       1.29
  @@ -19,7 +19,7 @@
    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    *
    * This package and its source code is available at www.jboss.org
  - * $Id: EJBVerifier11.java,v 1.28 2001/06/18 20:01:29 mnf999 Exp $
  + * $Id: EJBVerifier11.java,v 1.29 2002/03/05 18:44:24 ejort Exp $
    */
   
   
  @@ -55,7 +55,7 @@
    * @author  Aaron Mulder  ([EMAIL PROTECTED])
    * @author  Vinay Menon   ([EMAIL PROTECTED])
    *
  - * @version $Revision: 1.28 $
  + * @version $Revision: 1.29 $
    * @since   JDK 1.3
    */
   public class EJBVerifier11 extends AbstractVerifier {
  @@ -132,6 +132,15 @@
           }
       }
   
  +    public boolean isCreateMethod(Method m) 
  +    {
  +        return m.getName().equals(CREATE_METHOD);
  +    }
  +
  +    public boolean isEjbCreateMethod(Method m) 
  +    {
  +        return m.getName().equals(EJB_CREATE_METHOD);
  +    }
   
   
   /*
  
  
  
  1.10      +21 -13    jboss/src/main/org/jboss/verifier/strategy/EJBVerifier20.java
  
  Index: EJBVerifier20.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/verifier/strategy/EJBVerifier20.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- EJBVerifier20.java        3 Jan 2001 08:28:48 -0000       1.9
  +++ EJBVerifier20.java        5 Mar 2002 18:44:24 -0000       1.10
  @@ -19,7 +19,7 @@
    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    *
    * This package and its source code is available at www.jboss.org
  - * $Id: EJBVerifier20.java,v 1.9 2001/01/03 08:28:48 tobias Exp $
  + * $Id: EJBVerifier20.java,v 1.10 2002/03/05 18:44:24 ejort Exp $
    */
   
   
  @@ -43,7 +43,7 @@
    * EJB 2.0 bean verifier.
    *
    * @author   Juha Lindfors   ([EMAIL PROTECTED])
  - * @version $Revision: 1.9 $
  + * @version $Revision: 1.10 $
    * @since    JDK 1.3
    */
   public class EJBVerifier20 extends AbstractVerifier {
  @@ -64,21 +64,29 @@
    ***********************************************************************
    */
       
  -    public void checkSession(SessionMetaData session) {
  -            
  -            // NOT IMPLEMENTED YET
  +    public void checkSession(SessionMetaData session)
  +    {
  +       System.out.println("WARNING: EJBVerifier2.0 Session verification not 
implemented");        
       }            
   
  -    public void checkEntity(EntityMetaData entity) {
  -            
  -            // NOT IMPLEMENTED YET
  +    public void checkEntity(EntityMetaData entity)
  +    {
  +       System.out.println("WARNING: EJBVerifier2.0 Entity verification not 
implemented");        
       }        
           
  -    public void checkMessageBean(BeanMetaData bean) {
  -            
  -            // NOT IMPLEMENTED YET
  +    public void checkMessageBean(BeanMetaData bean)
  +    {
  +       System.out.println("WARNING: EJBVerifier2.0 Message verification not 
implemented");        
  +    }
  +
  +    public boolean isCreateMethod(Method m) 
  +    {
  +        return m.getName().startsWith(CREATE_METHOD);
  +    }
  +
  +    public boolean isEjbCreateMethod(Method m) 
  +    {
  +        return m.getName().startsWith(EJB_CREATE_METHOD);
       }
  -        
  -    
   }
   
  
  
  
  1.7       +3 -3      
jboss/src/main/org/jboss/verifier/strategy/VerificationContext.java
  
  Index: VerificationContext.java
  ===================================================================
  RCS file: 
/cvsroot/jboss/jboss/src/main/org/jboss/verifier/strategy/VerificationContext.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- VerificationContext.java  3 Jan 2001 08:28:48 -0000       1.6
  +++ VerificationContext.java  5 Mar 2002 18:44:24 -0000       1.7
  @@ -19,7 +19,7 @@
    * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
    *
    * This package and its source code is available at www.jboss.org
  - * $Id: VerificationContext.java,v 1.6 2001/01/03 08:28:48 tobias Exp $
  + * $Id: VerificationContext.java,v 1.7 2002/03/05 18:44:24 ejort Exp $
    *
    * You can reach the author by sending email to [EMAIL PROTECTED]
    */
  @@ -47,7 +47,7 @@
    * @see     << OTHER RELATED CLASSES >>
    *
    * @author  Juha Lindfors
  - * @version $Revision: 1.6 $
  + * @version $Revision: 1.7 $
    * @since   JDK 1.3
    */
   public interface VerificationContext extends StrategyContext,
  @@ -63,7 +63,7 @@
        * Version identifier.
        */    
       public final static String VERSION_2_0 =
  -        "No public release yet.";
  +        "Enterprise JavaBeans V2.0, Final Release";
   
           
        
  
  
  

_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to