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


Java BundleContext.registerService方法代码示例

本文整理汇总了Java中org.osgi.framework.BundleContext.registerService方法的典型用法代码示例。如果您正苦于以下问题:Java BundleContext.registerService方法的具体用法?Java BundleContext.registerService怎么用?Java BundleContext.registerService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.osgi.framework.BundleContext的用法示例。


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

示例1: start

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
@Override
public void start ( final BundleContext context ) throws Exception
{
    this.poolTracker = new ObjectPoolTracker<MasterItem> ( context, MasterItem.class );
    this.poolTracker.open ();

    this.mapperPoolTracker = new ObjectPoolTracker<ValueMapper> ( context, ValueMapper.class );
    this.mapperPoolTracker.open ();

    this.factory = new MapperHandlerFactoryImpl ( context, this.poolTracker, this.mapperPoolTracker, 1001 /* after manual */);
    final Dictionary<String, String> properties = new Hashtable<String, String> ();
    properties.put ( Constants.SERVICE_DESCRIPTION, "A value mapper master handler" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID, MapperHandlerFactoryImpl.FACTORY_ID );
    context.registerService ( ConfigurationFactory.class.getName (), this.factory, properties );

}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:Activator.java

示例2: start

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
@Override
public void start ( final BundleContext context ) throws Exception
{
    this.executor = ScheduledExportedExecutorService.newSingleThreadExportedScheduledExecutor ( context.getBundle ().getSymbolicName () );

    this.eventProcessor = new EventProcessor ( context );
    this.eventProcessor.open ();

    this.factory = new ScriptSourceFactory ( context, this.executor, this.eventProcessor );

    final Dictionary<String, String> properties = new Hashtable<String, String> ();
    properties.put ( Constants.SERVICE_DESCRIPTION, "A scripting data source" );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID, context.getBundle ().getSymbolicName () );

    context.registerService ( ConfigurationFactory.class.getName (), this.factory, properties );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:Activator.java

示例3: start

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

    this.executor = Executors.newSingleThreadExecutor ( new NamedThreadFactory ( context.getBundle ().getSymbolicName () ) );
    this.factory = new SumSourceFactory ( context, this.executor );

    final Dictionary<String, String> properties = new Hashtable<String, String> ();
    properties.put ( Constants.SERVICE_DESCRIPTION, "A summary data source" );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID, context.getBundle ().getSymbolicName () );

    context.registerService ( ConfigurationFactory.class.getName (), this.factory, properties );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:17,代码来源:Activator.java

示例4: start

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
@Activate
void start(BundleContext ctx) throws InterruptedException, VmidcException {
    // This is not done automatically by DS as we do not want the broadcast whiteboard
    // to activate another instance of this component, only people getting the runner!
    this.registration = ctx.registerService(BroadcastListener.class, this, null);

    try {
        EntityManager em = this.dbConnectionManager.getTransactionalEntityManager();
        this.dbConnectionManager.getTransactionControl().required(() -> {
            OSCEntityManager<SecurityGroup> sgEmgr = new OSCEntityManager<SecurityGroup>(SecurityGroup.class, em, this.txBroadcastUtil);
            for (SecurityGroup sg : sgEmgr.listAll()) {
                if (sg.getVirtualizationConnector().getVirtualizationType().isOpenstack()) {
                    addListener(sg);
                }
            }
            return null;
        });
    } catch (ScopedWorkException swe) {
        throw swe.asRuntimeException();
    }
}
 
开发者ID:opensecuritycontroller,项目名称:osc-core,代码行数:22,代码来源:OsSecurityGroupNotificationRunner.java

示例5: start

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
public void start ( final BundleContext context ) throws Exception
{
    this.factory = new EventPoolConfigurationFactory ( context );

    final Dictionary<String, String> properties = new Hashtable<String, String> ();
    properties.put ( ConfigurationAdministrator.FACTORY_ID, context.getBundle ().getSymbolicName () + ".pool" );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    properties.put ( Constants.SERVICE_DESCRIPTION, "Event pool service factory" );
    context.registerService ( ConfigurationFactory.class.getName (), this.factory, properties );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:11,代码来源:Activator.java

示例6: registerManagedService

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
public static ServiceRegistration registerManagedService(BundleContext bundleContext, ManagedService listener,
		String pid) {

       Dictionary<String, Object> props = new Hashtable<String, Object>();
	props.put(Constants.SERVICE_PID, pid);
	Bundle bundle = bundleContext.getBundle();
	props.put(Constants.BUNDLE_SYMBOLICNAME, OsgiStringUtils.nullSafeSymbolicName(bundle));
	props.put(Constants.BUNDLE_VERSION, OsgiBundleUtils.getBundleVersion(bundle));

	return bundleContext.registerService(ManagedService.class.getName(), listener, props);
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:12,代码来源:CMUtils.java

示例7: start

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

    this.executor = ScheduledExportedExecutorService.newSingleThreadExportedScheduledExecutor ( context.getBundle ().getSymbolicName () );
    this.factory = new BufferedDatasourceFactory ( context, this.executor );

    final Dictionary<String, String> properties = new Hashtable<String, String> ();
    properties.put ( Constants.SERVICE_DESCRIPTION, "A counter of changes on an item over a defined timeframe" );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID, context.getBundle ().getSymbolicName () );

    context.registerService ( ConfigurationFactory.class.getName (), this.factory, properties );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:16,代码来源:Activator.java

示例8: createService

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
@Override
protected Entry<ProxyHistoricalItem> createService ( final UserInformation userInformation, final String configurationId, final BundleContext context, final Map<String, String> parameters ) throws Exception
{
    final ProxyHistoricalItem service = new ProxyHistoricalItem ( context, this.executor, configurationId, parameters );

    final Dictionary<String, Object> properties = new Hashtable<String, Object> ();
    properties.put ( Constants.SERVICE_DESCRIPTION, "A proxy to historical items" );
    properties.put ( Constants.SERVICE_PID, configurationId );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );

    final ServiceRegistration<HistoricalItem> handle = context.registerService ( HistoricalItem.class, service, properties );
    return new Entry<ProxyHistoricalItem> ( configurationId, service, handle );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:14,代码来源:ProxyItemFactory.java

示例9: start

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
public void start ( final BundleContext context ) throws Exception
{
    this.executor = Executors.newSingleThreadScheduledExecutor ( new ThreadFactoryImplementation ( Activator.class.getName () ) );

    Dictionary<String, String> properties;

    // register sine factory
    this.factory1 = new SineDataSourceFactory ( context, this.executor );
    properties = new Hashtable<String, String> ();
    properties.put ( ConfigurationAdministrator.FACTORY_ID, "datasource.test.sine" );
    properties.put ( Constants.SERVICE_DESCRIPTION, "Testing Factory - Sine" );
    context.registerService ( ConfigurationFactory.class.getName (), this.factory1, properties );

    // register toggle factory
    this.factory2 = new ToggleDataSourceFactory ( context, this.executor );
    properties = new Hashtable<String, String> ();
    properties.put ( ConfigurationAdministrator.FACTORY_ID, "datasource.test.toggle" );
    properties.put ( Constants.SERVICE_DESCRIPTION, "Testing Factory - Toggle" );
    context.registerService ( ConfigurationFactory.class.getName (), this.factory2, properties );

    // register sawtooth factory
    this.factory3 = new SawtoothDataSourceFactory ( context, this.executor );
    properties = new Hashtable<String, String> ();
    properties.put ( ConfigurationAdministrator.FACTORY_ID, "datasource.test.sawtooth" );
    properties.put ( Constants.SERVICE_DESCRIPTION, "Testing Factory - Sawtooth" );
    context.registerService ( ConfigurationFactory.class.getName (), this.factory3, properties );

    // register random long factory
    this.factory4 = new RandomLongDataSourceFactory ( context, this.executor );
    properties = new Hashtable<String, String> ();
    properties.put ( ConfigurationAdministrator.FACTORY_ID, "datasource.test.randomlong" );
    properties.put ( Constants.SERVICE_DESCRIPTION, "Testing Factory - Random Long" );
    context.registerService ( ConfigurationFactory.class.getName (), this.factory4, properties );

    // register quality factory
    this.factory5 = new QualityDataSourceFactory ( context, this.executor );
    properties = new Hashtable<String, String> ();
    properties.put ( ConfigurationAdministrator.FACTORY_ID, "datasource.test.quality" );
    properties.put ( Constants.SERVICE_DESCRIPTION, "Testing Factory - Quality" );
    context.registerService ( ConfigurationFactory.class.getName (), this.factory5, properties );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:42,代码来源:Activator.java

示例10: registerManagedService

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
private void registerManagedService(BundleContext containerContext, PersistenceUnitInfo persistenceUnit) {
	Dictionary<String, Object> configuration = new Hashtable<String, Object>(); // NOSONAR
	configuration.put(Constants.SERVICE_PID, JPA_CONFIGURATION_PREFIX + persistenceUnit.getPersistenceUnitName());
	configReg = containerContext.registerService(ManagedService.class, 
			new ManagedEMF(this, persistenceUnit.getPersistenceUnitName()), configuration);
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:7,代码来源:AriesEntityManagerFactoryBuilder.java

示例11: registerBlueprintEventHandler

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
private void registerBlueprintEventHandler(final BundleContext context) {
    Dictionary<String, Object> props = new Hashtable<>();
    props.put(org.osgi.service.event.EventConstants.EVENT_TOPIC,
            new String[]{EventConstants.TOPIC_CREATED, EventConstants.TOPIC_FAILURE});
    eventHandlerReg = context.registerService(EventHandler.class.getName(), this, props);
}
 
开发者ID:hashsdn,项目名称:hashsdn-controller,代码行数:7,代码来源:BlueprintBundleTracker.java

示例12: StorageImpl

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
public StorageImpl ( final BundleContext context, final File file, final DataFilePool pool, final ScheduledExecutorService queryExecutor, final ScheduledExecutorService eventExecutor ) throws Exception
{
    super ( file, pool, queryExecutor, eventExecutor );

    // register with OSGi
    final Dictionary<String, Object> properties = new Hashtable<String, Object> ( 2 );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    properties.put ( Constants.SERVICE_PID, this.id );
    this.handle = context.registerService ( HistoricalItem.class, this, properties );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:11,代码来源:StorageImpl.java

示例13: addingService

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public Object addingService(ServiceReference reference) {
    String unitName = (String)reference.getProperty(JPA_UNIT_NAME);
    if (unitName == null) {
        return null;
    }
    BundleContext puContext = reference.getBundle().getBundleContext();
    TrackedEmf tracked = new TrackedEmf();
    tracked.emf = (EntityManagerFactory)puContext.getService(reference);
    tracked.emSupplier = new EMSupplierImpl(unitName, tracked.emf, coordinator);
    tracked.emSupplierReg = puContext.registerService(EmSupplier.class, tracked.emSupplier,
                                                     getEmSupplierProps(unitName));

    EntityManager emProxy = createProxy(tracked.emSupplier);
    tracked.emProxyReg = puContext.registerService(EntityManager.class, emProxy,
                                                     getEmSupplierProps(unitName));
    
    if (getTransactionType(tracked.emf) == PersistenceUnitTransactionType.RESOURCE_LOCAL) {
        JpaTemplate txManager = new ResourceLocalJpaTemplate(tracked.emSupplier, coordinator);
        tracked.rlTxManagerReg = puContext.registerService(JpaTemplate.class, txManager,
                                                      rlTxManProps(unitName));
    } else {
        tracked.tmTracker = new TMTracker(puContext, tracked.emSupplier, unitName, coordinator);
        tracked.tmTracker.open();
    }
    return tracked;
}
 
开发者ID:apache,项目名称:aries-jpa,代码行数:29,代码来源:EMFTracker.java

示例14: start

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
public void start ( final BundleContext context ) throws Exception
{
    this.factory = new ProxyDataSourceFactory ( context );

    final Dictionary<String, String> properties = new Hashtable<String, String> ();
    properties.put ( Constants.SERVICE_DESCRIPTION, "Proxy data sources" );
    properties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    properties.put ( ConfigurationAdministrator.FACTORY_ID, "da.datasource.proxy" );

    context.registerService ( ConfigurationFactory.class.getName (), this.factory, properties );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:12,代码来源:Activator.java

示例15: HSDBItemController

import org.osgi.framework.BundleContext; //导入方法依赖的package包/类
public HSDBItemController ( final String id, final ScheduledExecutorService executor, final BundleContext context, final HSDBValueSource source )
{
    this.source = source;

    final Map<String, Variant> properties = new HashMap<String, Variant> ();

    final HistoricalItemInformation information = new HistoricalItemInformation ( id, properties );
    this.item = new HSDBHistoricalItem ( executor, source, information );

    final Dictionary<String, Object> serviceProperties = new Hashtable<String, Object> ();
    serviceProperties.put ( Constants.SERVICE_PID, id );
    serviceProperties.put ( Constants.SERVICE_VENDOR, "Eclipse SCADA Project" );
    this.handle = context.registerService ( HistoricalItem.class, this.item, serviceProperties );
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:15,代码来源:HSDBItemController.java


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