/** * @see de.matrixweb.smaller.resource.Resource#apply(de.matrixweb.vfs.VFS, * de.matrixweb.smaller.resource.Processor, java.util.Map) */ @Override public Resource apply(final VFS vfs, final Processor processor, final Map<String, Object> options) throws IOException { if (processor instanceof MultiResourceProcessor) { return processor.execute(vfs, this, options); } final List<Resource> list = new ArrayList<Resource>(); for (final Resource resource : this.resources) { list.add(resource.apply(vfs, processor, options)); } this.resources.clear(); this.resources.addAll(list); return this; }
/** * @see de.matrixweb.smaller.resource.Resource#apply(de.matrixweb.vfs.VFS, * de.matrixweb.smaller.resource.Processor, java.util.Map) */ @Override public Resource apply(final VFS vfs, final Processor processor, final Map<String, Object> options) throws IOException { // Version 1.1.0 handling if (this.resources.isEmpty()) { LOGGER.info("Found empty input-ResourcesGroup; Processor '" + processor + "' will decide what to process"); return processor.execute(vfs, null, options); } if (processor instanceof MultiResourceProcessor) { LOGGER.info("MultiResourceProcessor '" + processor + "' execution on " + this); final Resource result = processor.execute(vfs, this, options); this.resources.clear(); this.resources.add(result); return result; } final List<Resource> list = new ArrayList<Resource>(); for (final Resource resource : this.resources) { LOGGER.info("Processor '" + processor + "' execution on " + resource); list.add(resource.apply(vfs, processor, options)); } this.resources.clear(); this.resources.addAll(list); return this; }
private void execute0_0(final VFS vfs, final Resources resources, final List<ProcessorOptions> entries) throws IOException { for (final ProcessorOptions entry : entries) { for (final Type type : Type.values()) { final List<Resource> res = resources.getByType(type); if (res.size() > 0 && entry.processor.supportsType(type)) { LOGGER.info("Executing processor {} for type {}", entry.name, type); final List<Resource> results = new ArrayList<Resource>(); for (final Resource r : res) { results.add(r.apply(vfs, entry.processor, entry.options)); } resources.replace(res, results); } } } }