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

Java ComponentFactory类代码示例

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

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



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

示例1: waitForFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
private ComponentFactory waitForFactory() {
   String filter = "(component.factory=com.chuidiang.examples.osgi_factory.adder_factory)";
   ServiceReference[] references=null;
   while (null == references) {
      try {
         Thread.sleep(1000);
         LOG.info("searching factory");
         references = context.getServiceReferences(
               ComponentFactory.class.getName(), filter);

      } catch (Exception e) {
         LOG.severe("Error getting factory " + e.getMessage());
      }
   }
   return (ComponentFactory) context.getService(references[0]);
}
 
开发者ID:chuidiang,项目名称:chuidiang-ejemplos,代码行数:17,代码来源:Activator.java


示例2: start

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public void start(BundleContext theContext) throws Exception {
   this.context = theContext;
   
   new Thread() {
      public void run() {
         ComponentFactory factory = waitForFactory();
         createSeveralInstances(factory);
      }
   }.start();
}
 
开发者ID:chuidiang,项目名称:chuidiang-ejemplos,代码行数:11,代码来源:Activator.java


示例3: createSeveralInstances

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
private void createSeveralInstances(ComponentFactory factory) {
   for (int i = 1; i < 5; i++) {
      try {
         Dictionary<String, String> configuration = new Hashtable<>();
         configuration.put("name", "Increment by " + i);
         configuration.put("increment", Integer.toString(i));
         factory.newInstance(configuration);
      } catch (Exception e) {
         LOG.severe("Error instantiating service " + e.getMessage());
      }
   }
}
 
开发者ID:chuidiang,项目名称:chuidiang-ejemplos,代码行数:13,代码来源:Activator.java


示例4: setFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
@Reference(target = "(component.factory=greeter.factory.provider)")
public void setFactory(final ComponentFactory factory) {
    try {
        lock.writeLock().lock();
        this.factory = factory;
    } finally {
        lock.writeLock().unlock();
    }
}
 
开发者ID:sully6768,项目名称:devnation2014,代码行数:10,代码来源:GreeterServiceFactoryManager.java


示例5: unsetFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public void unsetFactory(final ComponentFactory factory) {
    try {
        lock.writeLock().lock();
        this.factory = null;
    } finally {
        lock.writeLock().unlock();
    }
}
 
开发者ID:sully6768,项目名称:devnation2014,代码行数:9,代码来源:GreeterServiceFactoryManager.java


示例6: testServiceAccess

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
@Test
public void testServiceAccess() throws Exception {

    Module modA = getRuntime().installModule(getClass().getClassLoader(), getModuleHeadersA());
    modA.start();

    ModuleContext contextA = modA.getModuleContext();
    String filter = "(component.factory=" + ServiceFactoryB.FACTORY_ID + ")";
    Collection<ServiceReference<ComponentFactory>> srefs = contextA.getServiceReferences(ComponentFactory.class, filter);
    Assert.assertEquals("ServiceReference not null", 1, srefs.size());

    ComponentFactory factory = contextA.getService(srefs.iterator().next());
    Dictionary<String, Object> props = new Hashtable<String, Object>();
    props.put("key", "val1");
    factory.newInstance(props);

    Collection<ServiceReference<ServiceB>> srefsB = contextA.getServiceReferences(ServiceB.class, "(key=val1)");
    Assert.assertEquals("ServiceReference not null", 1, srefsB.size());
    ServiceB srvB = contextA.getService(srefsB.iterator().next());
    Assert.assertEquals("ServiceFactoryB#1:val1", srvB.doStuff());

    props.put("key", "val2");
    factory.newInstance(props);

    srefsB = contextA.getServiceReferences(ServiceB.class, "(key=val2)");
    Assert.assertEquals("ServiceReference not null", 1, srefsB.size());
    srvB = contextA.getService(srefsB.iterator().next());
    Assert.assertEquals("ServiceFactoryB#2:val2", srvB.doStuff());
}
 
开发者ID:tdiesler,项目名称:gravia,代码行数:30,代码来源:ComponentFactoryTestCase.java


示例7: setComponentFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
@Reference(target = "(component.factory=fipro.oneshot.factory)")
void setComponentFactory(ComponentFactory factory) {
	this.factory = factory;
}
 
开发者ID:fipro78,项目名称:osgi-ds-getting-started-pde,代码行数:5,代码来源:ShootCommand.java


示例8: APIsWebSocketHandler

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public APIsWebSocketHandler(ComponentFactory webSocketFactory) {
	this.webSocketFactory = webSocketFactory;
}
 
开发者ID:ismb,项目名称:jemma.osgi.dal.web-apis,代码行数:4,代码来源:APIsWebSocketHandler.java


示例9: OverLoadsWebSocketHandler

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public OverLoadsWebSocketHandler(ComponentFactory webSocketFactory) {
	this.webSocketFactory = webSocketFactory;
}
 
开发者ID:ismb,项目名称:jemma.osgi.dal.web-apis,代码行数:4,代码来源:OverLoadsWebSocketHandler.java


示例10: bindAPIComponentFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public void bindAPIComponentFactory(ComponentFactory componentFactory) {
	this.webSocketAPIFactory = componentFactory;
}
 
开发者ID:ismb,项目名称:jemma.osgi.dal.web-apis,代码行数:4,代码来源:WebApiComponent.java


示例11: unbindAPIComponentFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public void unbindAPIComponentFactory(ComponentFactory componentFactory) {
	this.webSocketAPIFactory = null;
}
 
开发者ID:ismb,项目名称:jemma.osgi.dal.web-apis,代码行数:4,代码来源:WebApiComponent.java


示例12: bindOverloadComponentFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public void bindOverloadComponentFactory(ComponentFactory componentFactory) {
	this.webSocketOverloadFactory = componentFactory;
}
 
开发者ID:ismb,项目名称:jemma.osgi.dal.web-apis,代码行数:4,代码来源:WebApiComponent.java


示例13: unbindOverloadComponentFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public void unbindOverloadComponentFactory(ComponentFactory componentFactory) {
	this.webSocketOverloadFactory = null;
}
 
开发者ID:ismb,项目名称:jemma.osgi.dal.web-apis,代码行数:4,代码来源:WebApiComponent.java


示例14: APIsWebSocketHandler

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public APIsWebSocketHandler(ComponentFactory webSocketFactory) {
	this.webSocketFactory=webSocketFactory;
}
 
开发者ID:ismb,项目名称:it.ismb.pert.osgi.dal.web-apis,代码行数:4,代码来源:APIsWebSocketHandler.java


示例15: OverLoadsWebSocketHandler

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public OverLoadsWebSocketHandler(ComponentFactory webSocketFactory) {
	this.webSocketFactory=webSocketFactory;
}
 
开发者ID:ismb,项目名称:it.ismb.pert.osgi.dal.web-apis,代码行数:4,代码来源:OverLoadsWebSocketHandler.java


示例16: bindAPIComponentFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public void bindAPIComponentFactory(ComponentFactory componentFactory)
{
	this.webSocketAPIFactory=componentFactory;
}
 
开发者ID:ismb,项目名称:it.ismb.pert.osgi.dal.web-apis,代码行数:5,代码来源:WebApiComponent.java


示例17: unbindAPIComponentFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public void unbindAPIComponentFactory(ComponentFactory componentFactory)
{
	this.webSocketAPIFactory=null;
}
 
开发者ID:ismb,项目名称:it.ismb.pert.osgi.dal.web-apis,代码行数:5,代码来源:WebApiComponent.java


示例18: bindOverloadComponentFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public void bindOverloadComponentFactory(ComponentFactory componentFactory)
{
	this.webSocketOverloadFactory=componentFactory;
}
 
开发者ID:ismb,项目名称:it.ismb.pert.osgi.dal.web-apis,代码行数:5,代码来源:WebApiComponent.java


示例19: unbindOverloadComponentFactory

import org.osgi.service.component.ComponentFactory; //导入依赖的package包/类
public void unbindOverloadComponentFactory(ComponentFactory componentFactory)
{
	this.webSocketOverloadFactory=null;
}
 
开发者ID:ismb,项目名称:it.ismb.pert.osgi.dal.web-apis,代码行数:5,代码来源:WebApiComponent.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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