Exemplo n.º 1
0
 @Override
 public void destroy() {
   if (mbean != null)
     try {
       ManagementFactory.getPlatformMBeanServer().unregisterMBean(mbean.getObjectName());
     } catch (Exception e) {
       e.printStackTrace();
     }
   if (proxy != null) proxy.stop();
   if (dicomConfig != null) dicomConfig.close();
 }
 private Device init(Device device, Issuer issuer, Code institutionCode) throws Exception {
   String name = device.getDeviceName();
   device.setThisNodeCertificates(
       config.deviceRef(name), (X509Certificate) keyStore.getCertificate(name));
   device.setIssuerOfPatientID(issuer);
   device.setIssuerOfAccessionNumber(issuer);
   if (institutionCode != null) {
     device.setInstitutionNames(institutionCode.getCodeMeaning());
     device.setInstitutionCodes(institutionCode);
   }
   return device;
 }
  public Device createArchiveDevice(String name, Device arrDevice, boolean sampleConfig)
      throws Exception {
    Device device = new Device(name);

    Connection dicom = new Connection("dicom", "localhost", 11112);
    dicom.setBindAddress("0.0.0.0");
    dicom.setClientBindAddress("0.0.0.0");
    dicom.setMaxOpsInvoked(0);
    dicom.setMaxOpsPerformed(0);
    device.addConnection(dicom);

    Connection dicomTLS = null;
    if (sampleConfig) {
      dicomTLS = new Connection("dicom-tls", "localhost", 2762);
      dicomTLS.setBindAddress("0.0.0.0");
      dicomTLS.setClientBindAddress("0.0.0.0");
      dicomTLS.setMaxOpsInvoked(0);
      dicomTLS.setMaxOpsPerformed(0);
      dicomTLS.setTlsCipherSuites(
          Connection.TLS_RSA_WITH_AES_128_CBC_SHA, Connection.TLS_RSA_WITH_3DES_EDE_CBC_SHA);
      device.addConnection(dicomTLS);
    }

    addArchiveDeviceExtension(device, sampleConfig);
    addHL7DeviceExtension(device, sampleConfig);
    addAuditLogger(device, arrDevice);
    device.addDeviceExtension(new ImageReaderExtension(ImageReaderFactory.getDefault()));
    device.addDeviceExtension(new ImageWriterExtension(ImageWriterFactory.getDefault()));

    device.setManufacturer("dcm4che.org");
    device.setManufacturerModelName("dcm4chee-arc");
    device.setSoftwareVersions("5.0.1");
    device.setKeyStoreURL(DCM4CHEE_ARC_KEY_JKS);
    device.setKeyStoreType("JKS");
    device.setKeyStorePin("secret");
    device.setThisNodeCertificates(
        config.deviceRef(name), (X509Certificate) keyStore.getCertificate(name));
    if (sampleConfig)
      for (String other : OTHER_DEVICES)
        device.setAuthorizedNodeCertificates(
            config.deviceRef(other), (X509Certificate) keyStore.getCertificate(other));

    device.addApplicationEntity(
        createAE(
            "DCM4CHEE",
            "Hide instances rejected for Quality Reasons",
            dicom,
            dicomTLS,
            HIDE_REJECTED_VIEW,
            true,
            true));
    device.addApplicationEntity(
        createAE(
            "DCM4CHEE_ADMIN",
            "Show instances rejected for Quality Reasons",
            dicom,
            dicomTLS,
            REGULAR_USE_VIEW,
            false,
            true));
    device.addApplicationEntity(
        createAE(
            "DCM4CHEE_TRASH",
            "Show rejected instances only",
            dicom,
            dicomTLS,
            TRASH_VIEW,
            false,
            false));

    return device;
  }