Search in sources :

Example 1 with ServerLifeCycleManager

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);
        }
    }
}
Also used : ServerLifeCycleManager(org.apache.cxf.endpoint.ServerLifeCycleManager) ServerLifeCycleListener(org.apache.cxf.endpoint.ServerLifeCycleListener) ServiceReference(org.osgi.framework.ServiceReference)

Example 2 with ServerLifeCycleManager

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);
            }
        });
    }
}
Also used : ClientLifeCycleListener(org.apache.cxf.endpoint.ClientLifeCycleListener) Server(org.apache.cxf.endpoint.Server) ServerLifeCycleManager(org.apache.cxf.endpoint.ServerLifeCycleManager) ClientLifeCycleManager(org.apache.cxf.endpoint.ClientLifeCycleManager) ServerLifeCycleListener(org.apache.cxf.endpoint.ServerLifeCycleListener) Client(org.apache.cxf.endpoint.Client) PostConstruct(javax.annotation.PostConstruct)

Example 3 with ServerLifeCycleManager

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();
        }
    }
}
Also used : ServerLifeCycleManager(org.apache.cxf.endpoint.ServerLifeCycleManager) ServerLifeCycleListener(org.apache.cxf.endpoint.ServerLifeCycleListener) ServiceReference(org.osgi.framework.ServiceReference)

Aggregations

ServerLifeCycleListener (org.apache.cxf.endpoint.ServerLifeCycleListener)3 ServerLifeCycleManager (org.apache.cxf.endpoint.ServerLifeCycleManager)3 ServiceReference (org.osgi.framework.ServiceReference)2 PostConstruct (javax.annotation.PostConstruct)1 Client (org.apache.cxf.endpoint.Client)1 ClientLifeCycleListener (org.apache.cxf.endpoint.ClientLifeCycleListener)1 ClientLifeCycleManager (org.apache.cxf.endpoint.ClientLifeCycleManager)1 Server (org.apache.cxf.endpoint.Server)1