Package org.osgi.framework

Examples of org.osgi.framework.BundleListener


            Thread.sleep(DEFAULT_TIMEOUT);

            final Set<String> installedSymbolicNames = new LinkedHashSet<String>();

            //Add a Bundle Listener
            bundleContext.addBundleListener(new BundleListener(){
                @Override
                public void bundleChanged(BundleEvent event) {
                  if (event.getType() == BundleEvent.INSTALLED) {
                      installedSymbolicNames.add(event.getBundle().getSymbolicName());
                  }
View Full Code Here


            Thread.sleep(DEFAULT_TIMEOUT);

            final Set<String> installedSymbolicNames = new LinkedHashSet<String>();

            //Add a Bundle Listener
            bundleContext.addBundleListener(new BundleListener(){
                @Override
                public void bundleChanged(BundleEvent event) {
                  if (event.getType() == BundleEvent.INSTALLED) {
                      installedSymbolicNames.add(event.getBundle().getSymbolicName());
                  }
View Full Code Here

        bundleContext.removeServiceListener(serviceListener);
    }

    @Test
    public void testBundleListener() throws Exception {
        BundleListener bundleListener = mock(BundleListener.class);
        BundleEvent bundleEvent = mock(BundleEvent.class);

        bundleContext.addBundleListener(bundleListener);

        MockOsgi.sendBundleEvent(bundleContext, bundleEvent);
View Full Code Here

            unregisterBundleMBeans();
            registerBundleMBeans();
          }
        }
      };
      bl = new BundleListener() {
        public void bundleChanged(BundleEvent event) {
          switch (event.getType()){
          case BundleEvent.INSTALLED:
            registerBundleMBean(event.getBundle());
            break;
View Full Code Here

            // Verify that the bundle got started automatically
            final Bundle targetBundle = bundles[0];
            if (targetBundle.getState() != Bundle.ACTIVE) {
                final CountDownLatch startedLatch = new CountDownLatch(1);
                systemContext.addBundleListener(new BundleListener() {
                    public void bundleChanged(BundleEvent event) {
                        Bundle auxBundle = event.getBundle();
                        if (targetBundle.equals(auxBundle) && BundleEvent.STARTED == event.getType()) {
                            startedLatch.countDown();
                        }
View Full Code Here

        // Stop the bundle
        bundle.stop();
        assertEquals(Bundle.RESOLVED, bundle.getState());

        final CountDownLatch uninstallLatch = new CountDownLatch(1);
        context.addBundleListener(new BundleListener() {
            public void bundleChanged(BundleEvent event) {
                if (event.getType() == BundleEvent.UNINSTALLED)
                    uninstallLatch.countDown();
            }
        });
View Full Code Here

        // can be created while in the process of creating
        // a triggering action delegate (if UI events are processed during startup). 
        // Also, if the start throws an exception, the bundle will be shut down. 
        // We don't want to have created any delegates if this happens.
        // See bug 63324 for more details.
        bundleListener = new BundleListener() {
            public void bundleChanged(BundleEvent event) {
                if (event.getBundle() == getBundle()) {
                    if (event.getType() == BundleEvent.STARTED) {
                        // We're getting notified that the bundle has been started.
                        // Make sure it's still active.  It may have been shut down between
View Full Code Here

        }

        if (pendingBundles.isEmpty()) {
            startDeploy(bundleContext);
        } else {
            BundleListener bundleListener = new BundleListener() {
                public void bundleChanged(BundleEvent bundleEvent) {
                    synchronized (pendingBundles) {
                        if (bundleEvent.getType() == BundleEvent.STARTED) {

                            pendingBundles.remove(bundleEvent.getBundle());
View Full Code Here

        for (final Bundle bundle : context.getBundles()) {
            registerHelpers(bundle);
        }

        // Listen to installed bundles
        context.addBundleListener(new BundleListener() {
            public void bundleChanged(BundleEvent event) {
                switch (event.getType()) {
                case BundleEvent.INSTALLED:
                    registerHelpers(event.getBundle());
                    break;
View Full Code Here

  private BundleListener bundleListener;
  private ServletConfig config;

  public Struts2ViewTypeServlet() {
    super();
    bundleListener = new BundleListener() {
      public void bundleChanged(BundleEvent event) {
        Bundle bundle = event.getBundle();
        String pluginName = bundle.getSymbolicName();
        if (BundleEvent.STOPPING == event.getType()
            || BundleEvent.STOPPED == event.getType()) {
View Full Code Here

TOP

Related Classes of org.osgi.framework.BundleListener

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.