use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class FacesManagedBeanExtension$JAXB method _read.
public static final FacesManagedBeanExtension _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final FacesManagedBeanExtension facesManagedBeanExtension = new FacesManagedBeanExtension();
context.beforeUnmarshal(facesManagedBeanExtension, LifecycleCallback.NONE);
List<Object> any = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("faces-config-managed-bean-extensionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, FacesManagedBeanExtension.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, facesManagedBeanExtension);
facesManagedBeanExtension.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()) {
// ELEMENT_REF: any
if (any == null) {
any = facesManagedBeanExtension.any;
if (any != null) {
any.clear();
} else {
any = new ArrayList<Object>();
}
}
any.add(context.readXmlAny(elementReader, Object.class, true));
}
if (any != null) {
facesManagedBeanExtension.any = any;
}
context.afterUnmarshal(facesManagedBeanExtension, LifecycleCallback.NONE);
return facesManagedBeanExtension;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class FacesManagedProperty$JAXB method _read.
public static final FacesManagedProperty _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final FacesManagedProperty facesManagedProperty = new FacesManagedProperty();
context.beforeUnmarshal(facesManagedProperty, 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 (("faces-config-managed-propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, FacesManagedProperty.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, facesManagedProperty);
facesManagedProperty.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 = facesManagedProperty.icon;
if (icon != null) {
icon.clear();
} else {
icon = new LocalCollection<Icon>();
}
}
icon.add(iconItem);
} else if (("property-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: propertyName
final String propertyNameRaw = elementReader.getElementAsString();
final String propertyName;
try {
propertyName = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesManagedProperty.propertyName = propertyName;
} else if (("property-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: propertyClass
final String propertyClassRaw = elementReader.getElementAsString();
final String propertyClass;
try {
propertyClass = Adapters.collapsedStringAdapterAdapter.unmarshal(propertyClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesManagedProperty.propertyClass = propertyClass;
} else if (("map-entries" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: mapEntries
final FacesMapEntries mapEntries = readFacesMapEntries(elementReader, context);
facesManagedProperty.mapEntries = mapEntries;
} else if (("null-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: nullValue
final FacesNullValue nullValue = readFacesNullValue(elementReader, context);
facesManagedProperty.nullValue = nullValue;
} else if (("value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: value
final String valueRaw = elementReader.getElementAsString();
final String value;
try {
value = Adapters.collapsedStringAdapterAdapter.unmarshal(valueRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
facesManagedProperty.value = value;
} else if (("list-entries" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: listEntries
final FacesListEntries listEntries = readFacesListEntries(elementReader, context);
facesManagedProperty.listEntries = listEntries;
} 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", "property-name"), new QName("http://java.sun.com/xml/ns/javaee", "property-class"), new QName("http://java.sun.com/xml/ns/javaee", "map-entries"), new QName("http://java.sun.com/xml/ns/javaee", "null-value"), new QName("http://java.sun.com/xml/ns/javaee", "value"), new QName("http://java.sun.com/xml/ns/javaee", "list-entries"));
}
}
if (descriptions != null) {
try {
facesManagedProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, FacesManagedProperty.class, "setDescriptions", Text[].class, e);
}
}
if (displayNames != null) {
try {
facesManagedProperty.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
} catch (final Exception e) {
context.setterError(reader, FacesManagedProperty.class, "setDisplayNames", Text[].class, e);
}
}
if (icon != null) {
facesManagedProperty.icon = icon;
}
context.afterUnmarshal(facesManagedProperty, LifecycleCallback.NONE);
return facesManagedProperty;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class AbsoluteOrdering$JAXB method _read.
public static final AbsoluteOrdering _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final AbsoluteOrdering absoluteOrdering = new AbsoluteOrdering();
context.beforeUnmarshal(absoluteOrdering, LifecycleCallback.NONE);
List<Object> nameOrOthers = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("absoluteOrderingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, AbsoluteOrdering.class);
}
}
// Read attributes
for (final Attribute attribute : reader.getAttributes()) {
if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
context.unexpectedAttribute(attribute);
}
}
// Read elements
for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
if (("name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: nameOrOthers
final java.lang.String nameOrOthersItem = elementReader.getElementAsString();
if (nameOrOthers == null) {
nameOrOthers = absoluteOrdering.nameOrOthers;
if (nameOrOthers != null) {
nameOrOthers.clear();
} else {
nameOrOthers = new ArrayList<Object>();
}
}
nameOrOthers.add(nameOrOthersItem);
} else if (("others" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: nameOrOthers
final org.apache.openejb.jee.OrderingOthers nameOrOthersItem1 = readOrderingOthers(elementReader, context);
if (nameOrOthers == null) {
nameOrOthers = absoluteOrdering.nameOrOthers;
if (nameOrOthers != null) {
nameOrOthers.clear();
} else {
nameOrOthers = new ArrayList<Object>();
}
}
nameOrOthers.add(nameOrOthersItem1);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "name"), new QName("http://java.sun.com/xml/ns/javaee", "others"));
}
}
if (nameOrOthers != null) {
absoluteOrdering.nameOrOthers = nameOrOthers;
}
context.afterUnmarshal(absoluteOrdering, LifecycleCallback.NONE);
return absoluteOrdering;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class ActivationConfig$JAXB method _read.
public static final ActivationConfig _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final ActivationConfig activationConfig = new ActivationConfig();
context.beforeUnmarshal(activationConfig, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
List<ActivationConfigProperty> activationConfigProperty = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("activation-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, ActivationConfig.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, activationConfig);
activationConfig.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 (("activation-config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: activationConfigProperty
final ActivationConfigProperty activationConfigPropertyItem = readActivationConfigProperty(elementReader, context);
if (activationConfigProperty == null) {
activationConfigProperty = activationConfig.activationConfigProperty;
if (activationConfigProperty != null) {
activationConfigProperty.clear();
} else {
activationConfigProperty = new ArrayList<ActivationConfigProperty>();
}
}
activationConfigProperty.add(activationConfigPropertyItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "activation-config-property"));
}
}
if (descriptions != null) {
try {
activationConfig.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, ActivationConfig.class, "setDescriptions", Text[].class, e);
}
}
if (activationConfigProperty != null) {
activationConfig.activationConfigProperty = activationConfigProperty;
}
context.afterUnmarshal(activationConfig, LifecycleCallback.NONE);
return activationConfig;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class ActivationSpec$JAXB method _read.
public static final ActivationSpec _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final ActivationSpec activationSpec = new ActivationSpec();
context.beforeUnmarshal(activationSpec, LifecycleCallback.NONE);
List<RequiredConfigProperty> requiredConfigProperty = null;
List<ConfigProperty> configProperty = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("activationspecType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, ActivationSpec.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, activationSpec);
activationSpec.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 (("activationspec-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: activationSpecClass
final String activationSpecClassRaw = elementReader.getElementAsString();
final String activationSpecClass;
try {
activationSpecClass = Adapters.collapsedStringAdapterAdapter.unmarshal(activationSpecClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
activationSpec.activationSpecClass = activationSpecClass;
} else if (("required-config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: requiredConfigProperty
final RequiredConfigProperty requiredConfigPropertyItem = readRequiredConfigProperty(elementReader, context);
if (requiredConfigProperty == null) {
requiredConfigProperty = activationSpec.requiredConfigProperty;
if (requiredConfigProperty != null) {
requiredConfigProperty.clear();
} else {
requiredConfigProperty = new ArrayList<RequiredConfigProperty>();
}
}
requiredConfigProperty.add(requiredConfigPropertyItem);
} else if (("config-property" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configProperty
final ConfigProperty configPropertyItem = readConfigProperty(elementReader, context);
if (configProperty == null) {
configProperty = activationSpec.configProperty;
if (configProperty != null) {
configProperty.clear();
} else {
configProperty = new ArrayList<ConfigProperty>();
}
}
configProperty.add(configPropertyItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "activationspec-class"), new QName("http://java.sun.com/xml/ns/javaee", "required-config-property"), new QName("http://java.sun.com/xml/ns/javaee", "config-property"));
}
}
if (requiredConfigProperty != null) {
activationSpec.requiredConfigProperty = requiredConfigProperty;
}
if (configProperty != null) {
activationSpec.configProperty = configProperty;
}
context.afterUnmarshal(activationSpec, LifecycleCallback.NONE);
return activationSpec;
}
Aggregations