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


Java ConfigurationAdmin.listConfigurations方法代码示例

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


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

示例1: factory

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
@Test
public void factory() throws IOException, InvalidSyntaxException {
    ServiceReference<ConfigurationAdmin> reference = bundleContext
            .getServiceReference(ConfigurationAdmin.class);
    ConfigurationAdmin configurationAdmin = bundleContext.getService(reference);

    org.osgi.service.cm.Configuration[] configurations = configurationAdmin
            .listConfigurations("(service.factoryPid=test)");
    assertNotNull(configurations);

    Dictionary<String, Object> properties = configurations[0].getProperties();

    assertNotNull(properties);

    assertEquals("value3", properties.get("test3"));

    bundleContext.ungetService(reference);
}
 
开发者ID:yrashk,项目名称:etcetera,代码行数:19,代码来源:BackendConfigurationTest.java

示例2: getConfiguration

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
protected Configuration getConfiguration( final String pid )
{
    final ConfigurationAdmin ca = getConfigurationAdmin();
    try
    {
        final String filter = "(" + Constants.SERVICE_PID + "=" + pid + ")";
        final Configuration[] configs = ca.listConfigurations( filter );
        if ( configs != null && configs.length > 0 )
        {
            return configs[0];
        }
    }
    catch ( InvalidSyntaxException ise )
    {
        // unexpected
    }
    catch ( IOException ioe )
    {
        TestCase.fail( "Failed listing configurations " + pid + ": " + ioe.toString() );
    }

    TestCase.fail( "No Configuration " + pid + " found" );
    return null;
}
 
开发者ID:mcculls,项目名称:osgi-in-action,代码行数:25,代码来源:ConfigurationTestBase.java

示例3: deleteFactoryConfigurations

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
protected void deleteFactoryConfigurations( String factoryPid )
{
    ConfigurationAdmin ca = getConfigurationAdmin();
    try
    {
        final String filter = "(service.factoryPid=" + factoryPid + ")";
        Configuration[] configs = ca.listConfigurations( filter );
        if ( configs != null )
        {
            for ( Configuration configuration : configs )
            {
                configuration.delete();
            }
        }
    }
    catch ( InvalidSyntaxException ise )
    {
        // unexpected
    }
    catch ( IOException ioe )
    {
        TestCase.fail( "Failed deleting configurations " + factoryPid + ": " + ioe.toString() );
    }
}
 
开发者ID:mcculls,项目名称:osgi-in-action,代码行数:25,代码来源:ConfigurationTestBase.java

示例4: handleList

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
private void handleList(String args, ConfigurationAdmin admin, PrintStream out) throws IOException, InvalidSyntaxException {
  Configuration[] configurations = null;
  if (args.equals("list")) {
    configurations = admin.listConfigurations(null);
  } else {
    configurations = admin.listConfigurations(args.substring(
      "list".length()).trim());
  }
  if (configurations != null) {
    for (Configuration configuration : configurations) {
      Dictionary properties = configuration.getProperties();
      for (Enumeration e = properties.keys(); e
        .hasMoreElements();) {
        Object key = e.nextElement();
        out.println(key + "=" + properties.get(key));
      }
    }
  }
}
 
开发者ID:mcculls,项目名称:osgi-in-action,代码行数:20,代码来源:ConfigAdminCommand.java

示例5: handleRemoveFactory

import org.osgi.service.cm.ConfigurationAdmin; //导入方法依赖的package包/类
private void handleRemoveFactory(String args, ConfigurationAdmin admin) throws IOException, InvalidSyntaxException {
  Configuration[] configurations = admin
  .listConfigurations("(service.pid=" +
    args.substring("remove-factory".length()).trim() + ")");
configurations[0].delete();

}
 
开发者ID:mcculls,项目名称:osgi-in-action,代码行数:8,代码来源:ConfigAdminCommand.java


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