示例#1
0
 public TransferCapability removeTransferCapabilityFor(
     String sopClass, TransferCapability.Role role) {
   TransferCapability tc =
       (role == TransferCapability.Role.SCU ? scuTCs : scpTCs).remove(sopClass);
   if (tc != null) tc.setApplicationEntity(null);
   return tc;
 }
示例#2
0
 public TransferCapability addTransferCapability(TransferCapability tc) {
   tc.setApplicationEntity(this);
   TransferCapability prev =
       (tc.getRole() == TransferCapability.Role.SCU ? scuTCs : scpTCs).put(tc.getSopClass(), tc);
   if (prev != null && prev != tc) prev.setApplicationEntity(null);
   return prev;
 }
示例#3
0
  public boolean supportsTransferCapability(
      TransferCapability transferCapability, boolean onlyAbstractSyntax) {
    TransferCapability matchingTC =
        this.getTransferCapabilityFor(
            transferCapability.getSopClass(), transferCapability.getRole());
    if (matchingTC == null) return false;
    else
      for (String ts : transferCapability.getTransferSyntaxes())
        if (!matchingTC.containsTransferSyntax(ts) && !onlyAbstractSyntax) return false;

    return true;
  }
示例#4
0
 public StringBuilder promptTo(StringBuilder sb, String indent) {
   String indent2 = indent + "  ";
   StringUtils.appendLine(sb, indent, "ApplicationEntity[title: ", AETitle);
   StringUtils.appendLine(sb, indent2, "alias titles: ", AETitleAliases);
   StringUtils.appendLine(sb, indent2, "desc: ", description);
   StringUtils.appendLine(sb, indent2, "acceptor: ", associationAcceptor);
   StringUtils.appendLine(sb, indent2, "initiator: ", associationInitiator);
   StringUtils.appendLine(sb, indent2, "installed: ", getAeInstalled());
   for (Connection conn : connections)
     conn.promptTo(sb, indent2).append(StringUtils.LINE_SEPARATOR);
   for (TransferCapability tc : getTransferCapabilities())
     tc.promptTo(sb, indent2).append(StringUtils.LINE_SEPARATOR);
   return sb.append(indent).append(']');
 }
示例#5
0
  private byte[] negotiate(ExtendedNegotiation exneg, TransferCapability tc) {
    if (exneg == null) return null;

    StorageOptions storageOptions = tc.getStorageOptions();
    if (storageOptions != null) return storageOptions.toExtendedNegotiationInformation();

    EnumSet<QueryOption> queryOptions = tc.getQueryOptions();
    if (queryOptions != null) {
      EnumSet<QueryOption> commonOpts = QueryOption.toOptions(exneg);
      commonOpts.retainAll(queryOptions);
      return QueryOption.toExtendedNegotiationInformation(commonOpts);
    }
    return null;
  }
示例#6
0
  public void setTransferCapabilities(Collection<TransferCapability> transferCapabilities) {
    scpTCs.clear();
    scuTCs.clear();

    for (TransferCapability tc : transferCapabilities) {
      tc.setApplicationEntity(this);
      switch (tc.getRole()) {
        case SCP:
          scpTCs.put(tc.getSopClass(), tc);
          break;
        case SCU:
          scuTCs.put(tc.getSopClass(), tc);
      }
    }
  }
示例#7
0
  protected PresentationContext negotiate(
      AAssociateRQ rq, AAssociateAC ac, PresentationContext rqpc) {
    String as = rqpc.getAbstractSyntax();
    TransferCapability tc = roleSelection(rq, ac, as);
    int pcid = rqpc.getPCID();
    if (tc == null)
      return new PresentationContext(
          pcid, PresentationContext.ABSTRACT_SYNTAX_NOT_SUPPORTED, rqpc.getTransferSyntax());

    for (String ts : rqpc.getTransferSyntaxes())
      if (tc.containsTransferSyntax(ts)) {
        byte[] info = negotiate(rq.getExtNegotiationFor(as), tc);
        if (info != null) ac.addExtendedNegotiation(new ExtendedNegotiation(as, info));
        return new PresentationContext(pcid, PresentationContext.ACCEPTANCE, ts);
      }

    return new PresentationContext(
        pcid, PresentationContext.TRANSFER_SYNTAX_NOT_SUPPORTED, rqpc.getTransferSyntax());
  }