/** * Defines the mapper to map source to destination files. * * @param mapper the mapper to use * @throws BuildException if more than one mapper is defined */ public void addMapper(Mapper mapper) throws BuildException { add(mapper.getImplementation()); }
protected void handleError(String msg) { if (failOnError) { throw new BuildException(msg, getLocation()); } log(msg, Project.MSG_WARN); }
/** * Adds a nested FileNameMapper. * * @param fileNameMapper the mapper to add * @throws BuildException if more than one mapper is defined */ public void add(FileNameMapper fileNameMapper) throws BuildException { if (mapper != null) { handleError("Cannot define more than one mapper"); return; } mapper = fileNameMapper; }
handleError("if steps are given, only active inputs nested in these steps are supported"); handleError("if steps are given, only active parameters nested in these steps are supported"); handleError("if steps are given, only active options nested in these steps are supported"); handleError("pipeline '" + pipelineResource.getName() + "' does not exist"); return; handleError("input file '" + inResource.getName() + "' does not exist"); return; handleError("'in' and explicit filesets cannot be used together."); return; log("'in' and/or 'out' cannot be used with implicit fileset: ignoring implicit fileset.", Project.MSG_VERBOSE); useImplicitFileset = false; log("steps cannot be used with implicit fileset: ignoring implicit fileset.", Project.MSG_VERBOSE); useImplicitFileset = false; handleError("Nested <mapper> for default output and 'out' cannot be used together."); return; outputResources.containsKey(outPort)) && mapper != null) { handleError("Nested <mapper> and port for default output cannot be used together."); return;
/** * Add a nested {@code <step>} element. * * @param step the configured Step object represented as {@code <step>}. */ public void addConfiguredStep(Step step) { if (!step.shouldUse()) { log("Skipping step '" + step.getName() + "' as it is configured to be unused.", Project.MSG_DEBUG); return; } if (step.getName() == null) { handleError("Steps must have their 'name' attribute set"); } steps.add(step); }
log("Newest input time: " + newestInputLastModified, Project.MSG_DEBUG); log("Oldest output time: " + oldestOutputLastModified, Project.MSG_DEBUG); log("Pipeline file " + pipelineResource + " time: " + pipelineLastModified, Project.MSG_DEBUG); log("Skipping because all outputs are newer than inputs and newer than pipeline", Project.MSG_DEBUG); return; useParameter(parameter); useOption(option); handleError(e);
/** * Add a nested {@code <profile>} element. * * @param profile the configured Resources object represented as {@code <profile>} */ public void addConfiguredProfile(UseableResources profile) { if (!profile.shouldUse()) { log("Skipping profile as it is configured to be unused.", Project.MSG_DEBUG); return; } if (profile.size() == 0) { return; } if (profile.size() > 1) { handleError("The profile element must be specified with at most one nested resource."); } setProfileFile((Resource) profile.iterator().next()); }
/** * Add a nested {@code <saxonConfig>} element. * * @param saxonConfig the configured Resources object represented as {@code <saxonConfig>} */ public void addConfiguredSaxonConfig(UseableResources saxonConfig) { if (!saxonConfig.shouldUse()) { log("Skipping saxonConfig as it is configured to be unused.", Project.MSG_DEBUG); return; } if (saxonConfig.size() == 0) { return; } if (saxonConfig.size() > 1) { handleError("The saxonConfig element must be specified with at most one nested resource."); } setSaxonConfigFile((Resource) saxonConfig.iterator().next()); }
/** * Add a nested {@code <config>} element. * * @param config the configured Resources object represented as {@code <config>} */ public void addConfiguredConfig(UseableResources config) { if (!config.shouldUse()) { log("Skipping config as it is configured to be unused.", Project.MSG_DEBUG); return; } if (config.size() == 0) { return; } if (config.size() > 1) { handleError("The config element must be specified with at most one nested resource."); } setConfigFile((Resource) config.iterator().next()); }
/** * Add a nested <pipeline> element. * * @param pipeline the configured Resources object represented as <pipeline>. */ public void addConfiguredPipeline(UseableResources pipeline) { if (!pipeline.shouldUse()) { log("Skipping pipeline as it is configured to be unused.", Project.MSG_DEBUG); return; } if (pipeline.size() == 0) { return; } if (pipeline.size() > 1) { handleError("The pipeline element must be specified with at most one nested resource."); } setPipeline((Resource) pipeline.iterator().next()); }
/** * Sets the destination directory to the base directory if it is not set explicitly. */ private void checkDest() { if (destDir == null) { destDir = baseDir; log("destdir defaulting to basedir", Project.MSG_DEBUG); } }
handleError("if steps are given, only active inputs nested in these steps are supported"); handleError("if steps are given, only active parameters nested in these steps are supported"); handleError("if steps are given, only active options nested in these steps are supported"); handleError("pipeline '" + pipelineResource.getName() + "' does not exist"); return; handleError("input file '" + inResource.getName() + "' does not exist"); return; handleError("'in' and explicit filesets cannot be used together."); return; log("'in' and/or 'out' cannot be used with implicit fileset: ignoring implicit fileset.", Project.MSG_VERBOSE); useImplicitFileset = false; log("steps cannot be used with implicit fileset: ignoring implicit fileset.", Project.MSG_VERBOSE); useImplicitFileset = false; handleError("Nested <mapper> for default output and 'out' cannot be used together."); return; outputResources.containsKey(outPort)) && mapper != null) { handleError("Nested <mapper> and port for default output cannot be used together."); return;
/** * Add a nested {@code <step>} element. * * @param step the configured Step object represented as {@code <step>}. */ public void addConfiguredStep(Step step) { if (!step.shouldUse()) { log("Skipping step '" + step.getName() + "' as it is configured to be unused.", Project.MSG_DEBUG); return; } if (step.getName() == null) { handleError("Steps must have their 'name' attribute set"); } steps.add(step); }
log("Newest input time: " + newestInputLastModified, Project.MSG_DEBUG); log("Oldest output time: " + oldestOutputLastModified, Project.MSG_DEBUG); log("Pipeline file " + pipelineResource + " time: " + pipelineLastModified, Project.MSG_DEBUG); log("Skipping because all outputs are newer than inputs and newer than pipeline", Project.MSG_DEBUG); return; useParameter(parameter); useOption(option); handleError(e);
/** * Add a nested {@code <profile>} element. * * @param profile the configured Resources object represented as {@code <profile>} */ public void addConfiguredProfile(UseableResources profile) { if (!profile.shouldUse()) { log("Skipping profile as it is configured to be unused.", Project.MSG_DEBUG); return; } if (profile.size() == 0) { return; } if (profile.size() > 1) { handleError("The profile element must be specified with at most one nested resource."); } setProfileFile((Resource) profile.iterator().next()); }
/** * Add a nested {@code <saxonConfig>} element. * * @param saxonConfig the configured Resources object represented as {@code <saxonConfig>} */ public void addConfiguredSaxonConfig(UseableResources saxonConfig) { if (!saxonConfig.shouldUse()) { log("Skipping saxonConfig as it is configured to be unused.", Project.MSG_DEBUG); return; } if (saxonConfig.size() == 0) { return; } if (saxonConfig.size() > 1) { handleError("The saxonConfig element must be specified with at most one nested resource."); } setSaxonConfigFile((Resource) saxonConfig.iterator().next()); }
/** * Add a nested {@code <config>} element. * * @param config the configured Resources object represented as {@code <config>} */ public void addConfiguredConfig(UseableResources config) { if (!config.shouldUse()) { log("Skipping config as it is configured to be unused.", Project.MSG_DEBUG); return; } if (config.size() == 0) { return; } if (config.size() > 1) { handleError("The config element must be specified with at most one nested resource."); } setConfigFile((Resource) config.iterator().next()); }
/** * Add a nested <pipeline> element. * * @param pipeline the configured Resources object represented as <pipeline>. */ public void addConfiguredPipeline(UseableResources pipeline) { if (!pipeline.shouldUse()) { log("Skipping pipeline as it is configured to be unused.", Project.MSG_DEBUG); return; } if (pipeline.size() == 0) { return; } if (pipeline.size() > 1) { handleError("The pipeline element must be specified with at most one nested resource."); } setPipeline((Resource) pipeline.iterator().next()); }
/** * Sets the destination directory to the base directory if it is not set explicitly. */ private void checkDest() { if (destDir == null) { destDir = baseDir; log("destdir defaulting to basedir", Project.MSG_DEBUG); } }
/** * Add a nested {@code <library>} element. * * @param libraries the configured Resources object represented as {@code <library>}. */ @SuppressWarnings("unchecked") public void addConfiguredLibrary(UseableResources libraries) { if (!libraries.shouldUse()) { log("Skipping library as it is configured to be unused.", Project.MSG_DEBUG); return; } try { for (Iterator<Resource> iterator = libraries.iterator(); iterator.hasNext(); ) { Resource library = iterator.next(); userArgs.addLibrary(library.getInputStream(), library.toString()); } } catch (Exception e) { handleError(e); } }