Package org.osgi.util.tracker

Examples of org.osgi.util.tracker.ServiceTracker


     */
    public void deactivate()
    {
        for ( Iterator ti = services.values().iterator(); ti.hasNext(); )
        {
            ServiceTracker tracker = ( ServiceTracker ) ti.next();
            tracker.close();
            ti.remove();
        }
        super.deactivate();
    }
View Full Code Here


        {
            synchronized ( Activator.class )
            {
                if ( m_packageAdmin == null )
                {
                    m_packageAdmin = new ServiceTracker( m_context, PACKAGEADMIN_CLASS, null );
                    m_packageAdmin.open();
                }
            }
        }
View Full Code Here

        props.put("osgi.command.scope", "felix");
        props.put("osgi.command.function", new String[] { "cd", "ls" });
        bc.registerService(
            Files.class.getName(), new Files(bc), props);

        m_tracker = new ServiceTracker(
            bc, "org.apache.felix.bundlerepository.RepositoryAdmin", null);
        m_tracker.open();
        props.put("osgi.command.scope", "obr");
        props.put("osgi.command.function", new String[] {
            "deploy", "info", "javadoc", "list", "repos", "source" });
View Full Code Here

public class Test extends AbstractIntegrationTest {

    private static final String PLATFORM_TRANSACTION_MANAGER_CLASS = "org.springframework.transaction.PlatformTransactionManager";

    public void test() throws Exception {
        ServiceTracker tracker = new ServiceTracker(bundleContext, TransactionManager.class.getName(), null);
        tracker.open();

        tracker.waitForService(5000L);
        ServiceReference ref = tracker.getServiceReference();
        assertNotNull(ref);
        String[] objClass = (String[]) ref.getProperty(Constants.OBJECTCLASS);
        assertNotNull(objClass);
        boolean found = false;
        for (String clazz : objClass) {
            found |= PLATFORM_TRANSACTION_MANAGER_CLASS.equals(clazz);
        }
        assertFalse(found);

        Bundle bundle = ref.getBundle();
        bundle.stop();
        installBundle("org.springframework", "spring-tx", null, "jar");
        getOsgiService(PackageAdmin.class).refreshPackages(new Bundle[] { bundle });
        System.err.println("Bundle refreshed");
        Thread.sleep(500);
        System.err.println("Starting bundle");
        bundle.start();

        tracker.waitForService(5000L);
        ref = tracker.getServiceReference();
        assertNotNull(ref);
        objClass = (String[]) ref.getProperty(Constants.OBJECTCLASS);
        assertNotNull(objClass);
        found = false;
        for (String clazz : objClass) {
            found |= PLATFORM_TRANSACTION_MANAGER_CLASS.equals(clazz);
        }
        assertTrue(found);

        tracker.close();
    }
View Full Code Here

        try
        {
            Field field = configMgr.getClass().getDeclaredField( "logTracker" );
            field.setAccessible( true );
            field.set( configMgr, new ServiceTracker( new MockBundleContext(), "", null )
            {
                public Object getService()
                {
                    return logService;
                }
View Full Code Here

     * @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, ShellService.class.getName(), this);
        this.tracker.open();
    }
View Full Code Here

     * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext)
     */
    public void start(final BundleContext context) throws Exception
    {
        this.context = context;
        this.pkgAdminTracker = new ServiceTracker(context,
            "org.osgi.service.packageadmin.PackageAdmin", this); //$NON-NLS-1$
        this.pkgAdminTracker.open();

        // register configuration printer
        final Dictionary/*<String, Object>*/props = new Hashtable/*<String, Object>*/();
 
View Full Code Here


    @Before
    public void setUp()
    {
        configAdminTracker = new ServiceTracker( bundleContext, ConfigurationAdmin.class.getName(), null );
        configAdminTracker.open();
    }
View Full Code Here

     * @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, UserAdmin.class.getName(), this);
        this.tracker.open();
    }
View Full Code Here

     * @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, DeploymentAdmin.class.getName(), this);
        this.tracker.open();
    }
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.