FileDocCategorySizeDatePackage
MethodPermissionComponentInterface.javaAPI DocGlassfish v2 API5243Fri May 04 22:33:32 BST 2007com.sun.enterprise.tools.verifier.tests.ejb

MethodPermissionComponentInterface

public class MethodPermissionComponentInterface extends com.sun.enterprise.tools.verifier.tests.ejb.EjbTest implements com.sun.enterprise.tools.verifier.tests.ejb.EjbCheck
Session Bean transaction demarcation type for all methods of remote interface test. The transaction attributes must be specified for the methods defined in the bean's remote interface and all the direct and indirect superinterfaces of the remote interface, excluding the methods of the javax.ejb.EJBObject interface.

Fields Summary
Result
result
Constructors Summary
Methods Summary
public Resultcheck(EjbDescriptor descriptor)
All methods should have a

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

    
                                  
        
        
        result = getInitializedResult();
//        boolean oneFailed = false;
        
        try  {
            if (descriptor instanceof EjbSessionDescriptor || descriptor instanceof EjbEntityDescriptor) {
                
                Set methods = descriptor.getMethodDescriptors();
//		 Set methodPermissions = new HashSet();
                boolean noPermissions = false;
                
                for (Iterator i = methods.iterator(); i.hasNext();) {
                    MethodDescriptor md = (MethodDescriptor) i.next();
                    Set permissions = descriptor.getMethodPermissionsFor(md);
                    if (permissions.isEmpty() || (permissions == null)) {
                        result.addWarningDetails(smh.getLocalString
                                (getClass().getName() + ".failed",
                                        "Warning: Method [ {0} ] of EJB [ {1} ] does not have assigned security-permissions",
                                        new Object[] {md.getName(), descriptor.getName()}));
                        result.setStatus(result.WARNING);
                        noPermissions = true;
                    } 
                }
                
                if (!noPermissions) {
                    result.passed(smh.getLocalString
                            (getClass().getName() + ".passed",
                                    "Valid: All [ {0} ]EJB  interfaces methods have security-permissions assigned.",
                                    new Object[] {descriptor.getName()}));
                }
                
            } else {
                result.notApplicable(smh.getLocalString(
                        getClass().getName() + ".notApplicable", 
                        "The bean [ {0} ] is neither a Session nor Entity Bean",
                        new Object[] {descriptor.getName()}));
                return result;
            }
        } catch (Exception e) {
            result.failed(smh.getLocalString(
                    getClass().getName() + ".exception", 
                    "The test generated the following exception [ {0} ]",
                    new Object[] {e.getLocalizedMessage()}));
        }
        return result;