コード例 #1
0
  /**
   * Initializes Association related parameters.
   *
   * @param cfg the configuration properties for this class.
   * @param url the DcmURL of the communication partner.
   */
  private final void initAssocParam(ConfigProperties cfg, DcmURL url) {
    String callingAET = null;

    // >>>> Get data for filling the Association object for establishing an
    // >>>> active association from configuration file

    acTimeout = Integer.parseInt(cfg.getProperty("ac-timeout", "5000"));
    dimseTimeout = Integer.parseInt(cfg.getProperty("dimse-timeout", "0"));
    soCloseDelay = Integer.parseInt(cfg.getProperty("so-close-delay", "500"));

    // >>>> Fill the Association Request package (A-ASSOCIATE-RQ)

    // Identifying the communication partner by an AET (Application Entity Title)
    assocRQ.setCalledAET(url.getCalledAET());

    // Identifying ourselves by an AET (Application Entity Title)
    if (url.getCallingAET() != null) {
      callingAET = url.getCallingAET();
    } else {
      callingAET = DEFAULT_CALLING_AET;
    }
    assocRQ.setCallingAET(callingAET);

    // Maximum size of one PDU (Protocol Data Unit)
    assocRQ.setMaxPDULength(Integer.parseInt(cfg.getProperty("max-pdu-len", "16352")));

    // Defines possibilities for asynchron DIMSE communication. Noramly synchron DIMSE communication
    // is used.
    // API doc: AssociationFactory.newAsyncOpsWindow(int maxOpsInvoked, int maxOpsPerfomed)
    // PS 3.7 - Annex D.3.3.3 ASYNCHRONOUS OPERATIONS WINDOW NEGOTIATION
    // maxOpsInvoked: This field shall contain the Maximum-number-operationsinvoked as defined for
    // the Association-requester
    // maxOpsPerfomed: This field shall contain the Maximum-number-operationsperformed as defined
    // for the Association-requester
    assocRQ.setAsyncOpsWindow(
        aFact.newAsyncOpsWindow(Integer.parseInt(cfg.getProperty("max-op-invoked", "0")), 1));

    for (Enumeration it = cfg.keys(); it.hasMoreElements(); ) {
      String key = (String) it.nextElement();

      // Setup available transfer syntaces for storage SOP classes
      // PS 3.4 - Annex B STORAGE SERVICE CLASS
      // PS 3.4 - B.5 STANDARD SOP CLASSES
      if (key.startsWith("pc.")) {
        initPresContext(
            Integer.parseInt(key.substring(3)),
            cfg.tokenize(cfg.getProperty(key), new LinkedList()));
      }
    }
  }
コード例 #2
0
 /**
  * Only used by method initAssocParam: Sets up available transfer syntaces for storage SOP
  * classes.
  *
  * @param pcid is a for the association unique odd number between 1 and 255.
  * @param val a list: First element is the symbolic name of the UID of the SOP to transmit, the
  *     following elements are the supportet transfer syntax for that SOP.
  */
 private final void initPresContext(int pcid, List val) {
   Iterator it = val.iterator();
   String as = UIDs.forName((String) it.next());
   String[] tsUIDs = new String[val.size() - 1];
   for (int i = 0; i < tsUIDs.length; ++i) {
     tsUIDs[i] = UIDs.forName((String) it.next());
   }
   // API doc: AssociationFactory.newPresContext(int pcid, String asuid, String[] tsuid)
   // pcid is a for the association unique odd number between 1 and 255.
   // asuid is the UID of a SOP class
   // TS list of transfer syntaces supported by this class for asuid.
   assocRQ.addPresContext(aFact.newPresContext(pcid, as, tsUIDs));
 }