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);
}
}
Aggregations