/** * 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, MapElement descriptor) { Node mapElementNode = super.writeDescriptor(parent, nodeName, descriptor); PrincipalNode pn = new PrincipalNode(); Principal[] principals = descriptor.getPrincipal(); for (int i=0;i<principals.length;i++) { pn.writeDescriptor(mapElementNode, RuntimeTagNames.PRINCIPAL, principals[i]); } // backend-principal if (descriptor.isBackendPrincipal()) { Element backend = (Element) appendChild(mapElementNode, RuntimeTagNames.BACKEND_PRINCIPAL); setAttribute(backend, RuntimeTagNames.USER_NAME, (String) descriptor.getAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.USER_NAME)); setAttribute(backend, RuntimeTagNames.PASSWORD, (String) descriptor.getAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.PASSWORD)); setAttribute(backend, RuntimeTagNames.CREDENTIAL, (String) descriptor.getAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.CREDENTIAL)); } return mapElementNode; } }
/** * 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, MapElement descriptor) { Node mapElementNode = super.writeDescriptor(parent, nodeName, descriptor); PrincipalNode pn = new PrincipalNode(); Principal[] principals = descriptor.getPrincipal(); for (int i=0;i<principals.length;i++) { pn.writeDescriptor(mapElementNode, RuntimeTagNames.PRINCIPAL, principals[i]); } // backend-principal if (descriptor.isBackendPrincipal()) { Element backend = (Element) appendChild(mapElementNode, RuntimeTagNames.BACKEND_PRINCIPAL); setAttribute(backend, RuntimeTagNames.USER_NAME, (String) descriptor.getAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.USER_NAME)); setAttribute(backend, RuntimeTagNames.PASSWORD, (String) descriptor.getAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.PASSWORD)); setAttribute(backend, RuntimeTagNames.CREDENTIAL, (String) descriptor.getAttributeValue(MapElement.BACKEND_PRINCIPAL, Principal.CREDENTIAL)); } return mapElementNode; } }