Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jboss.verifier.strategy
Class AbstractVerifier

    java.lang.Object
      org.jboss.verifier.strategy.AbstractVerifier

All Implemented Interfaces:
  org.gjt.lindfors.pattern.Strategy, VerificationStrategy

Direct Known Subclasses:
  EJBVerifier11, EJBVerifier20

public abstract class AbstractVerifier
extends Object
implements VerificationStrategy

Abstract superclass for verifiers containing a bunch of useful methods.

Since:
  JDK 1.3
Version:
  $Revision: 1.43 $
Author:
  Juha Lindfors, Aaron Mulder (ammulder@alumni.princeton.edu), Vinay Menon (menonv@cpw.co.uk), Andreas Schaefer, Luke Taylor, Jay Walters

  20020210: luke

  - Changed hasRemoteReturnType() to use isAssignableFrom() rather than just compare strings. See Bug 489554 (sub-classed remote return types should be OK)

  20020404: jwalters

  - Added new helper methods for Local home and interface matching pre-existing methods for Remote home and interface.

  20020404: luke

  - Changed hasDefaultConstructor to use reflection rather than calling newInstance. The latter won't work with abstract classes.
See Also:
  `VerificationStrategy`

Field Summary
`static String` | `BEAN_MANAGED_TX`
`protected ClassLoader` | `classloader` The application classloader.
`static String` | `CONTAINER_MANAGED_TX`
`protected static String` | `CREATE_METHOD`
`protected static String` | `EJB_CREATE_METHOD`
`protected static String` | `EJB_HOME_INTERFACE`
`protected static String` | `EJB_HOME_METHOD`
`protected static String` | `EJB_LOCAL_HOME_INTERFACE`
`protected static String` | `EJB_LOCAL_OBJECT_INTERFACE`
`protected static String` | `EJB_OBJECT_INTERFACE`
`protected static String` | `EJB_REMOVE_METHOD`
`protected static String` | `EJB_SELECT_METHOD`
`static String` | `STATEFUL_SESSION`
`static String` | `STATELESS_SESSION`

Constructor Summary
`AbstractVerifier(VerificationContext context, VerificationEventFactory factory)`

Method Summary
`void` | `checkMessageBean(MessageDrivenMetaData bean)` Provides an empty default implementation for EJB 1.1 verifier (message beans are for EJB 2.0 and greater only).
`protected void` | `fireBeanVerifiedEvent(BeanMetaData bean)`
`protected void` | `fireBeanVerifiedEvent(BeanMetaData bean, String msg)`
`protected void` | `fireSpecViolationEvent(BeanMetaData bean, Method method, Section section)`
`protected void` | `fireSpecViolationEvent(BeanMetaData bean, Section section)`
`org.gjt.lindfors.pattern.StrategyContext` | `getContext()` Returns the context object reference for this strategy implementation.
`Iterator` | `getCreateMethods(Class c)` Return all create methods of a class
`Method` | `getDefaultCreateMethod(Class c)`
`Iterator` | `getEJBCreateMethods(Class c)` Returns the ejbCreate(...) methods of a bean
`Method` | `getEJBFindByPrimaryKey(Class c)` Returns the ejbFindByPrimaryKey method
`Iterator` | `getEJBFindMethods(Class c)` returns the ejbFind methods of a bean
`Iterator` | `getFinderMethods(Class home)` returns the finder methods of a home interface
`Method` | `getMatchingEJBCreate(Class bean, Method create)`
`Method` | `getMatchingEJBFind(Class bean, Method finder)`
`Method` | `getMatchingEJBPostCreate(Class bean, Method create)`
`Iterator` | `getOnMessageMethods(Class c)` Returns the onMessage(...) method of a bean
`boolean` | `hasANonStaticField(Class c)` Checks for at least one non-static field.
`boolean` | `hasCreateMethod(Class c)` Searches for an instance of a public create method from the class
`boolean` | `hasDefaultConstructor(Class c)` Checks if a class has a default (no args) constructor
`boolean` | `hasDefaultCreateMethod(Class home)` Searches the class or interface, and its superclass or superinterface for a create() method that takes no arguments
`boolean` | `hasEJBCreateMethod(Class c, boolean isSession)` Searches for an instance of a public ejbCreate method from the class
`boolean` | `hasEJBFindByPrimaryKey(Class c)` checks if the class has an ejbFindByPrimaryKey method
`boolean` | `hasEJBHomeInterface(Class c)` Finds javax.ejb.EJBHome interface from the class or its superclasses
`boolean` | `hasEJBLocalHomeInterface(Class c)` Finds javax.ejb.EJBLocalHome interface from the class or its superclasses
`boolean` | `hasEJBLocalObjectInterface(Class c)` Finds java.ejb.EJBLocalObject interface from the class
`boolean` | `hasEJBObjectInterface(Class c)` Finds java.ejb.EJBObject interface from the class
`boolean` | `hasEntityBeanInterface(Class c)` Finds java.ejb.EntityBean interface from the class
`boolean` | `hasFinalizer(Class c)` Checks of the class defines a finalize() method
`boolean` | `hasFinderMethod(Class c)` check if a class has one or more finder methods
`boolean` | `hasLegalRMIIIOPArguments(Method method)`
`boolean` | `hasLegalRMIIIOPExceptionTypes(Method method)`
`boolean` | `hasLegalRMIIIOPReturnType(Method method)`
`boolean` | `hasLocalReturnType(BeanMetaData bean, Method m)` checks the return type of method matches the bean's local interface
`boolean` | `hasMatchingEJBCreate(Class bean, Method create)`
`boolean` | `hasMatchingEJBFind(Class bean, Method finder)`
`boolean` | `hasMatchingEJBHome(Class bean, Method home)`
`boolean` | `hasMatchingEJBPostCreate(Class bean, Method create)` Check whether a bean has a matching ejbPostCreate methods for a given ejbCreate method
`boolean` | `hasMatchingExceptions(Method source, Method target)` Check whether two given methods declare the same Exceptions
`boolean` | `hasMatchingMethod(Class bean, Method method)` Check if a class (or its superclasses) declare a given method
`boolean` | `hasMatchingReturnType(Method a, Method b)` Check whether two methods have the same return type
`boolean` | `hasMessageDrivenBeanInterface(Class c)` Finds java.ejb.MessageDrivenBean interface from the class
`boolean` | `hasMessageListenerInterface(Class c)` Finds javax.jms.MessageListener interface from the class
`boolean` | `hasMoreThanOneCreateMethods(Class c)` Check whether a class has more than one create method
`boolean` | `hasNoArguments(Method method)` checks if the method accepts any parameters.
`boolean` | `hasOnMessageMethod(Class c)` Searches for an instance of a public onMessage method from the class
`boolean` | `hasPrimaryKeyReturnType(EntityMetaData entity, Method m)` checks the return type of method matches the entity's primary key class or is a super class of the primary key class
`boolean` | `hasRemoteReturnType(BeanMetaData bean, Method m)` checks the return type of method matches the bean's remote interface
`boolean` | `hasSessionBeanInterface(Class c)` Finds java.ejb.SessionBean interface from the class
`boolean` | `hasSessionSynchronizationInterface(Class c)` Finds javax.ejb.SessionSynchronization interface from the class
`boolean` | `hasSingleArgument(Method method, Class argClass)` checks if the method accepts a single parameter of a specified type.
`boolean` | `hasVoidReturnType(Method method)` checks if a method has a void return type
`boolean` | `isAbstract(Class c)` checks if the given class is declared as abstract
`boolean` | `isAbstract(Method m)` checks if the given method is declared as abstract
`boolean` | `isAllFieldsPublic(Class c)` Checks whether all the fields in the class are declared as public.
`boolean` | `isAssignableFrom(Class clazz, String assignableFromClassName)`
`boolean` | `isAssignableFrom(String className, Class assignableFromClass)`
`abstract boolean` | `isCreateMethod(Method m)`
`abstract boolean` | `isEjbCreateMethod(Method m)`
`boolean` | `isFinal(Class c)` checks if the given class is declared as final
`boolean` | `isFinal(Member member)` checks if a class's member (method, constructor or field) has a `final` modifier.
`boolean` | `isFinderMethod(Method m)` Check if this is a finder method
`boolean` | `isMultiObjectFinder(Method f)` checks if finder method returns either Collection or Enumeration
`boolean` | `isOnMessageMethod(Method m)` Check if the given message is the onMessage() method
`boolean` | `isPublic(Class c)` checks if the given class is declared as `public`
`boolean` | `isPublic(Member member)` checks if a class's member (method, constructor or field) has a `public` modifier.
`protected boolean` | `isRMIIDLValueType(Class type)`
`protected boolean` | `isRMIIIOPType(Class type)`
`boolean` | `isSingleObjectFinder(EntityMetaData entity, Method finder)` checks if finder returns the primary key type
`boolean` | `isStatic(Class c)` checks if the given class is declared as static (inner classes only)
`boolean` | `isStatic(Member member)` checks if a class's member (method, constructor or field) has a `static` modifier.
`boolean` | `throwsCreateException(Method method)` checks if the method includes java.ejb.CreateException in its throws clause.
`boolean` | `throwsFinderException(Method method)` checks if the methods includes javax.ejb.FinderException in its throws clause.
`boolean` | `throwsNoException(Method method)` checks if the method throws no checked exceptions in its throws clause.
`boolean` | `throwsRemoteException(Method method)` Checks if the method includes java.rmi.RemoteException or its subclass in its throws clause.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods inherited from interface org.jboss.verifier.strategy.VerificationStrategy
`checkEntity, checkSession`

Field Detail

### EJB_OBJECT_INTERFACE

    protected static final String EJB_OBJECT_INTERFACE

See Also:
  Constant Field Values

### EJB_HOME_INTERFACE

    protected static final String EJB_HOME_INTERFACE

See Also:
  Constant Field Values

### EJB_LOCAL_OBJECT_INTERFACE

    protected static final String EJB_LOCAL_OBJECT_INTERFACE

See Also:
  Constant Field Values

### EJB_LOCAL_HOME_INTERFACE

    protected static final String EJB_LOCAL_HOME_INTERFACE

See Also:
  Constant Field Values

### classloader

    protected ClassLoader classloader

  The application classloader. This can be provided by the context directly via `VerificationContext.getClassLoader()` method, or constructed by this object by creating a classloader to the URL returned by `VerificationContext.getJarLocation()` method.

  Initialized in the constructor.

### BEAN_MANAGED_TX

    public static final String BEAN_MANAGED_TX

See Also:
  Constant Field Values

### CONTAINER_MANAGED_TX

    public static final String CONTAINER_MANAGED_TX

See Also:
  Constant Field Values

### STATEFUL_SESSION

    public static final String STATEFUL_SESSION

See Also:
  Constant Field Values

### STATELESS_SESSION

    public static final String STATELESS_SESSION

See Also:
  Constant Field Values

### EJB_CREATE_METHOD

    protected static final String EJB_CREATE_METHOD

See Also:
  Constant Field Values

### EJB_REMOVE_METHOD

    protected static final String EJB_REMOVE_METHOD

See Also:
  Constant Field Values

### CREATE_METHOD

    protected static final String CREATE_METHOD

See Also:
  Constant Field Values

### EJB_HOME_METHOD

    protected static final String EJB_HOME_METHOD

See Also:
  Constant Field Values

### EJB_SELECT_METHOD

    protected static final String EJB_SELECT_METHOD

See Also:
  Constant Field Values

Constructor Detail

### AbstractVerifier

    public AbstractVerifier(VerificationContext context,
                            VerificationEventFactory factory)

Method Detail

### isAssignableFrom

    public boolean isAssignableFrom(String className,
                                    Class assignableFromClass)

### isAssignableFrom

    public boolean isAssignableFrom(Class clazz,
                                    String assignableFromClassName)

### isCreateMethod

    public abstract boolean isCreateMethod(Method m)

### isEjbCreateMethod

    public abstract boolean isEjbCreateMethod(Method m)

### hasLegalRMIIIOPArguments

    public boolean hasLegalRMIIIOPArguments(Method method)

### hasLegalRMIIIOPReturnType

    public boolean hasLegalRMIIIOPReturnType(Method method)

### hasLegalRMIIIOPExceptionTypes

    public boolean hasLegalRMIIIOPExceptionTypes(Method method)

### throwsRemoteException

    public boolean throwsRemoteException(Method method)

  Checks if the method includes java.rmi.RemoteException or its subclass in its throws clause. See bug report #434739 and #607805

### hasSingleArgument

    public boolean hasSingleArgument(Method method,
                                     Class argClass)

  checks if the method accepts a single parameter of a specified type.

### hasNoArguments

    public boolean hasNoArguments(Method method)

  checks if the method accepts any parameters.

### throwsNoException

    public boolean throwsNoException(Method method)

  checks if the method throws no checked exceptions in its throws clause.

### throwsCreateException

    public boolean throwsCreateException(Method method)

  checks if the method includes java.ejb.CreateException in its throws clause.

### throwsFinderException

    public boolean throwsFinderException(Method method)

  checks if the methods includes javax.ejb.FinderException in its throws clause.

### isStatic

    public boolean isStatic(Member member)

  checks if a class's member (method, constructor or field) has a `static` modifier.

### isStatic

    public boolean isStatic(Class c)

  checks if the given class is declared as static (inner classes only)

### isFinal

    public boolean isFinal(Member member)

  checks if a class's member (method, constructor or field) has a `final` modifier.

### isFinal

    public boolean isFinal(Class c)

  checks if the given class is declared as final

### isPublic

    public boolean isPublic(Member member)

  checks if a class's member (method, constructor or field) has a `public` modifier.

### isPublic

    public boolean isPublic(Class c)

  checks if the given class is declared as `public`

### isAllFieldsPublic

    public boolean isAllFieldsPublic(Class c)

  Checks whether all the fields in the class are declared as public.

### isAbstract

    public boolean isAbstract(Class c)

  checks if the given class is declared as abstract

### isAbstract

    public boolean isAbstract(Method m)

  checks if the given method is declared as abstract

### isSingleObjectFinder

    public boolean isSingleObjectFinder(EntityMetaData entity,
                                        Method finder)

  checks if finder returns the primary key type

### isMultiObjectFinder

    public boolean isMultiObjectFinder(Method f)

  checks if finder method returns either Collection or Enumeration

### hasRemoteReturnType

    public boolean hasRemoteReturnType(BeanMetaData bean,
                                       Method m)

  checks the return type of method matches the bean's remote interface

### hasLocalReturnType

    public boolean hasLocalReturnType(BeanMetaData bean,
                                      Method m)

  checks the return type of method matches the bean's local interface

### hasVoidReturnType

    public boolean hasVoidReturnType(Method method)

  checks if a method has a void return type

### hasMessageDrivenBeanInterface

    public boolean hasMessageDrivenBeanInterface(Class c)

  Finds java.ejb.MessageDrivenBean interface from the class

### hasMessageListenerInterface

    public boolean hasMessageListenerInterface(Class c)

  Finds javax.jms.MessageListener interface from the class

### hasSessionBeanInterface

    public boolean hasSessionBeanInterface(Class c)

  Finds java.ejb.SessionBean interface from the class

### hasEntityBeanInterface

    public boolean hasEntityBeanInterface(Class c)

  Finds java.ejb.EntityBean interface from the class

### hasEJBObjectInterface

    public boolean hasEJBObjectInterface(Class c)

  Finds java.ejb.EJBObject interface from the class

### hasEJBLocalObjectInterface

    public boolean hasEJBLocalObjectInterface(Class c)

  Finds java.ejb.EJBLocalObject interface from the class

### hasEJBHomeInterface

    public boolean hasEJBHomeInterface(Class c)

  Finds javax.ejb.EJBHome interface from the class or its superclasses

### hasEJBLocalHomeInterface

    public boolean hasEJBLocalHomeInterface(Class c)

  Finds javax.ejb.EJBLocalHome interface from the class or its superclasses

### hasSessionSynchronizationInterface

    public boolean hasSessionSynchronizationInterface(Class c)

  Finds javax.ejb.SessionSynchronization interface from the class

### hasDefaultConstructor

    public boolean hasDefaultConstructor(Class c)

  Checks if a class has a default (no args) constructor

### hasFinalizer

    public boolean hasFinalizer(Class c)

  Checks of the class defines a finalize() method

### hasFinderMethod

    public boolean hasFinderMethod(Class c)

  check if a class has one or more finder methods

### isFinderMethod

    public boolean isFinderMethod(Method m)

  Check if this is a finder method

### isOnMessageMethod

    public boolean isOnMessageMethod(Method m)

  Check if the given message is the onMessage() method

### hasANonStaticField

    public boolean hasANonStaticField(Class c)

  Checks for at least one non-static field.

### hasOnMessageMethod

    public boolean hasOnMessageMethod(Class c)

  Searches for an instance of a public onMessage method from the class

### hasCreateMethod

    public boolean hasCreateMethod(Class c)

  Searches for an instance of a public create method from the class

### hasEJBCreateMethod

    public boolean hasEJBCreateMethod(Class c,
                                      boolean isSession)

  Searches for an instance of a public ejbCreate method from the class

### hasDefaultCreateMethod

    public boolean hasDefaultCreateMethod(Class home)

  Searches the class or interface, and its superclass or superinterface for a create() method that takes no arguments

### hasEJBFindByPrimaryKey

    public boolean hasEJBFindByPrimaryKey(Class c)

  checks if the class has an ejbFindByPrimaryKey method

### hasPrimaryKeyReturnType

    public boolean hasPrimaryKeyReturnType(EntityMetaData entity,
                                           Method m)

  checks the return type of method matches the entity's primary key class or is a super class of the primary key class

### getDefaultCreateMethod

    public Method getDefaultCreateMethod(Class c)

  Returns:
    Returns the default create method or `null` if none is found

### getEJBFindByPrimaryKey

    public Method getEJBFindByPrimaryKey(Class c)

  Returns the ejbFindByPrimaryKey method

### getEJBFindMethods

    public Iterator getEJBFindMethods(Class c)

  returns the ejbFind methods of a bean

### getFinderMethods

    public Iterator getFinderMethods(Class home)

  returns the finder methods of a home interface

### getOnMessageMethods

    public Iterator getOnMessageMethods(Class c)

  Returns the onMessage(...) method of a bean

### getEJBCreateMethods

    public Iterator getEJBCreateMethods(Class c)

  Returns the ejbCreate(...) methods of a bean

### getCreateMethods

    public Iterator getCreateMethods(Class c)

  Return all create methods of a class

### hasMoreThanOneCreateMethods

    public boolean hasMoreThanOneCreateMethods(Class c)

  Check whether a class has more than one create method

### hasMatchingExceptions

    public boolean hasMatchingExceptions(Method source,
                                         Method target)

  Check whether two given methods declare the same Exceptions

### hasMatchingMethod

    public boolean hasMatchingMethod(Class bean,
                                     Method method)

  Check if a class (or its superclasses) declare a given method

### hasMatchingReturnType

    public boolean hasMatchingReturnType(Method a,
                                         Method b)

  Check whether two methods have the same return type

### hasMatchingEJBPostCreate

    public boolean hasMatchingEJBPostCreate(Class bean,
                                            Method create)

  Check whether a bean has a matching ejbPostCreate methods for a given ejbCreate method

### hasMatchingEJBCreate

    public boolean hasMatchingEJBCreate(Class bean,
                                        Method create)

### getMatchingEJBPostCreate

    public Method getMatchingEJBPostCreate(Class bean,
                                           Method create)

### getMatchingEJBCreate

    public Method getMatchingEJBCreate(Class bean,
                                       Method create)

### hasMatchingEJBFind

    public boolean hasMatchingEJBFind(Class bean,
                                      Method finder)

### getMatchingEJBFind

    public Method getMatchingEJBFind(Class bean,
                                     Method finder)

### hasMatchingEJBHome

    public boolean hasMatchingEJBHome(Class bean,
                                      Method home)

### fireSpecViolationEvent

    protected void fireSpecViolationEvent(BeanMetaData bean,
                                          Section section)

### fireSpecViolationEvent

    protected void fireSpecViolationEvent(BeanMetaData bean,
                                          Method method,
                                          Section section)

### fireBeanVerifiedEvent

    protected final void fireBeanVerifiedEvent(BeanMetaData bean)

### fireBeanVerifiedEvent

    protected final void fireBeanVerifiedEvent(BeanMetaData bean,
                                               String msg)

### checkMessageBean

    public void checkMessageBean(MessageDrivenMetaData bean)

  Provides an empty default implementation for EJB 1.1 verifier (message beans are for EJB 2.0 and greater only).

  Specified by:
    `checkMessageBean` in interface `VerificationStrategy`

### getContext

    public org.gjt.lindfors.pattern.StrategyContext getContext()

  Returns the context object reference for this strategy implementation.

  Specified by:
    `getContext` in interface `org.gjt.lindfors.pattern.Strategy`
  Returns:
    the client object using this algorithm implementation

### isRMIIIOPType

    protected boolean isRMIIIOPType(Class type)

### isRMIIDLValueType

    protected boolean isRMIIDLValueType(Class type)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002 JBoss Group, LLC. All Rights Reserved.