Package org.osgi.framework

Examples of org.osgi.framework.FrameworkListener


    final Object refreshLock = new Object();
    FrameworkWiring wiring = bundleContext.getBundle().adapt(
        FrameworkWiring.class);
    if (wiring != null) {
      synchronized (refreshLock) {
        wiring.refreshBundles(bundles, new FrameworkListener() {
          public void frameworkEvent(FrameworkEvent event) {
            if (event.getType() == FrameworkEvent.PACKAGES_REFRESHED) {
              synchronized (refreshLock) {
                refreshLock.notifyAll();
              }
View Full Code Here


        this.start = start;
    }

    public void start() {
        frameworkStarted = new CountDownLatch(1);
    getBundleContext().addFrameworkListener(new FrameworkListener(){
      public void frameworkEvent(FrameworkEvent event) {
        log.debug("Got event: " + event.getType());
        if( event.getType() == FrameworkEvent.STARTED ) {
          frameworkStarted.countDown();
        }
View Full Code Here

    }

    protected void refreshPackages(Collection<Bundle> bundles) throws InterruptedException {
        final CountDownLatch latch = new CountDownLatch(1);
        FrameworkWiring fw = bundleContext.getBundle(0).adapt(FrameworkWiring.class);
        fw.refreshBundles(bundles, new FrameworkListener() {
            @Override
            public void frameworkEvent(FrameworkEvent event) {
                if (event.getType() == FrameworkEvent.ERROR) {
                    LOGGER.error("Framework error", event.getThrowable());
                }
View Full Code Here

        return constructResolveResult(bundles);
    }

    private void refreshBundlesAndWait(long[] bundleIdentifiers, Bundle[] bundles) throws IOException {
        final CountDownLatch latch = new CountDownLatch(1);
        FrameworkListener listener = new FrameworkListener() {
            public void frameworkEvent(FrameworkEvent event) {
                if (FrameworkEvent.PACKAGES_REFRESHED == event.getType()) {
                    latch.countDown();
                }
            }
View Full Code Here

        this.start = start;
    }

    public void start() {
        frameworkStarted = new CountDownLatch(1);
    getBundleContext().addFrameworkListener(new FrameworkListener(){
      public void frameworkEvent(FrameworkEvent event) {
        log.debug("Got event: " + event.getType());
        if( event.getType() == FrameworkEvent.STARTED ) {
          frameworkStarted.countDown();
        }
View Full Code Here

                    }
                }
                try {
                    final CountDownLatch latch = new CountDownLatch(1);
                    FrameworkWiring wiring = getBundleContext().getBundle(0).adapt(FrameworkWiring.class);
                    wiring.refreshBundles(updated, new FrameworkListener() {
                        public void frameworkEvent(FrameworkEvent event) {
                            latch.countDown();
                        }
                    });
                    latch.await();
View Full Code Here

    }

    public void init() {
        shell.getContext().getVariables().set("gshell.username", "smx");
        frameworkStarted = new CountDownLatch(1);
    getBundleContext().addFrameworkListener(new FrameworkListener(){
      public void frameworkEvent(FrameworkEvent event) {
        log.debug("Got event: " + event.getType());
        if( event.getType() == FrameworkEvent.STARTED ) {
          frameworkStarted.countDown();
        }
View Full Code Here

        this.start = start;
    }

    public void start() {
        frameworkStarted = new CountDownLatch(1);
    getBundleContext().addFrameworkListener(new FrameworkListener(){
      public void frameworkEvent(FrameworkEvent event) {
        log.debug("Got event: " + event.getType());
        if( event.getType() == FrameworkEvent.STARTED ) {
          frameworkStarted.countDown();
        }
View Full Code Here

    }

    protected void awaitKarafBeginningStartLevel(final BundleContext syscontext, final Integer beginningStartLevel, long timeout, TimeUnit unit) {
        final CountDownLatch latch = new CountDownLatch(1);
        final FrameworkStartLevel fwrkStartLevel = syscontext.getBundle().adapt(FrameworkStartLevel.class);
        FrameworkListener listener = new FrameworkListener() {
            @Override
            public void frameworkEvent(FrameworkEvent event) {
                if (event.getType() == FrameworkEvent.STARTLEVEL_CHANGED) {
                    int startLevel = fwrkStartLevel.getStartLevel();
                    if (startLevel == beginningStartLevel) {
View Full Code Here

   * registered activator instance and component bundle id.
   *
   * @param context
   */
  private void setDelayCheckBundleState(BundleContext context) {
    context.addFrameworkListener(new FrameworkListener() {
      public void frameworkEvent(FrameworkEvent event) {
        if (event.getType() == FrameworkEvent.STARTED) {
          ComponentCore.getInstance().checkBundleActivtorState();
        }
        // In OSGi 3.4, FrameworkEvent.STOPPED not exists, here do
View Full Code Here

TOP

Related Classes of org.osgi.framework.FrameworkListener

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.