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


Java ConfigurationAdmin.createFactoryConfiguration方法代码示例

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


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

示例1: start

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
@Override
public void start(BundleContext bundleContext) throws Exception {
    _context = bundleContext;
    _log.info("start called");

    ServiceReference configAdminServiceRef = bundleContext.getServiceReference(ConfigurationAdmin.class.getName());
    ConfigurationAdmin configAdminService = (ConfigurationAdmin) bundleContext.getService( configAdminServiceRef );

    Configuration configuration = configAdminService.createFactoryConfiguration("com.pronoia.controlservice");

    Properties props = new Properties();
    props.put( "control.name", "FredControlOne" );
    configuration.update( (Dictionary)props );

    configuration = configAdminService.createFactoryConfiguration( "com.pronoia.controlservice");
    props = new Properties();
    props.put( "control.name", "FredControlTwo" );
    configuration.update( (Dictionary)props );
}
 
开发者ID:hqstevenson,项目名称:osgi-dynamic-service,代码行数:20,代码来源:ManagedControlServiceClientActivator.java

示例2: createFactoryConfiguration

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
protected Configuration createFactoryConfiguration( final String factoryPid, final String location,
    final boolean withProps )
{
    final ConfigurationAdmin ca = getConfigurationAdmin();
    try
    {
        final Configuration config = ca.createFactoryConfiguration( factoryPid, null );
        if ( withProps )
        {
            config.update( theConfig );
        }
        return config;
    }
    catch ( IOException ioe )
    {
        TestCase.fail( "Failed updating factory configuration " + factoryPid + ": " + ioe.toString() );
        return null; // keep the compiler quiet
    }
}
 
开发者ID:mcculls,项目名称:osgi-in-action,代码行数:20,代码来源:ConfigurationTestBase.java

示例3: ConfigureThread

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
public ConfigureThread( final ConfigurationAdmin configAdmin, final String pid, final boolean isFactory )
    throws IOException
{
    // ensure configuration and disown it
    final Configuration config;
    if ( isFactory )
    {
        config = configAdmin.createFactoryConfiguration( pid );
    }
    else
    {
        config = configAdmin.getConfiguration( pid );
    }
    config.setBundleLocation( null );

    Hashtable<String, Object> props = new Hashtable<String, Object>();
    props.put( "prop1", "aValue" );
    props.put( "prop2", 4711 );

    this.config = config;
    this.props = props;
}
 
开发者ID:mcculls,项目名称:osgi-in-action,代码行数:23,代码来源:ConfigureThread.java

示例4: setUp

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Before
public void setUp() throws Exception{

    configAdmin  = (ConfigurationAdmin) cmTracker.waitForService(5000);

    assertNotNull(configAdmin);
    assertNotNull(txServiceProps.getProperty("aries.dsf.target.filter"));

    Filter dsfFilter = FrameworkUtil.createFilter("(&("+
            Constants.OBJECTCLASS + "="+DataSourceFactory.class.getName()+")"+txServiceProps.getProperty("aries.dsf.target.filter")+")");

    dsfTracker = new ServiceTracker<>(context,dsfFilter, null);

    dsfTracker.open();

    Filter cpFilter =  FrameworkUtil.createFilter("(&("+
            Constants.OBJECTCLASS+"="+JDBCConnectionProvider.class.getName()+")"
            + "(dataSourceName=addressBookDS)"
            +")");
    cpTracker = new ServiceTracker<>(context, cpFilter, null);
    cpTracker.open();

    localJDBCProviderConfig = configAdmin.createFactoryConfiguration(FACTORY_PID_ARIES_TX_CONTROL_JDBC_LOCAL,null);
    localJDBCProviderConfig.update((Hashtable)txServiceProps);

}
 
开发者ID:osgi,项目名称:osgi.enroute.examples.jdbc,代码行数:28,代码来源:BootstrapTest.java

示例5: handleAddFactory

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
private void handleAddFactory(String args, ConfigurationAdmin admin) throws IOException {
  String pid = args.substring("add-factory".length(),
      args.indexOf(" ", "add-factory ".length())).trim();
    Configuration conf = admin.createFactoryConfiguration(pid,
      null);
    createConfiguration(args.substring(
      ("add-factory " + pid).length()).trim(), pid, conf);
}
 
开发者ID:mcculls,项目名称:osgi-in-action,代码行数:9,代码来源:ConfigAdminCommand.java

示例6: updateAndWaitForConfig

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
private void updateAndWaitForConfig(ConfigurationAdmin cm, final Dictionary properties) throws Exception {
	Configuration cfg = cm.createFactoryConfiguration(FPID, null);
	cfg.update(properties);
	synchronized (Listener.regBarrier) {
		Listener.regBarrier.wait(10 * 1000);
	}
}
 
开发者ID:BeamFoundry,项目名称:spring-osgi,代码行数:8,代码来源:ManagedServiceFactoryTest.java

示例7: getConfiguration

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
/**
 * Gets a Configuration object.
 * @param pid the pid
 * @param factoryPid the factory pid
 * @param cm the config admin service
 * @return the Configuration object (used to update the configuration)
 * @throws Exception if the Configuration object cannot be retrieved
 */
static Configuration getConfiguration(String pid, String factoryPid,
        ConfigurationAdmin cm) throws IOException {
    Configuration newConfiguration = null;
    if (factoryPid != null) {
        newConfiguration = cm.createFactoryConfiguration(pid, null);
    } else {
        newConfiguration = cm.getConfiguration(pid, null);
    }
    return newConfiguration;
}
 
开发者ID:ow2-chameleon,项目名称:osgi-testing-helpers,代码行数:19,代码来源:ChameleonHelper.java

示例8: setUp

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
@Before
public void setUp() throws Exception{

    configAdmin  = (ConfigurationAdmin) cmTracker.waitForService(5000);

    assertNotNull(configAdmin);

    localJDBCProviderConfig = configAdmin.createFactoryConfiguration(FACTORY_PID_ARIES_TX_CONTROL_JDBC_LOCAL,null);
    localJDBCProviderConfig.update((Hashtable)txServiceProps);

    Filter dsfFilter = FrameworkUtil.createFilter("(&("+
            Constants.OBJECTCLASS + "="+DataSourceFactory.class.getName()+")"
            +txServiceProps.getProperty("aries.dsf.target.filter")+")");

    dsfTracker = new ServiceTracker<>(context, dsfFilter, null);

    dsfTracker.open();

    dataSourceFactory = dsfTracker.waitForService(3000);    

    Properties dsProps = new Properties();
    dsProps.load(this.getClass().getResourceAsStream("/ds.properties"));

    Connection con = dataSourceFactory.createDataSource(dsProps).getConnection();

    createTestTables(con);

    personDaoTracker = new ServiceTracker<>(context, PersonDao.class, null);
    personDaoTracker.open();

}
 
开发者ID:osgi,项目名称:osgi.enroute.examples.jdbc,代码行数:33,代码来源:PersonDAOTest.java


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