• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java BlueprintListener类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: start

import org.osgi.service.blueprint.container.BlueprintListener; //导入依赖的package包/类
@Override
public void start( BundleContext bundleContext ) throws Exception {
  BlueprintStateServiceImpl blueprintServiceImpl = new BlueprintStateServiceImpl( bundleContext );
  bundleContext
      .registerService( new String[] { BlueprintListener.class.getName(), BlueprintStateService.class.getName() },
          blueprintServiceImpl, null );

  KarafBlueprintWatcherImpl karafBlueprintWatcher = new KarafBlueprintWatcherImpl( bundleContext );
  bundleContext.registerService( IKarafBlueprintWatcher.class.getName(), karafBlueprintWatcher, null );

  bundleContext.registerService( ProxyUnwrapper.class.getName(), new ProxyUnwrapperImpl( bundleContext ), null );
  bundleContext.registerService( BeanFactoryLocator.class.getName(), new BeanFactoryLocatorImpl(), null );
  ServiceReference ref = bundleContext.getServiceReference( ConfigurationAdmin.class.getName() );
  ConfigurationAdmin admin = (ConfigurationAdmin) bundleContext.getService( ref );

  KarafFeatureWatcherImpl karafFeatureWatcher = new KarafFeatureWatcherImpl( bundleContext );
  bundleContext.registerService( IKarafFeatureWatcher.class.getName(), karafFeatureWatcher, null );
}
 
开发者ID:pentaho,项目名称:pentaho-osgi-bundles,代码行数:19,代码来源:BeanFactoryActivator.java


示例2: dispatchReplayEvents

import org.osgi.service.blueprint.container.BlueprintListener; //导入依赖的package包/类
void dispatchReplayEvents(BlueprintListener listener) {
	synchronized (events) {
		for (BlueprintEvent event : events.values()) {
			listener.blueprintEvent(event);
		}
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:8,代码来源:ReplayEventManager.java


示例3: BlueprintListenerManager

import org.osgi.service.blueprint.container.BlueprintListener; //导入依赖的package包/类
public BlueprintListenerManager(BundleContext context) {
	this.replayManager = new ReplayEventManager(context);

	OsgiServiceCollectionProxyFactoryBean fb = new OsgiServiceCollectionProxyFactoryBean();
	fb.setBundleContext(context);
	fb.setAvailability(Availability.OPTIONAL);
	fb.setCollectionType(CollectionType.LIST);
	fb.setInterfaces(new Class[] { BlueprintListener.class });
	fb.setBeanClassLoader(BundleDelegatingClassLoader.createBundleClassLoaderFor(context.getBundle()));
	fb.setListeners(new OsgiServiceLifecycleListener[] { new RegistrationReplayDelivery() });
	fb.afterPropertiesSet();

	cleanupHook = fb;
	listeners = (List) fb.getObject();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:16,代码来源:BlueprintListenerManager.java


示例4: blueprintEvent

import org.osgi.service.blueprint.container.BlueprintListener; //导入依赖的package包/类
public void blueprintEvent(BlueprintEvent event) {
	replayManager.addEvent(event);

	for (BlueprintListener listener : listeners) {
		try {
			listener.blueprintEvent(event);
		} catch (Exception ex) {
			log.warn("exception encountered when calling listener " + System.identityHashCode(listener), ex);
		}
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:12,代码来源:BlueprintListenerManager.java


示例5: waitForBlueprintContainer

import org.osgi.service.blueprint.container.BlueprintListener; //导入依赖的package包/类
/**
 * Synchronization method to wait for particular state of BlueprintContainer under test.
 */
public static void waitForBlueprintContainer(final Set<Long> eventHistory, BundleContext context,
                                             final String symbolicName, final int bpEvent, final Runnable runAndWait)
    throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(1);
    final Throwable[] pThrowable = new Throwable[] {null};
    ServiceRegistration<BlueprintListener> registration = context.registerService(BlueprintListener.class, new BlueprintListener() {
        @Override
        public void blueprintEvent(BlueprintEvent event) {
            if (event.getBundle().getSymbolicName().equals(symbolicName)) {
                if (event.getType() == bpEvent) {
                    // we skip events that we've already seen
                    // it works with BP container reloads if next CREATE state is at least 1ms after previous one
                    if (eventHistory == null || eventHistory.add(event.getTimestamp())) {
                        latch.countDown();
                    }
                } else if (event.getType() == BlueprintEvent.FAILURE) {
                    // we didn't wait for FAILURE, but we got it - fail fast then
                    pThrowable[0] = event.getCause();
                    latch.countDown();
                }
            }
        }
    }, null);
    if (runAndWait != null) {
        runAndWait.run();
    }
    latch.await(BlueprintHelper.DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
    registration.unregister();

    if (pThrowable[0] != null) {
        throw new RuntimeException(pThrowable[0].getMessage(), pThrowable[0]);
    }
}
 
开发者ID:mattrpav,项目名称:blueprint-test,代码行数:37,代码来源:BlueprintHelper.java


示例6: init

import org.osgi.service.blueprint.container.BlueprintListener; //导入依赖的package包/类
public void init() throws Exception {
    LOG.trace("init {}", this);

    // add service listener so we can be notified when blueprint container is done
    // and we would be ready to start CamelContext
    bundleContext.addServiceListener(this);
    // add blueprint listener as service, as we need this for the blueprint container
    // to support change events when it changes states
    registration = bundleContext.registerService(BlueprintListener.class, this, null);
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:11,代码来源:BlueprintCamelContext.java


示例7: waitForBlueprintContainer

import org.osgi.service.blueprint.container.BlueprintListener; //导入依赖的package包/类
/**
 * Synchronization method to wait for particular state of BlueprintContainer under test.
 */
public static void waitForBlueprintContainer(final Set<Long> eventHistory, BundleContext context,
                                             final String symbolicName, final int bpEvent, final Runnable runAndWait)
    throws InterruptedException {
    final CountDownLatch latch = new CountDownLatch(1);
    final Throwable[] pThrowable = new Throwable[] {null};
    ServiceRegistration<BlueprintListener> registration = context.registerService(BlueprintListener.class, new BlueprintListener() {
        @Override
        public void blueprintEvent(BlueprintEvent event) {
            if (event.getBundle().getSymbolicName().equals(symbolicName)) {
                if (event.getType() == bpEvent) {
                    // we skip events that we've already seen
                    // it works with BP container reloads if next CREATE state is at least 1ms after previous one
                    if (eventHistory == null || eventHistory.add(event.getTimestamp())) {
                        latch.countDown();
                    }
                } else if (event.getType() == BlueprintEvent.FAILURE) {
                    // we didn't wait for FAILURE, but we got it - fail fast then
                    pThrowable[0] = event.getCause();
                    latch.countDown();
                }
            }
        }
    }, null);
    if (runAndWait != null) {
        runAndWait.run();
    }
    latch.await(CamelBlueprintHelper.DEFAULT_TIMEOUT, TimeUnit.MILLISECONDS);
    registration.unregister();

    if (pThrowable[0] != null) {
        throw new RuntimeException(pThrowable[0].getMessage(), pThrowable[0]);
    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:37,代码来源:CamelBlueprintHelper.java


示例8: start

import org.osgi.service.blueprint.container.BlueprintListener; //导入依赖的package包/类
@Override
public void start(final BundleContext context) throws Exception {

    BlueprintListenerImpl blueprintListener = new BlueprintListenerImpl();
    blueprintListenerSR = context.registerService(BlueprintListener.class, blueprintListener,
            new Hashtable<String, Object>());

    Hashtable<String, String> servletProps = new Hashtable<String, String>();
    servletProps.put("felix.webconsole.label", "everit_blueprint_events");
    servletProps.put("felix.webconsole.category", "Everit");
    servletProps.put("felix.webconsole.title", "Blueprint Events");
    Servlet blueprintServlet = new BlueprintServlet(blueprintListener);
    blueprintServletSR = context.registerService(Servlet.class, blueprintServlet, servletProps);

}
 
开发者ID:everit-org-archive,项目名称:osgi-webconsole-blueprint,代码行数:16,代码来源:BlueprintPluginActivator.java


示例9: bind

import org.osgi.service.blueprint.container.BlueprintListener; //导入依赖的package包/类
public void bind(Object service, Map properties) throws Exception {
	BlueprintListener listener = (BlueprintListener) service;
	replayManager.dispatchReplayEvents(listener);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:5,代码来源:BlueprintListenerManager.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CloudServicePlan类代码示例发布时间:2022-05-22
下一篇:
Java Parity类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap