/** * write the descriptor class to a DOM tree and return it * * @param parent node for the DOM tree * @param node name for the descriptor * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, Principal descriptor) { Element principalNode = (Element) super.writeDescriptor(parent, nodeName, descriptor); appendTextChild(principalNode, RuntimeTagNames.DESCRIPTION, descriptor.getDescription()); setAttribute(principalNode, RuntimeTagNames.USER_NAME, (String) descriptor.getValue(Principal.USER_NAME)); setAttribute(principalNode, RuntimeTagNames.PASSWORD, (String) descriptor.getValue(Principal.PASSWORD)); setAttribute(principalNode, RuntimeTagNames.CREDENTIAL, (String) descriptor.getValue(Principal.CREDENTIAL)); return principalNode; } }
/** * Adds a new DOL descriptor instance to the descriptor instance associated with * this XMLNode * * @param descriptor the new descriptor */ public void addDescriptor(Object newDescriptor) { MapElement descriptor = (MapElement) getDescriptor(); if (descriptor==null) { throw new RuntimeException("Cannot set info on null descriptor"); } if (newDescriptor instanceof Principal) { Principal principal = (Principal) newDescriptor; if (principal.getValue(Principal.CREDENTIAL)==null) { descriptor.addPrincipal(principal); } else { descriptor.setBackendPrincipal(true); descriptor.setAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.USER_NAME, principal.getValue(Principal.USER_NAME)); descriptor.setAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.PASSWORD, principal.getValue(Principal.PASSWORD)); descriptor.setAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.CREDENTIAL, principal.getValue(Principal.CREDENTIAL)); } } }
/** * Adds a new DOL descriptor instance to the descriptor instance associated with * this XMLNode * * @param descriptor the new descriptor */ public void addDescriptor(Object newDescriptor) { MapElement descriptor = (MapElement) getDescriptor(); if (descriptor==null) { throw new RuntimeException("Cannot set info on null descriptor"); } if (newDescriptor instanceof Principal) { Principal principal = (Principal) newDescriptor; if (principal.getValue(Principal.CREDENTIAL)==null) { descriptor.addPrincipal(principal); } else { descriptor.setBackendPrincipal(true); descriptor.setAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.USER_NAME, principal.getValue(Principal.USER_NAME)); descriptor.setAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.PASSWORD, principal.getValue(Principal.PASSWORD)); descriptor.setAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.CREDENTIAL, principal.getValue(Principal.CREDENTIAL)); } } }
/** * write the descriptor class to a DOM tree and return it * * @param parent node for the DOM tree * @param node name for the descriptor * @param the descriptor to write * @return the DOM tree top node */ public Node writeDescriptor(Node parent, String nodeName, Principal descriptor) { Element principalNode = (Element) super.writeDescriptor(parent, nodeName, descriptor); appendTextChild(principalNode, RuntimeTagNames.DESCRIPTION, descriptor.getDescription()); setAttribute(principalNode, RuntimeTagNames.USER_NAME, (String) descriptor.getValue(Principal.USER_NAME)); setAttribute(principalNode, RuntimeTagNames.PASSWORD, (String) descriptor.getValue(Principal.PASSWORD)); setAttribute(principalNode, RuntimeTagNames.CREDENTIAL, (String) descriptor.getValue(Principal.CREDENTIAL)); return principalNode; } }