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();
}
}
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;
}
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();
}
}
}
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);
}
}
}
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;
}
Aggregations