Package org.osgi.framework

Examples of org.osgi.framework.BundleEvent


            public String getLocation() {
                return bundleLocation;
            }
        });

        BundleEvent bundleEvent = new BundleEvent(BundleEvent.INSTALLED, testBundleA);
        FrameworkEvent frameworkEvent = new FrameworkEvent(FrameworkEvent.INFO, testBundleA, new IllegalStateException());

        listeners.bundleChanged(bundleEvent);
        listeners.frameworkEvent(frameworkEvent);
        listeners.stopInternal();
View Full Code Here


     * @param type The type of bundle event to fire.
     * @param bundle The bundle associated with the event.
    **/
    void fireBundleEvent(int type, Bundle bundle)
    {
        m_dispatcher.fireBundleEvent(new BundleEvent(type, bundle), this);
    }
View Full Code Here

        m_dispatcher.fireBundleEvent(new BundleEvent(type, bundle), this);
    }

    void fireBundleEvent(int type, Bundle bundle, Bundle origin)
    {
        m_dispatcher.fireBundleEvent(new BundleEvent(type, bundle, origin), this);
    }
View Full Code Here

        this.storage = s;
        // Track bundles
        bundleContext.addBundleListener(this);
        for (Bundle bundle : bundleContext.getBundles()) {
            if (bundle.getState() == Bundle.ACTIVE) {
                bundleChanged(new BundleEvent(BundleEvent.STARTED, bundle));
            }
        }
        // Track deployed components
        deployedComponentsTracker = new ServiceTracker(bundleContext, javax.jbi.component.Component.class.getName(), null) {
            public Object addingService(ServiceReference serviceReference) {
View Full Code Here

        deployedAssembliesTracker.open();
    }

    public synchronized void destroy() throws Exception {
        for (Bundle bundle : bundles) {
            bundleChanged(new BundleEvent(BundleEvent.STOPPING, bundle));
        }
        deployedComponentsTracker.close();
        deployedAssembliesTracker.close();
        bundleContext.removeBundleListener(this);
    }
View Full Code Here

    public void init() throws Exception {
        bundleContext.addBundleListener(this);
        for (Bundle bundle : bundleContext.getBundles()) {
            if (bundle.getState() == Bundle.RESOLVED || bundle.getState() == Bundle.STARTING
                    || bundle.getState() == Bundle.ACTIVE)
            bundleChanged(new BundleEvent(BundleEvent.RESOLVED, bundle));
        }
    }
View Full Code Here

      expectLastCall().times(1);
      providerListener.added(anyObject(JcloudsTestYetAnotherComputeProviderMetadata.class));
      expectLastCall().times(1);
      replay(bundle, providerListener);

      BundleEvent event = new BundleEvent(BundleEvent.STARTED, bundle);
      listener.bundleChanged(event);
      verify(bundle, providerListener);
   }
View Full Code Here

      expectLastCall().times(1);
      apiListener.added(anyObject(JcloudsTestComputeApiMetadata.class));
      expectLastCall().times(1);
      replay(bundle, apiListener);

      BundleEvent event = new BundleEvent(BundleEvent.STARTED, bundle);
      listener.bundleChanged(event);
      verify(bundle, apiListener);
   }
View Full Code Here

    @Test
    public void testStopFramework() throws Exception {
        sut.registerContext("name", client, new HashMap<String, Object>());
        sut.registerContext("otherName", otherClient, new HashMap<String, Object>());

        sut.bundleChanged(new BundleEvent(BundleEvent.STOPPING, framework));
       
        assertTrue(getManagers().isEmpty());
        assertTrue(getContexts().isEmpty());
    }
View Full Code Here

    @Test
    public void testIndividual() throws Exception {
        sut.registerContext("name", client, new HashMap<String, Object>());
        sut.registerContext("otherName", otherClient, new HashMap<String, Object>());
       
        sut.bundleChanged(new BundleEvent(BundleEvent.STOPPING, client));
        assertEquals(1, getManagers().size());
        assertNull(getContexts().get(client));
        assertNotNull(getContexts().get(otherClient));
       
        sut.bundleChanged(new BundleEvent(BundleEvent.STOPPING, otherClient));
        assertEquals(1, getManagers().size());
        assertNull(getContexts().get(client));
        assertNull(getContexts().get(otherClient));
       
        sut.bundleChanged(new BundleEvent(BundleEvent.STOPPING, framework));
        assertTrue(getManagers().isEmpty());
    }
View Full Code Here

TOP

Related Classes of org.osgi.framework.BundleEvent

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.