FileDocCategorySizeDatePackage
BusinessIntfAnnotationValue.javaAPI DocGlassfish v2 API4501Fri May 04 22:33:34 BST 2007com.sun.enterprise.tools.verifier.tests.ejb.ejb30

BusinessIntfAnnotationValue

public class BusinessIntfAnnotationValue extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest
It is an error if @Local or @Remote is specified both on the bean class and on the referenced interface and the values differ. (Expert Group discussions)
author
Vikas Awasthi

Fields Summary
private com.sun.enterprise.tools.verifier.Result
result
private com.sun.enterprise.tools.verifier.tests.ComponentNameConstructor
compName
private Class
remoteAnn
private Class
localAnn
Constructors Summary
Methods Summary
public com.sun.enterprise.tools.verifier.Resultcheck(com.sun.enterprise.deployment.EjbDescriptor descriptor)

    
        
        result = getInitializedResult();
        compName = getVerifierContext().getComponentNameConstructor();

        testInterfaces(descriptor.getLocalBusinessClassNames(), remoteAnn);
        testInterfaces(descriptor.getRemoteBusinessClassNames(), localAnn);
    
        if(result.getStatus() != Result.FAILED) {
            addGoodDetails(result, compName);
            result.passed(smh.getLocalString
                            (getClass().getName() + ".passed",
                            "Valid annotations used in business interface(s)."));
        }
        return result;
    
private voidtestInterfaces(java.util.Set interfaces, java.lang.Class annot)

        // used in failure message
        Class cls = (annot.equals(localAnn))? remoteAnn : localAnn;

        for (String intf : interfaces) {
            try {
                Class intfCls = Class.forName(intf,
                                             false,
                                             getVerifierContext().getClassLoader());
                if(intfCls.getAnnotation(annot)!=null) {
                    addErrorDetails(result, compName);
                    result.failed(smh.getLocalString
                                 (getClass().getName() + ".failed",
                                 "{0} annotation is used in {1} interface [ {2} ].", 
                                 new Object[]{annot.getSimpleName(), 
                                             cls.getSimpleName(), 
                                             intfCls.getName()}));
                }
            } catch (ClassNotFoundException e) {
             //ignore as it will be caught in other tests
            }
        }