本文整理匯總了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();
}