All Downloads are FREE. Search and download functionalities are using the official Maven repository.

de.objektkontor.wsc.bundle.Activator Maven / Gradle / Ivy

package de.objektkontor.wsc.bundle;

import org.osgi.framework.BundleContext;
import org.osgi.util.tracker.ServiceTracker;

import de.objektkontor.wsc.container.Dispatcher;
import de.objektkontor.wsc.container.Endpoint;
import de.objektkontor.wsc.container.Processor;
import de.objektkontor.wsc.container.core.AbstractActivator;
import de.objektkontor.wsc.container.core.Container;

public class Activator extends AbstractActivator {

    private Container container;

    private ServiceTracker endpointTracker;
    private ServiceTracker, Processor> processorTracker;
    private ServiceTracker, Dispatcher> dispatcherTracker;

    @Override
    public void start(final BundleContext context) throws Exception {
        super.start(context);
        container = new Container();
        endpointTracker = new ServiceTracker(context, Endpoint.class.getName(), new EndpointTracker(container, context));
        processorTracker = new ServiceTracker, Processor>(context, Processor.class.getName(), new ProcessorTracker(container, context));
        dispatcherTracker = new ServiceTracker, Dispatcher>(context, Dispatcher.class.getName(), new DispatcherTracker(container, context));
        processorTracker.open();
        dispatcherTracker.open();
        endpointTracker.open();
    }

    @Override
    public void stop(BundleContext context) throws Exception {
        super.stop(context);
        endpointTracker.close();
        processorTracker.close();
        dispatcherTracker.close();
        container.destroy();
        container = null;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy