use of org.codice.ddf.configuration.DictionaryMap in project ddf by codice.
the class CatalogBundle method setResourceDownloadProperty.
private void setResourceDownloadProperty(String propertyName, Object propertyValue) throws IOException {
Map<String, Object> existingProperties;
try {
existingProperties = Optional.ofNullable(adminConfig.getAdminConsoleService().getProperties(CatalogBundle.RESOURCE_DOWNLOAD_MANAGER_PID)).orElse(new DictionaryMap<>());
} catch (NotCompliantMBeanException e) {
existingProperties = new DictionaryMap<>();
}
DictionaryMap<String, Object> updatedProperties = new DictionaryMap<>();
updatedProperties.putAll(existingProperties);
updatedProperties.put(propertyName, propertyValue);
Configuration configuration = adminConfig.getConfiguration(RESOURCE_DOWNLOAD_MANAGER_PID, null);
configuration.update(updatedProperties);
}
use of org.codice.ddf.configuration.DictionaryMap in project ddf by codice.
the class WfsSource method createFeatureMetacardTypeRegistration.
private MetacardTypeRegistration createFeatureMetacardTypeRegistration(FeatureTypeType featureTypeType, String ftName, XmlSchema schema) {
FeatureMetacardType ftMetacard = new FeatureMetacardType(schema, featureTypeType.getName(), nonQueryableProperties != null ? Arrays.stream(nonQueryableProperties).collect(toSet()) : new HashSet<>(), Wfs20Constants.GML_3_2_NAMESPACE);
Dictionary<String, Object> props = new DictionaryMap<>();
props.put(Metacard.CONTENT_TYPE, new String[] { ftName });
LOGGER.debug("WfsSource {}: Registering MetacardType: {}", getId(), ftName);
return new MetacardTypeRegistration(ftMetacard, props, featureTypeType.getDefaultCRS());
}
use of org.codice.ddf.configuration.DictionaryMap in project ddf by codice.
the class LdapLoginConfig method update.
/**
* Update method that receives new properties.
*
* @param props Map of properties.
*/
public void update(Map<String, ?> props) {
if (props != null) {
LOGGER.debug("Received an updated set of configurations for the LDAP Login Config.");
if (connectionPoolServiceRegistration != null) {
connectionPoolServiceRegistration.unregister();
}
if (ldapConnectionPool != null) {
ldapConnectionPool.close();
}
ConnectionFactory ldapConnectionFactory = null;
List<String> urls = new ArrayList<>();
Object urlsObj = props.get(LDAP_URL);
if (urlsObj instanceof String[]) {
urls.addAll(Arrays.asList((String[]) urlsObj));
} else {
urls.add(urlsObj.toString());
}
List<ConnectionFactory> connectionFactories = new ArrayList<>();
Boolean startTls = props.get(START_TLS) != null && Boolean.parseBoolean(props.get(START_TLS).toString());
for (String url : urls) {
connectionFactories.add(createLdapConnectionFactory(url, startTls));
}
String loadBalancingAlgorithm = (String) props.get(LDAP_LOAD_BALANCING);
Options options = Options.defaultOptions();
if (FAILOVER.equalsIgnoreCase(loadBalancingAlgorithm)) {
ldapConnectionFactory = Connections.newFailoverLoadBalancer(connectionFactories, options);
} else {
ldapConnectionFactory = Connections.newRoundRobinLoadBalancer(connectionFactories, options);
}
ldapConnectionPool = new GenericObjectPool<>(new LdapConnectionPooledObjectFactory(ldapConnectionFactory), createGenericPoolConfig(id), createGenericPoolAbandonConfig());
Dictionary<String, String> serviceProps = new DictionaryMap<>();
serviceProps.put("id", id);
LOGGER.debug("Registering LdapConnectionPool");
connectionPoolServiceRegistration = context.registerService(GenericObjectPool.class.getName(), ldapConnectionPool, serviceProps);
// create modules from the newly updated config
Module ldapModule = createLdapModule(props);
ldapService.update(ldapModule);
}
}
use of org.codice.ddf.configuration.DictionaryMap in project ddf by codice.
the class TransformerConsumer method doStart.
@Override
protected void doStart() throws CatalogTransformerException {
LOGGER.debug("ENTERING: doStart");
try {
super.doStart();
} catch (Exception e) {
throw new CatalogTransformerException("Failed to start Transformer Consumer", e);
}
DictionaryMap<String, String> props = new DictionaryMap<>();
if (endpoint.getTransformerId() != null) {
props.put(MimeTypeToTransformerMapper.ID_KEY, endpoint.getTransformerId());
}
if (endpoint.getMimeType() != null) {
props.put(MimeTypeToTransformerMapper.MIME_TYPE_KEY, endpoint.getMimeType());
}
if (LOGGER.isDebugEnabled()) {
LOGGER.debug("Registering as QueryResponseTransformer with id={}", endpoint.getTransformerId());
}
// Register this Catalog Consumer as an QueryResponseTransformer in the OSGi registry.
// The transformer ID (e.g., id=text/xml;id=xml) specified in the Camel route node
// is used as the "id" key for this QueryResponseTransformer in the OSGi registry.
// (This is how the CatalogContentPlugin will be able to look up this transformer by
// mimetype)
registration = endpoint.getComponent().getBundleContext().registerService(transformerClass.getName(), this, props);
LOGGER.debug("EXITING: doStart");
}
use of org.codice.ddf.configuration.DictionaryMap in project ddf by codice.
the class CatalogFrameworkImpl method registerBasicMetacard.
private void registerBasicMetacard() {
Bundle bundle = FrameworkUtil.getBundle(CatalogFrameworkImpl.class);
if (bundle != null && bundle.getBundleContext() != null) {
Dictionary<String, Object> properties = new DictionaryMap<>();
properties.put("name", MetacardImpl.BASIC_METACARD.getName());
bundle.getBundleContext().registerService(MetacardType.class, MetacardImpl.BASIC_METACARD, properties);
}
}
Aggregations