Search in sources :

Example 6 with Deployment

use of org.jboss.wsf.spi.deployment.Deployment 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 7 with Deployment

use of org.jboss.wsf.spi.deployment.Deployment in project jbossws-cxf by jbossws.

the class EndpointImpl method getSOAPAddressRewriteMetadata.

private SOAPAddressRewriteMetadata getSOAPAddressRewriteMetadata() {
    if (sarm == null) {
        Deployment dep = (Deployment) getBus().getProperty(Deployment.class.getName());
        sarm = dep.getAttachment(SOAPAddressRewriteMetadata.class);
    }
    return sarm;
}
Also used : SOAPAddressRewriteMetadata(org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata) Deployment(org.jboss.wsf.spi.deployment.Deployment)

Example 8 with Deployment

use of org.jboss.wsf.spi.deployment.Deployment in project jbossws-cxf by jbossws.

the class GracefulShutdownInterceptor method handleMessage.

@Override
public void handleMessage(Message message) throws Fault {
    ServletRequest req = (ServletRequest) message.get(AbstractHTTPDestination.HTTP_REQUEST);
    if (req != null && "true".equals(req.getAttribute("org.wildfly.suspended"))) {
        if (message instanceof SoapMessage) {
            SoapMessage soapMessage = (SoapMessage) message;
            if (!soapMessage.hasHeaders()) {
                throw createFault();
            } else {
                Deployment dep = soapMessage.getExchange().get(Endpoint.class).getService().getDeployment();
                RejectionRule rr = dep.getAttachment(RejectionRule.class);
                if (rr != null) {
                    List<Header> headers = soapMessage.getHeaders();
                    Map<QName, Object> m = new HashMap<>();
                    for (Header header : headers) {
                        m.put(header.getName(), header.getObject());
                    }
                    if (rr.rejectMessage(m)) {
                        throw createFault();
                    }
                }
            }
        } else {
            throw createFault();
        }
    }
}
Also used : ServletRequest(javax.servlet.ServletRequest) RejectionRule(org.jboss.wsf.spi.invocation.RejectionRule) Header(org.apache.cxf.headers.Header) HashMap(java.util.HashMap) QName(javax.xml.namespace.QName) Deployment(org.jboss.wsf.spi.deployment.Deployment) SoapMessage(org.apache.cxf.binding.soap.SoapMessage)

Example 9 with Deployment

use of org.jboss.wsf.spi.deployment.Deployment in project wildfly by wildfly.

the class AspectDeploymentProcessor method deploy.

@Override
public void deploy(final DeploymentPhaseContext phaseContext) throws DeploymentUnitProcessingException {
    final DeploymentUnit unit = phaseContext.getDeploymentUnit();
    if (isWebServiceDeployment(unit)) {
        ensureAspectInitialized();
        final Deployment dep = ASHelper.getRequiredAttachment(unit, WSAttachmentKeys.DEPLOYMENT_KEY);
        WSLogger.ROOT_LOGGER.tracef("%s start: %s", aspect, unit.getName());
        ClassLoader origClassLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
        try {
            WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(aspect.getLoader());
            dep.addAttachment(ServiceTarget.class, phaseContext.getServiceTarget());
            aspect.start(dep);
            dep.removeAttachment(ServiceTarget.class);
        } finally {
            WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(origClassLoader);
        }
    }
}
Also used : Deployment(org.jboss.wsf.spi.deployment.Deployment) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit)

Example 10 with Deployment

use of org.jboss.wsf.spi.deployment.Deployment in project wildfly by wildfly.

the class EndpointDeployService method install.

public static DeploymentUnit install(final ServiceTarget serviceTarget, final String context, final ClassLoader loader, final String hostName, final Map<String, String> urlPatternToClassName, JBossWebMetaData jbwmd, WebservicesMetaData wsmd, JBossWebservicesMetaData jbwsmd, Map<Class<?>, Object> deploymentAttachments, CapabilityServiceSupport capabilityServiceSupport) {
    final DeploymentUnit unit = EndpointPublisherHelper.doPrepareStep(context, loader, urlPatternToClassName, jbwmd, wsmd, jbwsmd, capabilityServiceSupport);
    if (deploymentAttachments != null) {
        Deployment dep = unit.getAttachment(WSAttachmentKeys.DEPLOYMENT_KEY);
        for (Entry<Class<?>, Object> e : deploymentAttachments.entrySet()) {
            dep.addAttachment(e.getKey(), e.getValue());
        }
    }
    final EndpointDeployService service = new EndpointDeployService(context, unit);
    final ServiceBuilder builder = serviceTarget.addService(service.getName());
    builder.requires(WSServices.CONFIG_SERVICE);
    builder.setInstance(service);
    builder.install();
    return unit;
}
Also used : Deployment(org.jboss.wsf.spi.deployment.Deployment) DeploymentUnit(org.jboss.as.server.deployment.DeploymentUnit) ServiceBuilder(org.jboss.msc.service.ServiceBuilder)

Aggregations

Deployment (org.jboss.wsf.spi.deployment.Deployment)16 SOAPAddressRewriteMetadata (org.jboss.wsf.spi.metadata.config.SOAPAddressRewriteMetadata)6 DefaultDeploymentModelFactory (org.jboss.ws.common.deployment.DefaultDeploymentModelFactory)4 Bus (org.apache.cxf.Bus)3 BusLifeCycleManager (org.apache.cxf.buslifecycle.BusLifeCycleManager)3 DeploymentUnit (org.jboss.as.server.deployment.DeploymentUnit)3 Endpoint (org.jboss.wsf.spi.deployment.Endpoint)3 HashMap (java.util.HashMap)2 ServiceName (org.jboss.msc.service.ServiceName)2 IOException (java.io.IOException)1 Writer (java.io.Writer)1 ArrayList (java.util.ArrayList)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ServletConfig (javax.servlet.ServletConfig)1 ServletException (javax.servlet.ServletException)1 ServletRequest (javax.servlet.ServletRequest)1 HttpServletResponseWrapper (javax.servlet.http.HttpServletResponseWrapper)1 QName (javax.xml.namespace.QName)1 SoapMessage (org.apache.cxf.binding.soap.SoapMessage)1 Header (org.apache.cxf.headers.Header)1