use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class ConfigProperty$JAXB method _read.
public static final ConfigProperty _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final ConfigProperty configProperty = new ConfigProperty();
context.beforeUnmarshal(configProperty, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("config-propertyType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, ConfigProperty.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, configProperty);
configProperty.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 (("config-property-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertyName
final String configPropertyNameRaw = elementReader.getElementAsString();
final String configPropertyName;
try {
configPropertyName = Adapters.collapsedStringAdapterAdapter.unmarshal(configPropertyNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
configProperty.configPropertyName = configPropertyName;
} else if (("config-property-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertyType
final String configPropertyTypeRaw = elementReader.getElementAsString();
final String configPropertyType;
try {
configPropertyType = Adapters.collapsedStringAdapterAdapter.unmarshal(configPropertyTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
configProperty.configPropertyType = configPropertyType;
} else if (("config-property-value" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertyValue
final String configPropertyValueRaw = elementReader.getElementAsString();
final String configPropertyValue;
try {
configPropertyValue = Adapters.collapsedStringAdapterAdapter.unmarshal(configPropertyValueRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
configProperty.configPropertyValue = configPropertyValue;
} else if (("config-property-ignore" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertyIgnore
final Boolean configPropertyIgnore = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
configProperty.configPropertyIgnore = configPropertyIgnore;
} else if (("config-property-supports-dynamic-updates" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertySupportsDynamicUpdates
final Boolean configPropertySupportsDynamicUpdates = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
configProperty.configPropertySupportsDynamicUpdates = configPropertySupportsDynamicUpdates;
} else if (("config-property-confidential" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: configPropertyConfidential
final Boolean configPropertyConfidential = ("1".equals(elementReader.getElementAsString()) || "true".equals(elementReader.getElementAsString()));
configProperty.configPropertyConfidential = configPropertyConfidential;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-name"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-type"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-value"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-ignore"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-supports-dynamic-updates"), new QName("http://java.sun.com/xml/ns/javaee", "config-property-confidential"));
}
}
if (descriptions != null) {
try {
configProperty.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, ConfigProperty.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(configProperty, LifecycleCallback.NONE);
return configProperty;
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class AuthConstraint$JAXB method _read.
public static final AuthConstraint _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final AuthConstraint authConstraint = new AuthConstraint();
context.beforeUnmarshal(authConstraint, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
List<String> roleName = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("auth-constraintType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, AuthConstraint.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, authConstraint);
authConstraint.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 (("role-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: roleName
final String roleNameItemRaw = elementReader.getElementAsString();
final String roleNameItem;
try {
roleNameItem = Adapters.collapsedStringAdapterAdapter.unmarshal(roleNameItemRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
if (roleName == null) {
roleName = authConstraint.roleName;
if (roleName != null) {
roleName.clear();
} else {
roleName = new ArrayList<String>();
}
}
roleName.add(roleNameItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "role-name"));
}
}
if (descriptions != null) {
try {
authConstraint.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, AuthConstraint.class, "setDescriptions", Text[].class, e);
}
}
if (roleName != null) {
authConstraint.roleName = roleName;
}
context.afterUnmarshal(authConstraint, LifecycleCallback.NONE);
return authConstraint;
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class CmpField$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final CmpField cmpField, RuntimeContext context) throws Exception {
if (cmpField == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (CmpField.class != cmpField.getClass()) {
context.unexpectedSubclass(writer, cmpField, CmpField.class);
return;
}
context.beforeMarshal(cmpField, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = cmpField.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(cmpField, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = cmpField.getDescriptions();
} catch (final Exception e) {
context.getterError(cmpField, "descriptions", CmpField.class, "getDescriptions", e);
}
if (descriptions != null) {
for (final Text descriptionsItem : descriptions) {
if (descriptionsItem != null) {
writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
writeText(writer, descriptionsItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(cmpField, "descriptions");
}
}
}
// ELEMENT: fieldName
final String fieldNameRaw = cmpField.fieldName;
String fieldName = null;
try {
fieldName = Adapters.collapsedStringAdapterAdapter.marshal(fieldNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(cmpField, "fieldName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (fieldName != null) {
writer.writeStartElement(prefix, "field-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(fieldName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(cmpField, "fieldName");
}
context.afterMarshal(cmpField, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class AuthenticationMechanism$JAXB method _read.
public static final AuthenticationMechanism _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final AuthenticationMechanism authenticationMechanism = new AuthenticationMechanism();
context.beforeUnmarshal(authenticationMechanism, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("authentication-mechanismType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, AuthenticationMechanism.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, authenticationMechanism);
authenticationMechanism.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 (("authentication-mechanism-type" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: authenticationMechanismType
final String authenticationMechanismTypeRaw = elementReader.getElementAsString();
final String authenticationMechanismType;
try {
authenticationMechanismType = Adapters.collapsedStringAdapterAdapter.unmarshal(authenticationMechanismTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
authenticationMechanism.authenticationMechanismType = authenticationMechanismType;
} else if (("credential-interface" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: credentialInterface
final String credentialInterfaceRaw = elementReader.getElementAsString();
final String credentialInterface;
try {
credentialInterface = Adapters.collapsedStringAdapterAdapter.unmarshal(credentialInterfaceRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
authenticationMechanism.credentialInterface = credentialInterface;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "authentication-mechanism-type"), new QName("http://java.sun.com/xml/ns/javaee", "credential-interface"));
}
}
if (descriptions != null) {
try {
authenticationMechanism.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, AuthenticationMechanism.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(authenticationMechanism, LifecycleCallback.NONE);
return authenticationMechanism;
}
use of org.apache.openejb.jee.Text$JAXB.readText in project tomee by apache.
the class FacesComponent$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final FacesComponent facesComponent, RuntimeContext context) throws Exception {
if (facesComponent == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (FacesComponent.class != facesComponent.getClass()) {
context.unexpectedSubclass(writer, facesComponent, FacesComponent.class);
return;
}
context.beforeMarshal(facesComponent, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = facesComponent.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesComponent, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = facesComponent.getDescriptions();
} catch (final Exception e) {
context.getterError(facesComponent, "descriptions", FacesComponent.class, "getDescriptions", e);
}
if (descriptions != null) {
for (final Text descriptionsItem : descriptions) {
if (descriptionsItem != null) {
writer.writeStartElement(prefix, "description", "http://java.sun.com/xml/ns/javaee");
writeText(writer, descriptionsItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesComponent, "descriptions");
}
}
}
// ELEMENT: displayNames
Text[] displayNames = null;
try {
displayNames = facesComponent.getDisplayNames();
} catch (final Exception e) {
context.getterError(facesComponent, "displayNames", FacesComponent.class, "getDisplayNames", e);
}
if (displayNames != null) {
for (final Text displayNamesItem : displayNames) {
if (displayNamesItem != null) {
writer.writeStartElement(prefix, "display-name", "http://java.sun.com/xml/ns/javaee");
writeText(writer, displayNamesItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesComponent, "displayNames");
}
}
}
// ELEMENT: icon
final LocalCollection<Icon> icon = facesComponent.icon;
if (icon != null) {
for (final Icon iconItem : icon) {
if (iconItem != null) {
writer.writeStartElement(prefix, "icon", "http://java.sun.com/xml/ns/javaee");
writeIcon(writer, iconItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesComponent, "icon");
}
}
}
// ELEMENT: componentType
final String componentTypeRaw = facesComponent.componentType;
String componentType = null;
try {
componentType = Adapters.collapsedStringAdapterAdapter.marshal(componentTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesComponent, "componentType", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (componentType != null) {
writer.writeStartElement(prefix, "component-type", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(componentType);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesComponent, "componentType");
}
// ELEMENT: componentClass
final String componentClassRaw = facesComponent.componentClass;
String componentClass = null;
try {
componentClass = Adapters.collapsedStringAdapterAdapter.marshal(componentClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(facesComponent, "componentClass", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (componentClass != null) {
writer.writeStartElement(prefix, "component-class", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(componentClass);
writer.writeEndElement();
} else {
context.unexpectedNullValue(facesComponent, "componentClass");
}
// ELEMENT: facet
final List<FacesFacet> facet = facesComponent.facet;
if (facet != null) {
for (final FacesFacet facetItem : facet) {
writer.writeStartElement(prefix, "facet", "http://java.sun.com/xml/ns/javaee");
if (facetItem != null) {
writeFacesFacet(writer, facetItem, context);
} else {
writer.writeXsiNil();
}
writer.writeEndElement();
}
}
// ELEMENT: attribute
final List<FacesAttribute> attribute = facesComponent.attribute;
if (attribute != null) {
for (final FacesAttribute attributeItem : attribute) {
writer.writeStartElement(prefix, "attribute", "http://java.sun.com/xml/ns/javaee");
if (attributeItem != null) {
writeFacesAttribute(writer, attributeItem, context);
} else {
writer.writeXsiNil();
}
writer.writeEndElement();
}
}
// ELEMENT: property
final List<FacesProperty> property = facesComponent.property;
if (property != null) {
for (final FacesProperty propertyItem : property) {
writer.writeStartElement(prefix, "property", "http://java.sun.com/xml/ns/javaee");
if (propertyItem != null) {
writeFacesProperty(writer, propertyItem, context);
} else {
writer.writeXsiNil();
}
writer.writeEndElement();
}
}
// ELEMENT: componentExtension
final List<FacesComponentExtension> componentExtension = facesComponent.componentExtension;
if (componentExtension != null) {
for (final FacesComponentExtension componentExtensionItem : componentExtension) {
if (componentExtensionItem != null) {
writer.writeStartElement(prefix, "component-extension", "http://java.sun.com/xml/ns/javaee");
writeFacesComponentExtension(writer, componentExtensionItem, context);
writer.writeEndElement();
}
}
}
context.afterMarshal(facesComponent, LifecycleCallback.NONE);
}
Aggregations