use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class Timeout$JAXB method _read.
public static final Timeout _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final Timeout timeout = new Timeout();
context.beforeUnmarshal(timeout, LifecycleCallback.NONE);
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("access-timeoutType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, Timeout.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, timeout);
timeout.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 (("timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: timeout
final Long timeout1 = Long.valueOf(elementReader.getElementAsString());
timeout.timeout = timeout1;
} else if (("unit" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: unit
final String unitRaw = elementReader.getElementAsString();
final TimeUnit unit;
try {
unit = Adapters.timeUnitAdapterAdapter.unmarshal(unitRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, TimeUnitAdapter.class, TimeUnit.class, TimeUnit.class, e);
continue;
}
if (unit != null) {
timeout.unit = unit;
}
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "timeout"), new QName("http://java.sun.com/xml/ns/javaee", "unit"));
}
}
context.afterUnmarshal(timeout, LifecycleCallback.NONE);
return timeout;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class Timer$JAXB method _read.
public static final Timer _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final Timer timer = new Timer();
context.beforeUnmarshal(timer, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("timerType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, Timer.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, timer);
timer.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 (("schedule" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: schedule
final TimerSchedule schedule = readTimerSchedule(elementReader, context);
timer.schedule = schedule;
} else if (("start" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: start
final XMLGregorianCalendar start = datatypeFactory.newXMLGregorianCalendar(elementReader.getElementAsString());
timer.start = start;
} else if (("end" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: end
final XMLGregorianCalendar end = datatypeFactory.newXMLGregorianCalendar(elementReader.getElementAsString());
timer.end = end;
} else if (("timeout-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: timeoutMethod
final NamedMethod timeoutMethod = readNamedMethod(elementReader, context);
timer.timeoutMethod = timeoutMethod;
} else if (("persistent" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: persistent
final Boolean persistent = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
timer.persistent = persistent;
} else if (("timezone" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: timezone
final String timezoneRaw = elementReader.getElementAsString();
final String timezone;
try {
timezone = Adapters.collapsedStringAdapterAdapter.unmarshal(timezoneRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
timer.timezone = timezone;
} else if (("info" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: info
final String infoRaw = elementReader.getElementAsString();
final String info;
try {
info = Adapters.collapsedStringAdapterAdapter.unmarshal(infoRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
timer.info = info;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "schedule"), new QName("http://java.sun.com/xml/ns/javaee", "start"), new QName("http://java.sun.com/xml/ns/javaee", "end"), new QName("http://java.sun.com/xml/ns/javaee", "timeout-method"), new QName("http://java.sun.com/xml/ns/javaee", "persistent"), new QName("http://java.sun.com/xml/ns/javaee", "timezone"), new QName("http://java.sun.com/xml/ns/javaee", "info"));
}
}
if (descriptions != null) {
try {
timer.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, Timer.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(timer, LifecycleCallback.NONE);
return timer;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class TimerSchedule$JAXB method _read.
public static final TimerSchedule _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final TimerSchedule timerSchedule = new TimerSchedule();
context.beforeUnmarshal(timerSchedule, LifecycleCallback.NONE);
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("timer-scheduleType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, TimerSchedule.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, timerSchedule);
timerSchedule.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 (("second" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: second
final String secondRaw = elementReader.getElementAsString();
final String second;
try {
second = Adapters.collapsedStringAdapterAdapter.unmarshal(secondRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
timerSchedule.second = second;
} else if (("minute" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: minute
final String minuteRaw = elementReader.getElementAsString();
final String minute;
try {
minute = Adapters.collapsedStringAdapterAdapter.unmarshal(minuteRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
timerSchedule.minute = minute;
} else if (("hour" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: hour
final String hourRaw = elementReader.getElementAsString();
final String hour;
try {
hour = Adapters.collapsedStringAdapterAdapter.unmarshal(hourRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
timerSchedule.hour = hour;
} else if (("day-of-month" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: dayOfMonth
final String dayOfMonthRaw = elementReader.getElementAsString();
final String dayOfMonth;
try {
dayOfMonth = Adapters.collapsedStringAdapterAdapter.unmarshal(dayOfMonthRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
timerSchedule.dayOfMonth = dayOfMonth;
} else if (("month" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: month
final String monthRaw = elementReader.getElementAsString();
final String month;
try {
month = Adapters.collapsedStringAdapterAdapter.unmarshal(monthRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
timerSchedule.month = month;
} else if (("day-of-week" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: dayOfWeek
final String dayOfWeekRaw = elementReader.getElementAsString();
final String dayOfWeek;
try {
dayOfWeek = Adapters.collapsedStringAdapterAdapter.unmarshal(dayOfWeekRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
timerSchedule.dayOfWeek = dayOfWeek;
} else if (("year" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: year
final String yearRaw = elementReader.getElementAsString();
final String year;
try {
year = Adapters.collapsedStringAdapterAdapter.unmarshal(yearRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
timerSchedule.year = year;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "second"), new QName("http://java.sun.com/xml/ns/javaee", "minute"), new QName("http://java.sun.com/xml/ns/javaee", "hour"), new QName("http://java.sun.com/xml/ns/javaee", "day-of-month"), new QName("http://java.sun.com/xml/ns/javaee", "month"), new QName("http://java.sun.com/xml/ns/javaee", "day-of-week"), new QName("http://java.sun.com/xml/ns/javaee", "year"));
}
}
context.afterUnmarshal(timerSchedule, LifecycleCallback.NONE);
return timerSchedule;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class TldAttribute$JAXB method _read.
public static final TldAttribute _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final TldAttribute tldAttribute = new TldAttribute();
context.beforeUnmarshal(tldAttribute, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("tld-attributeType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, TldAttribute.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, tldAttribute);
tldAttribute.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 (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: name
final String nameRaw = elementReader.getElementAsString();
final String name;
try {
name = Adapters.collapsedStringAdapterAdapter.unmarshal(nameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
tldAttribute.name = name;
} else if (("required" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: required
final String requiredRaw = elementReader.getElementAsString();
final String required;
try {
required = Adapters.collapsedStringAdapterAdapter.unmarshal(requiredRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
tldAttribute.required = required;
} else if (("rtexprvalue" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: rtexprvalue
final String rtexprvalueRaw = elementReader.getElementAsString();
final String rtexprvalue;
try {
rtexprvalue = Adapters.collapsedStringAdapterAdapter.unmarshal(rtexprvalueRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
tldAttribute.rtexprvalue = rtexprvalue;
} else if (("type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: type
final String typeRaw = elementReader.getElementAsString();
final String type;
try {
type = Adapters.collapsedStringAdapterAdapter.unmarshal(typeRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
tldAttribute.type = type;
} else if (("deferred-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: deferredValue
final TldDeferredValue deferredValue = readTldDeferredValue(elementReader, context);
tldAttribute.deferredValue = deferredValue;
} else if (("deferred-method" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: deferredMethod
final TldDeferredMethod deferredMethod = readTldDeferredMethod(elementReader, context);
tldAttribute.deferredMethod = deferredMethod;
} else if (("fragment" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: fragment
final String fragmentRaw = elementReader.getElementAsString();
final String fragment;
try {
fragment = Adapters.collapsedStringAdapterAdapter.unmarshal(fragmentRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
tldAttribute.fragment = fragment;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "required"), new QName("http://java.sun.com/xml/ns/javaee", "rtexprvalue"), new QName("http://java.sun.com/xml/ns/javaee", "type"), new QName("http://java.sun.com/xml/ns/javaee", "deferred-value"), new QName("http://java.sun.com/xml/ns/javaee", "deferred-method"), new QName("http://java.sun.com/xml/ns/javaee", "fragment"));
}
}
if (descriptions != null) {
try {
tldAttribute.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, TldAttribute.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(tldAttribute, LifecycleCallback.NONE);
return tldAttribute;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class TldExtension$JAXB method _read.
public static final TldExtension _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final TldExtension tldExtension = new TldExtension();
context.beforeUnmarshal(tldExtension, LifecycleCallback.NONE);
List<String> extensionElement = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("tld-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, TldExtension.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, tldExtension);
tldExtension.id = id;
} else if (("namespace" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
// ATTRIBUTE: namespace
tldExtension.namespace = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
} else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "namespace"));
}
}
// Read elements
for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
if (("extension-element" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: extensionElement
final String extensionElementItemRaw = elementReader.getElementAsString();
final String extensionElementItem;
try {
extensionElementItem = Adapters.collapsedStringAdapterAdapter.unmarshal(extensionElementItemRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
if (extensionElement == null) {
extensionElement = tldExtension.extensionElement;
if (extensionElement != null) {
extensionElement.clear();
} else {
extensionElement = new ArrayList<String>();
}
}
extensionElement.add(extensionElementItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "extension-element"));
}
}
if (extensionElement != null) {
tldExtension.extensionElement = extensionElement;
}
context.afterUnmarshal(tldExtension, LifecycleCallback.NONE);
return tldExtension;
}
Aggregations