Search in sources :

Example 11 with ContainerTransaction$JAXB.readContainerTransaction

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;
}
Also used : StatelessBean(org.apache.openejb.jee.StatelessBean) ContainerTransaction(org.apache.openejb.jee.ContainerTransaction) Method(org.apache.openejb.jee.Method) EjbJar(org.apache.openejb.jee.EjbJar) Module(org.apache.openejb.testing.Module)

Example 12 with ContainerTransaction$JAXB.readContainerTransaction

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);
}
Also used : ExcludeList$JAXB.writeExcludeList(org.apache.openejb.jee.ExcludeList$JAXB.writeExcludeList) ExcludeList$JAXB.readExcludeList(org.apache.openejb.jee.ExcludeList$JAXB.readExcludeList) SecurityRole$JAXB.readSecurityRole(org.apache.openejb.jee.SecurityRole$JAXB.readSecurityRole) SecurityRole$JAXB.writeSecurityRole(org.apache.openejb.jee.SecurityRole$JAXB.writeSecurityRole) MessageDestination$JAXB.readMessageDestination(org.apache.openejb.jee.MessageDestination$JAXB.readMessageDestination) MessageDestination$JAXB.writeMessageDestination(org.apache.openejb.jee.MessageDestination$JAXB.writeMessageDestination) CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) ApplicationException$JAXB.readApplicationException(org.apache.openejb.jee.ApplicationException$JAXB.readApplicationException) ApplicationException$JAXB.writeApplicationException(org.apache.openejb.jee.ApplicationException$JAXB.writeApplicationException) MethodPermission$JAXB.readMethodPermission(org.apache.openejb.jee.MethodPermission$JAXB.readMethodPermission) MethodPermission$JAXB.writeMethodPermission(org.apache.openejb.jee.MethodPermission$JAXB.writeMethodPermission) InterceptorBinding$JAXB.writeInterceptorBinding(org.apache.openejb.jee.InterceptorBinding$JAXB.writeInterceptorBinding) InterceptorBinding$JAXB.readInterceptorBinding(org.apache.openejb.jee.InterceptorBinding$JAXB.readInterceptorBinding) ApplicationException$JAXB.readApplicationException(org.apache.openejb.jee.ApplicationException$JAXB.readApplicationException) ApplicationException$JAXB.writeApplicationException(org.apache.openejb.jee.ApplicationException$JAXB.writeApplicationException) ContainerConcurrency$JAXB.writeContainerConcurrency(org.apache.openejb.jee.ContainerConcurrency$JAXB.writeContainerConcurrency) ContainerConcurrency$JAXB.readContainerConcurrency(org.apache.openejb.jee.ContainerConcurrency$JAXB.readContainerConcurrency) ContainerTransaction$JAXB.writeContainerTransaction(org.apache.openejb.jee.ContainerTransaction$JAXB.writeContainerTransaction) ContainerTransaction$JAXB.readContainerTransaction(org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Aggregations

ContainerTransaction (org.apache.openejb.jee.ContainerTransaction)10 EjbJar (org.apache.openejb.jee.EjbJar)8 Method (org.apache.openejb.jee.Method)6 InterceptorBinding (org.apache.openejb.jee.InterceptorBinding)4 ConfigurationFactory (org.apache.openejb.config.ConfigurationFactory)3 AssemblyDescriptor (org.apache.openejb.jee.AssemblyDescriptor)3 EnterpriseBean (org.apache.openejb.jee.EnterpriseBean)3 MethodPermission (org.apache.openejb.jee.MethodPermission)3 ArrayList (java.util.ArrayList)2 Assembler (org.apache.openejb.assembler.classic.Assembler)2 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)2 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)2 ApplicationException$JAXB.readApplicationException (org.apache.openejb.jee.ApplicationException$JAXB.readApplicationException)2 ApplicationException$JAXB.writeApplicationException (org.apache.openejb.jee.ApplicationException$JAXB.writeApplicationException)2 ContainerConcurrency$JAXB.readContainerConcurrency (org.apache.openejb.jee.ContainerConcurrency$JAXB.readContainerConcurrency)2 ContainerConcurrency$JAXB.writeContainerConcurrency (org.apache.openejb.jee.ContainerConcurrency$JAXB.writeContainerConcurrency)2 ContainerTransaction$JAXB.readContainerTransaction (org.apache.openejb.jee.ContainerTransaction$JAXB.readContainerTransaction)2 ContainerTransaction$JAXB.writeContainerTransaction (org.apache.openejb.jee.ContainerTransaction$JAXB.writeContainerTransaction)2 EntityBean (org.apache.openejb.jee.EntityBean)2 ExcludeList$JAXB.readExcludeList (org.apache.openejb.jee.ExcludeList$JAXB.readExcludeList)2