@Override public void generateIndex(Set<File> files, OutputStream output, String repoName, URI baseUri, boolean pretty, Registry registry, LogService log) throws Exception { long modified = files.stream() .mapToLong(File::lastModified) .max() .orElse(-1L); new SimpleIndexer().files(files) .base(baseUri) .compress(!pretty) .name(repoName) .increment(modified) .index(output); } }
/** * Generate the index to the specified file. * * @param file the file to write the index file * @throws IOException if a file cannot be indexed */ public void index(File file) throws IOException { repository().save(requireNonNull(file)); }
private XMLResourceGenerator repository() { XMLResourceGenerator repository = new XMLResourceGenerator(); List<Resource> resources = getResources(); repository.resources(resources); if (name != null) { repository.name(name); } if (increment > -1) { repository.increment(increment); } if (compress) { repository.compress(); } return repository; }
private Resource indexFile(File file) { try { ResourceBuilder resourceBuilder = new ResourceBuilder(); if (resourceBuilder.addFile(file, relativize(file))) { if (analyzer != null) { analyzer.analyzeFile(file, resourceBuilder.safeResourceBuilder()); } return resourceBuilder.build(); } } catch (Exception e) { reporter.exception(e, "Could not index file %s", file); } return null; }
private XMLResourceGenerator repository() { XMLResourceGenerator repository = new XMLResourceGenerator(); List<Resource> resources = getResources(); repository.resources(resources); if (name != null) { repository.name(name); } if (increment > -1) { repository.increment(increment); } if (compress) { repository.compress(); } return repository; }
private Resource indexFile(File file) { try { ResourceBuilder resourceBuilder = new ResourceBuilder(); if (resourceBuilder.addFile(file, relativize(file))) { if (analyzer != null) { analyzer.analyzeFile(file, resourceBuilder.safeResourceBuilder()); } return resourceBuilder.build(); } } catch (Exception e) { reporter.exception(e, "Could not index file %s", file); } return null; }
@Override public void generateIndex(Set<File> files, OutputStream output, String repoName, URI baseUri, boolean pretty, Registry registry, LogService log) throws Exception { long modified = files.stream() .mapToLong(File::lastModified) .max() .orElse(-1L); new SimpleIndexer().files(files) .base(baseUri) .compress(!pretty) .name(repoName) .increment(modified) .index(output); } }
/** * Generate the index to the specified output stream. * * @param outputStream the output stream to write the index file * @throws IOException if a file cannot be indexed */ public void index(OutputStream outputStream) throws IOException { repository().save(requireNonNull(outputStream)); }
/** * Generate the index to the specified output stream. * * @param outputStream the output stream to write the index file * @throws IOException if a file cannot be indexed */ public void index(OutputStream outputStream) throws IOException { repository().save(requireNonNull(outputStream)); }
/** * Generate the index to the specified file. * * @param file the file to write the index file * @throws IOException if a file cannot be indexed */ public void index(File file) throws IOException { repository().save(requireNonNull(file)); }