Search in sources :

Example 1 with JBossWebservicesMetaData

use of org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData in project jbossws-cxf by jbossws.

the class BusHolderTest method setupPropertyAndGetAlternativeSelector.

private static String setupPropertyAndGetAlternativeSelector(String alternative) {
    JBossWebservicesMetaData wsmd = null;
    if (alternative != null) {
        Map<String, String> props = new HashMap<String, String>();
        props.put(Constants.CXF_POLICY_ALTERNATIVE_SELECTOR_PROP, alternative);
        wsmd = new JBossWebservicesMetaData(null, null, null, null, props, null, null);
    }
    BusHolder holder = new BusHolder(new DDBeans());
    try {
        Deployment dep = new DefaultDeploymentModelFactory().newDeployment("testDeployment", null, null);
        dep.addAttachment(SOAPAddressRewriteMetadata.class, new SOAPAddressRewriteMetadata(getTestServerConfig(), null));
        holder.configure(null, null, wsmd, dep);
        return holder.getBus().getExtension(PolicyEngine.class).getAlternativeSelector().getClass().getName();
    } finally {
        holder.close();
    }
}
Also used : DDBeans(org.jboss.wsf.stack.cxf.metadata.services.DDBeans) DefaultDeploymentModelFactory(org.jboss.ws.common.deployment.DefaultDeploymentModelFactory) HashMap(java.util.HashMap) JBossWebservicesMetaData(org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData) SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata) Deployment(org.jboss.wsf.spi.deployment.Deployment) PolicyEngine(org.apache.cxf.ws.policy.PolicyEngine)

Example 2 with JBossWebservicesMetaData

use of org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData 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 3 with JBossWebservicesMetaData

use of org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData in project wildfly by wildfly.

the class JBossWebservicesDescriptorDeploymentProcessor method deploy.

public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    final ResourceRoot deploymentRoot = unit.getAttachment(Attachments.DEPLOYMENT_ROOT);
    final URL jbossWebservicesDescriptorURL = getJBossWebServicesDescriptorURL(deploymentRoot);
    if (jbossWebservicesDescriptorURL != null) {
        final JBossWebservicesPropertyReplaceFactory webservicesFactory = new JBossWebservicesPropertyReplaceFactory(jbossWebservicesDescriptorURL, JBossDescriptorPropertyReplacement.propertyReplacer(unit));
        final JBossWebservicesMetaData jbossWebservicesMD = webservicesFactory.load(jbossWebservicesDescriptorURL);
        unit.putAttachment(WSAttachmentKeys.JBOSS_WEBSERVICES_METADATA_KEY, jbossWebservicesMD);
    }
}
Also used : ResourceRoot(org.jboss.as.server.deployment.module.ResourceRoot) JBossWebservicesMetaData(org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData) JBossWebservicesPropertyReplaceFactory(org.jboss.as.webservices.metadata.JBossWebservicesPropertyReplaceFactory) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) URL(java.net.URL)

Example 4 with JBossWebservicesMetaData

use of org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData in project wildfly by wildfly.

the class AbstractMetaDataBuilderEJB method buildWebservicesMetaData.

/**
 * Builds webservices meta data. This methods sets:
 * <ul>
 *   <li>context root</li>
 *   <li>wsdl location resolver</li>
 *   <li>config name</li>
 *   <li>config file</li>
 * </ul>
 *
 * @param dep webservice deployment
 * @param ejbArchiveMD universal Jakarta Enterprise Beans meta data model
 */
private void buildWebservicesMetaData(final Deployment dep, final EJBArchiveMetaData.Builder ejbArchiveMDBuilder) {
    final JBossWebservicesMetaData webservicesMD = WSHelper.getOptionalAttachment(dep, JBossWebservicesMetaData.class);
    if (webservicesMD == null)
        return;
    // set context root
    final String contextRoot = webservicesMD.getContextRoot();
    ejbArchiveMDBuilder.setWebServiceContextRoot(contextRoot);
    WSLogger.ROOT_LOGGER.tracef("Setting context root: %s", contextRoot);
    // set config name
    final String configName = webservicesMD.getConfigName();
    ejbArchiveMDBuilder.setConfigName(configName);
    WSLogger.ROOT_LOGGER.tracef("Setting config name: %s", configName);
    // set config file
    final String configFile = webservicesMD.getConfigFile();
    ejbArchiveMDBuilder.setConfigFile(configFile);
    WSLogger.ROOT_LOGGER.tracef("Setting config file: %s", configFile);
    // set wsdl location resolver
    final JBossWebserviceDescriptionMetaData[] wsDescriptionsMD = webservicesMD.getWebserviceDescriptions();
    final PublishLocationAdapter resolver = new PublishLocationAdapterImpl(wsDescriptionsMD);
    ejbArchiveMDBuilder.setPublishLocationAdapter(resolver);
}
Also used : PublishLocationAdapter(org.jboss.wsf.spi.metadata.j2ee.PublishLocationAdapter) JBossWebserviceDescriptionMetaData(org.jboss.wsf.spi.metadata.webservices.JBossWebserviceDescriptionMetaData) JBossWebservicesMetaData(org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData)

Example 5 with JBossWebservicesMetaData

use of org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData 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)

Aggregations

JBossWebservicesMetaData (org.jboss.wsf.spi.metadata.webservices.JBossWebservicesMetaData)7 JBossWebMetaData (org.jboss.metadata.web.jboss.JBossWebMetaData)4 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)2 EJBEndpoint (org.jboss.as.webservices.metadata.model.EJBEndpoint)2 JAXWSDeployment (org.jboss.as.webservices.metadata.model.JAXWSDeployment)2 POJOEndpoint (org.jboss.as.webservices.metadata.model.POJOEndpoint)2 JSEArchiveMetaData (org.jboss.wsf.spi.metadata.j2ee.JSEArchiveMetaData)2 PublishLocationAdapter (org.jboss.wsf.spi.metadata.j2ee.PublishLocationAdapter)2 URL (java.net.URL)1 HashMap (java.util.HashMap)1 LinkedList (java.util.LinkedList)1 WebService (javax.jws.WebService)1 WebServiceProvider (javax.xml.ws.WebServiceProvider)1 PolicyEngine (org.apache.cxf.ws.policy.PolicyEngine)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 ResourceRoot (org.jboss.as.server.deployment.module.ResourceRoot)1 WSEndpointHandlersMapping (org.jboss.as.webservices.injection.WSEndpointHandlersMapping)1 JBossWebservicesPropertyReplaceFactory (org.jboss.as.webservices.metadata.JBossWebservicesPropertyReplaceFactory)1