use of org.jboss.wsf.stack.cxf.deployment.EndpointImpl in project jbossws-cxf by jbossws.
the class BusHolder method close.
public void close() {
// Move this stuff to the bus (our own impl)?
RMManager rmManager = bus.getExtension(RMManager.class);
if (rmManager != null) {
rmManager.shutdown();
}
for (EndpointImpl endpoint : endpoints) {
if (endpoint.isPublished()) {
endpoint.stop();
}
}
endpoints.clear();
// call bus shutdown unless the listener tells us shutdown has already been asked
if (busHolderListener == null || !busHolderListener.isPreShutdown()) {
bus.shutdown(true);
}
busHolderListener = null;
bus.getExtension(FactoryBeanListenerManager.class).removeListener(policySetsListener);
policySetsListener = null;
}
use of org.jboss.wsf.stack.cxf.deployment.EndpointImpl in project jbossws-cxf by jbossws.
the class ServerBeanCustomizer method customize.
@Override
public void customize(Object beanInstance) {
if (beanInstance instanceof EndpointImpl) {
configureEndpoint((EndpointImpl) beanInstance);
}
if (beanInstance instanceof ServerFactoryBean) {
ServerFactoryBean factory = (ServerFactoryBean) beanInstance;
if (factory.getInvoker() instanceof JBossWSInvoker) {
((JBossWSInvoker) factory.getInvoker()).setTargetBean(factory.getServiceBean());
}
List<Endpoint> depEndpoints = dep.getService().getEndpoints();
if (depEndpoints != null) {
final String targetBeanName = factory.getServiceBean().getClass().getName();
for (Endpoint depEndpoint : depEndpoints) {
if (depEndpoint.getTargetBeanClass().getName().equals(targetBeanName)) {
depEndpoint.addAttachment(Object.class, factory.getServiceBean());
}
}
}
}
if (beanInstance instanceof ServiceImpl) {
ServiceImpl service = (ServiceImpl) beanInstance;
List<Endpoint> depEndpoints = dep.getService().getEndpoints();
if (depEndpoints != null) {
final Collection<org.apache.cxf.endpoint.Endpoint> eps = service.getEndpoints().values();
for (Endpoint depEp : depEndpoints) {
for (org.apache.cxf.endpoint.Endpoint ep : eps) {
if (ep.getService().getName().equals(depEp.getProperty(Message.WSDL_SERVICE)) && ep.getEndpointInfo().getName().equals(depEp.getProperty(Message.WSDL_PORT)) && ep.getEndpointInfo().getAddress().equals(depEp.getAddress())) {
depEp.addAttachment(org.apache.cxf.endpoint.Endpoint.class, ep);
}
}
}
}
}
if (beanInstance instanceof HTTPTransportFactory) {
HTTPTransportFactory factory = (HTTPTransportFactory) beanInstance;
DestinationRegistry oldRegistry = factory.getRegistry();
if (!(oldRegistry instanceof JBossWSDestinationRegistryImpl)) {
factory.setRegistry(new JBossWSDestinationRegistryImpl());
}
}
super.customize(beanInstance);
}
use of org.jboss.wsf.stack.cxf.deployment.EndpointImpl in project jbossws-cxf by jbossws.
the class BusHolder method configure.
/**
* Update the Bus held by the this instance using the provided parameters.
* This basically prepares the bus for being used with JBossWS.
*
* @param resolver The ResourceResolver to configure, if any
* @param configurer The JBossWSCXFConfigurer to install in the bus, if any
* @param wsmd The current JBossWebservicesMetaData, if any
* @param dep The current deployment
*/
public void configure(ResourceResolver resolver, Configurer configurer, JBossWebservicesMetaData wsmd, Deployment dep) {
if (configured) {
throw Messages.MESSAGES.busAlreadyConfigured(bus);
}
bus.setProperty(org.jboss.wsf.stack.cxf.client.Constants.DEPLOYMENT_BUS, true);
busHolderListener = new BusHolderLifeCycleListener();
bus.getExtension(BusLifeCycleManager.class).registerLifeCycleListener(busHolderListener);
setWSDLManagerStreamWrapper(bus);
if (configurer != null) {
bus.setExtension(configurer, Configurer.class);
}
Map<String, String> props = getProperties(wsmd);
setInterceptors(bus, dep, props);
dep.addAttachment(Bus.class, bus);
try {
final JASPIAuthenticationProvider jaspiProvider = SPIProvider.getInstance().getSPI(JASPIAuthenticationProvider.class, ClassLoaderProvider.getDefaultProvider().getServerIntegrationClassLoader());
if (jaspiProvider != null && jaspiProvider.enableServerAuthentication(dep, wsmd)) {
bus.getInInterceptors().add(new AuthenticationMgrSubjectCreatingInterceptor());
}
} catch (WSFException e) {
Loggers.DEPLOYMENT_LOGGER.cannotFindJaspiClasses();
}
setResourceResolver(bus, resolver);
if (bus.getExtension(PolicyEngine.class) != null) {
bus.getExtension(PolicyEngine.class).setAlternativeSelector(getAlternativeSelector(props));
}
// *first* enabled cxf management if required, *then* add anything else which could be manageable (e.g. work queues)
setCXFManagement(bus, props);
setAdditionalWorkQueues(bus, props);
setWSDiscovery(bus, props);
AnnotationsInfo ai = dep.getAttachment(AnnotationsInfo.class);
if (ai == null || ai.hasAnnotatedClasses(PolicySets.class.getName())) {
policySetsListener = new PolicySetsAnnotationListener(dep.getClassLoader());
bus.getExtension(FactoryBeanListenerManager.class).addListener(policySetsListener);
}
// default to USE_ORIGINAL_THREAD = true; this can be overridden by simply setting the property in the endpoint or in the message using an interceptor
// this forces one way operation to use original thread, which is required for ejb webserivce endpoints to avoid authorization failures from ejb container
// and is a performance improvement in general when running in-container, as CXF needs to cache the message to free the thread, which is expensive
// (moreover the user can tune the web container thread pool instead of expecting cxf to fork new threads)
bus.setProperty(OneWayProcessorInterceptor.USE_ORIGINAL_THREAD, true);
// [JBWS-3135] enable decoupled faultTo. This is an optional feature in cxf and we need this to be default to make it same behavior with native stack
bus.setProperty("org.apache.cxf.ws.addressing.decoupled_fault_support", true);
FeatureUtils.addFeatures(bus, bus, props);
for (DDEndpoint dde : metadata.getEndpoints()) {
EndpointImpl endpoint = new EndpointImpl(bus, newInstance(dde.getImplementor()));
if (dde.getInvoker() != null)
endpoint.setInvoker(newInvokerInstance(dde.getInvoker(), dep));
endpoint.setAddress(dde.getAddress());
endpoint.setEndpointName(dde.getPortName());
endpoint.setServiceName(dde.getServiceName());
endpoint.setWsdlLocation(dde.getWsdlLocation());
setHandlers(endpoint, dde);
if (dde.getProperties() != null) {
Map<String, Object> p = new HashMap<String, Object>();
p.putAll(dde.getProperties());
endpoint.setProperties(p);
}
if (dde.isAddressingEnabled()) {
WSAddressingFeature addressingFeature = new WSAddressingFeature();
addressingFeature.setAddressingRequired(dde.isAddressingRequired());
addressingFeature.setResponses(dde.getAddressingResponses());
endpoint.getFeatures().add(addressingFeature);
}
endpoint.setPublishedEndpointUrl(dde.getPublishedEndpointUrl());
endpoint.setSOAPAddressRewriteMetadata(dep.getAttachment(SOAPAddressRewriteMetadata.class));
endpoint.publish();
endpoints.add(endpoint);
if (dde.isMtomEnabled()) {
SOAPBinding binding = (SOAPBinding) endpoint.getBinding();
binding.setMTOMEnabled(true);
}
}
configured = true;
}
Aggregations