Пример #1
0
  /** Creates new form SIPHeadersParametersFrame */
  public StackPanel(ConfigurationFrame configurationFrame, ProxyLauncher proxyLauncher) {
    super();
    this.parent = configurationFrame;
    this.proxyLauncher = proxyLauncher;

    listeningPointsList = new ListeningPointsList(proxyLauncher);

    initComponents();

    // Init the components input:
    try {
      Configuration configuration = proxyLauncher.getConfiguration();
      if (configuration == null) return;
      if (configuration.stackName != null) proxyStackNameTextField.setText(configuration.stackName);
      if (configuration.stackIPAddress != null)
        proxyIPAddressTextField.setText(configuration.stackIPAddress);

      if (configuration.outboundProxy != null)
        outboundProxyTextField.setText(configuration.outboundProxy);
      if (configuration.routerPath != null) routerClassTextField.setText(configuration.routerPath);
      if (configuration == null) listeningPointsList.displayList(new Hashtable());
      else listeningPointsList.displayList(configuration.listeningPoints);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
  /**
   * Initialize -- load password files etc. Password file format is name:authentication
   * domain:password
   *
   * @param pwFileName is the password file name.
   * @param Exception is thrown when the password file is bad.
   */
  public void initialize(String pwFileName) {
    try {
      XMLAuthenticationParser parser = new XMLAuthenticationParser(pwFileName);

      String def = parser.getRealm();
      if (def != null) DEFAULT_REALM = def;
      ProxyDebug.println(
          "DEBUG, DigestAuthenticationMethod, initialize()," + " the realm is:" + DEFAULT_REALM);
      Vector usersTagList = parser.getUsersTagList();
      if (usersTagList != null)
        for (int i = 0; i < usersTagList.size(); i++) {
          UserTag userTag = (UserTag) usersTagList.elementAt(i);
          String userName = userTag.getUserName();
          // String userRealm=userTag.getUserRealm();
          String userPassword = userTag.getUserPassword();
          if (userName != null) {

            if (userPassword == null) {
              ProxyDebug.println(
                  "DEBUG, DigestAuthenticationMethod, initialize(),"
                      + " the userPassword parameter does not exist for user: "******", we use the default: \""
                      + NULL_PASSWORD
                      + "\"");
              userPassword = NULL_PASSWORD;
            }
            passwordTable.put(userName + "@" + DEFAULT_REALM, userPassword);
          } else {
            ProxyDebug.println(
                "DEBUG, DigestAuthenticationMethod, initialize(),"
                    + " the userName parameter does not exist, we skip this entry!!");
          }
        }
      else
        ProxyDebug.println(
            "DEBUG, DigestAuthenticationMethod, initialize(),"
                + "Error during parsing the passwords file!");

    } catch (Exception e) {
      ProxyDebug.println("ERROR, DigestAuthenticationMethod, initialize()," + "exception raised:");
      e.printStackTrace();
    }
  }