Search in sources :

Example 1 with WSEndpointHandlersMapping

use of org.jboss.as.webservices.injection.WSEndpointHandlersMapping in project wildfly by wildfly.

the class WSIntegrationProcessorJAXWS_HANDLER method processAnnotation.

@Override
protected void processAnnotation(final DeploymentUnit unit, final EEModuleDescription moduleDescription) throws DeploymentUnitProcessingException {
    final WSEndpointHandlersMapping mapping = getOptionalAttachment(unit, WS_ENDPOINT_HANDLERS_MAPPING_KEY);
    final VirtualFile root = unit.getAttachment(DEPLOYMENT_ROOT).getRoot();
    final JBossWebservicesMetaData jbossWebservicesMD = unit.getAttachment(WSAttachmentKeys.JBOSS_WEBSERVICES_METADATA_KEY);
    final CompositeIndex index = unit.getAttachment(Attachments.COMPOSITE_ANNOTATION_INDEX);
    final boolean war = DeploymentTypeMarker.isType(DeploymentType.WAR, unit);
    final JBossWebMetaData jwmd = ASHelper.getJBossWebMetaData(unit);
    for (EEModuleClassDescription classDescription : moduleDescription.getClassDescriptions()) {
        ClassInfo classInfo = null;
        ClassAnnotationInformation<WebService, WebServiceAnnotationInfo> annotationInfo = classDescription.getAnnotationInformation(WebService.class);
        if (annotationInfo != null) {
            classInfo = (ClassInfo) annotationInfo.getClassLevelAnnotations().get(0).getTarget();
        }
        final ClassAnnotationInformation<WebServiceProvider, WebServiceProviderAnnotationInfo> providreInfo = classDescription.getAnnotationInformation(WebServiceProvider.class);
        if (providreInfo != null) {
            classInfo = (ClassInfo) providreInfo.getClassLevelAnnotations().get(0).getTarget();
        }
        if (classInfo != null && isJaxwsEndpoint(classInfo, index, false)) {
            final String endpointClassName = classInfo.name().toString();
            final ConfigResolver configResolver = new ConfigResolver(classInfo, jbossWebservicesMD, jwmd, root, war);
            final EndpointConfig config = configResolver.resolveEndpointConfig();
            if (config != null) {
                registerConfigMapping(endpointClassName, config, unit);
            }
            final Set<String> handlers = getHandlers(endpointClassName, config, configResolver, mapping);
            if (!handlers.isEmpty()) {
                if (isEjb3(classInfo)) {
                    for (final EJBEndpoint ejbEndpoint : getJaxwsEjbs(unit)) {
                        if (endpointClassName.equals(ejbEndpoint.getClassName())) {
                            for (final String handlerClassName : handlers) {
                                final String ejbEndpointName = ejbEndpoint.getName();
                                final String handlerName = ejbEndpointName + "-" + handlerClassName;
                                final ComponentDescription jaxwsHandlerDescription = createComponentDescription(unit, handlerName, handlerClassName, ejbEndpointName);
                                propagateNamingContext(jaxwsHandlerDescription, ejbEndpoint);
                            }
                        }
                    }
                } else {
                    for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
                        if (endpointClassName.equals(pojoEndpoint.getClassName())) {
                            for (final String handlerClassName : handlers) {
                                final String pojoEndpointName = pojoEndpoint.getName();
                                final String handlerName = pojoEndpointName + "-" + handlerClassName;
                                createComponentDescription(unit, handlerName, handlerClassName, pojoEndpointName);
                            }
                        }
                    }
                }
            }
        }
    }
}
Also used : VirtualFile(org.jboss.vfs.VirtualFile) JBossWebMetaData(org.jboss.metadata.web.jboss.JBossWebMetaData) ComponentDescription(org.jboss.as.ee.component.ComponentDescription) WebService(javax.jws.WebService) CompositeIndex(org.jboss.as.server.deployment.annotation.CompositeIndex) POJOEndpoint(org.jboss.as.webservices.metadata.model.POJOEndpoint) WSEndpointHandlersMapping(org.jboss.as.webservices.injection.WSEndpointHandlersMapping) WebServiceProvider(javax.xml.ws.WebServiceProvider) JBossWebservicesMetaData(org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData) EJBEndpoint(org.jboss.as.webservices.metadata.model.EJBEndpoint) EEModuleClassDescription(org.jboss.as.ee.component.EEModuleClassDescription) EndpointConfig(org.jboss.wsf.spi.metadata.config.EndpointConfig) ClassInfo(org.jboss.jandex.ClassInfo)

Example 2 with WSEndpointHandlersMapping

use of org.jboss.as.webservices.injection.WSEndpointHandlersMapping in project wildfly by wildfly.

the class XTSHandlerDeploymentProcessor method isAnyOfHandlersRegistered.

private boolean isAnyOfHandlersRegistered(final DeploymentUnit unit, final String endpointClass, final List<String> handlers) {
    final WSEndpointHandlersMapping mapping = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_HANDLERS_MAPPING_KEY);
    if (mapping == null) {
        return false;
    }
    final Set<String> existingHandlers = mapping.getHandlers(endpointClass);
    if (existingHandlers == null) {
        return false;
    }
    for (final String handler : handlers) {
        if (existingHandlers.contains(handler)) {
            return true;
        }
    }
    return false;
}
Also used : WSEndpointHandlersMapping(org.jboss.as.webservices.injection.WSEndpointHandlersMapping)

Example 3 with WSEndpointHandlersMapping

use of org.jboss.as.webservices.injection.WSEndpointHandlersMapping in project wildfly by wildfly.

the class XTSHandlerDeploymentProcessor method registerHandlersWithAS.

private void registerHandlersWithAS(DeploymentUnit unit, String endpointClass, List<String> handlersToAdd) {
    WSEndpointHandlersMapping mapping = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_HANDLERS_MAPPING_KEY);
    if (mapping == null) {
        mapping = new WSEndpointHandlersMapping();
        unit.putAttachment(WSAttachmentKeys.WS_ENDPOINT_HANDLERS_MAPPING_KEY, mapping);
    }
    Set<String> existingHandlers = mapping.getHandlers(endpointClass);
    if (existingHandlers == null) {
        existingHandlers = new HashSet<String>();
    } else {
        //Existing collection is an unmodifiableSet
        existingHandlers = new HashSet<String>(existingHandlers);
    }
    for (String handler : handlersToAdd) {
        existingHandlers.add(handler);
    }
    mapping.registerEndpointHandlers(endpointClass, existingHandlers);
}
Also used : WSEndpointHandlersMapping(org.jboss.as.webservices.injection.WSEndpointHandlersMapping)

Aggregations

WSEndpointHandlersMapping (org.jboss.as.webservices.injection.WSEndpointHandlersMapping)3 WebService (javax.jws.WebService)1 WebServiceProvider (javax.xml.ws.WebServiceProvider)1 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)1 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)1 CompositeIndex (org.jboss.as.server.deployment.annotation.CompositeIndex)1 EJBEndpoint (org.jboss.as.webservices.metadata.model.EJBEndpoint)1 POJOEndpoint (org.jboss.as.webservices.metadata.model.POJOEndpoint)1 ClassInfo (org.jboss.jandex.ClassInfo)1 JBossWebMetaData (org.jboss.metadata.web.jboss.JBossWebMetaData)1 VirtualFile (org.jboss.vfs.VirtualFile)1 EndpointConfig (org.jboss.wsf.spi.metadata.config.EndpointConfig)1 JBossWebservicesMetaData (org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData)1