use of org.dcm4che3.conf.api.ConfigurationException in project dcm4che by dcm4che.
the class JsonConfigurationTest method loadARR.
private static Device loadARR() throws IOException, ConfigurationException {
Path path = Paths.get("src/test/data/arrdevice.json");
try (BufferedReader reader = Files.newBufferedReader(path, Charset.forName("UTF-8"))) {
JsonConfiguration config = new JsonConfiguration();
config.addJsonConfigurationExtension(new JsonAuditRecordRepositoryConfiguration());
return config.loadDeviceFrom(Json.createParser(reader), null);
}
}
use of org.dcm4che3.conf.api.ConfigurationException in project dcm4che by dcm4che.
the class LdapHL7Configuration method appNamesRegistryExists.
private boolean appNamesRegistryExists() throws ConfigurationException {
if (appNamesRegistryDN != null)
return true;
if (!config.configurationExists())
return false;
String dn = CN_UNIQUE_HL7_APPLICATION_NAMES_REGISTRY + config.getConfigurationDN();
try {
if (!config.exists(dn))
return false;
} catch (NamingException e) {
throw new ConfigurationException(e);
}
appNamesRegistryDN = dn;
return true;
}
use of org.dcm4che3.conf.api.ConfigurationException in project dcm4che by dcm4che.
the class LdapHL7Configuration method listHL7AppInfos.
@Override
public synchronized HL7ApplicationInfo[] listHL7AppInfos(HL7ApplicationInfo keys) throws ConfigurationException {
if (!config.configurationExists())
return new HL7ApplicationInfo[0];
ArrayList<HL7ApplicationInfo> results = new ArrayList<HL7ApplicationInfo>();
NamingEnumeration<SearchResult> ne = null;
try {
String deviceName = keys.getDeviceName();
ne = config.search(deviceName, HL7_ATTRS, toFilter(keys));
Map<String, Connection> connCache = new HashMap<>();
while (ne.hasMore()) {
HL7ApplicationInfo hl7AppInfo = new HL7ApplicationInfo();
SearchResult ne1 = ne.next();
loadFrom(hl7AppInfo, ne1.getAttributes(), deviceName != null ? deviceName : LdapUtils.cutDeviceName(ne1.getName()), connCache);
results.add(hl7AppInfo);
}
} catch (NameNotFoundException e) {
return new HL7ApplicationInfo[0];
} catch (NamingException e) {
throw new ConfigurationException(e);
} finally {
LdapUtils.safeClose(ne);
}
return results.toArray(new HL7ApplicationInfo[results.size()]);
}
use of org.dcm4che3.conf.api.ConfigurationException in project dcm4che by dcm4che.
the class LdapHL7Configuration method loadHL7Application.
private HL7Application loadHL7Application(SearchResult sr, String deviceDN, Device device) throws NamingException, ConfigurationException {
Attributes attrs = sr.getAttributes();
HL7Application hl7app = new HL7Application(LdapUtils.stringValue(attrs.get("hl7ApplicationName"), null));
loadFrom(hl7app, attrs);
for (String connDN : LdapUtils.stringArray(attrs.get("dicomNetworkConnectionReference"))) hl7app.addConnection(LdapUtils.findConnection(connDN, deviceDN, device));
for (LdapHL7ConfigurationExtension ext : extensions) ext.loadChilds(hl7app, sr.getNameInNamespace());
return hl7app;
}
use of org.dcm4che3.conf.api.ConfigurationException in project dcm4che by dcm4che.
the class JsonAuditLoggerConfiguration method loadFrom.
private void loadFrom(AuditLoggerDeviceExtension ext, JsonReader reader, List<Connection> conns, ConfigurationDelegate config) throws ConfigurationException {
reader.next();
reader.expect(JsonParser.Event.START_ARRAY);
while (reader.next() == JsonParser.Event.START_OBJECT) {
AuditLogger logger = new AuditLogger();
loadFrom(logger, reader, conns, config);
reader.expect(JsonParser.Event.END_OBJECT);
ext.addAuditLogger(logger);
}
reader.expect(JsonParser.Event.END_ARRAY);
}
Aggregations