use of org.nhind.config.Setting in project nhin-d by DirectProject.
the class XdConfig method getValue.
private String getValue(Settings xdSetting) throws Exception {
Setting tmp;
String value = null;
if (proxy != null) {
tmp = proxy.getSettingByName(xdSetting.getKey());
if (tmp != null)
value = tmp.getValue();
else
value = xdSetting.getDefault();
}
return value;
}
use of org.nhind.config.Setting in project nhin-d by DirectProject.
the class WSDNSServerConfig method getServerSettings.
/*
* Just use the basic settings provider for now. Will only allow setting the port and IP bindings.
*/
private Provider<DNSServerSettings> getServerSettings() {
String ipBindings = "";
int port = 0;
try {
Setting[] settings = cfService.getSettingsByNames(new String[] { DNS_SERVER_BINDING, DNS_SERVER_PORT });
if (settings != null && settings.length > 0) {
for (Setting setting : settings) {
if (setting.getName().equalsIgnoreCase(DNS_SERVER_BINDING)) {
ipBindings = setting.getValue();
} else if (setting.getName().equalsIgnoreCase(DNS_SERVER_PORT)) {
String sPort = setting.getValue();
try {
port = Integer.parseInt(sPort);
} catch (Exception e) {
LOGGER.warn("Could not parse port setting " + port + " from configuration service");
}
}
}
}
} catch (Exception e) {
LOGGER.warn("Could not get DNS setting from web service.");
}
if ((ipBindings == null || ipBindings.length() == 0) && port == 0 && settings != null) {
LOGGER.info("Using DNS server settings from injected provider.");
return settings;
}
LOGGER.info("Using DNS server settings from configuration service.");
return new BasicDNSServerSettingsProvider(ipBindings, port);
}
use of org.nhind.config.Setting in project nhin-d by DirectProject.
the class WSSmtpAgentConfig method buildMDNSettings.
protected void buildMDNSettings() {
Setting autoResponseSettings;
Setting prodNameSetting;
Setting textSetting;
try {
autoResponseSettings = cfService.getSettingByName("MDNAutoResponse");
prodNameSetting = cfService.getSettingByName("MDNProdName");
textSetting = cfService.getSettingByName("MDNText");
} catch (Exception e) {
throw new SmtpAgentException(SmtpAgentError.InvalidConfigurationFormat, "WebService error getting MDN settings: " + e.getMessage(), e);
}
boolean autoResponse = (autoResponseSettings == null) ? true : Boolean.parseBoolean(autoResponseSettings.getValue());
String prodName = (prodNameSetting == null) ? "" : prodNameSetting.getValue();
String text = (textSetting == null) ? "" : textSetting.getValue();
notificationProducer = new NotificationProducer(new NotificationSettings(autoResponse, prodName, text));
}
use of org.nhind.config.Setting in project nhin-d by DirectProject.
the class WSSmtpAgentConfig method buildPublicCertStore.
/*
* Build the certificate resolver for public certificates
*/
@SuppressWarnings("unchecked")
protected void buildPublicCertStore() {
Provider<CertificateResolver> resolverProvider = null;
Collection<Provider<CertificateResolver>> resolverProviders = new ArrayList<Provider<CertificateResolver>>();
Setting setting = null;
String storeTypes;
try {
setting = cfService.getSettingByName("PublicStoreType");
} catch (Exception e) {
throw new SmtpAgentException(SmtpAgentError.InvalidConfigurationFormat, "WebService error getting public store type: " + e.getMessage(), e);
}
if (setting == null || setting.getValue() == null || setting.getValue().isEmpty())
// default to DNS
storeTypes = STORE_TYPE_DNS + "," + STORE_TYPE_PUBLIC_LDAP;
else
storeTypes = setting.getValue();
/*
* KeyStore based resolver
*/
String[] types = storeTypes.split(",");
for (String storeType : types) {
if (storeType.equalsIgnoreCase(STORE_TYPE_KEYSTORE)) {
Setting file;
Setting pass;
Setting privKeyPass;
try {
file = cfService.getSettingByName("PublicStoreFile");
pass = cfService.getSettingByName("PublicStoreFilePass");
privKeyPass = cfService.getSettingByName("PublicStorePrivKeyPass");
} catch (Exception e) {
throw new SmtpAgentException(SmtpAgentError.InvalidConfigurationFormat, "WebService error getting public store file settings: " + e.getMessage(), e);
}
resolverProvider = new KeyStoreCertificateStoreProvider((file == null) ? "PublicStoreKeyFile" : file.getValue(), (pass == null) ? "DefaultFilePass" : pass.getValue(), (privKeyPass == null) ? "DefaultKeyPass" : privKeyPass.getValue());
} else /*
* DNS resolver
*/
if (storeType.equalsIgnoreCase(STORE_TYPE_DNS)) {
resolverProvider = new DNSCertStoreProvider(Collections.EMPTY_LIST, null, new DNSCertificateStore.DefaultDNSCachePolicy());
} else /*
* Web Services
*/
if (storeType.equalsIgnoreCase(STORE_TYPE_WS)) {
resolverProvider = new ConfigServiceCertificateStoreProvider(cfService, null, new ConfigServiceCertificateStore.DefaultConfigStoreCachePolicy(), this.storeProvider);
} else /*
* Public LDAP resolver
*/
if (storeType.equalsIgnoreCase(STORE_TYPE_PUBLIC_LDAP)) {
resolverProvider = new PublicLdapCertificateStoreProvider(null, new LDAPCertificateStore.DefaultLDAPCachePolicy());
} else /*
* Default to DNS with a default cache policy
*/
{
resolverProvider = new DNSCertStoreProvider(Collections.EMPTY_LIST, null, new DNSCertificateStore.DefaultDNSCachePolicy());
}
resolverProviders.add(resolverProvider);
}
publicCertModule = new PublicCertStoreModule(resolverProviders);
}
use of org.nhind.config.Setting in project nhin-d by DirectProject.
the class WSSmtpAgentConfig method buildMessageSettings.
protected void buildMessageSettings(String type) {
Setting folderSettings;
try {
folderSettings = cfService.getSettingByName(type + "MessageSaveFolder");
} catch (Exception e) {
throw new SmtpAgentException(SmtpAgentError.InvalidConfigurationFormat, "WebService error getting " + type + " message settings: " + e.getMessage(), e);
}
String saveFolder = (folderSettings == null) ? null : folderSettings.getValue();
MessageProcessingSettings settings = null;
if (type.equalsIgnoreCase(MESSAGE_SETTING_RAW))
settings = rawSettings = new RawMessageSettings();
else if (type.equalsIgnoreCase(MESSAGE_SETTING_INCOMING))
settings = incomingSettings = new ProcessIncomingSettings();
else if (type.equalsIgnoreCase(MESSAGE_SETTING_OUTGOING))
settings = outgoingSettings = new ProcessOutgoingSettings();
else if (type.equalsIgnoreCase(MESSAGE_SETTING_BAD))
settings = badSettings = new ProcessBadMessageSettings();
if (saveFolder != null && settings != null)
settings.setSaveMessageFolder(new File(saveFolder));
}
Aggregations