@Override public synchronized String[] listRegisteredAETitles() throws ConfigurationException { if (!configurationExists()) return StringUtils.EMPTY_STRING; return list(aetsRegistryDN, "(objectclass=dicomUniqueAETitle)", "dicomAETitle"); }
public void ensureConfigurationExists() throws ConfigurationException { if (!configurationExists()) initConfiguration(); }
@Override public synchronized String[] listDeviceNames() throws ConfigurationException { if (!configurationExists()) return StringUtils.EMPTY_STRING; return list(devicesDN, "(objectclass=dicomDevice)", "dicomDeviceName"); }
@Override public synchronized String[] listDeviceNames() throws ConfigurationException { if (!configurationExists()) return StringUtils.EMPTY_STRING; return list(devicesDN, "(objectclass=dicomDevice)", "dicomDeviceName"); }
@Override public synchronized String[] listRegisteredAETitles() throws ConfigurationException { if (!configurationExists()) return StringUtils.EMPTY_STRING; return list(aetsRegistryDN, "(objectclass=dicomUniqueAETitle)", "dicomAETitle"); }
public void ensureConfigurationExists() throws ConfigurationException { if (!configurationExists()) initConfiguration(); }
@Override public synchronized boolean purgeConfiguration() throws ConfigurationException { if (!configurationExists()) return false; try { destroySubcontextWithChilds(configurationDN); LOG.info("Purge DICOM Configuration at {}", configurationDN); clearConfigurationDN(); } catch (NamingException e) { throw new ConfigurationException(e); } return true; }
@Override public synchronized boolean purgeConfiguration() throws ConfigurationException { if (!configurationExists()) return false; try { destroySubcontextWithChilds(configurationDN); LOG.info("Purge DICOM Configuration at {}", configurationDN); clearConfigurationDN(); } catch (NamingException e) { throw new ConfigurationException(e); } return true; }
@Override public synchronized void unregisterAETitle(String aet) throws ConfigurationException { if (configurationExists()) try { ctx.destroySubcontext(aetDN(aet, aetsRegistryDN)); } catch (NameNotFoundException e) { } catch (NamingException e) { throw new ConfigurationException(e); } }
@Override public synchronized Device findDevice(String name) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); return loadDevice(deviceRef(name)); }
@Override public synchronized void unregisterAETitle(String aet) throws ConfigurationException { if (configurationExists()) try { ctx.destroySubcontext(aetDN(aet, aetsRegistryDN)); } catch (NameNotFoundException e) { } catch (NamingException e) { throw new ConfigurationException(e); } }
@Override public synchronized Device findDevice(String name) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); return loadDevice(deviceRef(name)); }
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; }
@Override public synchronized ConfigurationChanges removeDevice(String name, EnumSet<Option> options) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); String dn = deviceRef(name); removeDeviceWithDN(dn, options != null && options.contains(Option.REGISTER)); ConfigurationChanges diffs = new ConfigurationChanges(false); ConfigurationChanges.addModifiedObject(diffs, dn, ConfigurationChanges.ChangeType.D); return diffs; }
@Override public synchronized ConfigurationChanges removeDevice(String name, EnumSet<Option> options) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); String dn = deviceRef(name); removeDeviceWithDN(dn, options != null && options.contains(Option.REGISTER)); ConfigurationChanges diffs = new ConfigurationChanges(false); ConfigurationChanges.addModifiedObject(diffs, dn, ConfigurationChanges.ChangeType.D); return diffs; }
public synchronized Device findDevice(String filter, String childName) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); SearchControls ctls = searchControlSubtreeScope(1, StringUtils.EMPTY_STRING, false); NamingEnumeration<SearchResult> ne = null; String childDN; try { ne = ctx.search(devicesDN, filter, ctls); if (!ne.hasMore()) throw new ConfigurationNotFoundException(childName); childDN = ne.next().getNameInNamespace(); } catch (NamingException e) { throw new ConfigurationException(e); } finally { LdapUtils.safeClose(ne); } String deviceDN = childDN.substring(childDN.indexOf(',') + 1); return loadDevice(deviceDN); }
@Override public byte[][] loadDeviceVendorData(String deviceName) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); try { Attributes attrs = getAttributes(deviceRef(deviceName), new String[]{ "dicomVendorData" }); return byteArrays(attrs.get("dicomVendorData")); } catch (NameNotFoundException e) { throw new ConfigurationNotFoundException("Device with specified name not found", e); } catch (NamingException e) { throw new ConfigurationException(e); } }
public synchronized Device findDevice(String filter, String childName) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); SearchControls ctls = searchControlSubtreeScope(1, StringUtils.EMPTY_STRING, false); NamingEnumeration<SearchResult> ne = null; String childDN; try { ne = ctx.search(devicesDN, filter, ctls); if (!ne.hasMore()) throw new ConfigurationNotFoundException(childName); childDN = ne.next().getNameInNamespace(); } catch (NamingException e) { throw new ConfigurationException(e); } finally { LdapUtils.safeClose(ne); } String deviceDN = childDN.substring(childDN.indexOf(',') + 1); return loadDevice(deviceDN); }
@Override public byte[][] loadDeviceVendorData(String deviceName) throws ConfigurationException { if (!configurationExists()) throw new ConfigurationNotFoundException(); try { Attributes attrs = getAttributes(deviceRef(deviceName), new String[]{ "dicomVendorData" }); return byteArrays(attrs.get("dicomVendorData")); } catch (NameNotFoundException e) { throw new ConfigurationNotFoundException("Device with specified name not found", e); } catch (NamingException e) { throw new ConfigurationException(e); } }
@Override public ConfigurationChanges updateDeviceVendorData(String deviceName, byte[]... vendorData) throws ConfigurationException { String deviceRef = deviceRef(deviceName); if (!configurationExists()) throw new ConfigurationNotFoundException(); ConfigurationChanges diffs = new ConfigurationChanges(false); try { Attributes attrs = getAttributes(deviceRef, new String[]{"dicomVendorData"}); byte[][] prev = byteArrays(attrs.get("dicomVendorData")); ConfigurationChanges.ModifiedObject ldapObj = ConfigurationChanges.addModifiedObject(diffs, deviceRef, ConfigurationChanges.ChangeType.C); List<ModificationItem> mods = new ArrayList<>(1); storeDiff(ldapObj, mods, "dicomVendorData", prev, vendorData); modifyAttributes(deviceRef, mods); } catch (NameNotFoundException e) { throw new ConfigurationNotFoundException("Device with specified name not found", e); } catch (NamingException e) { throw new ConfigurationException(e); } return diffs; }