Exemple #1
0
 public static String info() {
   if (logger == null) {
     return "AuditLogger not configured!";
   }
   StringBuilder sb = new StringBuilder();
   sb.append("Audit Source ID:")
       .append(logger.getAuditSourceID())
       .append("\nInstalled:")
       .append(logger.isInstalled());
   for (Connection c : logger.getConnections()) {
     sb.append("\nConnection: ")
         .append(c.getHostname())
         .append(":")
         .append(c.getPort())
         .append('(')
         .append(c.getProtocol())
         .append(')');
   }
   Device arrDevice = logger.getAuditRecordRepositoryDevice();
   sb.append("\nAudit Record Repository:").append(arrDevice);
   sb.append("\nProcess ID:")
       .append(AuditLogger.processID())
       .append("\nLocalHost:")
       .append(AuditLogger.localHost());
   return sb.toString();
 }
 private Device createArchiveDevice(String name) throws Exception {
   ArchiveDevice device = new ArchiveDevice(name);
   device.setFuzzyAlgorithmClass("org.dcm4che.soundex.ESoundex");
   device.setConfigurationStaleTimeout(CONFIGURATION_STALE_TIMEOUT);
   setAttributeFilters(device);
   device.setKeyStoreURL("resource:dcm4chee-arc-key.jks");
   device.setKeyStoreType("JKS");
   device.setKeyStorePin("secret");
   device.setThisNodeCertificates(
       config.deviceRef(name), (X509Certificate) keystore.getCertificate(name));
   for (String other : OTHER_DEVICES)
     device.setAuthorizedNodeCertificates(
         config.deviceRef(other), (X509Certificate) keystore.getCertificate(other));
   Connection dicom = createConnection("dicom", "localhost", 11112);
   dicom.setMaxOpsInvoked(0);
   dicom.setMaxOpsPerformed(0);
   device.addConnection(dicom);
   Connection dicomTLS = new Connection("dicom-tls", "localhost", 2762);
   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);
   ArchiveApplicationEntity ae =
       createAE("DCM4CHEE", IMAGE_TSUIDS, VIDEO_TSUIDS, OTHER_TSUIDS, null, PIX_MANAGER);
   device.addApplicationEntity(ae);
   ae.addConnection(dicom);
   ae.addConnection(dicomTLS);
   ArchiveApplicationEntity adminAE =
       createAdminAE(
           "DCM4CHEE_ADMIN", IMAGE_TSUIDS, VIDEO_TSUIDS, OTHER_TSUIDS, null, PIX_MANAGER);
   device.addApplicationEntity(adminAE);
   adminAE.addConnection(dicom);
   adminAE.addConnection(dicomTLS);
   ArchiveHL7Application hl7App = new ArchiveHL7Application("*");
   hl7App.setAcceptedMessageTypes(HL7_MESSAGE_TYPES);
   hl7App.setHL7DefaultCharacterSet("8859/1");
   hl7App.addTemplatesURI("adt2dcm", "resource:dcm4chee-arc-hl7-adt2dcm.xsl");
   device.addHL7Application(hl7App);
   Connection hl7 = new Connection("hl7", "localhost", 2575);
   device.addConnection(hl7);
   hl7App.addConnection(hl7);
   Connection hl7TLS = new Connection("hl7-tls", "localhost", 12575);
   hl7TLS.setTlsCipherSuites(
       Connection.TLS_RSA_WITH_AES_128_CBC_SHA, Connection.TLS_RSA_WITH_3DES_EDE_CBC_SHA);
   device.addConnection(hl7TLS);
   hl7App.addConnection(hl7TLS);
   return device;
 }
 private HL7Device createHL7Device(
     String name,
     Issuer issuer,
     Code institutionCode,
     String appName,
     String host,
     int port,
     int tlsPort)
     throws Exception {
   HL7Device device = new HL7Device(name);
   init(device, issuer, institutionCode);
   HL7Application hl7app = new HL7Application(appName);
   device.addHL7Application(hl7app);
   Connection dicom = new Connection("hl7", host, port);
   device.addConnection(dicom);
   hl7app.addConnection(dicom);
   Connection dicomTLS = new Connection("hl7-tls", host, tlsPort);
   dicomTLS.setTlsCipherSuites(
       Connection.TLS_RSA_WITH_AES_128_CBC_SHA, Connection.TLS_RSA_WITH_3DES_EDE_CBC_SHA);
   device.addConnection(dicomTLS);
   hl7app.addConnection(dicomTLS);
   return device;
 }
 private Device createDevice(
     String name,
     Issuer issuer,
     Code institutionCode,
     String aet,
     String host,
     int port,
     int tlsPort)
     throws Exception {
   Device device = init(new Device(name), issuer, institutionCode);
   ApplicationEntity ae = new ApplicationEntity(aet);
   ae.setAssociationAcceptor(true);
   device.addApplicationEntity(ae);
   Connection dicom = new Connection("dicom", host, port);
   device.addConnection(dicom);
   ae.addConnection(dicom);
   Connection dicomTLS = new Connection("dicom-tls", host, tlsPort);
   dicomTLS.setTlsCipherSuites(
       Connection.TLS_RSA_WITH_AES_128_CBC_SHA, Connection.TLS_RSA_WITH_3DES_EDE_CBC_SHA);
   device.addConnection(dicomTLS);
   ae.addConnection(dicomTLS);
   return device;
 }
 private Connection createConnection(
     String commonName, String hostname, int port, String... tlsCipherSuites) {
   Connection conn = new Connection(commonName, hostname, port);
   conn.setTlsCipherSuites(tlsCipherSuites);
   return conn;
 }
 @Override
 protected List<ModificationItem> storeDiffs(
     Connection a, Connection b, List<ModificationItem> mods) {
   super.storeDiffs(a, b, mods);
   storeDiff(
       mods,
       "dcmProtocol",
       StringUtils.nullify(a.getProtocol(), Protocol.DICOM),
       StringUtils.nullify(b.getProtocol(), Protocol.DICOM));
   storeDiff(mods, "dcmHTTPProxy", a.getHttpProxy(), b.getHttpProxy());
   storeDiff(mods, "dcmBlacklistedHostname", a.getBlacklist(), b.getBlacklist());
   storeDiff(mods, "dcmTCPBacklog", a.getBacklog(), b.getBacklog(), Connection.DEF_BACKLOG);
   storeDiff(
       mods,
       "dcmTCPConnectTimeout",
       a.getConnectTimeout(),
       b.getConnectTimeout(),
       Connection.NO_TIMEOUT);
   storeDiff(
       mods,
       "dcmAARQTimeout",
       a.getRequestTimeout(),
       b.getRequestTimeout(),
       Connection.NO_TIMEOUT);
   storeDiff(
       mods, "dcmAAACTimeout", a.getAcceptTimeout(), b.getAcceptTimeout(), Connection.NO_TIMEOUT);
   storeDiff(
       mods,
       "dcmARRPTimeout",
       a.getReleaseTimeout(),
       b.getReleaseTimeout(),
       Connection.NO_TIMEOUT);
   storeDiff(
       mods,
       "dcmResponseTimeout",
       a.getResponseTimeout(),
       b.getResponseTimeout(),
       Connection.NO_TIMEOUT);
   storeDiff(
       mods,
       "dcmRetrieveTimeout",
       a.getRetrieveTimeout(),
       b.getRetrieveTimeout(),
       Connection.NO_TIMEOUT);
   storeDiff(
       mods, "dcmIdleTimeout", a.getIdleTimeout(), b.getIdleTimeout(), Connection.NO_TIMEOUT);
   storeDiff(
       mods,
       "dcmTCPCloseDelay",
       a.getSocketCloseDelay(),
       b.getSocketCloseDelay(),
       Connection.DEF_SOCKETDELAY);
   storeDiff(
       mods,
       "dcmTCPSendBufferSize",
       a.getSendBufferSize(),
       b.getSendBufferSize(),
       Connection.DEF_BUFFERSIZE);
   storeDiff(
       mods,
       "dcmTCPReceiveBufferSize",
       a.getReceiveBufferSize(),
       b.getReceiveBufferSize(),
       Connection.DEF_BUFFERSIZE);
   storeDiff(mods, "dcmTCPNoDelay", a.isTcpNoDelay(), b.isTcpNoDelay(), true);
   storeDiff(
       mods,
       "dcmTLSProtocol",
       a.isTls() ? a.getTlsProtocols() : StringUtils.EMPTY_STRING,
       b.isTls() ? b.getTlsProtocols() : StringUtils.EMPTY_STRING);
   storeDiff(
       mods,
       "dcmTLSNeedClientAuth",
       !a.isTls() || a.isTlsNeedClientAuth(),
       !a.isTls() || a.isTlsNeedClientAuth(),
       true);
   storeDiff(
       mods,
       "dcmSendPDULength",
       a.getSendPDULength(),
       b.getSendPDULength(),
       Connection.DEF_MAX_PDU_LENGTH);
   storeDiff(
       mods,
       "dcmReceivePDULength",
       a.getReceivePDULength(),
       b.getReceivePDULength(),
       Connection.DEF_MAX_PDU_LENGTH);
   storeDiff(
       mods,
       "dcmMaxOpsPerformed",
       a.getMaxOpsPerformed(),
       b.getMaxOpsPerformed(),
       Connection.SYNCHRONOUS_MODE);
   storeDiff(
       mods,
       "dcmMaxOpsInvoked",
       a.getMaxOpsInvoked(),
       b.getMaxOpsInvoked(),
       Connection.SYNCHRONOUS_MODE);
   storeDiff(mods, "dcmPackPDV", a.isPackPDV(), b.isPackPDV(), true);
   return mods;
 }
  @Override
  protected void loadFrom(Connection conn, Attributes attrs) throws NamingException {
    super.loadFrom(conn, attrs);
    if (!hasObjectClass(attrs, "dcmNetworkConnection")) return;

    conn.setProtocol(Protocol.valueOf(stringValue(attrs.get("dcmProtocol"), "DICOM")));
    conn.setHttpProxy(stringValue(attrs.get("dcmHTTPProxy"), null));
    conn.setBlacklist(stringArray(attrs.get("dcmBlacklistedHostname")));
    conn.setBacklog(intValue(attrs.get("dcmTCPBacklog"), Connection.DEF_BACKLOG));
    conn.setConnectTimeout(intValue(attrs.get("dcmTCPConnectTimeout"), Connection.NO_TIMEOUT));
    conn.setRequestTimeout(intValue(attrs.get("dcmAARQTimeout"), Connection.NO_TIMEOUT));
    conn.setAcceptTimeout(intValue(attrs.get("dcmAAACTimeout"), Connection.NO_TIMEOUT));
    conn.setReleaseTimeout(intValue(attrs.get("dcmARRPTimeout"), Connection.NO_TIMEOUT));
    conn.setResponseTimeout(intValue(attrs.get("dcmResponseTimeout"), Connection.NO_TIMEOUT));
    conn.setRetrieveTimeout(intValue(attrs.get("dcmRetrieveTimeout"), Connection.NO_TIMEOUT));
    conn.setIdleTimeout(intValue(attrs.get("dcmIdleTimeout"), Connection.NO_TIMEOUT));
    conn.setSocketCloseDelay(intValue(attrs.get("dcmTCPCloseDelay"), Connection.DEF_SOCKETDELAY));
    conn.setSendBufferSize(intValue(attrs.get("dcmTCPSendBufferSize"), Connection.DEF_BUFFERSIZE));
    conn.setReceiveBufferSize(
        intValue(attrs.get("dcmTCPReceiveBufferSize"), Connection.DEF_BUFFERSIZE));
    conn.setTcpNoDelay(booleanValue(attrs.get("dcmTCPNoDelay"), true));
    conn.setTlsNeedClientAuth(booleanValue(attrs.get("dcmTLSNeedClientAuth"), true));
    String[] tlsProtocols = stringArray(attrs.get("dcmTLSProtocol"));
    if (tlsProtocols.length > 0) conn.setTlsProtocols(tlsProtocols);
    conn.setSendPDULength(intValue(attrs.get("dcmSendPDULength"), Connection.DEF_MAX_PDU_LENGTH));
    conn.setReceivePDULength(
        intValue(attrs.get("dcmReceivePDULength"), Connection.DEF_MAX_PDU_LENGTH));
    conn.setMaxOpsPerformed(intValue(attrs.get("dcmMaxOpsPerformed"), Connection.SYNCHRONOUS_MODE));
    conn.setMaxOpsInvoked(intValue(attrs.get("dcmMaxOpsInvoked"), Connection.SYNCHRONOUS_MODE));
    conn.setPackPDV(booleanValue(attrs.get("dcmPackPDV"), true));
  }
 @Override
 protected Attributes storeTo(Connection conn, Attributes attrs) {
   super.storeTo(conn, attrs);
   storeNotNull(attrs, "dcmProtocol", StringUtils.nullify(conn.getProtocol(), Protocol.DICOM));
   storeNotNull(attrs, "dcmHTTPProxy", conn.getHttpProxy());
   storeNotEmpty(attrs, "dcmBlacklistedHostname", conn.getBlacklist());
   storeNotDef(attrs, "dcmTCPBacklog", conn.getBacklog(), Connection.DEF_BACKLOG);
   storeNotDef(attrs, "dcmTCPConnectTimeout", conn.getConnectTimeout(), Connection.NO_TIMEOUT);
   storeNotDef(attrs, "dcmAARQTimeout", conn.getRequestTimeout(), Connection.NO_TIMEOUT);
   storeNotDef(attrs, "dcmAAACTimeout", conn.getAcceptTimeout(), Connection.NO_TIMEOUT);
   storeNotDef(attrs, "dcmARRPTimeout", conn.getReleaseTimeout(), Connection.NO_TIMEOUT);
   storeNotDef(attrs, "dcmResponseTimeout", conn.getResponseTimeout(), Connection.NO_TIMEOUT);
   storeNotDef(attrs, "dcmRetrieveTimeout", conn.getRetrieveTimeout(), Connection.NO_TIMEOUT);
   storeNotDef(attrs, "dcmIdleTimeout", conn.getIdleTimeout(), Connection.NO_TIMEOUT);
   storeNotDef(attrs, "dcmTCPCloseDelay", conn.getSocketCloseDelay(), Connection.DEF_SOCKETDELAY);
   storeNotDef(attrs, "dcmTCPSendBufferSize", conn.getSendBufferSize(), Connection.DEF_BUFFERSIZE);
   storeNotDef(
       attrs, "dcmTCPReceiveBufferSize", conn.getReceiveBufferSize(), Connection.DEF_BUFFERSIZE);
   storeNotDef(attrs, "dcmTCPNoDelay", conn.isTcpNoDelay(), true);
   storeNotDef(attrs, "dcmSendPDULength", conn.getSendPDULength(), Connection.DEF_MAX_PDU_LENGTH);
   storeNotDef(
       attrs, "dcmReceivePDULength", conn.getReceivePDULength(), Connection.DEF_MAX_PDU_LENGTH);
   storeNotDef(
       attrs, "dcmMaxOpsPerformed", conn.getMaxOpsPerformed(), Connection.SYNCHRONOUS_MODE);
   storeNotDef(attrs, "dcmMaxOpsInvoked", conn.getMaxOpsInvoked(), Connection.SYNCHRONOUS_MODE);
   storeNotDef(attrs, "dcmPackPDV", conn.isPackPDV(), true);
   if (conn.isTls()) {
     storeNotEmpty(attrs, "dcmTLSProtocol", conn.getTlsProtocols());
     storeNotDef(attrs, "dcmTLSNeedClientAuth", conn.isTlsNeedClientAuth(), true);
   }
   return attrs;
 }