Search in sources :

Example 6 with InboundResourceadapter$JAXB.writeInboundResourceadapter

use of org.apache.openejb.jee.InboundResourceadapter$JAXB.writeInboundResourceadapter in project tomee by apache.

the class ResourceAdapter$JAXB method _write.

public static final void _write(final XoXMLStreamWriter writer, final ResourceAdapter resourceAdapter, RuntimeContext context) throws Exception {
    if (resourceAdapter == null) {
        writer.writeXsiNil();
        return;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final String prefix = writer.getUniquePrefix("http://java.sun.com/xml/ns/javaee");
    if (ResourceAdapter.class != resourceAdapter.getClass()) {
        context.unexpectedSubclass(writer, resourceAdapter, ResourceAdapter.class);
        return;
    }
    context.beforeMarshal(resourceAdapter, LifecycleCallback.NONE);
    // ATTRIBUTE: id
    final String idRaw = resourceAdapter.id;
    if (idRaw != null) {
        String id = null;
        try {
            id = Adapters.collapsedStringAdapterAdapter.marshal(idRaw);
        } catch (final Exception e) {
            context.xmlAdapterError(resourceAdapter, "id", CollapsedStringAdapter.class, String.class, String.class, e);
        }
        writer.writeAttribute("", "", "id", id);
    }
    // ELEMENT: resourceAdapterClass
    final String resourceAdapterClassRaw = resourceAdapter.resourceAdapterClass;
    String resourceAdapterClass = null;
    try {
        resourceAdapterClass = Adapters.collapsedStringAdapterAdapter.marshal(resourceAdapterClassRaw);
    } catch (final Exception e) {
        context.xmlAdapterError(resourceAdapter, "resourceAdapterClass", CollapsedStringAdapter.class, String.class, String.class, e);
    }
    if (resourceAdapterClass != null) {
        writer.writeStartElement(prefix, "resourceadapter-class", "http://java.sun.com/xml/ns/javaee");
        writer.writeCharacters(resourceAdapterClass);
        writer.writeEndElement();
    }
    // ELEMENT: configProperty
    final List<ConfigProperty> configProperty = resourceAdapter.configProperty;
    if (configProperty != null) {
        for (final ConfigProperty configPropertyItem : configProperty) {
            if (configPropertyItem != null) {
                writer.writeStartElement(prefix, "config-property", "http://java.sun.com/xml/ns/javaee");
                writeConfigProperty(writer, configPropertyItem, context);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: outboundResourceAdapter
    final OutboundResourceAdapter outboundResourceAdapter = resourceAdapter.outboundResourceAdapter;
    if (outboundResourceAdapter != null) {
        writer.writeStartElement(prefix, "outbound-resourceadapter", "http://java.sun.com/xml/ns/javaee");
        writeOutboundResourceAdapter(writer, outboundResourceAdapter, context);
        writer.writeEndElement();
    }
    // ELEMENT: inboundResourceAdapter
    final InboundResourceadapter inboundResourceAdapter = resourceAdapter.inboundResourceAdapter;
    if (inboundResourceAdapter != null) {
        writer.writeStartElement(prefix, "inbound-resourceadapter", "http://java.sun.com/xml/ns/javaee");
        writeInboundResourceadapter(writer, inboundResourceAdapter, context);
        writer.writeEndElement();
    }
    // ELEMENT: adminObject
    final List<AdminObject> adminObject = resourceAdapter.adminObject;
    if (adminObject != null) {
        for (final AdminObject adminObjectItem : adminObject) {
            if (adminObjectItem != null) {
                writer.writeStartElement(prefix, "adminobject", "http://java.sun.com/xml/ns/javaee");
                writeAdminObject(writer, adminObjectItem, context);
                writer.writeEndElement();
            }
        }
    }
    // ELEMENT: securityPermission
    final List<SecurityPermission> securityPermission = resourceAdapter.securityPermission;
    if (securityPermission != null) {
        for (final SecurityPermission securityPermissionItem : securityPermission) {
            if (securityPermissionItem != null) {
                writer.writeStartElement(prefix, "security-permission", "http://java.sun.com/xml/ns/javaee");
                writeSecurityPermission(writer, securityPermissionItem, context);
                writer.writeEndElement();
            }
        }
    }
    context.afterMarshal(resourceAdapter, LifecycleCallback.NONE);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) ConfigProperty$JAXB.readConfigProperty(org.apache.openejb.jee.ConfigProperty$JAXB.readConfigProperty) ConfigProperty$JAXB.writeConfigProperty(org.apache.openejb.jee.ConfigProperty$JAXB.writeConfigProperty) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) InboundResourceadapter$JAXB.readInboundResourceadapter(org.apache.openejb.jee.InboundResourceadapter$JAXB.readInboundResourceadapter) InboundResourceadapter$JAXB.writeInboundResourceadapter(org.apache.openejb.jee.InboundResourceadapter$JAXB.writeInboundResourceadapter) OutboundResourceAdapter$JAXB.readOutboundResourceAdapter(org.apache.openejb.jee.OutboundResourceAdapter$JAXB.readOutboundResourceAdapter) OutboundResourceAdapter$JAXB.writeOutboundResourceAdapter(org.apache.openejb.jee.OutboundResourceAdapter$JAXB.writeOutboundResourceAdapter) AdminObject$JAXB.readAdminObject(org.apache.openejb.jee.AdminObject$JAXB.readAdminObject) AdminObject$JAXB.writeAdminObject(org.apache.openejb.jee.AdminObject$JAXB.writeAdminObject) SecurityPermission$JAXB.writeSecurityPermission(org.apache.openejb.jee.SecurityPermission$JAXB.writeSecurityPermission) SecurityPermission$JAXB.readSecurityPermission(org.apache.openejb.jee.SecurityPermission$JAXB.readSecurityPermission)

Aggregations

Connector (org.apache.openejb.jee.Connector)4 InboundResourceadapter (org.apache.openejb.jee.InboundResourceadapter)4 MessageListener (org.apache.openejb.jee.MessageListener)4 ResourceAdapter (org.apache.openejb.jee.ResourceAdapter)4 List (java.util.List)3 Properties (java.util.Properties)3 AppInfo (org.apache.openejb.assembler.classic.AppInfo)3 Assembler (org.apache.openejb.assembler.classic.Assembler)3 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)3 TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)3 AppModule (org.apache.openejb.config.AppModule)3 ConfigurationFactory (org.apache.openejb.config.ConfigurationFactory)3 ConnectorModule (org.apache.openejb.config.ConnectorModule)3 EjbModule (org.apache.openejb.config.EjbModule)3 InitContextFactory (org.apache.openejb.core.ivm.naming.InitContextFactory)3 EjbJar (org.apache.openejb.jee.EjbJar)3 MessageAdapter (org.apache.openejb.jee.MessageAdapter)3 MessageDrivenBean (org.apache.openejb.jee.MessageDrivenBean)3 InitialContext (javax.naming.InitialContext)2 CollapsedStringAdapter (javax.xml.bind.annotation.adapters.CollapsedStringAdapter)2