use of org.apache.cxf.endpoint.ServerLifeCycleManager in project cxf by apache.
the class OSGIBusListener method registerServerLifecycleListeners.
private void registerServerLifecycleListeners() {
ServiceReference<?>[] refs = getServiceReferences(defaultContext, ServerLifeCycleListener.class);
ServerLifeCycleManager clcm = bus.getExtension(ServerLifeCycleManager.class);
for (ServiceReference<?> ref : refs) {
if (!isPrivate(ref) && !isExcluded(ref)) {
ServerLifeCycleListener listener = (ServerLifeCycleListener) defaultContext.getService(ref);
clcm.registerListener(listener);
}
}
}
use of org.apache.cxf.endpoint.ServerLifeCycleManager in project cxf by apache.
the class RMManager method registerListeners.
@PostConstruct
void registerListeners() {
if (null == bus) {
return;
}
ServerLifeCycleManager slm = bus.getExtension(ServerLifeCycleManager.class);
if (null != slm) {
slm.registerListener(new ServerLifeCycleListener() {
public void startServer(Server server) {
RMManager.this.startServer(server);
}
public void stopServer(Server server) {
RMManager.this.stopServer(server);
}
});
}
ClientLifeCycleManager clm = bus.getExtension(ClientLifeCycleManager.class);
if (null != clm) {
clm.registerListener(new ClientLifeCycleListener() {
public void clientCreated(Client client) {
RMManager.this.clientCreated(client);
}
public void clientDestroyed(Client client) {
RMManager.this.clientDestroyed(client);
}
});
}
}
use of org.apache.cxf.endpoint.ServerLifeCycleManager in project cxf by apache.
the class OSGiBusListenerTest method setUpServerLifeCycleListeners.
private void setUpServerLifeCycleListeners(String[] names, String[] restricted, String excludes) throws Exception {
ServiceReference<Object>[] svcrefs = createTestServiceReferences(names, restricted);
EasyMock.expect(bundleContext.getServiceReferences(ServerLifeCycleListener.class.getName(), null)).andReturn(svcrefs);
ServerLifeCycleManager lcmanager = control.createMock(ServerLifeCycleManager.class);
EasyMock.expect(bus.getExtension(ServerLifeCycleManager.class)).andReturn(lcmanager).anyTimes();
for (int i = 0; i < names.length; i++) {
ServerLifeCycleListener cl = control.createMock(ServerLifeCycleListener.class);
EasyMock.expect(bundleContext.getService(svcrefs[i])).andReturn(cl).anyTimes();
if (!isExcluded(BUNDLE_NAME, names[i], restricted[i], excludes)) {
lcmanager.registerListener(cl);
EasyMock.expectLastCall();
}
}
}
Aggregations