use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class LocaleEncodingMappingList$JAXB method _read.
public static final LocaleEncodingMappingList _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final LocaleEncodingMappingList localeEncodingMappingList = new LocaleEncodingMappingList();
context.beforeUnmarshal(localeEncodingMappingList, LifecycleCallback.NONE);
List<LocaleEncodingMapping> localeEncodingMapping = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("locale-encoding-mapping-listType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, LocaleEncodingMappingList.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, localeEncodingMappingList);
localeEncodingMappingList.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 (("locale-encoding-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: localeEncodingMapping
final LocaleEncodingMapping localeEncodingMappingItem = readLocaleEncodingMapping(elementReader, context);
if (localeEncodingMapping == null) {
localeEncodingMapping = localeEncodingMappingList.localeEncodingMapping;
if (localeEncodingMapping != null) {
localeEncodingMapping.clear();
} else {
localeEncodingMapping = new ArrayList<LocaleEncodingMapping>();
}
}
localeEncodingMapping.add(localeEncodingMappingItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "locale-encoding-mapping"));
}
}
if (localeEncodingMapping != null) {
localeEncodingMappingList.localeEncodingMapping = localeEncodingMapping;
}
context.afterUnmarshal(localeEncodingMappingList, LifecycleCallback.NONE);
return localeEncodingMappingList;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class MessageDestination$JAXB method _read.
public static final MessageDestination _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final MessageDestination messageDestination = new MessageDestination();
context.beforeUnmarshal(messageDestination, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
ArrayList<Text> displayNames = null;
LocalCollection<Icon> icon = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("message-destinationType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, MessageDestination.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, messageDestination);
messageDestination.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: descriptions
final Text descriptionsItem = readText(elementReader, context);
if (descriptions == null) {
descriptions = new ArrayList<Text>();
}
descriptions.add(descriptionsItem);
} else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: displayNames
final Text displayNamesItem = readText(elementReader, context);
if (displayNames == null) {
displayNames = new ArrayList<Text>();
}
displayNames.add(displayNamesItem);
} else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: icon
final Icon iconItem = readIcon(elementReader, context);
if (icon == null) {
icon = messageDestination.icon;
if (icon != null) {
icon.clear();
} else {
icon = new LocalCollection<Icon>();
}
}
icon.add(iconItem);
} else if (("message-destination-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: messageDestinationName
final String messageDestinationNameRaw = elementReader.getElementAsString();
final String messageDestinationName;
try {
messageDestinationName = Adapters.collapsedStringAdapterAdapter.unmarshal(messageDestinationNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
messageDestination.messageDestinationName = messageDestinationName;
} else if (("mapped-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: mappedName
final String mappedNameRaw = elementReader.getElementAsString();
final String mappedName;
try {
mappedName = Adapters.collapsedStringAdapterAdapter.unmarshal(mappedNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
messageDestination.mappedName = mappedName;
} else if (("lookup-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: lookupName
final String lookupNameRaw = elementReader.getElementAsString();
final String lookupName;
try {
lookupName = Adapters.collapsedStringAdapterAdapter.unmarshal(lookupNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
messageDestination.lookupName = lookupName;
} 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", "message-destination-name"), new QName("http://java.sun.com/xml/ns/javaee", "mapped-name"), new QName("http://java.sun.com/xml/ns/javaee", "lookup-name"));
}
}
if (descriptions != null) {
try {
messageDestination.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, MessageDestination.class, "setDescriptions", Text[].class, e);
}
}
if (displayNames != null) {
try {
messageDestination.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
} catch (final Exception e) {
context.setterError(reader, MessageDestination.class, "setDisplayNames", Text[].class, e);
}
}
if (icon != null) {
messageDestination.icon = icon;
}
context.afterUnmarshal(messageDestination, LifecycleCallback.NONE);
return messageDestination;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class MessageDrivenDestination$JAXB method _read.
public static final MessageDrivenDestination _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final MessageDrivenDestination messageDrivenDestination = new MessageDrivenDestination();
context.beforeUnmarshal(messageDrivenDestination, LifecycleCallback.NONE);
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
return context.unexpectedXsiType(reader, MessageDrivenDestination.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, messageDrivenDestination);
messageDrivenDestination.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 (("destination-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: destinationType
final DestinationType destinationType = readDestinationType(elementReader, context);
messageDrivenDestination.destinationType = destinationType;
} else if (("subscription-durability" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: subscriptionDurability
final SubscriptionDurability subscriptionDurability = readSubscriptionDurability(elementReader, context);
messageDrivenDestination.subscriptionDurability = subscriptionDurability;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "destination-type"), new QName("http://java.sun.com/xml/ns/javaee", "subscription-durability"));
}
}
context.afterUnmarshal(messageDrivenDestination, LifecycleCallback.NONE);
return messageDrivenDestination;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class MessageListener$JAXB method _read.
public static final MessageListener _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final MessageListener messageListener = new MessageListener();
context.beforeUnmarshal(messageListener, LifecycleCallback.NONE);
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("messagelistenerType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, MessageListener.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, messageListener);
messageListener.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 (("messagelistener-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: messageListenerType
final String messageListenerTypeRaw = elementReader.getElementAsString();
final String messageListenerType;
try {
messageListenerType = Adapters.collapsedStringAdapterAdapter.unmarshal(messageListenerTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
messageListener.messageListenerType = messageListenerType;
} else if (("activationspec" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: activationSpec
final ActivationSpec activationSpec = readActivationSpec(elementReader, context);
messageListener.activationSpec = activationSpec;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "messagelistener-type"), new QName("http://java.sun.com/xml/ns/javaee", "activationspec"));
}
}
context.afterUnmarshal(messageListener, LifecycleCallback.NONE);
return messageListener;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class Method$JAXB method _read.
public static final Method _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final Method method = new Method();
context.beforeUnmarshal(method, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("methodType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, Method.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, method);
method.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: descriptions
final Text descriptionsItem = readText(elementReader, context);
if (descriptions == null) {
descriptions = new ArrayList<Text>();
}
descriptions.add(descriptionsItem);
} else if (("ejb-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: ejbName
final String ejbNameRaw = elementReader.getElementAsString();
final String ejbName;
try {
ejbName = Adapters.collapsedStringAdapterAdapter.unmarshal(ejbNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
method.ejbName = ejbName;
} else if (("method-intf" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: methodIntf
final MethodIntf methodIntf = parseMethodIntf(elementReader, context, elementReader.getElementAsString());
if (methodIntf != null) {
method.methodIntf = methodIntf;
}
} else if (("method-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: methodName
final String methodNameRaw = elementReader.getElementAsString();
final String methodName;
try {
methodName = Adapters.collapsedStringAdapterAdapter.unmarshal(methodNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
method.methodName = methodName;
} else if (("method-params" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: methodParams
final MethodParams methodParams = readMethodParams(elementReader, context);
method.methodParams = methodParams;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-name"), new QName("http://java.sun.com/xml/ns/javaee", "method-intf"), new QName("http://java.sun.com/xml/ns/javaee", "method-name"), new QName("http://java.sun.com/xml/ns/javaee", "method-params"));
}
}
if (descriptions != null) {
try {
method.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, Method.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(method, LifecycleCallback.NONE);
return method;
}
Aggregations