Search in sources :

Example 1 with SecurityRoleNode

use of com.sun.enterprise.deployment.node.SecurityRoleNode in project Payara by payara.

the class EjbBundleNode method writeAssemblyDescriptor.

/**
 * write assembly-descriptor related xml information to the DOM tree
 */
private void writeAssemblyDescriptor(Node parentNode, EjbBundleDescriptorImpl bundleDescriptor) {
    Node assemblyNode = parentNode.getOwnerDocument().createElement(EjbTagNames.ASSEMBLY_DESCRIPTOR);
    // security-role*
    SecurityRoleNode roleNode = new SecurityRoleNode();
    for (Iterator e = bundleDescriptor.getRoles().iterator(); e.hasNext(); ) {
        roleNode.writeDescriptor(assemblyNode, TagNames.ROLE, (Role) e.next());
    }
    // method-permission*
    Map excludedMethodsByEjb = new HashMap();
    MethodPermissionNode mpNode = new MethodPermissionNode();
    for (EjbDescriptor ejbDesc : bundleDescriptor.getEjbs()) {
        if (ejbDesc instanceof EjbMessageBeanDescriptor)
            continue;
        Vector excludedMethods = new Vector();
        addMethodPermissions(ejbDesc, ejbDesc.getPermissionedMethodsByPermission(), excludedMethods, mpNode, assemblyNode);
        addMethodPermissions(ejbDesc, ejbDesc.getStyledPermissionedMethodsByPermission(), excludedMethods, mpNode, assemblyNode);
        if (excludedMethods.size() > 0) {
            excludedMethodsByEjb.put(ejbDesc, excludedMethods);
        }
    }
    // container-transaction*
    ContainerTransactionNode ctNode = new ContainerTransactionNode();
    for (EjbDescriptor ejbDesc : bundleDescriptor.getEjbs()) {
        ctNode.writeDescriptor(assemblyNode, EjbTagNames.CONTAINER_TRANSACTION, ejbDesc);
    }
    // interceptor-binding*
    InterceptorBindingNode ibNode = new InterceptorBindingNode();
    for (EjbDescriptor ejbDesc : bundleDescriptor.getEjbs()) {
        if (!ejbDesc.getInterceptorClasses().isEmpty()) {
            ibNode.writeBindings(assemblyNode, ejbDesc);
        }
    }
    // message-destination*
    writeMessageDestinations(assemblyNode, bundleDescriptor.getMessageDestinations().iterator());
    // exclude-list*
    if (excludedMethodsByEjb.size() > 0) {
        Node excludeListNode = this.appendChild(assemblyNode, EjbTagNames.EXCLUDE_LIST);
        for (Object o : excludedMethodsByEjb.entrySet()) {
            Map.Entry entry = (Map.Entry) o;
            EjbDescriptor ejbDesc = (EjbDescriptor) entry.getKey();
            Vector excludedMethods = (Vector) entry.getValue();
            MethodPermissionDescriptor mpd = new MethodPermissionDescriptor();
            mpd.addMethodPermission(MethodPermission.getExcludedMethodPermission());
            mpd.addMethods(excludedMethods);
            mpNode.writeDescriptorInNode(excludeListNode, mpd, ejbDesc);
        }
    }
    for (EjbApplicationExceptionInfo next : bundleDescriptor.getApplicationExceptions().values()) {
        EjbApplicationExceptionNode node = new EjbApplicationExceptionNode();
        node.writeDescriptor(assemblyNode, EjbTagNames.APPLICATION_EXCEPTION, next);
    }
    if (assemblyNode.hasChildNodes()) {
        parentNode.appendChild(assemblyNode);
    }
}
Also used : MethodPermissionDescriptor(com.sun.enterprise.deployment.MethodPermissionDescriptor) HashMap(java.util.HashMap) GFEjbBundleRuntimeNode(org.glassfish.ejb.deployment.node.runtime.GFEjbBundleRuntimeNode) SecurityRoleNode(com.sun.enterprise.deployment.node.SecurityRoleNode) EjbBundleRuntimeNode(org.glassfish.ejb.deployment.node.runtime.EjbBundleRuntimeNode) Node(org.w3c.dom.Node) AbstractBundleNode(com.sun.enterprise.deployment.node.AbstractBundleNode) MessageDestinationNode(com.sun.enterprise.deployment.node.MessageDestinationNode) SecurityRoleNode(com.sun.enterprise.deployment.node.SecurityRoleNode) EjbDescriptor(org.glassfish.ejb.deployment.descriptor.EjbDescriptor) EjbMessageBeanDescriptor(org.glassfish.ejb.deployment.descriptor.EjbMessageBeanDescriptor) EjbApplicationExceptionInfo(org.glassfish.ejb.deployment.descriptor.EjbApplicationExceptionInfo) Iterator(java.util.Iterator) HashMap(java.util.HashMap) Map(java.util.Map) Vector(java.util.Vector)

Aggregations

MethodPermissionDescriptor (com.sun.enterprise.deployment.MethodPermissionDescriptor)1 AbstractBundleNode (com.sun.enterprise.deployment.node.AbstractBundleNode)1 MessageDestinationNode (com.sun.enterprise.deployment.node.MessageDestinationNode)1 SecurityRoleNode (com.sun.enterprise.deployment.node.SecurityRoleNode)1 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 Vector (java.util.Vector)1 EjbApplicationExceptionInfo (org.glassfish.ejb.deployment.descriptor.EjbApplicationExceptionInfo)1 EjbDescriptor (org.glassfish.ejb.deployment.descriptor.EjbDescriptor)1 EjbMessageBeanDescriptor (org.glassfish.ejb.deployment.descriptor.EjbMessageBeanDescriptor)1 EjbBundleRuntimeNode (org.glassfish.ejb.deployment.node.runtime.EjbBundleRuntimeNode)1 GFEjbBundleRuntimeNode (org.glassfish.ejb.deployment.node.runtime.GFEjbBundleRuntimeNode)1 Node (org.w3c.dom.Node)1