use of org.osgi.service.cm.Configuration in project ddf by codice.
the class AdminConfig method setLogLevels.
public void setLogLevels() throws IOException {
String logLevel = System.getProperty(TEST_LOGLEVEL_PROPERTY);
String securityLogLevel = System.getProperty(TEST_SECURITYLOGLEVEL_PROPERTY);
Configuration logConfig = configAdmin.getConfiguration(LOG_CONFIG_PID, null);
Dictionary<String, Object> properties = logConfig.getProperties();
properties.put(LOGGER_PREFIX + "*", DEFAULT_LOG_LEVEL);
if (!StringUtils.isEmpty(logLevel)) {
properties.put(LOGGER_PREFIX + "ddf", logLevel);
properties.put(LOGGER_PREFIX + "org.codice", logLevel);
if (StringUtils.isEmpty(securityLogLevel)) {
properties.put(LOGGER_PREFIX + "ddf.security.expansion.impl.RegexExpansion", logLevel);
properties.put(LOGGER_PREFIX + "ddf.security.service.impl.AbstractAuthorizingRealm", logLevel);
}
}
logConfig.update(properties);
}
use of org.osgi.service.cm.Configuration in project ddf by codice.
the class ServiceManagerImpl method createManagedService.
@Override
public Configuration createManagedService(String factoryPid, Map<String, Object> properties) throws IOException {
Configuration sourceConfig = adminConfig.createFactoryConfiguration(factoryPid, null);
startManagedService(sourceConfig, properties);
return sourceConfig;
}
use of org.osgi.service.cm.Configuration in project ddf by codice.
the class SynchronizedConfiguration method updateConfig.
public final void updateConfig() throws Exception {
Configuration config = configAdmin.getConfiguration(pid, location);
config.update(new Hashtable<>(configProps));
long timeoutLimit = System.currentTimeMillis() + CONFIG_UPDATE_MAX_WAIT_MILLIS;
boolean retried = false;
while (true) {
if (configCallable.call()) {
break;
} else {
//if it still keeps failing then we should remove this
if (!retried && System.currentTimeMillis() > timeoutLimit - CONFIG_UPDATE_MAX_WAIT_MILLIS / 2) {
config.update(new Hashtable<>(configProps));
retried = true;
}
if (System.currentTimeMillis() > timeoutLimit) {
fail(String.format("Timed out waiting for configuration change for %s", pid));
} else {
Thread.sleep(LOOP_SLEEP_MILLIS);
}
}
}
}
use of org.osgi.service.cm.Configuration in project ddf by codice.
the class SystemStateManager method captureSystemState.
private void captureSystemState() {
LOGGER.info("Capturing system state");
try {
baseFeatures = Arrays.stream(features.listInstalledFeatures()).map(e -> e.getName()).collect(Collectors.toList());
Configuration[] configs = adminConfig.listConfigurations(CONFIGURATION_FILTER);
for (Configuration config : configs) {
baseConfigurations.put(config.getPid(), config);
}
console.runCommand("catalog:export --provider --force --skip-signature-verification --delete=false --output \"./itest-catalog-entries.zip\" --cql \"\\\"metacard-tags\\\" like '*'\"");
LOGGER.info("Feature Count: {}", baseFeatures.size());
LOGGER.info("Configuration Count: {}", baseConfigurations.size());
} catch (Exception e) {
LOGGER.error("Error capturing system configuration.", e);
}
}
use of org.osgi.service.cm.Configuration in project ddf by codice.
the class ServiceManagerImpl method stopManagedService.
@Override
public void stopManagedService(String servicePid) throws IOException {
Configuration sourceConfig = adminConfig.getConfiguration(servicePid, null);
ServiceManagerImpl.ServiceConfigurationListener listener = new ServiceManagerImpl.ServiceConfigurationListener(sourceConfig.getPid());
adminConfig.getDdfConfigAdmin().delete(sourceConfig.getPid());
}
Aggregations