use of org.dcm4chee.arc.event.SoftwareConfiguration in project dcm4chee-arc-light by dcm4che.
the class ConfigurationRS method createDevice.
@POST
@Path("/devices/{DeviceName}")
@Consumes("application/json")
public void createDevice(@PathParam("DeviceName") String deviceName, Reader content) {
logRequest();
Device device = toDevice(deviceName, content);
try {
ConfigurationChanges diffs = conf.persist(device, options());
softwareConfigurationEvent.fire(new SoftwareConfiguration(request, deviceName, diffs));
} catch (IllegalStateException | ConfigurationNotFoundException e) {
throw new WebApplicationException(errResponse(e.getMessage(), Response.Status.NOT_FOUND));
} catch (IllegalArgumentException e) {
throw new WebApplicationException(errResponse(e.getMessage(), Response.Status.BAD_REQUEST));
} catch (ConfigurationException e) {
throw new WebApplicationException(errResponse(e.getMessage(), Response.Status.CONFLICT));
} catch (Exception e) {
throw new WebApplicationException(errResponseAsTextPlain(exceptionAsString(e), Response.Status.INTERNAL_SERVER_ERROR));
}
}
use of org.dcm4chee.arc.event.SoftwareConfiguration in project dcm4chee-arc-light by dcm4che.
the class ConfigurationRS method deleteDevice.
@DELETE
@Path("/devices/{DeviceName}")
public void deleteDevice(@PathParam("DeviceName") String deviceName) {
logRequest();
try {
ConfigurationChanges diffs = conf.removeDevice(deviceName, options());
softwareConfigurationEvent.fire(new SoftwareConfiguration(request, deviceName, diffs));
} catch (IllegalStateException | ConfigurationNotFoundException e) {
throw new WebApplicationException(errResponse(e.getMessage(), Response.Status.NOT_FOUND));
} catch (ConfigurationException e) {
throw new WebApplicationException(errResponse(e.getMessage(), Response.Status.CONFLICT));
} catch (Exception e) {
throw new WebApplicationException(errResponseAsTextPlain(exceptionAsString(e), Response.Status.INTERNAL_SERVER_ERROR));
}
}
use of org.dcm4chee.arc.event.SoftwareConfiguration in project dcm4chee-arc-light by dcm4che.
the class ArchiveServiceImpl method mergeSoftwareVersions.
private void mergeSoftwareVersions() {
Properties gitProps = new Properties();
InputStream in = ArchiveService.class.getResourceAsStream("git.properties");
if (in == null) {
LOG.warn("Missing git.properties");
return;
}
try {
gitProps.load(in);
} catch (IOException e) {
LOG.warn("Failed to read git.properties", e);
return;
}
String[] versions = { "master".equals(gitProps.getProperty("git.branch")) ? gitProps.getProperty("git.build.version") : gitProps.getProperty("git.build.version") + '-' + gitProps.getProperty("git.branch"), gitProps.getProperty("git.commit.id.abbrev"), gitProps.getProperty("git.commit.time") };
if (!LdapUtils.equals(device.getSoftwareVersions(), versions)) {
try {
LOG.info("Update Software Version in LDAP to: {}", Arrays.toString(versions));
device.setSoftwareVersions(versions);
ConfigurationChanges diffs = conf.merge(device, EnumSet.of(DicomConfiguration.Option.PRESERVE_VENDOR_DATA, DicomConfiguration.Option.PRESERVE_CERTIFICATE, DicomConfiguration.Option.CONFIGURATION_CHANGES));
softwareConfigurationEvent.fire(new SoftwareConfiguration(null, device.getDeviceName(), diffs));
} catch (ConfigurationException e) {
LOG.warn("Failed to update Software Version in LDAP:\n", e);
}
}
}
use of org.dcm4chee.arc.event.SoftwareConfiguration in project dcm4chee-arc-light by dcm4che.
the class UpdateMetadataScheduler method updateDeviceConfiguration.
private void updateDeviceConfiguration(ArchiveDeviceExtension arcDev) {
try {
LOG.info("Update Storage configuration of Device: {}:\n", device.getDeviceName());
ConfigurationChanges diffs = conf.merge(device, EnumSet.of(DicomConfiguration.Option.PRESERVE_VENDOR_DATA, DicomConfiguration.Option.PRESERVE_CERTIFICATE, arcDev.isAuditSoftwareConfigurationVerbose() ? DicomConfiguration.Option.CONFIGURATION_CHANGES_VERBOSE : DicomConfiguration.Option.CONFIGURATION_CHANGES));
softwareConfigurationEvent.fire(new SoftwareConfiguration(null, device.getDeviceName(), diffs));
} catch (ConfigurationException e) {
LOG.warn("Failed to update Storage configuration of Device: {}:\n", device.getDeviceName(), e);
}
}
use of org.dcm4chee.arc.event.SoftwareConfiguration in project dcm4chee-arc-light by dcm4che.
the class StoreServiceImpl method updateDeviceConfiguration.
private void updateDeviceConfiguration(ArchiveDeviceExtension arcDev) {
Device device = arcDev.getDevice();
try {
LOG.info("Update Storage configuration of Device: {}", device.getDeviceName());
ConfigurationChanges diffs = conf.merge(device, EnumSet.of(DicomConfiguration.Option.PRESERVE_VENDOR_DATA, DicomConfiguration.Option.PRESERVE_CERTIFICATE, arcDev.isAuditSoftwareConfigurationVerbose() ? DicomConfiguration.Option.CONFIGURATION_CHANGES_VERBOSE : DicomConfiguration.Option.CONFIGURATION_CHANGES));
softwareConfigurationEvent.fire(new SoftwareConfiguration(null, device.getDeviceName(), diffs));
} catch (ConfigurationException e) {
LOG.warn("Failed to update Storage configuration of Device: {}:\n", device.getDeviceName(), e);
}
}
Aggregations