Search in sources :

Example 1 with ConfigurationException

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);
    }
}
Also used : Path(java.nio.file.Path) JsonAuditRecordRepositoryConfiguration(org.dcm4che3.conf.json.audit.JsonAuditRecordRepositoryConfiguration) BufferedReader(java.io.BufferedReader)

Example 2 with ConfigurationException

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;
}
Also used : ConfigurationException(org.dcm4che3.conf.api.ConfigurationException)

Example 3 with ConfigurationException

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()]);
}
Also used : HashMap(java.util.HashMap) ConfigurationException(org.dcm4che3.conf.api.ConfigurationException) ArrayList(java.util.ArrayList) Connection(org.dcm4che3.net.Connection) HL7ApplicationInfo(org.dcm4che3.net.hl7.HL7ApplicationInfo)

Example 4 with ConfigurationException

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;
}
Also used : HL7Application(org.dcm4che3.net.hl7.HL7Application)

Example 5 with ConfigurationException

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);
}
Also used : AuditLogger(org.dcm4che3.net.audit.AuditLogger)

Aggregations

ConfigurationException (org.dcm4che3.conf.api.ConfigurationException)60 Attributes (org.dcm4che3.data.Attributes)10 ArchiveDeviceExtension (org.dcm4chee.arc.conf.ArchiveDeviceExtension)10 IOException (java.io.IOException)9 Response (javax.ws.rs.core.Response)9 ApplicationEntity (org.dcm4che3.net.ApplicationEntity)9 HL7DeviceExtension (org.dcm4che3.net.hl7.HL7DeviceExtension)8 ArrayList (java.util.ArrayList)7 Device (org.dcm4che3.net.Device)7 HL7Application (org.dcm4che3.net.hl7.HL7Application)7 DicomServiceException (org.dcm4che3.net.service.DicomServiceException)7 JsonGenerator (javax.json.stream.JsonGenerator)5 QueryAttributes (org.dcm4chee.arc.query.util.QueryAttributes)5 NoCache (org.jboss.resteasy.annotations.cache.NoCache)5 JsonParsingException (javax.json.stream.JsonParsingException)4 AsyncResponse (javax.ws.rs.container.AsyncResponse)4 RequestScoped (javax.enterprise.context.RequestScoped)3 Inject (javax.inject.Inject)3 Json (javax.json.Json)3 HttpServletRequest (javax.servlet.http.HttpServletRequest)3