/** * write the descriptor class to a DOM tree and return it * * @param parent node for the DOM tree * @param node name for * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor( Node parent, String nodeName, PrincipalNameDescriptor descriptor) { //principal-name Element principal = (Element) appendTextChild( parent, RuntimeTagNames.PRINCIPAL_NAME, descriptor.getName()); // class-name setAttribute(principal, RuntimeTagNames.CLASS_NAME, descriptor.getClassName()); return principal; } }
/** * parsed an attribute of an element * * @param the element name * @param the attribute name * @param the attribute value * @return true if the attribute was processed */ protected boolean setAttributeValue( XMLElement element, XMLElement attribute, String value) { PrincipalNameDescriptor principal = (PrincipalNameDescriptor) getDescriptor(); if (attribute.getQName().equals(RuntimeTagNames.CLASS_NAME)) { principal.setClassName(value); return true; } return false; }
/** * receives notiification of the value for a particular tag * * @param element the xml element * @param value it's associated value */ public void setElementValue(XMLElement element, String value) { PrincipalNameDescriptor principal = (PrincipalNameDescriptor) getDescriptor(); if (RuntimeTagNames.PRINCIPAL_NAME.equals(element.getQName())) { principal.setName(value); Object rootDesc = getParentNode().getParentNode().getDescriptor(); if (rootDesc instanceof RootDeploymentDescriptor) { principal.setClassLoader(((RootDeploymentDescriptor)rootDesc).getClassLoader()); } } else super.setElementValue(element, value); }
/** * write the descriptor class to a DOM tree and return it * * @param parent node for the DOM tree * @param node name * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, SecurityRoleMapping descriptor) { Node roleMapping = appendChild(parent, nodeName); //role-name appendTextChild(roleMapping, RuntimeTagNames.ROLE_NAME, descriptor.getRoleName()); //principal-name+ PrincipalNameNode principal = new PrincipalNameNode(); List<PrincipalNameDescriptor> principals = descriptor.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { principal.writeDescriptor( roleMapping, RuntimeTagNames.PRINCIPAL_NAME, principals.get(i)); } //group+ List<String> groups = descriptor.getGroupNames(); for (int i = 0; i < groups.size(); i++) { appendTextChild(roleMapping, RuntimeTagNames.GROUP_NAME, groups.get(i)); } return roleMapping; } }
/** * receives notiification of the value for a particular tag * * @param element the xml element * @param value it's associated value */ public void setElementValue(XMLElement element, String value) { PrincipalNameDescriptor principal = (PrincipalNameDescriptor) getDescriptor(); if (RuntimeTagNames.PRINCIPAL_NAME.equals(element.getQName())) { principal.setName(value); Object rootDesc = getParentNode().getParentNode().getDescriptor(); if (rootDesc instanceof RootDeploymentDescriptor) { principal.setClassLoader(((RootDeploymentDescriptor)rootDesc).getClassLoader()); } } else super.setElementValue(element, value); }
/** * write the descriptor class to a DOM tree and return it * * @param parent node for the DOM tree * @param node name * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, SecurityRoleMapping descriptor) { Node roleMapping = appendChild(parent, nodeName); //role-name appendTextChild(roleMapping, RuntimeTagNames.ROLE_NAME, descriptor.getRoleName()); //principal-name+ PrincipalNameNode principal = new PrincipalNameNode(); List<PrincipalNameDescriptor> principals = descriptor.getPrincipalNames(); for (int i = 0; i < principals.size(); i++) { principal.writeDescriptor( roleMapping, RuntimeTagNames.PRINCIPAL_NAME, principals.get(i)); } //group+ List<String> groups = descriptor.getGroupNames(); for (int i = 0; i < groups.size(); i++) { appendTextChild(roleMapping, RuntimeTagNames.GROUP_NAME, groups.get(i)); } return roleMapping; } }
/** * write the descriptor class to a DOM tree and return it * * @param parent node for the DOM tree * @param node name for * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor( Node parent, String nodeName, PrincipalNameDescriptor descriptor) { //principal-name Element principal = (Element) appendTextChild( parent, RuntimeTagNames.PRINCIPAL_NAME, descriptor.getName()); // class-name setAttribute(principal, RuntimeTagNames.CLASS_NAME, descriptor.getClassName()); return principal; } }
/** * parsed an attribute of an element * * @param the element name * @param the attribute name * @param the attribute value * @return true if the attribute was processed */ protected boolean setAttributeValue( XMLElement element, XMLElement attribute, String value) { PrincipalNameDescriptor principal = (PrincipalNameDescriptor) getDescriptor(); if (attribute.getQName().equals(RuntimeTagNames.CLASS_NAME)) { principal.setClassName(value); return true; } return false; }