当前位置: 首页>>代码示例>>Java>>正文


Java FrameworkListener类代码示例

本文整理汇总了Java中org.osgi.framework.FrameworkListener的典型用法代码示例。如果您正苦于以下问题:Java FrameworkListener类的具体用法?Java FrameworkListener怎么用?Java FrameworkListener使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


FrameworkListener类属于org.osgi.framework包,在下文中一共展示了FrameworkListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: notifyFrameworkListeners

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
/**
 * notify all framework listeners.
 *
 * @param state the new state.
 * @param bundle the bundle.
 * @param throwable a throwable.
 */
static void notifyFrameworkListeners(final int state, final Bundle bundle, final Throwable throwable) {

    if (frameworkListeners.isEmpty()) {
        return;
    }

    final FrameworkEvent event = new FrameworkEvent(state);

    final FrameworkListener[] listeners = frameworkListeners.toArray(new FrameworkListener[frameworkListeners.size()]);

    for (int i = 0; i < listeners.length; i++) {
        final FrameworkListener listener = listeners[i];

        listener.frameworkEvent(event);
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:24,代码来源:Framework.java

示例2: start

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
/**
 * Starting the blocker instance.
 */
public void start() {
  frameworkListener = new FrameworkListener() {

    @Override
    public void frameworkEvent(final FrameworkEvent event) {
      if (event.getType() == FrameworkEvent.STARTED) {
        blocking = false;
        unblock();
      }

    }
  };
  bundleContext.addFrameworkListener(frameworkListener);

  Bundle frameworkBundle = bundleContext.getBundle(0);
  if (frameworkBundle.getState() != Bundle.ACTIVE) {
    blocking = true;
    block();
  } else {
    blocking = false;
  }

}
 
开发者ID:everit-org,项目名称:osgi-testrunner,代码行数:27,代码来源:FrameworkStartingShutdownBlockerImpl.java

示例3: start

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
public @Override void start(final BundleContext context) throws Exception {
        if (System.getProperty("netbeans.home") != null) {
            throw new IllegalStateException("Should not be run from inside regular NetBeans module system");
        }
        String storage = context.getProperty(Constants.FRAMEWORK_STORAGE);
        if (storage != null) {
            System.setProperty("netbeans.user", storage);
        }
        System.setProperty("TopSecurityManager.disable", "true");
        NbBundle.setBranding(System.getProperty("branding.token"));
        OSGiMainLookup.initialize(context);
        queue = new DependencyQueue<String,Bundle>();
        this.context = context;
        framework = ((Framework) context.getBundle(0));
        if (framework.getState() == Bundle.STARTING) {
            LOG.fine("framework still starting");
            final AtomicReference<FrameworkListener> frameworkListener = new AtomicReference<FrameworkListener>();
            frameworkListener.set(new FrameworkListener() {
                public @Override void frameworkEvent(FrameworkEvent event) {
                    if (event.getType() == FrameworkEvent.STARTED) {
//                        System.err.println("framework started");
                        context.removeFrameworkListener(frameworkListener.get());
                        context.addBundleListener(Activator.this);
                        processLoadedBundles();
                    }
                }
            });
            context.addFrameworkListener(frameworkListener.get());
        } else {
            LOG.fine("framework already started");
            context.addBundleListener(this);
            processLoadedBundles();
        }
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:Activator.java

示例4: notifyFrameworkListeners

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
static void notifyFrameworkListeners(int event, Bundle bundle, Throwable th) {
    if (!frameworkListeners.isEmpty()) {
        FrameworkEvent frameworkEvent = new FrameworkEvent(event, bundle, th);
        FrameworkListener[] frameworkListenerArr = frameworkListeners.toArray(new FrameworkListener[frameworkListeners.size()]);
        for (FrameworkListener frameworkListener : frameworkListenerArr) {
            frameworkListener.frameworkEvent(frameworkEvent);
        }
    }
}
 
开发者ID:bunnyblue,项目名称:ACDD,代码行数:10,代码来源:Framework.java

示例5: addFrameworkListener

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
public void addFrameworkListener(FrameworkListener frameworkListener) {
    checkValid();
    if (this.bundle.registeredFrameworkListeners == null) {
        this.bundle.registeredFrameworkListeners = new ArrayList();
    }
    if (!this.bundle.registeredFrameworkListeners.contains(frameworkListener)) {
        Framework.frameworkListeners.add(frameworkListener);
        this.bundle.registeredFrameworkListeners.add(frameworkListener);
    }
}
 
开发者ID:achellies,项目名称:AtlasForAndroid,代码行数:11,代码来源:BundleContextImpl.java

示例6: removeFrameworkListener

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
public void removeFrameworkListener(FrameworkListener frameworkListener) {
    checkValid();
    Framework.frameworkListeners.remove(frameworkListener);
    this.bundle.registeredFrameworkListeners.remove(frameworkListener);
    if (this.bundle.registeredFrameworkListeners.isEmpty()) {
        this.bundle.registeredFrameworkListeners = null;
    }
}
 
开发者ID:achellies,项目名称:AtlasForAndroid,代码行数:9,代码来源:BundleContextImpl.java

示例7: notifyFrameworkListeners

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
static void notifyFrameworkListeners(int i, Bundle bundle, Throwable th) {
    if (!frameworkListeners.isEmpty()) {
        FrameworkEvent frameworkEvent = new FrameworkEvent(i, bundle, th);
        FrameworkListener[] frameworkListenerArr = (FrameworkListener[]) frameworkListeners.toArray(new FrameworkListener[frameworkListeners.size()]);
        for (FrameworkListener frameworkEvent2 : frameworkListenerArr) {
            frameworkEvent2.frameworkEvent(frameworkEvent);
        }
    }
}
 
开发者ID:achellies,项目名称:AtlasForAndroid,代码行数:10,代码来源:Framework.java

示例8: start

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
@Override
public void start(BundleContext context) throws Exception {
	this.context = context;

	packages = load(context.getBundle(), "guardinfo/packages.properties", packages);
	services = load(context.getBundle(), "guardinfo/services.properties", services);

	Hashtable<String,Object> properties = new Hashtable<>();
	properties.put("command.scope", "guard");
	properties.put("command.function", new String[] {
			"restart", "clear"
	});
	context.registerService(Object.class, new Object(), properties);

	final AtomicBoolean started = new AtomicBoolean(false);

	//
	// Wait before polling
	context.addFrameworkListener(new FrameworkListener() {

		@Override
		public void frameworkEvent(FrameworkEvent event) {
			if (event.getType() == FrameworkEvent.STARTED && started.getAndSet(true)) {
				start();
			}
		}
	});
	Thread.sleep(5000);
	if (started.getAndSet(true))
		start();
}
 
开发者ID:osgi,项目名称:bundles,代码行数:32,代码来源:Guard.java

示例9: setFrameworkStartLevel

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
public void setFrameworkStartLevel(final int startLevel) {
    Logger.info("Setting framework startlevel to " + startLevel);
    final AtomicBoolean startLevelReached = new AtomicBoolean(false);
    final Lock lock = new ReentrantLock();
    final Condition startLevelReachedCondition = lock.newCondition();

    frameworkStartLevel.setStartLevel(startLevel, new FrameworkListener() {

        @Override
        public void frameworkEvent(final FrameworkEvent event) {
            lock.lock();
            int eventType = event.getType();
            if ((eventType == FrameworkEvent.STARTLEVEL_CHANGED) || (eventType == FrameworkEvent.ERROR)) {
                if (eventType == FrameworkEvent.ERROR) {
                    Logger.error("Setting framework startlevel to " + startLevel + " finished with error: ",
                            event.getThrowable());
                } else {
                    Logger.info("Setting framework startlevel to " + startLevel + " finished with success");
                }
                startLevelReached.set(true);
                startLevelReachedCondition.signal();
            }
            lock.unlock();
        }
    });
    lock.lock();
    try {
        while (!startLevelReached.get()) {
            startLevelReachedCondition.await();
        }
    } catch (InterruptedException e) {
        Logger.error("Startlevel reaching wait interrupted", e);
    } finally {
        lock.unlock();
    }
    currentFrameworkStartLevelValue = startLevel;
}
 
开发者ID:everit-org,项目名称:osgi-richconsole,代码行数:38,代码来源:UpgradeProcess.java

示例10: addFrameworkListener

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
public void addFrameworkListener(FrameworkListener fl) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:NetigsoSelfQueryTest.java

示例11: removeFrameworkListener

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
public void removeFrameworkListener(FrameworkListener fl) {
    throw new UnsupportedOperationException("Not supported yet.");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:NetigsoSelfQueryTest.java

示例12: removeFrameworkListener

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
public void removeFrameworkListener(FrameworkListener fl) {
    delegate.removeFrameworkListener(fl);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:Netbinox.java

示例13: addFrameworkListener

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
public void addFrameworkListener(FrameworkListener fl) {
    delegate.addFrameworkListener(fl);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:Netbinox.java

示例14: addFrameworkListener

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
public static void addFrameworkListener(FrameworkListener listener) {
    frameworkListeners.add(listener);
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:4,代码来源:Framework.java

示例15: removeFrameworkListener

import org.osgi.framework.FrameworkListener; //导入依赖的package包/类
public static void removeFrameworkListener(FrameworkListener listener) {
    frameworkListeners.remove(listener);
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:4,代码来源:Framework.java


注:本文中的org.osgi.framework.FrameworkListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。