use of org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction in project tomee by apache.
the class InterfaceTransactionTest method module.
@Module
public EjbJar module() throws Exception {
final EjbJar ejbJar = new EjbJar();
ejbJar.addEnterpriseBean(new StatelessBean(OrangeBean.class));
final Method remoteMethod = new Method("OrangeBean", "isInTransaction").withInterface(MethodIntf.REMOTE);
final Method localMethod = new Method("OrangeBean", "isInTransaction").withInterface(MethodIntf.LOCAL);
final List<ContainerTransaction> transactions = ejbJar.getAssemblyDescriptor().getContainerTransaction();
transactions.add(new ContainerTransaction(TransAttribute.REQUIRED, remoteMethod));
transactions.add(new ContainerTransaction(TransAttribute.SUPPORTS, localMethod));
return ejbJar;
}
use of org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction in project tomee by apache.
the class AssemblyDescriptor$JAXB method _write.
public static final void _write(final XoXMLStreamWriter writer, final AssemblyDescriptor assemblyDescriptor, RuntimeContext context) throws Exception {
if (assemblyDescriptor == null) {
writer.writeXsiNil();
return;
}
if (context == null) {
context = new RuntimeContext();
}
final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
if (AssemblyDescriptor.class != assemblyDescriptor.getClass()) {
context.unexpectedSubclass(writer, assemblyDescriptor, AssemblyDescriptor.class);
return;
}
context.beforeMarshal(assemblyDescriptor, LifecycleCallback.NONE);
// ATTRIBUTE: id
final String idRaw = assemblyDescriptor.id;
if (idRaw != null) {
String id = null;
try {
id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
} catch (final Exception e) {
context.xmlAdapterError(assemblyDescriptor, "id", CollapsedStringAdapter.class, String.class, String.class, e);
}
writer.writeAttribute("", "", "id", id);
}
// ELEMENT: securityRole
final List<SecurityRole> securityRole = assemblyDescriptor.securityRole;
if (securityRole != null) {
for (final SecurityRole securityRoleItem : securityRole) {
if (securityRoleItem != null) {
writer.writeStartElement(prefix, "security-role", "http://java.sun.com/xml/ns/javaee");
writeSecurityRole(writer, securityRoleItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(assemblyDescriptor, "securityRole");
}
}
}
// ELEMENT: methodPermission
final List<MethodPermission> methodPermission = assemblyDescriptor.methodPermission;
if (methodPermission != null) {
for (final MethodPermission methodPermissionItem : methodPermission) {
if (methodPermissionItem != null) {
writer.writeStartElement(prefix, "method-permission", "http://java.sun.com/xml/ns/javaee");
writeMethodPermission(writer, methodPermissionItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(assemblyDescriptor, "methodPermission");
}
}
}
// ELEMENT: containerTransaction
final List<ContainerTransaction> containerTransaction = assemblyDescriptor.containerTransaction;
if (containerTransaction != null) {
for (final ContainerTransaction containerTransactionItem : containerTransaction) {
if (containerTransactionItem != null) {
writer.writeStartElement(prefix, "container-transaction", "http://java.sun.com/xml/ns/javaee");
writeContainerTransaction(writer, containerTransactionItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(assemblyDescriptor, "containerTransaction");
}
}
}
// ELEMENT: containerConcurrency
final List<ContainerConcurrency> containerConcurrency = assemblyDescriptor.containerConcurrency;
if (containerConcurrency != null) {
for (final ContainerConcurrency containerConcurrencyItem : containerConcurrency) {
if (containerConcurrencyItem != null) {
writer.writeStartElement(prefix, "container-concurrency", "http://java.sun.com/xml/ns/javaee");
writeContainerConcurrency(writer, containerConcurrencyItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(assemblyDescriptor, "containerConcurrency");
}
}
}
// ELEMENT: interceptorBinding
final List<InterceptorBinding> interceptorBinding = assemblyDescriptor.interceptorBinding;
if (interceptorBinding != null) {
for (final InterceptorBinding interceptorBindingItem : interceptorBinding) {
if (interceptorBindingItem != null) {
writer.writeStartElement(prefix, "interceptor-binding", "http://java.sun.com/xml/ns/javaee");
writeInterceptorBinding(writer, interceptorBindingItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(assemblyDescriptor, "interceptorBinding");
}
}
}
// ELEMENT: messageDestination
final List<MessageDestination> messageDestination = assemblyDescriptor.messageDestination;
if (messageDestination != null) {
for (final MessageDestination messageDestinationItem : messageDestination) {
if (messageDestinationItem != null) {
writer.writeStartElement(prefix, "message-destination", "http://java.sun.com/xml/ns/javaee");
writeMessageDestination(writer, messageDestinationItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(assemblyDescriptor, "messageDestination");
}
}
}
// ELEMENT: excludeList
final ExcludeList excludeList = assemblyDescriptor.excludeList;
if (excludeList != null) {
writer.writeStartElement(prefix, "exclude-list", "http://java.sun.com/xml/ns/javaee");
writeExcludeList(writer, excludeList, context);
writer.writeEndElement();
}
// ELEMENT: applicationException
final KeyedCollection<String, ApplicationException> applicationException = assemblyDescriptor.applicationException;
if (applicationException != null) {
for (final ApplicationException applicationExceptionItem : applicationException) {
if (applicationExceptionItem != null) {
writer.writeStartElement(prefix, "application-exception", "http://java.sun.com/xml/ns/javaee");
writeApplicationException(writer, applicationExceptionItem, context);
writer.writeEndElement();
} else {
context.unexpectedNullValue(assemblyDescriptor, "applicationException");
}
}
}
context.afterMarshal(assemblyDescriptor, LifecycleCallback.NONE);
}
Aggregations