use of org.apache.openejb.jee.Text$JAXB.writeText in project tomee by apache.
the class SecurityIdentity$JAXB method _read.
public static final SecurityIdentity _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final SecurityIdentity securityIdentity = new SecurityIdentity();
context.beforeUnmarshal(securityIdentity, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("security-identityType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, SecurityIdentity.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, securityIdentity);
securityIdentity.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 (("use-caller-identity" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: useCallerIdentity
final Empty useCallerIdentity = readEmpty(elementReader, context);
securityIdentity.useCallerIdentity = useCallerIdentity;
} else if (("run-as" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: runAs
final RunAs runAs = readRunAs(elementReader, context);
securityIdentity.runAs = runAs;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "use-caller-identity"), new QName("http://java.sun.com/xml/ns/javaee", "run-as"));
}
}
if (descriptions != null) {
try {
securityIdentity.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, SecurityIdentity.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(securityIdentity, LifecycleCallback.NONE);
return securityIdentity;
}
use of org.apache.openejb.jee.Text$JAXB.writeText in project tomee by apache.
the class SecurityPermission$JAXB method _read.
public static final SecurityPermission _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final SecurityPermission securityPermission = new SecurityPermission();
context.beforeUnmarshal(securityPermission, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("security-permissionType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, SecurityPermission.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, securityPermission);
securityPermission.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 (("security-permission-spec" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: securityPermissionSpec
final String securityPermissionSpecRaw = elementReader.getElementAsString();
final String securityPermissionSpec;
try {
securityPermissionSpec = Adapters.collapsedStringAdapterAdapter.unmarshal(securityPermissionSpecRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
securityPermission.securityPermissionSpec = securityPermissionSpec;
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "security-permission-spec"));
}
}
if (descriptions != null) {
try {
securityPermission.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, SecurityPermission.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(securityPermission, LifecycleCallback.NONE);
return securityPermission;
}
use of org.apache.openejb.jee.Text$JAXB.writeText in project tomee by apache.
the class SecurityRole$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final SecurityRole securityRole, RuntimeContext context) throws Exception {
if (securityRole == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (SecurityRole.class != securityRole.getClass()) {
context.unexpectedSubclass(writer, securityRole, SecurityRole.class);
return;
}
context.beforeMarshal(securityRole, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = securityRole.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(securityRole, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = securityRole.getDescriptions();
} catch (final Exception e) {
context.getterError(securityRole, "descriptions", SecurityRole.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(securityRole, "descriptions");
}
}
}
// ELEMENT: roleName
final String roleNameRaw = securityRole.roleName;
String roleName = null;
try {
roleName = Adapters.collapsedStringAdapterAdapter.marshal(roleNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(securityRole, "roleName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (roleName != null) {
writer.writeStartElement(prefix, "role-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(roleName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(securityRole, "roleName");
}
context.afterMarshal(securityRole, LifecycleCallback.NONE);
}
use of org.apache.openejb.jee.Text$JAXB.writeText in project tomee by apache.
the class SecurityRoleRef$JAXB method _read.
public static final SecurityRoleRef _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final SecurityRoleRef securityRoleRef = new SecurityRoleRef();
context.beforeUnmarshal(securityRoleRef, LifecycleCallback.NONE);
ArrayList<Text> descriptions = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("security-role-refType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, SecurityRoleRef.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, securityRoleRef);
securityRoleRef.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 roleNameRaw = elementReader.getElementAsString();
final String roleName;
try {
roleName = Adapters.collapsedStringAdapterAdapter.unmarshal(roleNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
securityRoleRef.roleName = roleName;
} else if (("role-link" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: roleLink
final String roleLinkRaw = elementReader.getElementAsString();
final String roleLink;
try {
roleLink = Adapters.collapsedStringAdapterAdapter.unmarshal(roleLinkRaw);
} catch (final Exception e) {
context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
continue;
}
securityRoleRef.roleLink = roleLink;
} 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"), new QName("http://java.sun.com/xml/ns/javaee", "role-link"));
}
}
if (descriptions != null) {
try {
securityRoleRef.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
} catch (final Exception e) {
context.setterError(reader, SecurityRoleRef.class, "setDescriptions", Text[].class, e);
}
}
context.afterUnmarshal(securityRoleRef, LifecycleCallback.NONE);
return securityRoleRef;
}
use of org.apache.openejb.jee.Text$JAXB.writeText in project tomee by apache.
the class ServiceRef$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final ServiceRef serviceRef, RuntimeContext context) throws Exception {
if (serviceRef == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (ServiceRef.class != serviceRef.getClass()) {
context.unexpectedSubclass(writer, serviceRef, ServiceRef.class);
return;
}
context.beforeMarshal(serviceRef, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = serviceRef.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: descriptions
Text[] descriptions = null;
try {
descriptions = serviceRef.getDescriptions();
} catch (final Exception e) {
context.getterError(serviceRef, "descriptions", ServiceRef.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(serviceRef, "descriptions");
}
}
}
// ELEMENT: displayNames
Text[] displayNames = null;
try {
displayNames = serviceRef.getDisplayNames();
} catch (final Exception e) {
context.getterError(serviceRef, "displayNames", ServiceRef.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(serviceRef, "displayNames");
}
}
}
// ELEMENT: icon
final LocalCollection<Icon> icon = serviceRef.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(serviceRef, "icon");
}
}
}
// ELEMENT: serviceRefName
final String serviceRefNameRaw = serviceRef.serviceRefName;
String serviceRefName = null;
try {
serviceRefName = Adapters.collapsedStringAdapterAdapter.marshal(serviceRefNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "serviceRefName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (serviceRefName != null) {
writer.writeStartElement(prefix, "service-ref-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(serviceRefName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(serviceRef, "serviceRefName");
}
// ELEMENT: serviceInterface
final String serviceInterfaceRaw = serviceRef.serviceInterface;
String serviceInterface = null;
try {
serviceInterface = Adapters.collapsedStringAdapterAdapter.marshal(serviceInterfaceRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "serviceInterface", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (serviceInterface != null) {
writer.writeStartElement(prefix, "service-interface", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(serviceInterface);
writer.writeEndElement();
} else {
context.unexpectedNullValue(serviceRef, "serviceInterface");
}
// ELEMENT: serviceRefType
final String serviceRefTypeRaw = serviceRef.serviceRefType;
String serviceRefType = null;
try {
serviceRefType = Adapters.collapsedStringAdapterAdapter.marshal(serviceRefTypeRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "serviceRefType", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (serviceRefType != null) {
writer.writeStartElement(prefix, "service-ref-type", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(serviceRefType);
writer.writeEndElement();
}
// ELEMENT: wsdlFile
final String wsdlFileRaw = serviceRef.wsdlFile;
String wsdlFile = null;
try {
wsdlFile = Adapters.collapsedStringAdapterAdapter.marshal(wsdlFileRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "wsdlFile", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (wsdlFile != null) {
writer.writeStartElement(prefix, "wsdl-file", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(wsdlFile);
writer.writeEndElement();
}
// ELEMENT: jaxrpcMappingFile
final String jaxrpcMappingFileRaw = serviceRef.jaxrpcMappingFile;
String jaxrpcMappingFile = null;
try {
jaxrpcMappingFile = Adapters.collapsedStringAdapterAdapter.marshal(jaxrpcMappingFileRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "jaxrpcMappingFile", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (jaxrpcMappingFile != null) {
writer.writeStartElement(prefix, "jaxrpc-mapping-file", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(jaxrpcMappingFile);
writer.writeEndElement();
}
// ELEMENT: serviceQname
final QName serviceQname = serviceRef.serviceQname;
if (serviceQname != null) {
writer.writeStartElement(prefix, "service-qname", "http://java.sun.com/xml/ns/javaee");
writer.writeQName(serviceQname);
writer.writeEndElement();
}
// ELEMENT: portComponentRef
final List<PortComponentRef> portComponentRef = serviceRef.portComponentRef;
if (portComponentRef != null) {
for (final PortComponentRef portComponentRefItem : portComponentRef) {
if (portComponentRefItem != null) {
writer.writeStartElement(prefix, "port-component-ref", "http://java.sun.com/xml/ns/javaee");
writePortComponentRef(writer, portComponentRefItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(serviceRef, "portComponentRef");
}
}
}
// ELEMENT: handler
final List<Handler> handler = serviceRef.handler;
if (handler != null) {
for (final Handler handlerItem : handler) {
if (handlerItem != null) {
writer.writeStartElement(prefix, "handler", "http://java.sun.com/xml/ns/javaee");
writeHandler(writer, handlerItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(serviceRef, "handler");
}
}
}
// ELEMENT: handlerChains
final HandlerChains handlerChains = serviceRef.handlerChains;
if (handlerChains != null) {
writer.writeStartElement(prefix, "handler-chains", "http://java.sun.com/xml/ns/javaee");
writeHandlerChains(writer, handlerChains, context);
writer.writeEndElement();
}
// ELEMENT: mappedName
final String mappedNameRaw = serviceRef.mappedName;
String mappedName = null;
try {
mappedName = Adapters.collapsedStringAdapterAdapter.marshal(mappedNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "mappedName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (mappedName != null) {
writer.writeStartElement(prefix, "mapped-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(mappedName);
writer.writeEndElement();
}
// ELEMENT: injectionTarget
final Set<InjectionTarget> injectionTarget = serviceRef.injectionTarget;
if (injectionTarget != null) {
for (final InjectionTarget injectionTargetItem : injectionTarget) {
if (injectionTargetItem != null) {
writer.writeStartElement(prefix, "injection-target", "http://java.sun.com/xml/ns/javaee");
writeInjectionTarget(writer, injectionTargetItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(serviceRef, "injectionTarget");
}
}
}
// ELEMENT: lookupName
final String lookupNameRaw = serviceRef.lookupName;
String lookupName = null;
try {
lookupName = Adapters.collapsedStringAdapterAdapter.marshal(lookupNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(serviceRef, "lookupName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (lookupName != null) {
writer.writeStartElement(prefix, "lookup-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(lookupName);
writer.writeEndElement();
}
context.afterMarshal(serviceRef, LifecycleCallback.NONE);
}
Aggregations