Package org.osgi.util.tracker

Examples of org.osgi.util.tracker.ServiceTracker


     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
     */
    public final void start(BundleContext context) throws Exception
    {
        this.context = context;
        this.tracker = new ServiceTracker(context, WebConsolePlugin.SCR_SERVICE, this);
        this.tracker.open();
    }
View Full Code Here


public class Activator implements BundleActivator
{

    public void start( final BundleContext ctx ) throws Exception
    {
        ServiceTracker tracker = new ServiceTracker( ctx, JUnitService.class.getName(), null );
        tracker.open();

        Hashtable<String, Object> props = new Hashtable<String, Object>();
        props.put( CommandProcessor.COMMAND_SCOPE, "sigil" );
        props.put( CommandProcessor.COMMAND_FUNCTION, new String[]
            { "runTests", "listTests" } );
View Full Code Here

    protected AbstractBundleRepositoryRenderHelper( final AbstractWebConsolePlugin logger,
        final BundleContext bundleContext, final String serviceName )
    {
        this.logger = logger;
        this.repositoryAdmin = new ServiceTracker( bundleContext, serviceName, null );
        this.repositoryAdmin.open();
    }
View Full Code Here

        this.context = context;
        Filter filter = context.createFilter("(|" //$NON-NLS-1$
            + '(' + OBJECTCLASS + "=org.osgi.service.obr.RepositoryAdmin)" //$NON-NLS-1$
            + '(' + OBJECTCLASS + "=org.apache.felix.bundlerepository.RepositoryAdmin)" //$NON-NLS-1$
            + ')');
        this.tracker = new ServiceTracker(context, filter, this);
        this.tracker.open();
    }
View Full Code Here

        roleQuery = PropertiesUtil.toString(conf.get(PROP_ROLE_QUERY), DEFAULT_ROLE_QUERY);
        datasourceName = PropertiesUtil.toString(conf.get(PROP_DS_NAME), DEFAULT_DS_NAME);

        Filter filter = context.createFilter("(&(objectClass=javax.sql.DataSource)"
            + "(dataSourceName=" + datasourceName + "))");
        dataSourceTracker = new ServiceTracker(context, filter, null);
        dataSourceTracker.open();
        registerLoginModuleFactory(context, conf);
    }
View Full Code Here

    @Override
    protected void setUp()
    {
        for (Class<?> c : getReferences())
        {
            ServiceTracker t = createBindTracker(c);
            t.open();
            trackers.add(t);
        }
    }
View Full Code Here

        trackers.clear();
    }

    private ServiceTracker createBindTracker(final Class<?> c)
    {
        return new ServiceTracker(ctx, c.getName(), new ServiceTrackerCustomizer()
        {
            public Object addingService(ServiceReference reference)
            {
                Object o = ctx.getService(reference);
                Method m = getBindMethod(c);
View Full Code Here

    private final ServiceTracker tracker;

    public LogServiceLogger(BundleContext context)
    {
        this.consoleLogger = new ConsoleLogger();
        this.tracker = new ServiceTracker(context, LogService.class.getName(), null);
        this.tracker.open();
    }
View Full Code Here

        Properties props = new Properties();
        props.put(Constants.SERVICE_PID, PID);
        this.configServiceReg = this.context.registerService(ManagedService.class.getName(), new JettyManagedService(this), props);

        this.eventAdmintTracker = new ServiceTracker(this.context, EventAdmin.class.getName(), this);
        this.eventAdmintTracker.open();

        this.bundleTracker = new BundleTracker(this.context, Bundle.ACTIVE | Bundle.STARTING, this);
        this.bundleTracker.open();
    }
View Full Code Here

     * @param serviceName the service name to obtain
     * @return the service or <code>null</code> if missing.
     */
    public final Object getService( String serviceName )
    {
        ServiceTracker serviceTracker = ( ServiceTracker ) services.get( serviceName );
        if ( serviceTracker == null )
        {
            serviceTracker = new ServiceTracker( getBundleContext(), serviceName, null );
            serviceTracker.open();

            services.put( serviceName, serviceTracker );
        }

        return serviceTracker.getService();
    }
View Full Code Here

TOP

Related Classes of org.osgi.util.tracker.ServiceTracker

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.