Exemplo n.º 1
0
 public DcmRcv(String name) {
   device = new Device(name);
   executor = new NewThreadExecutor(name);
   device.setNetworkApplicationEntity(ae);
   device.setNetworkConnection(nc);
   ae.setNetworkConnection(nc);
   ae.setAssociationAcceptor(true);
   ae.register(new VerificationService());
   ae.register(storageSCP);
   ae.register(stgcmtSCP);
 }
Exemplo n.º 2
0
 public final void setAssociationReaperPeriod(int period) {
   device.setAssociationReaperPeriod(period);
 }
Exemplo n.º 3
0
 public void stop() {
   if (device != null) {
     device.stopListening();
   }
 }
Exemplo n.º 4
0
 public void start() throws IOException {
   device.startListening(executor);
 }
Exemplo n.º 5
0
 public void initTLS() throws GeneralSecurityException, IOException {
   KeyStore keyStore = loadKeyStore(keyStoreURL, keyStorePassword);
   KeyStore trustStore = loadKeyStore(trustStoreURL, trustStorePassword);
   device.initTLS(keyStore, keyPassword != null ? keyPassword : keyStorePassword, trustStore);
 }
Exemplo n.º 6
0
  public void testRetrieveInputObjectsFromObjectStore() {
    String[] DEF_TS = {UID.ImplicitVRLittleEndian, UID.ExplicitVRLittleEndian};

    PlanArchiveSim pas = new PlanArchiveSim("PAS", "localhost", 40406);
    try {
      pas.start();
    } catch (IOException e1) {
      e1.printStackTrace();
      assertTrue(false);
    }

    PlanHolderSim phs = new PlanHolderSim("PHS", "localhost", 40407);
    try {
      phs.start();
    } catch (IOException e1) {
      e1.printStackTrace();
      assertTrue(false);
    }

    String name = "TestSCUCMovePlan";
    Device device = new Device(name);

    Executor executor = new NewThreadExecutor(name);
    NetworkApplicationEntity ae = new NetworkApplicationEntity();
    NetworkConnection localConn = new NetworkConnection();

    device.setNetworkApplicationEntity(ae);
    device.setNetworkConnection(localConn);

    ae.setNetworkConnection(localConn);
    ae.setAssociationInitiator(true);
    ae.setAssociationAcceptor(false);
    ae.setAETitle(name);
    ae.setTransferCapability(
        new TransferCapability[] {
          new TransferCapability(
              UID.StudyRootQueryRetrieveInformationModelMOVE, DEF_TS, TransferCapability.SCU)
        });

    NetworkApplicationEntity remoteAE = new NetworkApplicationEntity();
    NetworkConnection remoteConn = new NetworkConnection();

    remoteAE.setInstalled(true);
    remoteAE.setAssociationAcceptor(true);
    remoteConn.setHostname("localhost");
    remoteConn.setPort(40406);
    remoteAE.setNetworkConnection(remoteConn);
    remoteAE.setAETitle("PAS");

    // **
    // start Cmove Association
    // **
    String abstractSyntaxUID = UID.StudyRootQueryRetrieveInformationModelMOVE;
    DicomObject attrs = setCmoveAttributes();
    String transferSyntaxUid = UID.ImplicitVRLittleEndian;
    DimseRSP rsp = null;
    String movedUID = "";

    Association assoc = null;
    try {
      assoc = ae.connect(remoteAE, executor);
    } catch (ConfigurationException e) {
      assertTrue(false);
    } catch (IOException e) {
      e.printStackTrace();
      assertTrue(false);
    } catch (InterruptedException e) {
      assertTrue(false);
    }
    movedUID = phs.getPlanUID();
    assertTrue(movedUID.equalsIgnoreCase("empty"));
    try {
      rsp = assoc.cmove(abstractSyntaxUID, 0, attrs, transferSyntaxUid, "PHS");
      while (!rsp.next()) {}
    } catch (IOException e) {
      System.out.println(e.getMessage());
      assertTrue(false);
    } catch (InterruptedException e) {
      System.out.println(e.getMessage());
      assertTrue(false);
    }
    movedUID = phs.getPlanUID();

    assertTrue(movedUID.equalsIgnoreCase("1.2.34.56"));
    phs.stop();
    pas.stop();
  }