當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。