FileDocCategorySizeDatePackage
ImplementsTimedObjectTest.javaAPI DocGlassfish v2 API4464Fri May 04 22:34:08 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.timer

ImplementsTimedObjectTest

public class ImplementsTimedObjectTest extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest
Checks if the EJB class implements the TimedObject interface
version
author
Anisha Malhotra

Fields Summary
com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor
compName
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)
Checks if the EJB class implements the TimedObject interface

param
descriptor the Enterprise Java Bean deployment descriptor
return
Result the results for this assertion

                                 
        
        Result result = getInitializedResult();
        ComponentNameConstructor compName =
                getVerifierContext().getComponentNameConstructor();
        boolean isEjb30 = descriptor.getEjbBundleDescriptor().getSpecVersion().equalsIgnoreCase("3.0");
        if(descriptor.isTimedObject()) {
            //Timers can be created for stateless session beans, message-driven beans,
            //and 2.1 entity beans.Timers cannot be created for stateful session beans or EJB 3.0 entities.
            if(((descriptor instanceof EjbEntityDescriptor) && isEjb30)
                    || ( (descriptor instanceof EjbSessionDescriptor) &&
                    ((((EjbSessionDescriptor)descriptor).getSessionType()).equals
                    (EjbSessionDescriptor.STATEFUL)) )) {
                addErrorDetails(result, compName);
                result.failed(smh.getLocalString(getClass().getName()+
                        ".failed1", "[ {0} ] must not implement the TimedObject interface." +
                        "Only 2.1 entity beans or stateless session beans may " +
                        "implement the TimedObject interface" ,
                        new Object[] {descriptor.getEjbClassName()}));
            }
        }
        if(result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString (getClass().getName()+".passed",
                    "[ {0} ] properly implements the TimedObject interface",
                    new Object[] {descriptor.getEjbClassName()}));

        }
        return result;