Example #1
0
 private static void handleCommands(String fileNamePath, File outFilePath, String mode)
     throws IOException {
   // Purpose: Process file that contains commands for this process (e.g. STOP, ENQ etc.)
   System.out.println("Handling Command");
   TStringList sl = new TStringList();
   sl.ReadFromFile(fileNamePath);
   for (int j = 0; j < sl.Count(); j++) {
     handleOneCommand(sl.getString(j), outFilePath, mode);
   }
   // File cmdFile = new File(fileNamePath);
   // cmdFile.delete();
 }
Example #2
0
  private String[] loadKBInfo(String mode, String parentPath) {
    // Results:  [0] = kbFilePath
    //			[1] = kbID

    String[] results = new String[2];
    results[0] = "";
    results[1] = "";
    String configFilePath = parentPath + "config/";
    File configFileDir = new File(configFilePath);
    if (configFileDir.isDirectory() == false) {
      System.out.println(configFileDir.getName() + " directory is missing. Exiting");
      System.exit(0);
    }

    String configFName = parentPath + "config/KB MAP.txt";
    TStringList sl = new TStringList();
    try {
      sl.ReadFromFile(configFName);
    } catch (IOException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    for (int i = 0; i < sl.Count(); i++) {
      String s = sl.getString(i);
      String lbl = s.split("=")[0];
      if (lbl.equals("")) continue;
      String[] lblParts = lbl.split(":");
      if (lblParts.length < 2) continue;
      if (lblParts[0].equals(mode) == false) continue;
      if (lblParts[1].equals("KB")) {
        String kbFilePath = parentPath + "kbs/" + s.split("=")[1].trim();
        results[0] = kbFilePath;
      } else if (lblParts[1].equals("ID")) {
        results[1] = s.split("=")[1].trim(); // kb ID string
      }
    }
    return results;
  }