use of com.sun.xml.ws.streaming.Attributes in project metro-jax-ws by eclipse-ee4j.
the class DeploymentDescriptorParser method parseAdapters.
private List<A> parseAdapters(XMLStreamReader reader) {
if (!reader.getName().equals(QNAME_ENDPOINTS)) {
failWithFullName("runtime.parser.invalidElement", reader);
}
List<A> adapters = new ArrayList<>();
Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
String version = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_VERSION);
if (!ATTRVALUE_SUPPORTED_VERSIONS.contains(version)) {
failWithLocalName("runtime.parser.invalidVersionNumber", reader, version);
}
while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
if (reader.getName().equals(QNAME_ENDPOINT)) {
attrs = XMLStreamReaderUtil.getAttributes(reader);
String name = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_NAME);
if (!names.add(name)) {
logger.warning(WsservletMessages.SERVLET_WARNING_DUPLICATE_ENDPOINT_NAME());
}
String implementationName = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_IMPLEMENTATION);
Class<?> implementorClass = getImplementorClass(implementationName, reader);
MetadataReader metadataReader = null;
ExternalMetadataFeature externalMetadataFeature = null;
// parse subelements to instantiate externalMetadataReader, if necessary ...
XMLStreamReaderUtil.nextElementContent(reader);
if (reader.getEventType() != XMLStreamConstants.END_ELEMENT) {
externalMetadataFeature = configureExternalMetadataReader(reader);
if (externalMetadataFeature != null) {
metadataReader = externalMetadataFeature.getMetadataReader(implementorClass.getClassLoader(), false);
}
}
QName serviceName = getQNameAttribute(attrs, ATTR_SERVICE);
if (serviceName == null) {
serviceName = EndpointFactory.getDefaultServiceName(implementorClass, metadataReader);
}
QName portName = getQNameAttribute(attrs, ATTR_PORT);
if (portName == null) {
portName = EndpointFactory.getDefaultPortName(serviceName, implementorClass, metadataReader);
}
// get enable-mtom attribute value
String enable_mtom = getAttribute(attrs, ATTR_ENABLE_MTOM);
String mtomThreshold = getAttribute(attrs, ATTR_MTOM_THRESHOLD_VALUE);
String dbMode = getAttribute(attrs, ATTR_DATABINDING);
String bindingId = getAttribute(attrs, ATTR_BINDING);
if (bindingId != null) {
// Convert short-form tokens to API's binding ids
bindingId = getBindingIdForToken(bindingId);
}
WSBinding binding = createBinding(bindingId, implementorClass, enable_mtom, mtomThreshold, dbMode);
if (externalMetadataFeature != null) {
binding.getFeatures().mergeFeatures(new WebServiceFeature[] { externalMetadataFeature }, true);
}
String urlPattern = getMandatoryNonEmptyAttribute(reader, attrs, ATTR_URL_PATTERN);
// TODO use 'docs' as the metadata. If wsdl is non-null it's the primary.
boolean handlersSetInDD = setHandlersAndRoles(binding, reader, serviceName, portName);
EndpointFactory.verifyImplementorClass(implementorClass, metadataReader);
SDDocumentSource primaryWSDL = getPrimaryWSDL(reader, attrs, implementorClass, metadataReader);
WSEndpoint<?> endpoint = WSEndpoint.create(implementorClass, !handlersSetInDD, null, serviceName, portName, container, binding, primaryWSDL, docs.values(), createEntityResolver(), false);
adapters.add(adapterFactory.createAdapter(name, urlPattern, endpoint));
} else {
failWithLocalName("runtime.parser.invalidElement", reader);
}
}
return adapters;
}
use of com.sun.xml.ws.streaming.Attributes in project metro-jax-ws by eclipse-ee4j.
the class DeploymentDescriptorParser method configureExternalMetadataReader.
protected ExternalMetadataFeature configureExternalMetadataReader(XMLStreamReader reader) {
ExternalMetadataFeature.Builder featureBuilder = null;
while (QNAME_EXT_METADA.equals(reader.getName())) {
if (reader.getEventType() == XMLStreamConstants.START_ELEMENT) {
Attributes attrs = XMLStreamReaderUtil.getAttributes(reader);
String file = getAttribute(attrs, ATTR_FILE);
if (file != null) {
if (featureBuilder == null) {
featureBuilder = ExternalMetadataFeature.builder();
}
featureBuilder.addFiles(new File(file));
}
String res = getAttribute(attrs, ATTR_RESOURCE);
if (res != null) {
if (featureBuilder == null) {
featureBuilder = ExternalMetadataFeature.builder();
}
featureBuilder.addResources(res);
}
}
XMLStreamReaderUtil.nextElementContent(reader);
}
return buildFeature(featureBuilder);
}
Aggregations