Search in sources :

Example 1 with POJOEndpoint

use of org.jboss.as.webservices.metadata.model.POJOEndpoint in project wildfly by wildfly.

the class AbstractMetaDataBuilderPOJO method getServletUrlPatternsMappings.

/**
     * Returns servlet name to url pattern mappings.
     *
     * @param jbossWebMD jboss web meta data
     * @return servlet name to url pattern mappings
     */
private Map<String, String> getServletUrlPatternsMappings(final JBossWebMetaData jbossWebMD, final List<POJOEndpoint> pojoEndpoints) {
    final Map<String, String> mappings = new HashMap<String, String>();
    final List<ServletMappingMetaData> servletMappings = WebMetaDataHelper.getServletMappings(jbossWebMD);
    for (final POJOEndpoint pojoEndpoint : pojoEndpoints) {
        mappings.put(pojoEndpoint.getName(), pojoEndpoint.getUrlPattern());
        if (!pojoEndpoint.isDeclared()) {
            final String endpointName = pojoEndpoint.getName();
            final List<String> urlPatterns = WebMetaDataHelper.getUrlPatterns(pojoEndpoint.getUrlPattern());
            WebMetaDataHelper.newServletMapping(endpointName, urlPatterns, servletMappings);
        }
    }
    return mappings;
}
Also used : ServletMappingMetaData(org.jboss.metadata.web.spec.ServletMappingMetaData) HashMap(java.util.HashMap) POJOEndpoint(org.jboss.as.webservices.metadata.model.POJOEndpoint)

Example 2 with POJOEndpoint

use of org.jboss.as.webservices.metadata.model.POJOEndpoint in project wildfly by wildfly.

the class AbstractMetaDataBuilderPOJO method getServletClassMappings.

/**
     * Returns servlet name to servlet class mappings.
     *
     * @param jbossWebMD jboss web meta data
     * @return servlet name to servlet mappings
     */
private Map<String, String> getServletClassMappings(final JBossWebMetaData jbossWebMD, final List<POJOEndpoint> pojoEndpoints) {
    final Map<String, String> mappings = new HashMap<String, String>();
    final JBossServletsMetaData servlets = WebMetaDataHelper.getServlets(jbossWebMD);
    for (final POJOEndpoint pojoEndpoint : pojoEndpoints) {
        final String pojoName = pojoEndpoint.getName();
        final String pojoClassName = pojoEndpoint.getClassName();
        mappings.put(pojoName, pojoClassName);
        if (!pojoEndpoint.isDeclared()) {
            final String endpointName = pojoEndpoint.getName();
            final String endpointClassName = pojoEndpoint.getClassName();
            WebMetaDataHelper.newServlet(endpointName, endpointClassName, servlets);
        }
    }
    return mappings;
}
Also used : JBossServletsMetaData(org.jboss.metadata.web.jboss.JBossServletsMetaData) HashMap(java.util.HashMap) POJOEndpoint(org.jboss.as.webservices.metadata.model.POJOEndpoint)

Example 3 with POJOEndpoint

use of org.jboss.as.webservices.metadata.model.POJOEndpoint in project wildfly by wildfly.

the class AbstractMetaDataBuilderPOJO method create.

/**
     * Builds universal JSE meta data model that is AS agnostic.
     *
     * @param dep webservice deployment
     * @return universal JSE meta data model
     */
JSEArchiveMetaData create(final Deployment dep) {
    if (WSLogger.ROOT_LOGGER.isTraceEnabled()) {
        WSLogger.ROOT_LOGGER.tracef("Creating JBoss agnostic meta data for POJO webservice deployment: %s", dep.getSimpleName());
    }
    final JBossWebMetaData jbossWebMD = WSHelper.getRequiredAttachment(dep, JBossWebMetaData.class);
    final DeploymentUnit unit = WSHelper.getRequiredAttachment(dep, DeploymentUnit.class);
    final List<POJOEndpoint> pojoEndpoints = getPojoEndpoints(unit);
    final JSEArchiveMetaData.Builder builder = new JSEArchiveMetaData.Builder();
    // set context root
    final String contextRoot = getContextRoot(dep, jbossWebMD);
    builder.setContextRoot(contextRoot);
    WSLogger.ROOT_LOGGER.tracef("Setting context root: %s", contextRoot);
    // set servlet url patterns mappings
    final Map<String, String> servletMappings = getServletUrlPatternsMappings(jbossWebMD, pojoEndpoints);
    builder.setServletMappings(servletMappings);
    // set servlet class names mappings
    final Map<String, String> servletClassNamesMappings = getServletClassMappings(jbossWebMD, pojoEndpoints);
    builder.setServletClassNames(servletClassNamesMappings);
    // set security domain
    final String securityDomain = jbossWebMD.getSecurityDomain();
    builder.setSecurityDomain(securityDomain);
    // set wsdl location resolver
    final JBossWebservicesMetaData jbossWebservicesMD = WSHelper.getOptionalAttachment(dep, JBossWebservicesMetaData.class);
    if (jbossWebservicesMD != null) {
        final PublishLocationAdapter resolver = new PublishLocationAdapterImpl(jbossWebservicesMD.getWebserviceDescriptions());
        builder.setPublishLocationAdapter(resolver);
    }
    // set security meta data
    final List<JSESecurityMetaData> jseSecurityMDs = getSecurityMetaData(jbossWebMD.getSecurityConstraints());
    builder.setSecurityMetaData(jseSecurityMDs);
    // set config name and file
    setConfigNameAndFile(builder, jbossWebMD, jbossWebservicesMD);
    return builder.build();
}
Also used : JBossWebMetaData(org.jboss.metadata.web.jboss.JBossWebMetaData) PublishLocationAdapter(org.jboss.wsf.spi.metadata.j2ee.PublishLocationAdapter) POJOEndpoint(org.jboss.as.webservices.metadata.model.POJOEndpoint) JSESecurityMetaData(org.jboss.wsf.spi.metadata.j2ee.JSESecurityMetaData) JSEArchiveMetaData(org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData) JBossWebservicesMetaData(org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 4 with POJOEndpoint

use of org.jboss.as.webservices.metadata.model.POJOEndpoint 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 5 with POJOEndpoint

use of org.jboss.as.webservices.metadata.model.POJOEndpoint in project wildfly by wildfly.

the class DeploymentModelBuilderJAXWS_POJO method build.

@Override
protected void build(final Deployment dep, final DeploymentUnit unit) {
    WSLogger.ROOT_LOGGER.trace("Creating JAXWS POJO endpoints meta data model");
    WSEndpointConfigMapping ecm = unit.getAttachment(WSAttachmentKeys.WS_ENDPOINT_CONFIG_MAPPING_KEY);
    for (final POJOEndpoint pojoEndpoint : getJaxwsPojos(unit)) {
        final String pojoEndpointName = pojoEndpoint.getName();
        WSLogger.ROOT_LOGGER.tracef("POJO name: %s", pojoEndpointName);
        final String pojoEndpointClassName = pojoEndpoint.getClassName();
        WSLogger.ROOT_LOGGER.tracef("POJO class: %s", pojoEndpointClassName);
        final Endpoint ep = newHttpEndpoint(pojoEndpointClassName, pojoEndpointName, dep);
        final ServiceName componentViewName = pojoEndpoint.getComponentViewName();
        if (componentViewName != null) {
            ep.setProperty(COMPONENT_VIEW_NAME, componentViewName);
        }
        if (ecm != null) {
            ep.setEndpointConfig(ecm.getConfig(pojoEndpointClassName));
        }
    }
}
Also used : POJOEndpoint(org.jboss.as.webservices.metadata.model.POJOEndpoint) Endpoint(org.jboss.wsf.spi.deployment.Endpoint) ServiceName(org.jboss.msc.service.ServiceName) POJOEndpoint(org.jboss.as.webservices.metadata.model.POJOEndpoint) WSEndpointConfigMapping(org.jboss.as.webservices.deployers.WSEndpointConfigMapping)

Aggregations

POJOEndpoint (org.jboss.as.webservices.metadata.model.POJOEndpoint)6 HashMap (java.util.HashMap)3 JBossWebMetaData (org.jboss.metadata.web.jboss.JBossWebMetaData)3 WebService (javax.jws.WebService)2 WebServiceProvider (javax.xml.ws.WebServiceProvider)2 ComponentDescription (org.jboss.as.ee.component.ComponentDescription)2 EEModuleClassDescription (org.jboss.as.ee.component.EEModuleClassDescription)2 CompositeIndex (org.jboss.as.server.deployment.annotation.CompositeIndex)2 EJBEndpoint (org.jboss.as.webservices.metadata.model.EJBEndpoint)2 ClassInfo (org.jboss.jandex.ClassInfo)2 ServiceName (org.jboss.msc.service.ServiceName)2 JBossWebservicesMetaData (org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData)2 HashSet (java.util.HashSet)1 EEModuleDescription (org.jboss.as.ee.component.EEModuleDescription)1 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)1 WSEndpointConfigMapping (org.jboss.as.webservices.deployers.WSEndpointConfigMapping)1 WSEndpointHandlersMapping (org.jboss.as.webservices.injection.WSEndpointHandlersMapping)1 JAXWSDeployment (org.jboss.as.webservices.metadata.model.JAXWSDeployment)1 ASHelper.getJBossWebMetaData (org.jboss.as.webservices.util.ASHelper.getJBossWebMetaData)1 ASHelper.getWebserviceMetadataEJBEndpoint (org.jboss.as.webservices.util.ASHelper.getWebserviceMetadataEJBEndpoint)1