예제 #1
0
  public void createXmlMessages() throws Exception {
    Browser.createXmlMessages();
    MMS.createXmlMessages();
    JavaApp.createXmlMessages();

    // IM should be last to generate id_name for all other applications!!!
    // set flag to avoid duplicationNAP names before calling createXmlMessages()
    // The method setNAPFlagForIMAndValidate() should be changed for new  applications
    Validator.setNAPFlagForIMAndValidate();
    IM.createXmlMessages();
  }
예제 #2
0
  public static String validateAndCreateJavaApps(ArrayList arrJavaAppLines) throws Exception {
    String err = "";
    String line;
    String[] result_str;
    int colIndex;
    // set array with headers
    if (arrJavaAppLines.size() > 0) {
      line = (String) arrJavaAppLines.get(0); // get headers
      line += ",dummy"; // for supporting method split.
      result_str = line.split(",");
      JavaApp.colsNum = result_str.length;
      for (int i = 0; i < result_str.length; i++) {
        JavaApp.arrJavaAppLineHeaders.add(result_str[i]);
      }
    }

    for (int i = 1; i < arrJavaAppLines.size(); i++) { // start from 1 to skip header
      line = (String) arrJavaAppLines.get(i);
      if ((Util.str(line)).length() == 0) {
        continue;
      }
      line += ",dummy"; // for supporting method split.
      result_str = line.split(",");
      Value[] result = Util.attStrToArrValue(result_str);

      // checlk for length
      if (result.length != JavaApp.colsNum) {
        err +=
            "JavaApp, line#"
                + (i + 1)
                + ": The number of tokens should be "
                + JavaApp.colsNum
                + "\n";
        continue;
      }

      JavaApp javaApp = new JavaApp();

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("mcc");
      if (colIndex == -1) {
        throw new Exception("The colomn 'mcc' is missing in the JavaApp file");
      }
      javaApp.mcc = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("mnc");
      if (colIndex == -1) {
        throw new Exception("The colomn 'mnc' is missing in the JavaApp file");
      }
      javaApp.mnc = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("operator_name");
      if (colIndex == -1) {
        throw new Exception("The colomn 'operator_name' is missing in the JavaApp file");
      }
      javaApp.operator_name = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("account_type");
      if (colIndex == -1) {
        throw new Exception("The colomn 'account_type' is missing in the JavaApp file");
      }
      javaApp.account_type = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("country_name");
      if (colIndex == -1) {
        throw new Exception("The colomn 'country_name' is missing in the JavaApp file");
      }
      javaApp.country_name = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("ppp_auth_type");
      if (colIndex == -1) {
        throw new Exception("The colomn 'ppp_auth_type' is missing in the JavaApp file");
      }
      javaApp.ppp_auth_type = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("ppp_auth_name");
      if (colIndex == -1) {
        throw new Exception("The colomn 'ppp_auth_name' is missing in the JavaApp file");
      }
      javaApp.ppp_auth_name = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("ppp_auth_secret");
      if (colIndex == -1) {
        throw new Exception("The colomn 'ppp_auth_secret' is missing in the JavaApp file");
      }
      javaApp.ppp_auth_secret = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("ap_requires_auth");
      if (colIndex == -1) {
        throw new Exception("The colomn 'ap_requires_auth' is missing in the JavaApp file");
      }
      javaApp.ap_requires_auth = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("service_name");
      if (colIndex == -1) {
        throw new Exception("The colomn 'service_name' is missing in the JavaApp file");
      }
      javaApp.service_name = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("gprs_access_point_name");
      if (colIndex == -1) {
        throw new Exception("The colomn 'gprs_access_point_name' is missing in the JavaApp file");
      }
      javaApp.gprs_access_point_name = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("dns_1");
      if (colIndex == -1) {
        throw new Exception("The colomn 'dns_1' is missing in the JavaApp file");
      }
      javaApp.dns_1 = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("dns_2");
      if (colIndex == -1) {
        throw new Exception("The colomn 'dns_2' is missing in the JavaApp file");
      }
      javaApp.dns_2 = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("nap_addr_type");
      if (colIndex == -1) {
        throw new Exception("The colomn 'nap_addr_type' is missing in the JavaApp file");
      }
      javaApp.nap_addr_type = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("bearer");
      if (colIndex == -1) {
        throw new Exception("The colomn 'bearer' is missing in the JavaApp file");
      }
      javaApp.bearer = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("proxy");
      if (colIndex == -1) {
        throw new Exception("The colomn 'proxy' is missing in the Java file");
      }
      javaApp.proxy = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("proxy_addr_type");
      if (colIndex == -1) {
        throw new Exception("The colomn 'proxy_addr_type' is missing in the Java file");
      }
      javaApp.proxy_addr_type = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("port");
      if (colIndex == -1) {
        throw new Exception("The colomn 'port' is missing in the Java file");
      }
      javaApp.port = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("proxy_type");
      if (colIndex == -1) {
        throw new Exception("The colomn 'proxy_type' is missing in the Java file");
      }
      javaApp.proxy_type = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("proxy_requires_auth");
      if (colIndex == -1) {
        throw new Exception("The colomn 'proxy_requires_auth' is missing in the Java file");
      }
      javaApp.proxy_requires_auth = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("proxy_auth_name");
      if (colIndex == -1) {
        throw new Exception("The colomn 'proxy_auth_name' is missing in the Java file");
      }
      javaApp.proxy_auth_name = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("proxy_auth_secret");
      if (colIndex == -1) {
        throw new Exception("The colomn 'proxy_auth_secret' is missing in the Java file");
      }
      javaApp.proxy_auth_secret = result[colIndex];

      colIndex = JavaApp.arrJavaAppLineHeaders.indexOf("proxy_auth_type");
      if (colIndex == -1) {
        throw new Exception("The colomn 'proxy_auth_type' is missing in the Java file");
      }
      javaApp.proxy_auth_type = result[colIndex];

      // validate all data
      String lineErr = javaApp.validateData();
      if (lineErr.length() > 0) {
        err += "JavaApp, data not valid, line #" + (i + 1) + ": \n" + lineErr + "\n";
      }
      JavaApp.arrJavaAppFromLines.add(javaApp);
    }
    return err;
  }