use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class MDBActivationWork method createServer.
private Server createServer(Bus bus, Class<?> serviceClass, MDBInvoker invoker) {
// create server bean factory
final ServerFactoryBean factory;
if (serviceClass != null && EndpointUtils.hasWebServiceAnnotation(serviceClass)) {
factory = new JaxWsServerFactoryBean();
} else {
factory = new ServerFactoryBean();
}
if (LOG.isLoggable(Level.FINE)) {
LOG.fine("Creating a server using " + factory.getClass().getName());
}
if (serviceClass != null) {
factory.setServiceClass(serviceClass);
}
if (spec.getWsdlLocation() != null) {
factory.setWsdlLocation(spec.getWsdlLocation());
}
if (spec.getAddress() != null) {
factory.setAddress(spec.getAddress());
}
factory.setBus(bus);
if (spec.getEndpointName() != null) {
factory.setEndpointName(QName.valueOf(spec.getEndpointName()));
}
if (spec.getSchemaLocations() != null) {
factory.setSchemaLocations(getListOfString(spec.getSchemaLocations()));
}
if (spec.getServiceName() != null) {
factory.setServiceName(QName.valueOf(spec.getServiceName()));
}
factory.setInvoker(invoker);
// Don't start the server yet
factory.setStart(false);
final Server retval;
if (factory instanceof JaxWsServerFactoryBean) {
retval = createServerFromJaxwsEndpoint((JaxWsServerFactoryBean) factory);
} else {
retval = factory.create();
}
return retval;
}
use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class JCABusFactory method deregisterServants.
private void deregisterServants(Bus aBus) {
synchronized (servantsCache) {
for (Server servant : servantsCache) {
// REVISIT: seems using server.stop() doesn't release resource properly.
servant.destroy();
LOG.info("Shutdown the EJB Endpoint: " + servant.getEndpoint().getEndpointInfo().getName());
}
servantsCache.clear();
}
}
use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class JCABusFactory method initializeServantsFromProperties.
private void initializeServantsFromProperties(Properties ejbServants) throws ResourceException {
deregisterServants(bus);
LOG.info("Initializing EJB endpoints from properties file...");
try {
Enumeration<?> keys = ejbServants.keys();
while (keys.hasMoreElements()) {
String theJNDIName = (String) keys.nextElement();
String value = (String) ejbServants.get(theJNDIName);
EJBServantConfig config = new EJBServantConfig(theJNDIName, value);
EJBEndpoint ejbEndpoint = new EJBEndpoint(config);
ejbEndpoint.setEjbServantBaseURL(mcf.getEJBServantBaseURL());
ejbEndpoint.setWorkManager(getWorkManager());
Server servant = ejbEndpoint.publish();
synchronized (servantsCache) {
if (servant != null) {
servantsCache.add(servant);
}
}
}
} catch (Exception e) {
e.printStackTrace();
throw new ResourceException(new Message("FAIL_TO_START_EJB_SERVANTS", BUNDLE).toString(), e);
}
}
use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class ExceptionTest method testJaxws.
@Test(expected = HelloException.class)
public void testJaxws() throws Exception {
JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
sfbean.setServiceClass(ExceptionService.class);
setupAegis(sfbean);
sfbean.setAddress("local://ExceptionService4");
Server server = sfbean.create();
Service service = server.getEndpoint().getService();
service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));
JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
proxyFac.setAddress("local://ExceptionService4");
proxyFac.setBus(getBus());
setupAegis(proxyFac.getClientFactoryBean());
ExceptionService clientInterface = proxyFac.create(ExceptionService.class);
clientInterface.sayHiWithException();
}
use of org.apache.cxf.endpoint.Server in project cxf by apache.
the class ExceptionTest method testJaxwsServerSimpleClient.
@Test(expected = HelloException.class)
public void testJaxwsServerSimpleClient() throws Exception {
JaxWsServerFactoryBean sfbean = new JaxWsServerFactoryBean();
sfbean.setServiceClass(ExceptionService.class);
sfbean.setDataBinding(new AegisDatabinding());
sfbean.setAddress("local://ExceptionServiceJaxWs1");
Server server = sfbean.create();
Service service = server.getEndpoint().getService();
service.setInvoker(new BeanInvoker(new ExceptionServiceImpl()));
ClientProxyFactoryBean proxyFac = new ClientProxyFactoryBean();
proxyFac.setAddress("local://ExceptionServiceJaxWs1");
proxyFac.setBus(getBus());
setupAegis(proxyFac.getClientFactoryBean());
ExceptionService clientInterface = proxyFac.create(ExceptionService.class);
clientInterface.sayHiWithException();
}
Aggregations