private long readPersistentPath() {
   try {
     String persistentPathContent = FileCommands.readFileAsString(persistentPath);
     return Long.parseLong(persistentPathContent.replace("\n", ""));
   } catch (IOException e) {
     Log.log.logErr(
         "There occured an error reading the persistentPath " + "of a RemoteRequirement",
         Log.CORE);
   } catch (NumberFormatException e) {
     Log.log.logErr(
         "The content of the persistentPath of a "
             + "RemoteRequirement was not correctly written previously",
         Log.CORE);
   }
   // timestamp file was not found or was not correctly written.
   // Therefore we need to force a consistencycheck.
   return 0L;
 }
Beispiel #2
0
  private static ModuleKey getModuleKeyForAssimilation(
      Path str, String main, Map<Path, Integer> dependentFiles, SGLR strParser)
      throws IOException, InvalidParseTableException, TokenExpectedException, BadTokenException,
          SGLRException {
    log.beginTask("Generating", "Generate module key for current assimilation", Log.CACHING);
    try {
      IStrategoTerm aterm =
          (IStrategoTerm)
              strParser.parse(
                  FileCommands.readFileAsString(str), str.getAbsolutePath(), "StrategoModule");

      aterm = ATermCommands.getApplicationSubterm(aterm, "Module", 1);

      return new ModuleKey(dependentFiles, STR_FILE_PATTERN, aterm);
    } catch (Exception e) {
      throw new SGLRException(strParser, "could not parse STR file " + str, e);
    } finally {
      log.endTask();
    }
  }