@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;
 }
 public void init(Properties props) {
   for (String cuid : props.stringPropertyNames())
     commonExtNegs.put(
         cuid,
         new CommonExtendedNegotiation(
             cuid, UID.StorageServiceClass, StringUtils.split(props.getProperty(cuid), ',')));
 }
Exemplo n.º 3
0
    private int[] tagPathOf(String s) throws SAXException {
      String[] ss = StringUtils.split(s, '/');
      if (ss.length == 0) throw new SAXException("missing tag attribute");

      try {
        int[] tagPath = new int[ss.length];
        for (int i = 0; i < tagPath.length; i++)
          tagPath[i] = ss[i].equals("..") ? -1 : (int) Long.parseLong(s, 16);
        return tagPath;
      } catch (IllegalArgumentException e) {
        throw new SAXException("invalid tag=\"" + s + '"');
      }
    }
Exemplo n.º 4
0
    private void startDataElement(
        String tagStr,
        String vrStr,
        String typeStr,
        String vmStr,
        String items,
        String valueNumberStr)
        throws SAXException {
      if (idref != null) throw new SAXException("<Item> with idref must be empty");

      IOD iod = iodStack.getLast();
      int tag = tagOf(tagStr);
      VR vr = vrOf(vrStr);
      DataElementType type = typeOf(typeStr);

      int minVM = -1;
      int maxVM = -1;
      String vm = vr == VR.SQ ? items : vmStr;
      if (vm != null) {
        try {
          String[] ss = StringUtils.split(vm, '-');
          if (ss[0].charAt(0) != 'n') {
            minVM = Integer.parseInt(ss[0]);
            if (ss.length > 1) {
              if (ss[1].charAt(0) != 'n') maxVM = Integer.parseInt(ss[1]);
            } else {
              maxVM = minVM;
            }
          }
        } catch (IllegalArgumentException e) {
          throw new SAXException((vr == VR.SQ ? "invalid items=\"" : "invalid vm=\"") + vm + '"');
        }
      }
      DataElement el =
          new DataElement(tag, vr, type, minVM, maxVM, valueNumberOf(valueNumberStr, 0));
      iod.add(el);
      elementConditions = true;
      itemConditions = false;
    }
 @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;
 }