Search in sources :

Example 1 with PortComponentRef

use of org.apache.openejb.jee.PortComponentRef in project tomee by apache.

the class SunConversion method deploy.

public AppModule deploy(final AppModule appModule) {
    final SunApplication sunApplication = getSunApplication(appModule);
    if (sunApplication != null) {
        for (final Web web : sunApplication.getWeb()) {
            final String webUri = web.getWebUri();
            for (final WebModule webModule : appModule.getWebModules()) {
                if (webUri.equals(webModule.getModuleId())) {
                    webModule.setContextRoot(web.getContextRoot());
                    break;
                }
            }
        }
        for (final ClientModule clientModule : appModule.getClientModules()) {
            final ApplicationClient applicationClient = clientModule.getApplicationClient();
            if (applicationClient == null) {
                continue;
            }
            // map ejb-refs
            final Map<String, org.apache.openejb.jee.EjbRef> refMap = applicationClient.getEjbRefMap();
            // map ejb-ref jndi name declaration to deploymentId
            for (final EjbRef ref : sunApplication.getEjbRef()) {
                if (ref.getJndiName() != null) {
                    String refName = ref.getEjbRefName();
                    refName = normalize(refName);
                    org.apache.openejb.jee.EjbRef ejbRef = refMap.get(refName);
                    // try to match from lookup name
                    for (final Map.Entry<String, org.apache.openejb.jee.EjbRef> aRef : refMap.entrySet()) {
                        if (refName.equals(aRef.getValue().getLookupName())) {
                            ejbRef = aRef.getValue();
                            break;
                        }
                    }
                    if (ejbRef == null) {
                        ejbRef = new org.apache.openejb.jee.EjbRef();
                        ejbRef.setEjbRefName(refName);
                        refMap.put(refName, ejbRef);
                        applicationClient.getEjbRef().add(ejbRef);
                    }
                    ejbRef.setMappedName(ref.getJndiName());
                }
            }
            // map resource-env-refs and message-destination-refs
            final Map<String, JndiReference> resEnvMap = new TreeMap<>();
            resEnvMap.putAll(applicationClient.getResourceEnvRefMap());
            resEnvMap.putAll(applicationClient.getMessageDestinationRefMap());
            for (final ResourceRef ref : sunApplication.getResourceRef()) {
                if (ref.getJndiName() != null) {
                    String refName = ref.getResRefName();
                    refName = normalize(refName);
                    final JndiReference resEnvRef = resEnvMap.get(refName);
                    if (resEnvRef != null) {
                        resEnvRef.setMappedName(ref.getJndiName());
                    }
                }
            }
            for (final ResourceEnvRef ref : sunApplication.getResourceEnvRef()) {
                if (ref.getJndiName() != null) {
                    String refName = ref.getResourceEnvRefName();
                    refName = normalize(refName);
                    final JndiReference resEnvRef = resEnvMap.get(refName);
                    if (resEnvRef != null) {
                        resEnvRef.setMappedName(ref.getJndiName());
                    }
                }
            }
            for (final MessageDestinationRef ref : sunApplication.getMessageDestinationRef()) {
                if (ref.getJndiName() != null) {
                    String refName = ref.getMessageDestinationRefName();
                    refName = normalize(refName);
                    final JndiReference resEnvRef = resEnvMap.get(refName);
                    if (resEnvRef != null) {
                        resEnvRef.setMappedName(ref.getJndiName());
                    }
                }
            }
            for (final MessageDestination destination : sunApplication.getMessageDestination()) {
                if (destination.getJndiName() != null) {
                    String name = destination.getMessageDestinationName();
                    name = normalize(name);
                    final JndiReference ref = resEnvMap.get(name);
                    if (ref != null) {
                        ref.setMappedName(destination.getJndiName());
                    }
                }
            }
            final Map<String, ServiceRef> serviceRefMap = applicationClient.getServiceRefMap();
            for (final org.apache.openejb.jee.sun.ServiceRef ref : sunApplication.getServiceRef()) {
                String refName = ref.getServiceRefName();
                refName = normalize(refName);
                final ServiceRef serviceRef = serviceRefMap.get(refName);
                if (serviceRef != null) {
                    final Map<String, PortComponentRef> ports = new TreeMap<>();
                    for (final PortComponentRef portComponentRef : serviceRef.getPortComponentRef()) {
                        ports.put(portComponentRef.getServiceEndpointInterface(), portComponentRef);
                    }
                    for (final PortInfo portInfo : ref.getPortInfo()) {
                        final PortComponentRef portComponentRef = ports.get(portInfo.getServiceEndpointInterface());
                        if (portComponentRef != null) {
                            final WsdlPort wsdlPort = portInfo.getWsdlPort();
                            if (wsdlPort != null) {
                                final QName qname = new QName(wsdlPort.getNamespaceURI(), wsdlPort.getLocalpart());
                                portComponentRef.setQName(qname);
                            }
                            for (final StubProperty stubProperty : portInfo.getStubProperty()) {
                                final String name = stubProperty.getName();
                                final String value = stubProperty.getValue();
                                portComponentRef.getProperties().setProperty(name, value);
                            }
                        }
                    }
                    final String wsdlOverride = ref.getWsdlOverride();
                    if (wsdlOverride != null && wsdlOverride.length() > 0) {
                        final String serviceId = extractServiceId(wsdlOverride);
                        serviceRef.setMappedName(serviceId);
                    }
                }
            }
        }
    }
    for (final EjbModule ejbModule : appModule.getEjbModules()) {
        convertModule(ejbModule, appModule.getCmpMappings());
    }
    for (final ClientModule clientModule : appModule.getClientModules()) {
        convertModule(clientModule);
    }
    for (final WebModule webModule : appModule.getWebModules()) {
        convertModule(webModule);
    }
    return appModule;
}
Also used : WsdlPort(org.apache.openejb.jee.sun.WsdlPort) PortInfo(org.apache.openejb.jee.sun.PortInfo) MessageDestinationRef(org.apache.openejb.jee.sun.MessageDestinationRef) JndiReference(org.apache.openejb.jee.JndiReference) EjbRef(org.apache.openejb.jee.sun.EjbRef) ResourceEnvRef(org.apache.openejb.jee.sun.ResourceEnvRef) ApplicationClient(org.apache.openejb.jee.ApplicationClient) SunApplicationClient(org.apache.openejb.jee.sun.SunApplicationClient) MessageDestination(org.apache.openejb.jee.sun.MessageDestination) QName(javax.xml.namespace.QName) StubProperty(org.apache.openejb.jee.sun.StubProperty) SunApplication(org.apache.openejb.jee.sun.SunApplication) TreeMap(java.util.TreeMap) PortComponentRef(org.apache.openejb.jee.PortComponentRef) Web(org.apache.openejb.jee.sun.Web) ResourceRef(org.apache.openejb.jee.sun.ResourceRef) Map(java.util.Map) HashMap(java.util.HashMap) TreeMap(java.util.TreeMap) ServiceRef(org.apache.openejb.jee.ServiceRef)

Example 2 with PortComponentRef

use of org.apache.openejb.jee.PortComponentRef in project tomee by apache.

the class SunConversion method convertModule.

public void convertModule(final WebModule webModule) {
    if (webModule == null) {
        return;
    }
    final WebApp webApp = webModule.getWebApp();
    if (webApp == null) {
        return;
    }
    final SunWebApp sunWebApp = getSunWebApp(webModule);
    if (sunWebApp == null) {
        return;
    }
    if (sunWebApp.getContextRoot() != null) {
        webModule.setContextRoot(sunWebApp.getContextRoot());
    }
    // map ejb-refs
    final Map<String, JndiReference> refMap = new TreeMap<>();
    refMap.putAll(webApp.getEjbRefMap());
    refMap.putAll(webApp.getEjbLocalRefMap());
    // map ejb-ref jndi name declaration to deploymentId
    for (final EjbRef ref : sunWebApp.getEjbRef()) {
        if (ref.getJndiName() != null) {
            final String refName = ref.getEjbRefName();
            JndiReference ejbRef = refMap.get(refName);
            if (ejbRef == null) {
                ejbRef = new org.apache.openejb.jee.EjbRef();
                ejbRef.setName(refName);
                refMap.put(refName, ejbRef);
                webApp.getEjbRef().add((org.apache.openejb.jee.EjbRef) ejbRef);
            }
            ejbRef.setMappedName(ref.getJndiName());
        }
    }
    // map resource-env-refs and message-destination-refs
    final Map<String, JndiReference> resEnvMap = new TreeMap<>();
    resEnvMap.putAll(webApp.getResourceRefMap());
    resEnvMap.putAll(webApp.getResourceEnvRefMap());
    resEnvMap.putAll(webApp.getMessageDestinationRefMap());
    for (final ResourceRef ref : sunWebApp.getResourceRef()) {
        if (ref.getJndiName() != null) {
            String refName = ref.getResRefName();
            refName = normalize(refName);
            final JndiReference resEnvRef = resEnvMap.get(refName);
            if (resEnvRef != null) {
                resEnvRef.setMappedName(ref.getJndiName());
            }
        }
    }
    for (final ResourceEnvRef ref : sunWebApp.getResourceEnvRef()) {
        if (ref.getJndiName() != null) {
            String refName = ref.getResourceEnvRefName();
            refName = normalize(refName);
            final JndiReference resEnvRef = resEnvMap.get(refName);
            if (resEnvRef != null) {
                resEnvRef.setMappedName(ref.getJndiName());
            }
        }
    }
    for (final MessageDestinationRef ref : sunWebApp.getMessageDestinationRef()) {
        if (ref.getJndiName() != null) {
            String refName = ref.getMessageDestinationRefName();
            refName = normalize(refName);
            final JndiReference resEnvRef = resEnvMap.get(refName);
            if (resEnvRef != null) {
                resEnvRef.setMappedName(ref.getJndiName());
            }
        }
    }
    final Map<String, ServiceRef> serviceRefMap = webApp.getServiceRefMap();
    for (final org.apache.openejb.jee.sun.ServiceRef ref : sunWebApp.getServiceRef()) {
        String refName = ref.getServiceRefName();
        refName = normalize(refName);
        final ServiceRef serviceRef = serviceRefMap.get(refName);
        if (serviceRef != null) {
            final Map<String, PortComponentRef> ports = new TreeMap<>();
            for (final PortComponentRef portComponentRef : serviceRef.getPortComponentRef()) {
                ports.put(portComponentRef.getServiceEndpointInterface(), portComponentRef);
            }
            for (final PortInfo portInfo : ref.getPortInfo()) {
                final PortComponentRef portComponentRef = ports.get(portInfo.getServiceEndpointInterface());
                if (portComponentRef != null) {
                    final WsdlPort wsdlPort = portInfo.getWsdlPort();
                    if (wsdlPort != null) {
                        final QName qname = new QName(wsdlPort.getNamespaceURI(), wsdlPort.getLocalpart());
                        portComponentRef.setQName(qname);
                    }
                    for (final StubProperty stubProperty : portInfo.getStubProperty()) {
                        final String name = stubProperty.getName();
                        final String value = stubProperty.getValue();
                        portComponentRef.getProperties().setProperty(name, value);
                    }
                }
            }
            final String wsdlOverride = ref.getWsdlOverride();
            if (wsdlOverride != null && wsdlOverride.length() > 0) {
                final String serviceId = extractServiceId(wsdlOverride);
                serviceRef.setMappedName(serviceId);
            }
        }
    }
    // map wsdl locations
    if (webModule.getWebservices() != null) {
        final Map<String, WebserviceDescription> descriptions = webModule.getWebservices().getWebserviceDescriptionMap();
        for (final org.apache.openejb.jee.sun.WebserviceDescription sunDescription : sunWebApp.getWebserviceDescription()) {
            final WebserviceDescription description = descriptions.get(sunDescription.getWebserviceDescriptionName());
            if (description == null) {
                continue;
            }
            final String serviceId = extractSerivceId(sunDescription.getWsdlPublishLocation(), description.getWsdlFile());
            if (serviceId != null) {
                description.setId(serviceId);
            }
        }
    }
}
Also used : SunWebApp(org.apache.openejb.jee.sun.SunWebApp) WsdlPort(org.apache.openejb.jee.sun.WsdlPort) PortInfo(org.apache.openejb.jee.sun.PortInfo) MessageDestinationRef(org.apache.openejb.jee.sun.MessageDestinationRef) JndiReference(org.apache.openejb.jee.JndiReference) EjbRef(org.apache.openejb.jee.sun.EjbRef) ResourceEnvRef(org.apache.openejb.jee.sun.ResourceEnvRef) QName(javax.xml.namespace.QName) StubProperty(org.apache.openejb.jee.sun.StubProperty) TreeMap(java.util.TreeMap) PortComponentRef(org.apache.openejb.jee.PortComponentRef) WebserviceDescription(org.apache.openejb.jee.WebserviceDescription) ResourceRef(org.apache.openejb.jee.sun.ResourceRef) ServiceRef(org.apache.openejb.jee.ServiceRef) SunWebApp(org.apache.openejb.jee.sun.SunWebApp) WebApp(org.apache.openejb.jee.WebApp)

Example 3 with PortComponentRef

use of org.apache.openejb.jee.PortComponentRef in project tomee by apache.

the class SunConversion method convertModule.

public void convertModule(final ClientModule clientModule) {
    if (clientModule == null) {
        return;
    }
    final ApplicationClient applicationClient = clientModule.getApplicationClient();
    if (applicationClient == null) {
        return;
    }
    final SunApplicationClient sunApplicationClient = getSunApplicationClient(clientModule);
    if (sunApplicationClient == null) {
        return;
    }
    // map ejb-refs
    final Map<String, org.apache.openejb.jee.EjbRef> refMap = applicationClient.getEjbRefMap();
    // map ejb-ref jndi name declaration to deploymentId
    for (final EjbRef ref : sunApplicationClient.getEjbRef()) {
        if (ref.getJndiName() != null) {
            String refName = ref.getEjbRefName();
            refName = normalize(refName);
            org.apache.openejb.jee.EjbRef ejbRef = refMap.get(refName);
            if (ejbRef == null) {
                ejbRef = new org.apache.openejb.jee.EjbRef();
                ejbRef.setEjbRefName(refName);
                refMap.put(refName, ejbRef);
                applicationClient.getEjbRef().add(ejbRef);
            }
            ejbRef.setMappedName(ref.getJndiName());
        }
    }
    // map resource-env-refs and message-destination-refs
    final Map<String, JndiReference> resEnvMap = new TreeMap<>();
    resEnvMap.putAll(applicationClient.getResourceEnvRefMap());
    resEnvMap.putAll(applicationClient.getMessageDestinationRefMap());
    for (final ResourceRef ref : sunApplicationClient.getResourceRef()) {
        if (ref.getJndiName() != null) {
            String refName = ref.getResRefName();
            refName = normalize(refName);
            final JndiReference resEnvRef = resEnvMap.get(refName);
            if (resEnvRef != null) {
                resEnvRef.setMappedName(ref.getJndiName());
            }
        }
    }
    for (final ResourceEnvRef ref : sunApplicationClient.getResourceEnvRef()) {
        if (ref.getJndiName() != null) {
            String refName = ref.getResourceEnvRefName();
            refName = normalize(refName);
            final JndiReference resEnvRef = resEnvMap.get(refName);
            if (resEnvRef != null) {
                resEnvRef.setMappedName(ref.getJndiName());
            }
        }
    }
    for (final MessageDestinationRef ref : sunApplicationClient.getMessageDestinationRef()) {
        if (ref.getJndiName() != null) {
            String refName = ref.getMessageDestinationRefName();
            refName = normalize(refName);
            final JndiReference resEnvRef = resEnvMap.get(refName);
            if (resEnvRef != null) {
                resEnvRef.setMappedName(ref.getJndiName());
            }
        }
    }
    final Map<String, ServiceRef> serviceRefMap = applicationClient.getServiceRefMap();
    for (final org.apache.openejb.jee.sun.ServiceRef ref : sunApplicationClient.getServiceRef()) {
        String refName = ref.getServiceRefName();
        refName = normalize(refName);
        final ServiceRef serviceRef = serviceRefMap.get(refName);
        if (serviceRef != null) {
            final Map<String, PortComponentRef> ports = new TreeMap<>();
            for (final PortComponentRef portComponentRef : serviceRef.getPortComponentRef()) {
                ports.put(portComponentRef.getServiceEndpointInterface(), portComponentRef);
            }
            for (final PortInfo portInfo : ref.getPortInfo()) {
                final PortComponentRef portComponentRef = ports.get(portInfo.getServiceEndpointInterface());
                if (portComponentRef != null) {
                    final WsdlPort wsdlPort = portInfo.getWsdlPort();
                    if (wsdlPort != null) {
                        final QName qname = new QName(wsdlPort.getNamespaceURI(), wsdlPort.getLocalpart());
                        portComponentRef.setQName(qname);
                    }
                    for (final StubProperty stubProperty : portInfo.getStubProperty()) {
                        final String name = stubProperty.getName();
                        final String value = stubProperty.getValue();
                        portComponentRef.getProperties().setProperty(name, value);
                    }
                }
            }
            final String wsdlOverride = ref.getWsdlOverride();
            if (wsdlOverride != null && wsdlOverride.length() > 0) {
                final String serviceId = extractServiceId(wsdlOverride);
                serviceRef.setMappedName(serviceId);
            }
        }
    }
}
Also used : WsdlPort(org.apache.openejb.jee.sun.WsdlPort) PortInfo(org.apache.openejb.jee.sun.PortInfo) MessageDestinationRef(org.apache.openejb.jee.sun.MessageDestinationRef) JndiReference(org.apache.openejb.jee.JndiReference) EjbRef(org.apache.openejb.jee.sun.EjbRef) ResourceEnvRef(org.apache.openejb.jee.sun.ResourceEnvRef) ApplicationClient(org.apache.openejb.jee.ApplicationClient) SunApplicationClient(org.apache.openejb.jee.sun.SunApplicationClient) QName(javax.xml.namespace.QName) StubProperty(org.apache.openejb.jee.sun.StubProperty) TreeMap(java.util.TreeMap) SunApplicationClient(org.apache.openejb.jee.sun.SunApplicationClient) PortComponentRef(org.apache.openejb.jee.PortComponentRef) ResourceRef(org.apache.openejb.jee.sun.ResourceRef) ServiceRef(org.apache.openejb.jee.ServiceRef)

Example 4 with PortComponentRef

use of org.apache.openejb.jee.PortComponentRef in project tomee by apache.

the class JndiEncInfoBuilder method buildServiceRefInfos.

private void buildServiceRefInfos(final JndiConsumer jndiConsumer, final JndiEncInfo moduleJndiEnc, final JndiEncInfo compJndiEnc) {
    for (final ServiceRef ref : jndiConsumer.getServiceRef()) {
        final ServiceReferenceInfo info = new ServiceReferenceInfo();
        info.referenceName = ref.getName();
        info.location = buildLocationInfo(ref);
        info.targets.addAll(buildInjectionInfos(ref));
        insert(info, appInfo.globalJndiEnc.serviceRefs, appInfo.appJndiEnc.serviceRefs, moduleJndiEnc.serviceRefs, compJndiEnc.serviceRefs);
        if (SystemInstance.get().hasProperty("openejb.geronimo")) {
            continue;
        }
        info.id = ref.getMappedName();
        info.serviceQName = ref.getServiceQname();
        info.serviceType = ref.getServiceInterface();
        info.referenceType = ref.getServiceRefType();
        info.wsdlFile = ref.getWsdlFile();
        info.jaxrpcMappingFile = ref.getJaxrpcMappingFile();
        info.handlerChains.addAll(ConfigurationFactory.toHandlerChainInfo(ref.getAllHandlers()));
        for (final PortComponentRef portComponentRef : ref.getPortComponentRef()) {
            final PortRefInfo portRefInfo = new PortRefInfo();
            portRefInfo.qname = portComponentRef.getQName();
            portRefInfo.serviceEndpointInterface = portComponentRef.getServiceEndpointInterface();
            portRefInfo.enableMtom = portComponentRef.isEnableMtom();
            portRefInfo.properties.putAll(portComponentRef.getProperties());
            info.portRefs.add(portRefInfo);
        }
    }
}
Also used : PortComponentRef(org.apache.openejb.jee.PortComponentRef) PortRefInfo(org.apache.openejb.assembler.classic.PortRefInfo) ServiceRef(org.apache.openejb.jee.ServiceRef) ServiceReferenceInfo(org.apache.openejb.assembler.classic.ServiceReferenceInfo)

Example 5 with PortComponentRef

use of org.apache.openejb.jee.PortComponentRef 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);
}
Also used : CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) QName(javax.xml.namespace.QName) Handler$JAXB.readHandler(org.apache.openejb.jee.Handler$JAXB.readHandler) Handler$JAXB.writeHandler(org.apache.openejb.jee.Handler$JAXB.writeHandler) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) HandlerChains$JAXB.readHandlerChains(org.apache.openejb.jee.HandlerChains$JAXB.readHandlerChains) HandlerChains$JAXB.writeHandlerChains(org.apache.openejb.jee.HandlerChains$JAXB.writeHandlerChains) PortComponentRef$JAXB.readPortComponentRef(org.apache.openejb.jee.PortComponentRef$JAXB.readPortComponentRef) PortComponentRef$JAXB.writePortComponentRef(org.apache.openejb.jee.PortComponentRef$JAXB.writePortComponentRef) InjectionTarget$JAXB.readInjectionTarget(org.apache.openejb.jee.InjectionTarget$JAXB.readInjectionTarget) InjectionTarget$JAXB.writeInjectionTarget(org.apache.openejb.jee.InjectionTarget$JAXB.writeInjectionTarget) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext)

Aggregations

QName (javax.xml.namespace.QName)6 PortComponentRef (org.apache.openejb.jee.PortComponentRef)5 ServiceRef (org.apache.openejb.jee.ServiceRef)5 TreeMap (java.util.TreeMap)4 EjbRef (org.apache.openejb.jee.sun.EjbRef)4 MessageDestinationRef (org.apache.openejb.jee.sun.MessageDestinationRef)4 PortInfo (org.apache.openejb.jee.sun.PortInfo)4 ResourceEnvRef (org.apache.openejb.jee.sun.ResourceEnvRef)4 ResourceRef (org.apache.openejb.jee.sun.ResourceRef)4 StubProperty (org.apache.openejb.jee.sun.StubProperty)4 WsdlPort (org.apache.openejb.jee.sun.WsdlPort)4 JndiReference (org.apache.openejb.jee.JndiReference)3 HashMap (java.util.HashMap)2 Map (java.util.Map)2 CollapsedStringAdapter (javax.xml.bind.annotation.adapters.CollapsedStringAdapter)2 ApplicationClient (org.apache.openejb.jee.ApplicationClient)2 Handler$JAXB.readHandler (org.apache.openejb.jee.Handler$JAXB.readHandler)2 Handler$JAXB.writeHandler (org.apache.openejb.jee.Handler$JAXB.writeHandler)2 HandlerChains$JAXB.readHandlerChains (org.apache.openejb.jee.HandlerChains$JAXB.readHandlerChains)2 HandlerChains$JAXB.writeHandlerChains (org.apache.openejb.jee.HandlerChains$JAXB.writeHandlerChains)2