/** * This is a migration method for global to processor options. Currently used * by the merge-processor which gets the 'source:once' option from the global * scope. */ private Map<String, Object> injectGlobalOptionsFallback( final Version version, final Manifest manifest, final String name, final Map<String, Object> options) { final Map<String, Object> copy = new HashMap<String, Object>(options); copy.put("version", version.toString()); if (manifest != null) { if ("merge".equals(name)) { copy.put("source", GlobalOptions.isSourceOnce(manifest) ? "once" : ""); } } return copy; }
/** * @param resolver * @param task * @return Returns a list of input resources resolved from the given * {@link Task} * @throws IOException */ @Deprecated public static Resources createResourceGroup(final ResourceResolver resolver, final Task task) throws IOException { return createResourceGroupImpl1(resolver, new SourceMerger(GlobalOptions.isSourceOnce(task)), new ArrayList<String>(Arrays.asList(task.getIn()))); }
/** * @param version * The spec version to execute * @param resolver * The {@link ResourceResolver} to use for resource resolving * @param task * The input {@link Task} * @return Returns the resolved input resources * @throws IOException */ public static Resources createResourceGroup(final Version version, final ResourceResolver resolver, final Task task) throws IOException { if (version.isAtLeast(Version._1_0_0)) { // Since version 1.1.0 no multi-resources return createResourceGroupImpl0(resolver, new SourceMerger(GlobalOptions.isSourceOnce(task)), new ArrayList<String>(Arrays.asList(task.getIn()))); } return createResourceGroup(resolver, task); }
@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); } } } }