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