コード例 #1
0
ファイル: PACSStudyOperations.java プロジェクト: vgurev/ICMA
  public PACSStudyOperations(String username, String password) throws Exception {
    sxc = new PACSConfiguration();
    serverConfiguration = sxc.getElementValues();

    env = new Properties();
    env.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    env.setProperty(Context.URL_PKG_PREFIXES, "org.jnp.interfaces.NamingContextFactory");

    env.setProperty(Context.PROVIDER_URL, "jnp://" + serverConfiguration.getHostName() + ":1099/");
    pacsHandler = new PACSCallBackHandler(username, password);

    conf =
        new Configuration() {
          @Override
          public AppConfigurationEntry[] getAppConfigurationEntry(String name) {
            @SuppressWarnings({"unchecked", "rawtypes"})
            AppConfigurationEntry entry =
                new AppConfigurationEntry(
                    "org.jboss.security.ClientLoginModule",
                    AppConfigurationEntry.LoginModuleControlFlag.REQUIRED,
                    new java.util.HashMap());
            return new AppConfigurationEntry[] {entry};
          }
        };
  }
コード例 #2
0
ファイル: PACSStudyOperations.java プロジェクト: vgurev/ICMA
  public static void dcmSND(String filename) throws Exception {
    // ServerXmlConfiguration sxc = new ServerXmlConfiguration();
    Context context = new InitialContext();
    String icmaaetitle = (String) context.lookup("java:global/ICMAAETITLE");
    PACSConfiguration sxc = new PACSConfiguration();
    ServerConfiguration sc = sxc.getElementValues();
    DcmSnd dcmsnd = new DcmSnd(icmaaetitle); // Register the calling AE title
    dcmsnd.setCalledAET(sc.getAeTitle());
    dcmsnd.setRemoteHost(sc.getHostName());
    dcmsnd.setRemotePort(Integer.parseInt((sc.getPort())));
    dcmsnd.setOfferDefaultTransferSyntaxInSeparatePresentationContext(false);
    dcmsnd.setSendFileRef(false);

    // Username password etc
    /*
     * if (cl.hasOption("username")) { String username =
     * cl.getOptionValue("username"); UserIdentity userId; UserIdentity
     * userId; if (cl.hasOption("passcode")) { String passcode =
     * cl.getOptionValue("passcode"); userId = new
     * UserIdentity.UsernamePasscode(username, passcode.toCharArray()); }
     * else { userId = new UserIdentity.Username(username); }
     * userId.setPositiveResponseRequested(cl.hasOption("uidnegrsp"));
     * dcmsnd.setUserIdentity(userId); }
     */

    dcmsnd.setStorageCommitment(false);
    dcmsnd.setPackPDV(true);
    dcmsnd.setTcpNoDelay(true);
    // Setup the file
    dcmsnd.addFile(new File(filename));
    dcmsnd.configureTransferCapability();
    try {
      // Start the sending process
      dcmsnd.start();
      // Open connections
      dcmsnd.open();
      dcmsnd.send();
      dcmsnd.close();
    } catch (Exception exx) {
      throw exx;
    } finally {
      dcmsnd.stop();
    }
  }