Пример #1
0
  @Override
  protected String selectTransferSyntaxFor(Association storeas, ArchiveInstanceLocator inst)
      throws UnsupportedStoreSCUException {
    Set<String> acceptedTransferSyntax = storeas.getTransferSyntaxesFor(inst.cuid);
    // check for SOP classes elimination
    if (context
        .getArchiveAEExtension()
        .getRetrieveSuppressionCriteria()
        .isCheckTransferCapabilities()) {
      inst = service.eliminateUnSupportedSOPClasses(inst, context);

      // check if eliminated then throw exception
      if (inst == null)
        throw new UnsupportedStoreSCUException("Unable to send instance, SOP class not configured");

      if (isConfiguredAndAccepted(inst, storeas.getTransferSyntaxesFor(inst.cuid)))
        return inst.tsuid;
      else return getDefaultConfiguredTransferSyntax(inst);
    }

    if (acceptedTransferSyntax.contains(inst.tsuid)) return inst.tsuid;

    return storeas.getTransferSyntaxesFor(inst.cuid).contains(UID.ExplicitVRLittleEndian)
        ? UID.ExplicitVRLittleEndian
        : UID.ImplicitVRLittleEndian;
  }
Пример #2
0
  private void retrieve(Attributes keys) throws IOException, InterruptedException {
    DimseRSPHandler rspHandler =
        new DimseRSPHandler(as.nextMessageID()) {
          int lastRemaining = -1;
          long lastChanged;

          @Override
          public void onDimseRSP(Association as, Attributes cmd, Attributes data) {
            super.onDimseRSP(as, cmd, data);
            if (idleRetrieveTimeout != -1 && Status.isPending(cmd.getInt(Tag.Status, -1))) {
              int remaining = cmd.getInt(Tag.NumberOfRemainingSuboperations, -1);
              if (remaining > 0) {
                if (lastRemaining != remaining) {
                  lastRemaining = remaining;
                  lastChanged = System.currentTimeMillis();
                } else {
                  long idleTime = System.currentTimeMillis() - lastChanged;
                  if (idleTime > idleRetrieveTimeout) {
                    LOG.warn(
                        "Cancel C-MOVE request after "
                            + idleTime
                            + "ms of idle time! response:"
                            + cmd);
                    try {
                      exitCode = 3;
                      cancel(as);
                    } catch (IOException e) {
                      e.printStackTrace();
                    }
                  } else {
                    LOG.info(
                        "C_MOVE Request is idle for "
                            + idleTime
                            + "ms! idleRetrieveTimeout="
                            + idleRetrieveTimeout);
                  }
                }
              }
            }
          }
        };

    as.cmove(model.cuid, priority, keys, null, destination, rspHandler);
  }
Пример #3
0
 private CStoreForwardTask createTask(final Association as) {
   ApplicationEntity localAE = retrieveCtx.getLocalApplicationEntity();
   Association storeas = openAssociation(as, localAE);
   final CStoreForwardTask task = new CStoreForwardTask(retrieveCtx, storeas);
   forwardTasks.put(as, task);
   as.addAssociationListener(
       new AssociationListener() {
         @Override
         public void onClose(Association association) {
           task.onStore(null);
           forwardTasks.remove(as);
         }
       });
   if (storeas != null) {
     retrieveCtx.incrementPendingCStoreForward();
     localAE.getDevice().execute(task);
   }
   return task;
 }
Пример #4
0
 private AAssociateRQ createAARQ(Association as) {
   AAssociateRQ aarq = new AAssociateRQ();
   for (PresentationContext pc : as.getAAssociateRQ().getPresentationContexts())
     aarq.addPresentationContext(pc);
   return aarq;
 }
Пример #5
0
 public void retrieve(Attributes keys, DimseRSPHandler handler)
     throws IOException, InterruptedException {
   as.cmove(model.cuid, priority, keys, null, destination, handler);
 }
Пример #6
0
 public void close() throws IOException, InterruptedException {
   if (as != null && as.isReadyForDataTransfer()) {
     as.waitForOutstandingRSP();
     as.release();
   }
 }