Search in sources :

Example 1 with JMSEndpointsMetaData

use of org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData in project wildfly by wildfly.

the class WSIntegrationProcessorJAXWS_POJO method isJmsEndpoint.

private static boolean isJmsEndpoint(final DeploymentUnit unit, final ClassInfo classInfo) {
    final String endpointClassName = classInfo.name().toString();
    final JMSEndpointsMetaData jmsEndpointsMD = getRequiredAttachment(unit, JMS_ENDPOINT_METADATA_KEY);
    for (final JMSEndpointMetaData endpoint : jmsEndpointsMD.getEndpointsMetaData()) {
        if (endpointClassName.equals(endpoint.getImplementor())) {
            return true;
        }
    }
    return false;
}
Also used : JMSEndpointMetaData(org.jboss.wsf.spi.metadata.jms.JMSEndpointMetaData) JMSEndpointsMetaData(org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData)

Example 2 with JMSEndpointsMetaData

use of org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData in project wildfly by wildfly.

the class DeploymentModelBuilderJAXWS_JMS method build.

@Override
protected void build(final Deployment dep, final DeploymentUnit unit) {
    // propagate
    final JMSEndpointsMetaData jmsEndpointsMD = getOptionalAttachment(unit, JMS_ENDPOINT_METADATA_KEY);
    dep.addAttachment(JMSEndpointsMetaData.class, jmsEndpointsMD);
    WSLogger.ROOT_LOGGER.trace("Creating JAXWS Jakarta Messaging endpoints meta data model");
    for (final JMSEndpointMetaData jmsEndpoint : jmsEndpointsMD.getEndpointsMetaData()) {
        final String jmsEndpointName = jmsEndpoint.getName();
        WSLogger.ROOT_LOGGER.tracef("Jakarta Messaging name: %s", jmsEndpointName);
        final String jmsEndpointClassName = jmsEndpoint.getImplementor();
        WSLogger.ROOT_LOGGER.tracef("Jakarta Messaging class: %s", jmsEndpointClassName);
        final String jmsEndpointAddress = jmsEndpoint.getSoapAddress();
        WSLogger.ROOT_LOGGER.tracef("Jakarta Messaging address: %s", jmsEndpointAddress);
        Endpoint ep = newJMSEndpoint(jmsEndpointClassName, jmsEndpointName, jmsEndpointAddress, dep);
        markWeldDeployment(unit, ep);
    }
}
Also used : JMSEndpointMetaData(org.jboss.wsf.spi.metadata.jms.JMSEndpointMetaData) Endpoint(org.jboss.wsf.spi.deployment.Endpoint) JMSEndpointsMetaData(org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData)

Example 3 with JMSEndpointsMetaData

use of org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData in project wildfly by wildfly.

the class WSIntegrationProcessorJAXWS_JMS method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    if (DeploymentTypeMarker.isType(DeploymentType.EAR, unit)) {
        return;
    }
    final List<AnnotationInstance> webServiceAnnotations = getAnnotations(unit, WEB_SERVICE_ANNOTATION);
    // TODO: how about @WebServiceProvider JMS based endpoints?
    // group @WebService annotations in the deployment by wsdl contract location
    Map<String, List<AnnotationInstance>> map = new HashMap<String, List<AnnotationInstance>>();
    for (AnnotationInstance webServiceAnnotation : webServiceAnnotations) {
        final AnnotationValue wsdlLocation = webServiceAnnotation.value(WSDL_LOCATION);
        final AnnotationValue port = webServiceAnnotation.value(PORT_NAME);
        final AnnotationValue service = webServiceAnnotation.value(SERVICE_NAME);
        // support for contract-first development only: pick-up @WebService annotations referencing a provided wsdl contract only
        if (wsdlLocation != null && port != null && service != null) {
            String key = wsdlLocation.asString();
            List<AnnotationInstance> annotations = map.get(key);
            if (annotations == null) {
                annotations = new LinkedList<AnnotationInstance>();
                map.put(key, annotations);
            }
            annotations.add(webServiceAnnotation);
        }
    }
    // extract SOAP-over-JMS 1.0 bindings
    List<JMSEndpointMetaData> list = new LinkedList<JMSEndpointMetaData>();
    if (!map.isEmpty()) {
        for (String wsdlLocation : map.keySet()) {
            try {
                final ResourceRoot resourceRoot = getWsdlResourceRoot(unit, wsdlLocation);
                if (resourceRoot == null)
                    continue;
                final VirtualFile wsdlLocationFile = resourceRoot.getRoot().getChild(wsdlLocation);
                final URL url = wsdlLocationFile.toURL();
                SOAPAddressWSDLParser parser = new SOAPAddressWSDLParser(url);
                for (AnnotationInstance ai : map.get(wsdlLocation)) {
                    String port = ai.value(PORT_NAME).asString();
                    String service = ai.value(SERVICE_NAME).asString();
                    AnnotationValue targetNS = ai.value(TARGET_NAMESPACE);
                    String tns = targetNS != null ? targetNS.asString() : null;
                    QName serviceName = new QName(tns, service);
                    QName portName = new QName(tns, port);
                    String soapAddress = parser.filterSoapAddress(serviceName, portName, SOAPAddressWSDLParser.SOAP_OVER_JMS_NS);
                    if (soapAddress != null) {
                        ClassInfo webServiceClassInfo = (ClassInfo) ai.target();
                        String beanClassName = webServiceClassInfo.name().toString();
                        // service name ?
                        list.add(new JMSEndpointMetaData(beanClassName, port, beanClassName, wsdlLocation, soapAddress));
                    }
                }
            } catch (Exception ignore) {
                WSLogger.ROOT_LOGGER.cannotReadWsdl(wsdlLocation);
            }
        }
    }
    unit.putAttachment(JMS_ENDPOINT_METADATA_KEY, new JMSEndpointsMetaData(list));
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) JMSEndpointsMetaData(org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData) LinkedList(java.util.LinkedList) URL(java.net.URL) DeploymentUnitProcessingException(org.jboss.as.server.deployment.DeploymentUnitProcessingException) ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) JMSEndpointMetaData(org.jboss.wsf.spi.metadata.jms.JMSEndpointMetaData) AnnotationValue(org.jboss.jandex.AnnotationValue) LinkedList(java.util.LinkedList) AttachmentList(org.jboss.as.server.deployment.AttachmentList) List(java.util.List) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) SOAPAddressWSDLParser(org.jboss.ws.common.deployment.SOAPAddressWSDLParser) AnnotationInstance(org.jboss.jandex.AnnotationInstance) ClassInfo(org.jboss.jandex.ClassInfo)

Aggregations

JMSEndpointMetaData (org.jboss.wsf.spi.metadata.jms.JMSEndpointMetaData)3 JMSEndpointsMetaData (org.jboss.wsf.spi.metadata.jms.JMSEndpointsMetaData)3 URL (java.net.URL)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 QName (javax.xml.namespace.QName)1 AttachmentList (org.jboss.as.server.deployment.AttachmentList)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 DeploymentUnitProcessingException (org.jboss.as.server.deployment.DeploymentUnitProcessingException)1 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)1 AnnotationInstance (org.jboss.jandex.AnnotationInstance)1 AnnotationValue (org.jboss.jandex.AnnotationValue)1 ClassInfo (org.jboss.jandex.ClassInfo)1 VirtualFile (org.jboss.vfs.VirtualFile)1 SOAPAddressWSDLParser (org.jboss.ws.common.deployment.SOAPAddressWSDLParser)1 Endpoint (org.jboss.wsf.spi.deployment.Endpoint)1