use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class FacesListEntries$JAXB method _read.
public static final FacesListEntries _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final FacesListEntries facesListEntries = new FacesListEntries();
context.beforeUnmarshal(facesListEntries, LifecycleCallback.NONE);
List<Object> nullValueOrValue = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("faces-config-list-entriesType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, FacesListEntries.class);
}
}
// Read attributes
for (final Attribute attribute : reader.getAttributes()) {
if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
// ATTRIBUTE: id
final java.lang.String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
context.addXmlId(reader, id, facesListEntries);
facesListEntries.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 (("value-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: valueClass
final java.lang.String valueClassRaw = elementReader.getElementAsString();
final java.lang.String valueClass;
try {
valueClass = Adapters.collapsedStringAdapterAdapter.unmarshal(valueClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, java.lang.String.class, java.lang.String.class, e);
continue;
}
facesListEntries.valueClass = valueClass;
} else if (("value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: nullValueOrValue
final java.lang.String nullValueOrValueItem = elementReader.getElementAsString();
if (nullValueOrValue == null) {
nullValueOrValue = facesListEntries.nullValueOrValue;
if (nullValueOrValue != null) {
nullValueOrValue.clear();
} else {
nullValueOrValue = new ArrayList<Object>();
}
}
nullValueOrValue.add(nullValueOrValueItem);
} else if (("null-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: nullValueOrValue
final org.apache.openejb.jee.FacesNullValue nullValueOrValueItem1 = readFacesNullValue(elementReader, context);
if (nullValueOrValue == null) {
nullValueOrValue = facesListEntries.nullValueOrValue;
if (nullValueOrValue != null) {
nullValueOrValue.clear();
} else {
nullValueOrValue = new ArrayList<Object>();
}
}
nullValueOrValue.add(nullValueOrValueItem1);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "value-class"), new QName("http://java.sun.com/xml/ns/javaee", "value"), new QName("http://java.sun.com/xml/ns/javaee", "null-value"));
}
}
if (nullValueOrValue != null) {
facesListEntries.nullValueOrValue = nullValueOrValue;
}
context.afterUnmarshal(facesListEntries, LifecycleCallback.NONE);
return facesListEntries;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class FacesLocaleConfig$JAXB method _read.
public static final FacesLocaleConfig _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final FacesLocaleConfig facesLocaleConfig = new FacesLocaleConfig();
context.beforeUnmarshal(facesLocaleConfig, LifecycleCallback.NONE);
List<FacesSupportedLocale> supportedLocale = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("faces-config-locale-configType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, FacesLocaleConfig.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, facesLocaleConfig);
facesLocaleConfig.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 (("default-locale" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: defaultLocale
final FacesDefaultLocale defaultLocale = readFacesDefaultLocale(elementReader, context);
facesLocaleConfig.defaultLocale = defaultLocale;
} else if (("supported-locale" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: supportedLocale
final FacesSupportedLocale supportedLocaleItem = readFacesSupportedLocale(elementReader, context);
if (supportedLocale == null) {
supportedLocale = facesLocaleConfig.supportedLocale;
if (supportedLocale != null) {
supportedLocale.clear();
} else {
supportedLocale = new ArrayList<FacesSupportedLocale>();
}
}
supportedLocale.add(supportedLocaleItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "default-locale"), new QName("http://java.sun.com/xml/ns/javaee", "supported-locale"));
}
}
if (supportedLocale != null) {
facesLocaleConfig.supportedLocale = supportedLocale;
}
context.afterUnmarshal(facesLocaleConfig, LifecycleCallback.NONE);
return facesLocaleConfig;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class ServiceInterfaceMapping$JAXB method _read.
public static final ServiceInterfaceMapping _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final ServiceInterfaceMapping serviceInterfaceMapping = new ServiceInterfaceMapping();
context.beforeUnmarshal(serviceInterfaceMapping, LifecycleCallback.NONE);
List<PortMapping> portMapping = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("service-interface-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, ServiceInterfaceMapping.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, serviceInterfaceMapping);
serviceInterfaceMapping.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 (("service-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: serviceInterface
final String serviceInterfaceRaw = elementReader.getElementAsString();
final String serviceInterface;
try {
serviceInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(serviceInterfaceRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
serviceInterfaceMapping.serviceInterface = serviceInterface;
} else if (("wsdl-service-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: wsdlServiceName
final QName wsdlServiceName = elementReader.getElementAsQName();
serviceInterfaceMapping.wsdlServiceName = wsdlServiceName;
} else if (("port-mapping" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: portMapping
final PortMapping portMappingItem = readPortMapping(elementReader, context);
if (portMapping == null) {
portMapping = serviceInterfaceMapping.portMapping;
if (portMapping != null) {
portMapping.clear();
} else {
portMapping = new ArrayList<PortMapping>();
}
}
portMapping.add(portMappingItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "service-interface"), new QName("http://java.sun.com/xml/ns/javaee", "wsdl-service-name"), new QName("http://java.sun.com/xml/ns/javaee", "port-mapping"));
}
}
if (portMapping != null) {
serviceInterfaceMapping.portMapping = portMapping;
}
context.afterUnmarshal(serviceInterfaceMapping, LifecycleCallback.NONE);
return serviceInterfaceMapping;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class Servlet$JAXB method _read.
public static final Servlet _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final Servlet servlet = new Servlet();
context.beforeUnmarshal(servlet, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
ArrayList<Text> displayNames = null;
LocalCollection<Icon> icon = null;
List<ParamValue> initParam = null;
List<SecurityRoleRef> securityRoleRef = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("servletType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, Servlet.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, servlet);
servlet.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 = servlet.icon;
if (icon != null) {
icon.clear();
} else {
icon = new LocalCollection<Icon>();
}
}
icon.add(iconItem);
} else if (("servlet-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: servletName
final String servletNameRaw = elementReader.getElementAsString();
final String servletName;
try {
servletName = Adapters.collapsedStringAdapterAdapter.unmarshal(servletNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
servlet.servletName = servletName;
} else if (("servlet-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: servletClass
final String servletClassRaw = elementReader.getElementAsString();
final String servletClass;
try {
servletClass = Adapters.collapsedStringAdapterAdapter.unmarshal(servletClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
servlet.servletClass = servletClass;
} else if (("jsp-file" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: jspFile
final String jspFileRaw = elementReader.getElementAsString();
final String jspFile;
try {
jspFile = Adapters.collapsedStringAdapterAdapter.unmarshal(jspFileRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
servlet.jspFile = jspFile;
} else if (("init-param" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: initParam
final ParamValue initParamItem = readParamValue(elementReader, context);
if (initParam == null) {
initParam = servlet.initParam;
if (initParam != null) {
initParam.clear();
} else {
initParam = new ArrayList<ParamValue>();
}
}
initParam.add(initParamItem);
} else if (("load-on-startup" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: loadOnStartup
final String loadOnStartupRaw = elementReader.getElementAsString();
final Integer loadOnStartup;
try {
loadOnStartup = Adapters.loadOnStartupAdapterAdapter.unmarshal(loadOnStartupRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, LoadOnStartupAdapter.class, Integer.class, Integer.class, e);
continue;
}
servlet.loadOnStartup = loadOnStartup;
} else if (("enabled" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: enabled
final Boolean enabled = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
servlet.enabled = enabled;
} else if (("async-supported" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: asyncSupported
final Boolean asyncSupported = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
servlet.asyncSupported = asyncSupported;
} else if (("run-as" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: runAs
final RunAs runAs = readRunAs(elementReader, context);
servlet.runAs = runAs;
} else if (("security-role-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: securityRoleRef
final SecurityRoleRef securityRoleRefItem = readSecurityRoleRef(elementReader, context);
if (securityRoleRef == null) {
securityRoleRef = servlet.securityRoleRef;
if (securityRoleRef != null) {
securityRoleRef.clear();
} else {
securityRoleRef = new ArrayList<SecurityRoleRef>();
}
}
securityRoleRef.add(securityRoleRefItem);
} else if (("multipart-config" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: multipartConfig
final MultipartConfig multipartConfig = readMultipartConfig(elementReader, context);
servlet.multipartConfig = multipartConfig;
} 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", "servlet-name"), new QName("http://java.sun.com/xml/ns/javaee", "servlet-class"), new QName("http://java.sun.com/xml/ns/javaee", "jsp-file"), new QName("http://java.sun.com/xml/ns/javaee", "init-param"), new QName("http://java.sun.com/xml/ns/javaee", "load-on-startup"), new QName("http://java.sun.com/xml/ns/javaee", "enabled"), new QName("http://java.sun.com/xml/ns/javaee", "async-supported"), new QName("http://java.sun.com/xml/ns/javaee", "run-as"), new QName("http://java.sun.com/xml/ns/javaee", "security-role-ref"), new QName("http://java.sun.com/xml/ns/javaee", "multipart-config"));
}
}
if (descriptions != null) {
try {
servlet.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, Servlet.class, "setDescriptions", Text[].class, e);
}
}
if (displayNames != null) {
try {
servlet.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
} catch (final Exception e) {
context.setterError(reader, Servlet.class, "setDisplayNames", Text[].class, e);
}
}
if (icon != null) {
servlet.icon = icon;
}
if (initParam != null) {
servlet.initParam = initParam;
}
if (securityRoleRef != null) {
servlet.securityRoleRef = securityRoleRef;
}
context.afterUnmarshal(servlet, LifecycleCallback.NONE);
return servlet;
}
use of org.metatype.sxc.util.XoXMLStreamReader in project tomee by apache.
the class ServletMapping$JAXB method _read.
public static final ServletMapping _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final ServletMapping servletMapping = new ServletMapping();
context.beforeUnmarshal(servletMapping, LifecycleCallback.NONE);
List<String> urlPattern = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("servlet-mappingType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, ServletMapping.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, servletMapping);
servletMapping.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 (("servlet-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: servletName
final String servletNameRaw = elementReader.getElementAsString();
final String servletName;
try {
servletName = Adapters.collapsedStringAdapterAdapter.unmarshal(servletNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
servletMapping.servletName = servletName;
} else if (("url-pattern" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: urlPattern
final String urlPatternItemRaw = elementReader.getElementAsString();
final String urlPatternItem;
try {
urlPatternItem = Adapters.trimStringAdapterAdapter.unmarshal(urlPatternItemRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, TrimStringAdapter.class, String.class, String.class, e);
continue;
}
if (urlPattern == null) {
urlPattern = servletMapping.urlPattern;
if (urlPattern != null) {
urlPattern.clear();
} else {
urlPattern = new ArrayList<String>();
}
}
urlPattern.add(urlPatternItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "servlet-name"), new QName("http://java.sun.com/xml/ns/javaee", "url-pattern"));
}
}
if (urlPattern != null) {
servletMapping.urlPattern = urlPattern;
}
context.afterUnmarshal(servletMapping, LifecycleCallback.NONE);
return servletMapping;
}
Aggregations