Beispiel #1
0
 private InputStream createInputStream(FileInfo info) throws IOException {
   if (info.getLocalFile().endsWith("gz")) {
     return new GZIPInputStream(new FileInputStream(new File(info.getLocalFile())));
   } else {
     return new FileInputStream(new File(info.getLocalFile()));
   }
 }
Beispiel #2
0
 private void importFiles(List<FileInfo> infos) {
   for (FileInfo info : infos) {
     try {
       LOGGER.info("Importing log " + info.getLocalFile() + " from host " + info.getHostName());
       this.importer.importLogInBatchMode(
           new OriginLogFile(
               new OriginHost(info.getHostName(), "127.0.0.1"), info.getRemoteFile()),
           new Log4jLogParser(createInputStream(info)));
     } catch (FileNotFoundException e) {
       throw new RuntimeException(e);
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
   }
 }
Beispiel #3
0
 private void ensureLocalParentFoldersExist(List<FileInfo> infos) {
   for (FileInfo info : infos) {
     new File(info.getLocalFile()).getParentFile().mkdirs();
   }
 }