Search in sources :

Example 1 with ConfigurationAdminMBean

use of org.codice.ddf.ui.admin.api.ConfigurationAdminMBean in project admin-console-beta by connexta.

the class ManagedServiceOperation method readState.

@Override
public Map<String, Map<String, Object>> readState() throws ConfiguratorException {
    try {
        String[][] configurations = getConfigAdmin().getConfigurations(String.format("(service.factoryPid=%s)", factoryPid));
        if (configurations == null || configurations.length == 0) {
            return Collections.emptyMap();
        }
        HashMap<String, Map<String, Object>> retVal = new HashMap<>();
        ConfigurationAdminMBean configAdminMBean = getConfigAdminMBean();
        for (String[] configuration : configurations) {
            String configPid = configuration[0];
            retVal.put(configPid, configAdminMBean.getProperties(configPid));
        }
        return retVal;
    } catch (IOException | MalformedObjectNameException e) {
        LOGGER.debug("Error retrieving configurations for factoryPid, {}", factoryPid, e);
        throw new ConfiguratorException("Error retrieving configurations");
    }
}
Also used : ConfigurationAdminMBean(org.codice.ddf.ui.admin.api.ConfigurationAdminMBean) MalformedObjectNameException(javax.management.MalformedObjectNameException) HashMap(java.util.HashMap) IOException(java.io.IOException) ConfiguratorException(org.codice.ddf.admin.configurator.ConfiguratorException) Map(java.util.Map) HashMap(java.util.HashMap)

Aggregations

IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 ConfiguratorException (org.codice.ddf.admin.configurator.ConfiguratorException)1 ConfigurationAdminMBean (org.codice.ddf.ui.admin.api.ConfigurationAdminMBean)1