FileDocCategorySizeDatePackage
DenyAllHandler.javaAPI DocGlassfish v2 API4996Fri May 04 22:31:34 BST 2007com.sun.enterprise.deployment.annotation.handlers

DenyAllHandler

public class DenyAllHandler extends AbstractAttributeHandler
This handler is responsible for handling the javax.annotation.security.DenyAll.
author
Shing Wai Chan

Fields Summary
Constructors Summary
public DenyAllHandler()

    
Methods Summary
public java.lang.ClassgetAnnotationType()

return
the annoation type this annotation handler is handling

        return DenyAll.class;
    
protected com.sun.enterprise.deployment.annotation.HandlerProcessingResultprocessAnnotation(com.sun.enterprise.deployment.annotation.AnnotationInfo ainfo, com.sun.enterprise.deployment.annotation.context.EjbContext[] ejbContexts)
Process Annotation with given EjbContexts.

param
ainfo
param
ejbContexts
return
HandlerProcessingResult


        AnnotatedElement ae = (AnnotatedElement)ainfo.getAnnotatedElement();
        Method annMethod = (Method) ainfo.getAnnotatedElement();
        if (ae.isAnnotationPresent(PermitAll.class) ||
                ae.isAnnotationPresent(RolesAllowed.class)) {
            log(Level.SEVERE, ainfo,
                localStrings.getLocalString(
                "enterprise.deployment.annotation.handlers.inconsistentsecannotation",
                "This annotation is not consistent with other annotations.  One cannot have more than one of @RolesAllowed, @PermitAll, @DenyAll in the same AnnotatedElement."));
            return getDefaultFailedResult();
        }

        for (EjbContext ejbContext : ejbContexts) {
            EjbDescriptor ejbDesc = ejbContext.getDescriptor();
                
            for (Object next : ejbDesc.getSecurityBusinessMethodDescriptors()) {
                MethodDescriptor md = (MethodDescriptor)next;
                // override by xml
                if (!hasMethodPermissionsFromDD(md, ejbDesc)) {
                    Method m = md.getMethod(ejbDesc);
                    if (TypeUtil.sameMethodSignature(m, annMethod)) {
                        ejbDesc.addPermissionedMethod(
                            MethodPermission.getExcludedMethodPermission(), md);
                    }
                }
            }
        }

        return getDefaultProcessedResult();