use of org.apache.cxf.configuration.Configurer in project teiid by teiid.
the class WSManagedConnectionFactory method createConnectionFactory.
@SuppressWarnings("serial")
@Override
public BasicConnectionFactory<WSConnectionImpl> createConnectionFactory() throws ResourceException {
if (this.endPointName == null) {
this.endPointName = WSManagedConnectionFactory.DEFAULT_LOCAL_NAME;
}
if (this.serviceName == null) {
this.serviceName = WSManagedConnectionFactory.DEFAULT_LOCAL_NAME;
}
if (this.namespaceUri == null) {
this.namespaceUri = WSManagedConnectionFactory.DEFAULT_NAMESPACE_URI;
}
this.portQName = new QName(this.namespaceUri, this.endPointName);
this.serviceQName = new QName(this.namespaceUri, this.serviceName);
if (this.wsdl != null) {
try {
this.wsdlUrl = new URL(this.wsdl);
} catch (MalformedURLException e) {
File f = new File(this.wsdl);
try {
this.wsdlUrl = f.toURI().toURL();
} catch (MalformedURLException e1) {
throw new InvalidPropertyException(e1);
}
}
}
if (this.configFile != null) {
this.bus = new SpringBusFactory().createBus(this.configFile);
JaxWsClientFactoryBean instance = new JaxWsClientFactoryBean();
if (this.wsdl == null) {
Configurer configurer = this.bus.getExtension(Configurer.class);
if (null != configurer) {
// $NON-NLS-1$
configurer.configureBean(this.portQName.toString() + ".jaxws-client.proxyFactory", instance);
}
this.outInterceptors = instance.getOutInterceptors();
}
}
return new BasicConnectionFactory<WSConnectionImpl>() {
@Override
public WSConnectionImpl getConnection() throws ResourceException {
return new WSConnectionImpl(WSManagedConnectionFactory.this);
}
};
}
use of org.apache.cxf.configuration.Configurer in project cxf by apache.
the class ServiceImplTest method testConfigureBean.
@Test
public // CXF-2723 :Allow configuration of JaxWsClientFactoryBean during port creation
void testConfigureBean() throws Exception {
Configurer oldConfiguer = this.getBus().getExtension(Configurer.class);
JAXWSClientFactoryCongfiguer clientConfiguer = new JAXWSClientFactoryCongfiguer();
getBus().setExtension(clientConfiguer, Configurer.class);
URL wsdl1 = getClass().getResource("/wsdl/calculator.wsdl");
ServiceImpl service = new ServiceImpl(getBus(), wsdl1, SERVICE_1, ServiceImpl.class);
service.createPort(PORT_1, null, CalculatorPortType.class);
assertTrue("The JAXWSClientFcatoryBean is not configured by the new configurer", isJAXWSClientFactoryConfigured);
assertTrue("The ClientProxyFcatoryBean is not configured by the new configurer", isClientProxyFactoryBeanConfigured);
getBus().setExtension(oldConfiguer, Configurer.class);
}
use of org.apache.cxf.configuration.Configurer in project cxf by apache.
the class WSAFeatureXmlTest method testServerFactory.
@Test
public void testServerFactory() {
JaxWsServerFactoryBean sf = new JaxWsServerFactoryBean();
assertNotNull(bus != null);
sf.setServiceBean(new GreeterImpl());
sf.setAddress("http://localhost:" + PORT + "/test");
sf.setStart(false);
Configurer c = getBus().getExtension(Configurer.class);
c.configureBean("server", sf);
Server server = sf.create();
Endpoint endpoint = server.getEndpoint();
checkAddressInterceptors(endpoint.getInInterceptors());
}
use of org.apache.cxf.configuration.Configurer in project jbossws-cxf by jbossws.
the class Helper method setBindingCustomizationOnClientSide.
/**
* Setup binding customization on client side using the JBossWSConfigurer
*
* @throws Exception
*/
@SuppressWarnings("unchecked")
private Bus setBindingCustomizationOnClientSide() throws Exception {
BindingCustomization jaxbCustomizations = new JAXBBindingCustomization();
if (jaxbIntroUrl == null) {
jaxbIntroUrl = Thread.currentThread().getContextClassLoader().getResource("jaxb-intros.xml");
}
BindingCustomizationFactory.populateBindingCustomization(jaxbIntroUrl.openStream(), jaxbCustomizations);
Bus bus = BusFactory.newInstance().createBus();
BusFactory.setThreadDefaultBus(bus);
JBossWSConfigurer configurer = (JBossWSConfigurer) bus.getExtension(Configurer.class);
configurer.getCustomizer().setBindingCustomization(jaxbCustomizations);
return bus;
}
use of org.apache.cxf.configuration.Configurer in project jbossws-cxf by jbossws.
the class BusDeploymentAspect method startDeploymentBus.
private void startDeploymentBus(final Deployment dep) {
BusFactory.setThreadDefaultBus(null);
ClassLoader origClassLoader = SecurityActions.getContextClassLoader();
try {
final ArchiveDeployment aDep = (ArchiveDeployment) dep;
final ResourceResolver deploymentResolver = aDep.getResourceResolver();
final org.apache.cxf.resource.ResourceResolver resolver = new JBossWSResourceResolver(deploymentResolver);
// set the runtime classloader (pointing to the deployment unit) to allow CXF accessing to the classes;
// use origClassLoader (which on AS7 is set to ASIL aggregation module's classloader by TCCLDeploymentProcessor) as
// parent to make sure user provided libs in the deployment do no mess up the WS endpoint's deploy if they duplicates
// libraries already available on the application server modules.
SecurityActions.setContextClassLoader(new DelegateClassLoader(dep.getClassLoader(), origClassLoader));
DDBeans metadata = dep.getAttachment(DDBeans.class);
BusHolder holder = new BusHolder(metadata);
Configurer configurer = holder.createServerConfigurer(dep.getAttachment(BindingCustomization.class), new WSDLFilePublisher(aDep), aDep);
holder.configure(resolver, configurer, dep.getAttachment(JBossWebservicesMetaData.class), dep);
dep.addAttachment(BusHolder.class, holder);
} finally {
BusFactory.setThreadDefaultBus(null);
SecurityActions.setContextClassLoader(origClassLoader);
}
}
Aggregations