use of java.util.Dictionary in project camel by apache.
the class AbstractFeatureTest method overridePropertiesWithConfigAdmin.
protected void overridePropertiesWithConfigAdmin(String pid, Properties props) throws IOException {
ConfigurationAdmin configAdmin = getOsgiService(bundleContext, ConfigurationAdmin.class);
// passing null as second argument ties the configuration to correct bundle.
Configuration config = configAdmin.getConfiguration(pid, null);
if (config == null) {
throw new IllegalArgumentException("Cannot find configuration with pid " + pid + " in OSGi ConfigurationAdmin service.");
}
// let's merge configurations
Dictionary<String, Object> currentProperties = config.getProperties();
Dictionary newProps = new Properties();
if (currentProperties == null) {
currentProperties = newProps;
}
for (Enumeration<String> ek = currentProperties.keys(); ek.hasMoreElements(); ) {
String k = ek.nextElement();
newProps.put(k, currentProperties.get(k));
}
for (String p : props.stringPropertyNames()) {
newProps.put(p, props.getProperty(p));
}
LOG.info("Updating ConfigAdmin {} by overriding properties {}", config, newProps);
config.update(newProps);
}
use of java.util.Dictionary in project opennms by OpenNMS.
the class HeartbeatSinkPerfIT method addServicesOnStartup.
@SuppressWarnings("rawtypes")
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
services.put(MinionIdentity.class.getName(), new KeyValueHolder<Object, Dictionary>(new MinionIdentity() {
@Override
public String getId() {
return "0";
}
@Override
public String getLocation() {
return REMOTE_LOCATION_NAME;
}
}, new Properties()));
Properties props = new Properties();
props.setProperty("alias", "opennms.broker");
services.put(Component.class.getName(), new KeyValueHolder<Object, Dictionary>(queuingservice, props));
}
use of java.util.Dictionary in project opennms by OpenNMS.
the class EchoRpcBlueprintIT method addServicesOnStartup.
@SuppressWarnings("rawtypes")
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
services.put(MinionIdentity.class.getName(), new KeyValueHolder<Object, Dictionary>(new MockMinionIdentity(REMOTE_LOCATION_NAME), new Properties()));
Properties props = new Properties();
props.setProperty("alias", "opennms.broker");
services.put(Component.class.getName(), new KeyValueHolder<Object, Dictionary>(queuingservice, props));
}
use of java.util.Dictionary in project opennms by OpenNMS.
the class SinkBlueprintMessageFailureIT method addServicesOnStartup.
@SuppressWarnings("rawtypes")
@Override
protected void addServicesOnStartup(Map<String, KeyValueHolder<Object, Dictionary>> services) {
services.put(MinionIdentity.class.getName(), new KeyValueHolder<Object, Dictionary>(new MinionIdentity() {
@Override
public String getId() {
return "0";
}
@Override
public String getLocation() {
return REMOTE_LOCATION_NAME;
}
}, new Properties()));
Properties props = new Properties();
props.setProperty("alias", "opennms.broker");
services.put(Component.class.getName(), new KeyValueHolder<Object, Dictionary>(queuingservice, props));
}
use of java.util.Dictionary in project opennms by OpenNMS.
the class ApplicationFactoryServiceTracker method addingService.
@SuppressWarnings({ "unchecked" })
@Override
public Object addingService(ServiceReference reference) {
ApplicationFactory factory = (ApplicationFactory) super.addingService(reference);
if (factory == null)
return null;
FactoryServlet servlet = new FactoryServlet(factory, reference.getBundle().getBundleContext());
Dictionary props = new Properties();
for (String key : reference.getPropertyKeys()) {
props.put(key, reference.getProperty(key));
}
if (props.get(Constants.ALIAS) == null) {
logger.warn("You have not set the alias property for ApplicationFactory: " + factory);
}
m_serviceRegistration.put(factory, context.registerService(Servlet.class.getName(), servlet, props));
return factory;
}
Aggregations