Пример #1
0
  /** closes resources and write everything to file */
  public void shutdown() {

    pdb.closeDB(); // save the db
    if (newWeights == null) {
      newWeights = origWeights;
    }
    writePropertyFile(
        newWeights, genProps.getProperty("outWeightsLoc", genProps.getProperty("inWeightsLoc")));
    userInterface.closeResources();
    System.out.println("preferences saved and closed without error.");
  }
Пример #2
0
 /**
  * shows the database on the user interface, if the user interface exists and no user response is
  * specied and there is no 'blanketAccept' option.
  */
 public void showDatabase() {
   if (userInterface != null) // the user interface exists
   {
     if (!genProps.contains("userResponse")) // if we have no preknown user response
     {
       if (genProps.getProperty("blanketAccept", null) == null) // if we have no blanket accept
       {
         userInterface.showDatabase(pdb); // we must be running interactive
       }
     }
   }
 }
Пример #3
0
 /**
  * Generates handles response. This is were we would pass stuff to cli or gui, etc
  *
  * @param n the processed policy object
  * @return the policyObjected as accepted by user (potentially modified
  */
 public PolicyObject userResponse(PolicyObject n) {
   if ((parseAct(genProps.getProperty("userResponse", null)) == null)
       && !Boolean.parseBoolean(genProps.getProperty("blanketAccept", "false"))) {
     return userInterface.userResponse(n);
   } else {
     if (Boolean.parseBoolean(genProps.getProperty("blanketAccept", "false"))) {
       return n.setAction(n.getAction().setOverride(true));
     } else {
       return n.setAction(parseAct(genProps.getProperty("userResponse", null)));
     }
   }
 }
Пример #4
0
 /**
  * call the user interface's general configuration method if the userInit option is true, and a
  * user interface exists
  */
 public void configUI() {
   if (Boolean.parseBoolean(genProps.getProperty("userInit", "false"))
       && !(userInterface == null)) {
     userInterface.user_init(genProps);
   }
 }