" attribute is mandory for an URLEndpoint configuration");
return null;
}
String pattern = urlPatternAttr.getAttributeValue();
URLEndpoint endpoint = new URLEndpoint(Pattern.compile(pattern));
OMElement messageBuilders = xml.getFirstChildWithName(
new QName(URLEndpointsConfiguration.MESSAGE_BUILDERS));
if (messageBuilders != null) {
OMAttribute defaultBuilderAttr = messageBuilders.getAttribute(
new QName("defaultBuilder"));
if (defaultBuilderAttr != null) {
Builder builder = loadBuilder(defaultBuilderAttr.getAttributeValue());
if (builder != null) {
endpoint.setDefaultBuilder(builder);
}
}
Iterator it = messageBuilders.getChildrenWithName(
new QName(URLEndpointsConfiguration.MESSAGE_BUILDER));
while(it.hasNext()) {
OMElement builderElement = (OMElement) it.next();
OMAttribute contentTypeAttr = builderElement.getAttribute(
new QName(URLEndpointsConfiguration.CONTENT_TYPE));
if (contentTypeAttr == null) {
handleException(URLEndpointsConfiguration.CONTENT_TYPE +
" attribute cannot be null for URLEndpoint " +
"with the " + URLEndpointsConfiguration.URL_PATTERN + " : " + pattern);
}
OMAttribute classAttr = builderElement.getAttribute(
new QName(URLEndpointsConfiguration.CLASS));
if (classAttr == null) {
handleException(URLEndpointsConfiguration.CLASS +
" attribute cannot be null for URLEndpoint " +
"with the " + URLEndpointsConfiguration.URL_PATTERN + " : " + pattern);
}
if (classAttr != null && contentTypeAttr != null) {
Builder builder = loadBuilder(classAttr.getAttributeValue());
if (builder != null) {
endpoint.addBuilder(contentTypeAttr.getAttributeValue(), builder);
}
}
}
}
Iterator paramItr = xml.getChildrenWithName(
new QName(URLEndpointsConfiguration.PARAMETER));
while (paramItr.hasNext()) {
OMElement p = (OMElement) paramItr.next();
OMAttribute paramNameAttr = p.getAttribute(new QName(URLEndpointsConfiguration.NAME));
if (paramNameAttr == null) {
handleException("Parameter " + URLEndpointsConfiguration.NAME + " cannot be null");
} else {
endpoint.addParameter(new Parameter(paramNameAttr.getAttributeValue(), p.getText()));
}
}
return endpoint;
}