/** * @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 { return processor.execute(vfs, this, options); }
/** * @see de.matrixweb.smaller.resource.ProcessorFactory#dispose() */ @Override public void dispose() { for (final Processor processor : this.processors.values()) { processor.dispose(); } }
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); } } } }
@Deprecated private List<ProcessorOptions> setupProcessors(final Version version, final Task task) { final List<ProcessorOptions> list = new ArrayList<Pipeline.ProcessorOptions>(); boolean hasJsMerger = false; boolean hasCssMerger = false; final String processors = task.getProcessor(); LOGGER.info("Building processor chain: {}", processors); for (final String name : processors.split(",")) { final Processor processor = this.processorFactory.getProcessor(name); if (processor != null) { hasJsMerger |= processor instanceof MergingProcessor && processor.supportsType(Type.JS); hasCssMerger |= processor instanceof MergingProcessor && processor.supportsType(Type.CSS); list.add(new ProcessorOptions(name, processor, addVersionToOptions( task.getOptionsFor(name), version))); } } // Since version 1.0.0 no implicit merger if (version == Version.UNDEFINED) { if (!hasJsMerger) { list.add(0, createTypeMerger(Type.JS)); } if (!hasCssMerger) { list.add(0, createTypeMerger(Type.CSS)); } } return list; }
/** * @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; }
@Deprecated private void execute1_0(final VFS vfs, final ResourceResolver resolver, final Resources resources, final List<ProcessorOptions> entries, final Task task) throws IOException { for (final ProcessorOptions entry : entries) { for (final Type type : Type.values()) { final List<Resource> res = resources.getByType(type); if (entry.processor.supportsType(type)) { LOGGER.info("Executing processor {} for type {}", entry.name, type); final List<Resource> results = new ArrayList<Resource>(); // TODO: SourceMerger should not be required here final ResourceGroup group = new ResourceGroup(res, new SourceMerger( GlobalOptions.isSourceOnce(task))); group.apply(vfs, entry.processor, entry.options); results.addAll(group.getResources()); resources.replace(res, results); } } } }
/** * @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; }
.getName()); LOGGER.info("Executing processor {}", proc.getName()); final Resource result = processor.execute( vfs, input == null ? null : resolver.resolve(input),