public CHIA(Writer out) throws IOException { Preconditions.checkNotNull(out); this.out = out; this.automataConsole = new CHIAAutomataConsole(); this.console = new ConsoleReader(); this.console.setExpandEvents(false); console.setPrompt("CHIA> "); usage(); if (ClassLoader.getSystemResource("History.txt") != null) { console.setHistory( new FileHistory(new File(ClassLoader.getSystemResource("History.txt").getPath()))); } else { out.write("The History file cannot be loaded" + "\n"); } out.write("CHIA Started\n"); out.flush(); if (ClassLoader.getSystemResource("log4j.properties") != null) { PropertyConfigurator.configure(ClassLoader.getSystemResource("log4j.properties")); } else { out.write("The logging file cannot be loaded" + "\n"); } out.flush(); }
@Override protected Optional<Mapping> _call() { Preconditions.checkNotNull(entry); final File osmMapFolder = command(ResolveOSMMappingLogFolder.class).call(); File file = new File(osmMapFolder, entry.getPostMappingId().toString()); if (!file.exists()) { return Optional.absent(); } try { List<String> lines = Files.readLines(file, Charsets.UTF_8); String s = Joiner.on("\n").join(lines); Mapping mapping = Mapping.fromString(s); return Optional.of(mapping); } catch (IOException e) { throw Throwables.propagate(e); } }