}
Iterator props = elem.getChildrenWithName(
new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "parameter"));
ArrayList <Entry> params = new ArrayList<Entry>();
Entry entry = null;
while (props.hasNext()) {
Object o = props.next();
if (o instanceof OMElement) {
OMElement prop = (OMElement) o;
OMAttribute pname = prop.getAttribute(new QName("name"));
OMElement propertyValue = prop.getFirstElement();
if (pname != null) {
if (propertyValue != null) {
entry = new Entry();
entry.setKey(pname.getAttributeValue());
entry.setValue(propertyValue.toString());
params.add(entry);
} else {
entry = new Entry();
entry.setKey(pname.getAttributeValue());
entry.setValue(prop.getText().trim());
params.add(entry);
}
}
}
}
pd.setServiceParams(params.toArray(new Entry[params.size()]));
OMElement wsdl = elem.getFirstChildWithName(
new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "publishWSDL"));
if (wsdl != null) {
OMAttribute wsdlkey = wsdl.getAttribute(
new QName(XMLConfigConstants.NULL_NAMESPACE, "key"));
if (wsdlkey != null) {
pd.setWsdlKey(wsdlkey.getAttributeValue());
} else {
OMAttribute wsdlURI = wsdl.getAttribute(
new QName(XMLConfigConstants.NULL_NAMESPACE, "uri"));
if (wsdlURI != null) {
pd.setWsdlURI(wsdlURI.getAttributeValue());
} else {
OMElement wsdl11 = wsdl.getFirstChildWithName(
new QName(WSDLConstants.WSDL1_1_NAMESPACE, "definitions"));
String wsdlDef;
if (wsdl11 != null) {
wsdlDef = wsdl11.toString().replaceAll("\n|\\r|\\f|\\t", "");
wsdlDef = wsdlDef.replaceAll("> +<", "><");
pd.setWsdlDef(wsdlDef);
} else {
OMElement wsdl20 = wsdl.getFirstChildWithName(
new QName(WSDL2Constants.WSDL_NAMESPACE, "description"));
if (wsdl20 != null) {
wsdlDef = wsdl20.toString().replaceAll("\n|\\r|\\f|\\t", "");
wsdlDef = wsdlDef.replaceAll("> +<", "><");
pd.setWsdlDef(wsdlDef);
}
}
}
}
Iterator it = wsdl.getChildrenWithName(
new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "resource"));
ArrayList <Entry> resources = new ArrayList<Entry>();
Entry resource = null;
while (it.hasNext()) {
OMElement resourceElem = (OMElement)it.next();
OMAttribute location = resourceElem.getAttribute
(new QName(XMLConfigConstants.NULL_NAMESPACE, "location"));
if (location == null) {
// todo handle exception
}
OMAttribute key = resourceElem.getAttribute(
new QName(XMLConfigConstants.NULL_NAMESPACE, "key"));
if (key == null) {
// todo handle exception
}
resource = new Entry();
resource.setKey(location.getAttributeValue());
resource.setValue(key.getAttributeValue());
resources.add(resource);
}
pd.setWsdlResources(resources.toArray(new Entry[resources.size()]));
}