use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.
the class ApplicationException$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final ApplicationException applicationException, RuntimeContext context) throws Exception {
if (applicationException == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (ApplicationException.class != applicationException.getClass()) {
context.unexpectedSubclass(writer, applicationException, ApplicationException.class);
return;
}
context.beforeMarshal(applicationException, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = applicationException.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(applicationException, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: exceptionClass
final String exceptionClassRaw = applicationException.exceptionClass;
String exceptionClass = null;
try {
exceptionClass = Adapters.collapsedStringAdapterAdapter.marshal(exceptionClassRaw);
} catch (final Exception e) {
context.xmlAdapterError(applicationException, "exceptionClass", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (exceptionClass != null) {
writer.writeStartElement(prefix, "exception-class", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(exceptionClass);
writer.writeEndElement();
} else {
context.unexpectedNullValue(applicationException, "exceptionClass");
}
// ELEMENT: rollback
final Boolean rollback = applicationException.rollback;
if (rollback != null) {
writer.writeStartElement(prefix, "rollback", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(Boolean.toString(rollback));
writer.writeEndElement();
}
// ELEMENT: inherited
final Boolean inherited = applicationException.inherited;
if (inherited != null) {
writer.writeStartElement(prefix, "inherited", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(Boolean.toString(inherited));
writer.writeEndElement();
}
context.afterMarshal(applicationException, LifecycleCallback.NONE);
}
use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.
the class AroundInvoke$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final AroundInvoke aroundInvoke, RuntimeContext context) throws Exception {
if (aroundInvoke == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (AroundInvoke.class != aroundInvoke.getClass()) {
context.unexpectedSubclass(writer, aroundInvoke, AroundInvoke.class);
return;
}
context.beforeMarshal(aroundInvoke, LifecycleCallback.NONE);
// ELEMENT: clazz
final String clazzRaw = aroundInvoke.clazz;
String clazz = null;
try {
clazz = Adapters.collapsedStringAdapterAdapter.marshal(clazzRaw);
} catch (final Exception e) {
context.xmlAdapterError(aroundInvoke, "clazz", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (clazz != null) {
writer.writeStartElement(prefix, "class", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(clazz);
writer.writeEndElement();
}
// ELEMENT: methodName
final String methodNameRaw = aroundInvoke.methodName;
String methodName = null;
try {
methodName = Adapters.collapsedStringAdapterAdapter.marshal(methodNameRaw);
} catch (final Exception e) {
context.xmlAdapterError(aroundInvoke, "methodName", CollapsedStringAdapter.class, String.class, String.class, e);
}
if (methodName != null) {
writer.writeStartElement(prefix, "method-name", "http://java.sun.com/xml/ns/javaee");
writer.writeCharacters(methodName);
writer.writeEndElement();
} else {
context.unexpectedNullValue(aroundInvoke, "methodName");
}
context.afterMarshal(aroundInvoke, LifecycleCallback.NONE);
}
use of org.metatype.sxc.jaxb.RuntimeContext in project tomee by apache.
the class AssemblyDescriptor$JAXB method _read.
public static final AssemblyDescriptor _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
// Check for xsi:nil
if (reader.isXsiNil()) {
return null;
}
if (context == null) {
context = new RuntimeContext();
}
final AssemblyDescriptor assemblyDescriptor = new AssemblyDescriptor();
context.beforeUnmarshal(assemblyDescriptor, LifecycleCallback.NONE);
List<SecurityRole> securityRole = null;
List<MethodPermission> methodPermission = null;
List<ContainerTransaction> containerTransaction = null;
List<ContainerConcurrency> containerConcurrency = null;
List<InterceptorBinding> interceptorBinding = null;
List<MessageDestination> messageDestination = null;
KeyedCollection<String, ApplicationException> applicationException = null;
// Check xsi:type
final QName xsiType = reader.getXsiType();
if (xsiType != null) {
if (("assembly-descriptorType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
return context.unexpectedXsiType(reader, AssemblyDescriptor.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, assemblyDescriptor);
assemblyDescriptor.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 (("security-role" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: securityRole
final SecurityRole securityRoleItem = readSecurityRole(elementReader, context);
if (securityRole == null) {
securityRole = assemblyDescriptor.securityRole;
if (securityRole != null) {
securityRole.clear();
} else {
securityRole = new ArrayList<SecurityRole>();
}
}
securityRole.add(securityRoleItem);
} else if (("method-permission" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: methodPermission
final MethodPermission methodPermissionItem = readMethodPermission(elementReader, context);
if (methodPermission == null) {
methodPermission = assemblyDescriptor.methodPermission;
if (methodPermission != null) {
methodPermission.clear();
} else {
methodPermission = new ArrayList<MethodPermission>();
}
}
methodPermission.add(methodPermissionItem);
} else if (("container-transaction" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: containerTransaction
final ContainerTransaction containerTransactionItem = readContainerTransaction(elementReader, context);
if (containerTransaction == null) {
containerTransaction = assemblyDescriptor.containerTransaction;
if (containerTransaction != null) {
containerTransaction.clear();
} else {
containerTransaction = new ArrayList<ContainerTransaction>();
}
}
containerTransaction.add(containerTransactionItem);
} else if (("container-concurrency" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: containerConcurrency
final ContainerConcurrency containerConcurrencyItem = readContainerConcurrency(elementReader, context);
if (containerConcurrency == null) {
containerConcurrency = assemblyDescriptor.containerConcurrency;
if (containerConcurrency != null) {
containerConcurrency.clear();
} else {
containerConcurrency = new ArrayList<ContainerConcurrency>();
}
}
containerConcurrency.add(containerConcurrencyItem);
} else if (("interceptor-binding" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: interceptorBinding
final InterceptorBinding interceptorBindingItem = readInterceptorBinding(elementReader, context);
if (interceptorBinding == null) {
interceptorBinding = assemblyDescriptor.interceptorBinding;
if (interceptorBinding != null) {
interceptorBinding.clear();
} else {
interceptorBinding = new ArrayList<InterceptorBinding>();
}
}
interceptorBinding.add(interceptorBindingItem);
} else if (("message-destination" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: messageDestination
final MessageDestination messageDestinationItem = readMessageDestination(elementReader, context);
if (messageDestination == null) {
messageDestination = assemblyDescriptor.messageDestination;
if (messageDestination != null) {
messageDestination.clear();
} else {
messageDestination = new ArrayList<MessageDestination>();
}
}
messageDestination.add(messageDestinationItem);
} else if (("exclude-list" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: excludeList
final ExcludeList excludeList = readExcludeList(elementReader, context);
assemblyDescriptor.excludeList = excludeList;
} else if (("application-exception" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
// ELEMENT: applicationException
final ApplicationException applicationExceptionItem = readApplicationException(elementReader, context);
if (applicationException == null) {
applicationException = assemblyDescriptor.applicationException;
if (applicationException != null) {
applicationException.clear();
} else {
applicationException = new KeyedCollection<String, ApplicationException>();
}
}
applicationException.add(applicationExceptionItem);
} else {
context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "security-role"), new QName("http://java.sun.com/xml/ns/javaee", "method-permission"), new QName("http://java.sun.com/xml/ns/javaee", "container-transaction"), new QName("http://java.sun.com/xml/ns/javaee", "container-concurrency"), new QName("http://java.sun.com/xml/ns/javaee", "interceptor-binding"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination"), new QName("http://java.sun.com/xml/ns/javaee", "exclude-list"), new QName("http://java.sun.com/xml/ns/javaee", "application-exception"));
}
}
if (securityRole != null) {
assemblyDescriptor.securityRole = securityRole;
}
if (methodPermission != null) {
assemblyDescriptor.methodPermission = methodPermission;
}
if (containerTransaction != null) {
assemblyDescriptor.containerTransaction = containerTransaction;
}
if (containerConcurrency != null) {
assemblyDescriptor.containerConcurrency = containerConcurrency;
}
if (interceptorBinding != null) {
assemblyDescriptor.interceptorBinding = interceptorBinding;
}
if (messageDestination != null) {
assemblyDescriptor.messageDestination = messageDestination;
}
if (applicationException != null) {
assemblyDescriptor.applicationException = applicationException;
}
context.afterUnmarshal(assemblyDescriptor, LifecycleCallback.NONE);
return assemblyDescriptor;
}
use of org.metatype.sxc.jaxb.RuntimeContext 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.jaxb.RuntimeContext 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;
}
Aggregations