本文整理汇总了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 );
}
示例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
}
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}
示例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();
}