use of org.apache.openejb.jee.ServiceImplBean in project tomee by apache.
the class PortComponent$JAXB method _read.
public static final PortComponent _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final PortComponent portComponent = new PortComponent();
context.beforeUnmarshal(portComponent, LifecycleCallback.NONE);
List<Handler> handler = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("port-componentType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, PortComponent.class);
}
}
// Read attributes
for (final Attribute attribute : reader.getAttributes()) {
if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
// ATTRIBUTE: id
final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
context.addXmlId(reader, id, portComponent);
portComponent.id = id;
} else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
context.unexpectedAttribute(attribute, new QName("", "id"));
}
}
// Read elements
for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: description
final String descriptionRaw = elementReader.getElementAsString();
final String description;
try {
description = Adapters.collapsedStringAdapterAdapter.unmarshal(descriptionRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
portComponent.description = description;
} else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: displayName
final String displayNameRaw = elementReader.getElementAsString();
final String displayName;
try {
displayName = Adapters.collapsedStringAdapterAdapter.unmarshal(displayNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
portComponent.displayName = displayName;
} else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: icon
final Icon icon = readIcon(elementReader, context);
portComponent.icon = icon;
} else if (("port-component-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: portComponentName
final String portComponentNameRaw = elementReader.getElementAsString();
final String portComponentName;
try {
portComponentName = Adapters.collapsedStringAdapterAdapter.unmarshal(portComponentNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
portComponent.portComponentName = portComponentName;
} else if (("wsdl-service" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: wsdlService
final QName wsdlService = elementReader.getElementAsQName();
portComponent.wsdlService = wsdlService;
} else if (("wsdl-port" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: wsdlPort
final QName wsdlPort = elementReader.getElementAsQName();
portComponent.wsdlPort = wsdlPort;
} else if (("enable-mtom" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: enableMtom
final Boolean enableMtom = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
portComponent.enableMtom = enableMtom;
} else if (("mtom-threshold" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: mtomThreshold
final Integer mtomThreshold = Integer.valueOf(elementReader.getElementAsString());
portComponent.mtomThreshold = mtomThreshold;
} else if (("addressing" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: addressing
final Addressing addressing = readAddressing(elementReader, context);
portComponent.addressing = addressing;
} else if (("respect-binding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: respectBinding
final RespectBinding respectBinding = readRespectBinding(elementReader, context);
portComponent.respectBinding = respectBinding;
} else if (("protocol-binding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: protocolBinding
final String protocolBindingRaw = elementReader.getElementAsString();
final String protocolBinding;
try {
protocolBinding = Adapters.collapsedStringAdapterAdapter.unmarshal(protocolBindingRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
portComponent.protocolBinding = protocolBinding;
} else if (("service-endpoint-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: serviceEndpointInterface
final String serviceEndpointInterfaceRaw = elementReader.getElementAsString();
final String serviceEndpointInterface;
try {
serviceEndpointInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceEndpointInterfaceRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
portComponent.serviceEndpointInterface = serviceEndpointInterface;
} else if (("service-impl-bean" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: serviceImplBean
final ServiceImplBean serviceImplBean = readServiceImplBean(elementReader, context);
portComponent.serviceImplBean = serviceImplBean;
} else if (("handler" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: handler
final Handler handlerItem = readHandler(elementReader, context);
if (handler == null) {
handler = portComponent.handler;
if (handler != null) {
handler.clear();
} else {
handler = new ArrayList<Handler>();
}
}
handler.add(handlerItem);
} else if (("handler-chains" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: handlerChains
final HandlerChains handlerChains = readHandlerChains(elementReader, context);
portComponent.handlerChains = handlerChains;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "display-name"), new QName("http://java.sun.com/xml/ns/javaee", "icon"), new QName("http://java.sun.com/xml/ns/javaee", "port-component-name"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-service"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-port"), new QName("http://java.sun.com/xml/ns/javaee", "enable-mtom"), new QName("http://java.sun.com/xml/ns/javaee", "mtom-threshold"), new QName("http://java.sun.com/xml/ns/javaee", "addressing"), new QName("http://java.sun.com/xml/ns/javaee", "respect-binding"), new QName("http://java.sun.com/xml/ns/javaee", "protocol-binding"), new QName("http://java.sun.com/xml/ns/javaee", "service-endpoint-interface"), new QName("http://java.sun.com/xml/ns/javaee", "service-impl-bean"), new QName("http://java.sun.com/xml/ns/javaee", "handler"), new QName("http://java.sun.com/xml/ns/javaee", "handler-chains"));
}
}
if (handler != null) {
portComponent.handler = handler;
}
context.afterUnmarshal(portComponent, LifecycleCallback.NONE);
return portComponent;
}
Aggregations