public Element toXML(Document doc) { if (doc == null) throw new NullPointerException(_MESSAGES.get("NullDocument")); Element root = XmlUtils.createElement(doc, WsrlConstants.SET_TERMINATION_QNAME); XmlUtils.setElement(root, WsrlConstants.REQUESTED_TIME_QNAME, getTerminationTime()); return root; } }
public Element toXML(Object obj, QName qname) { if (obj == null) return XmlUtils.createElement(qname); return XmlUtils.createElement(XmlUtils.createDocument(), qname, obj); } }
setMessage(XmlUtils.getElementText(xml, WefConstants.MESSAGE_QNAME)); String disposition = XmlUtils.getElementText(xml, WefConstants.SUCCESS_DISPOSITION_QNAME); Element priorityXML = XmlUtils.getElement(xml, WefConstants.PRIORITY_QNAME); _priority = XmlUtils.getShort(priorityXML).shortValue(); Element severityXML = XmlUtils.getElement(xml, WefConstants.SEVERITY_QNAME); _severity = XmlUtils.getShort(severityXML).shortValue(); Element timeXML = XmlUtils.getElement(xml, WefConstants.SITUATION_TIME_QNAME); _situationTime = XmlUtils.getDate(timeXML); Element categoryXML = XmlUtils.getElement(xml, WefConstants.SITUATION_CATEGORY_QNAME); Element categoryTypeXML = XmlUtils.getFirstElement(categoryXML); QName categoryName = XmlUtils.getElementQName(categoryTypeXML); hierarchy.add(categoryName); categoryTypeXML = XmlUtils.getElement(categoryTypeXML, WefConstants.SITUATION_CATEGORY_QNAME);
protected Map createInitializationParameters(Element xml) { Map parameters = new HashMap(); Element[] paramXML = XmlUtils.getElements(xml, DescriptorConstants.INIT_PARAM_QNAME); for (int n = 0; n < paramXML.length; ++n) { String name = XmlUtils.getElementText(paramXML[n], DescriptorConstants.PARAM_NAME_QNAME); String value = XmlUtils.getElementText(paramXML[n], DescriptorConstants.PARAM_VALUE_QNAME); parameters.put(name, value); } return parameters; }
public SimpleComponent(Element xml, WefFactory factory) { _name = XmlUtils.getElementQName(xml); Element addressXML = XmlUtils.getElement(xml, WefConstants.COMP_ADDRESS_QNAME); _address = factory.createComponentAddress(addressXML); }
public Element putResourcePropertyDocument(Element wsrpDoc) throws SoapFault { Element request = XmlUtils.createElement(XmlUtils.EMPTY_DOC, WsrpConstants.PUT_DOCUMENT_QNAME, wsrpDoc, false); Element response = invoke(WsrpConstants.PUT_RP_DOCUMENT_URI, request); return XmlUtils.getFirstElement(response); }
/** * * This is a convenience method that resolves all of the schema includes * referenced in a WSDL. It iterates over every schema in the WSDL's * <em>types</em> section and processes it via XsdUtils.addIncludes(). * * @return The given WSDL, now with the included schemas added to its * <em>types</em> section. * */ public static Document addSchemaIncludes(Document wsdl, String wsdlPath, Environment environment, Set namespaces) { Element root = XmlUtils.getFirstElement(wsdl); Element types = XmlUtils.getElement(root, TYPES_QNAME); Element[] schemas = XmlUtils.getElements(types, XsdUtils.SCHEMA_QNAME); for (int n = 0; n < schemas.length; ++n) addSchemaIncludes(schemas[n], schemas[n], wsdlPath, environment, namespaces); return wsdl; }
public Element toXML(Object obj, QName qname) { return XmlUtils.createElement(qname, obj); } }
public Document getDocument(Bundle bundle, URL resourceConfig) { try { return XmlUtils.createDocument(resourceConfig.openStream()); } catch (Exception error) { error.printStackTrace(); return null; } }
public String getWsdlPathForContext(Document xml, String context) throws SoapFault { if (xml == null) throw new NullPointerException(_MESSAGES.get("NullDescriptorDocument")); if (context == null) return null; Element root = XmlUtils.getElement(xml, DescriptorConstants.MUSE_QNAME); Element[] resourceXML = XmlUtils.getElements(root, DescriptorConstants.RESOURCE_TYPE_QNAME); if(resourceXML == null) return null; QName qname = DescriptorConstants.CONTEXT_PATH_QNAME; for(int i=0;i<resourceXML.length;i++){ String path = XmlUtils.getElementText(resourceXML[i], qname); if(context.equals(path)){ Element wsdlElement = XmlUtils.getElement(resourceXML[i], DescriptorConstants.WSDL_QNAME); if(wsdlElement != null) return XmlUtils.getElementText(wsdlElement,DescriptorConstants.WSDL_FILE_QNAME); break; } } return null; }
/** * * @return An XML representation of the current WS-RP document, without * the XML header. * */ public synchronized String toString() { return XmlUtils.toString(toXML(), false); }
protected String createURI(Element xml) { return XmlUtils.getElementText(xml, DescriptorConstants.CAPABILITY_URI_QNAME); }
Element idXML = XmlUtils.getElement(xml, WefConstants.EVENT_ID_QNAME); setEventID(XmlUtils.extractText(idXML)); alreadySeen.add(idXML); Element reporterXML = XmlUtils.getElement(xml, WefConstants.REPORTER_COMP_QNAME); Element sourceXML = XmlUtils.getElement(xml, WefConstants.SOURCE_COMP_QNAME); alreadySeen.add(sourceXML); Element situationXML = XmlUtils.getElement(xml, WefConstants.SITUATION_QNAME); Element[] children = XmlUtils.getAllElements(xml);
private Collection parseElementCollection(Element property, QName qname) { Collection values = new ArrayList(); Element valuesXML = XmlUtils.getElement(property, qname); if (valuesXML != null) { // // we store the values as XML fragments - we will need // these to do simple validation later. converting the // values to non-XML would serve no purpose, and would // require much more complexity // Element[] children = XmlUtils.getAllElements(valuesXML); for (int n = 0; n < children.length; ++n) values.add(children[n]); } return values; }
private Map parseExtendedMetadata(Element property) { Map extended = new HashMap(); Element[] children = XmlUtils.getAllElements(property); for (int n = 0; n < children.length; ++n) { QName qname = XmlUtils.getElementQName(children[n]); // // 'extended metadata' is any element that isn't the // RMD *Values elements // if (!qname.equals(WsrmdConstants.VALID_VALUES_QNAME) && !qname.equals(WsrmdConstants.VALID_RANGE_QNAME) && !qname.equals(WsrmdConstants.STATIC_VALUES_QNAME)&& !qname.equals(WsrmdConstants.INITIAL_VALUES_QNAME)) { String value = XmlUtils.extractText(children[n]); extended.put(qname, value); } } return extended; }
/** * * @param root * A DOM Element representing a WS-N SimpleNotificationMessage * */ public SimpleNotificationMessage(Element root) throws SoapFault { if (root == null) throw new NullPointerException(_MESSAGES.get("NullMessageElement")); _topicPath = XmlUtils.getQNameFromChild(root, WsnConstants.TOPIC_QNAME); Element producerXML = XmlUtils.getElement(root, WsnConstants.PRODUCER_QNAME); if (producerXML != null) _producer = new EndpointReference(producerXML); Element subXML = XmlUtils.getElement(root, WsnConstants.SUBSCRIPTION_EPR_QNAME); if (subXML != null) _subscription = new EndpointReference(subXML); Element messageXML = XmlUtils.getElement(root, WsnConstants.MESSAGE_QNAME); // // we have to have a Message element, even if it's empty // if (messageXML == null) throw new SoapFault(_MESSAGES.get("NoMessageContent")); Element[] children = XmlUtils.getAllElements(messageXML); for (int n = 0; n < children.length; ++n) addMessageContent(children[n]); }
public Element toXML(Document doc) { PersistenceDefinition def = getPersistenceDefinition(); Element root = XmlUtils.createElement(doc, DescriptorConstants.PERSISTENCE_QNAME); XmlUtils.setElement(root, DescriptorConstants.PERSISTENCE_LOCATION_QNAME, def.getPersistenceLocation()); XmlUtils.setElement(root, DescriptorConstants.JAVA_PERSISTENCE_QNAME, def.getPersistenceClass().getName()); Map parameters = def.getInitializationParameters(); if (parameters != null) { InitParamDescriptor id = createInitParamDescriptor(); id.setInitializationParameters(parameters); Element initParamXML = id.toXML(doc); // // we move the sub tree because InitParamDescriptor.toXML() returns // a wrapper element around multiple init-param elements // XmlUtils.moveSubTree(initParamXML, root); } return root; } }
public void load(Document xml, Environment environment) throws SoapFault Element root = XmlUtils.getFirstElement(xml); QName rootName = XmlUtils.getElementQName(root);
public Element[] getMetadata(String dialect) throws SoapFault { GetMetadataRequest get = new GetMetadataRequest(dialect); Element response = invoke(WsxConstants.GET_METADATA_URI, get.toXML()); // // each child element is a MetadataSection - we want to dig down // one level deeper and get the actual content for the user // Element[] sections = XmlUtils.getAllElements(response); Element[] metadata = new Element[sections.length]; for (int n = 0; n < sections.length; ++n) metadata[n] = XmlUtils.getFirstElement(sections[n]); return metadata; }
public InsertRequest(Element request) throws BaseFault { if (request == null) throw new NullPointerException(_MESSAGES.get("NullRequestElement")); Element[] children = XmlUtils.getAllElements(request); if (children.length == 0) throw new InvalidMessageFormatFault(_MESSAGES.get("NoPropertiesFoundInsert")); // // the WS-RP spec says that in an Insert request with multiple // elements, all elements MUST have the same qualified name // QName firstQName = XmlUtils.getElementQName(children[0]); Element[] matches = XmlUtils.getElements(request, firstQName); if (matches.length != children.length) throw new InvalidMessageFormatFault(_MESSAGES.get("NamesNotEqualInsert")); setPropertyName(firstQName); setValues(children); }