/** * Ensures that the File associated with this stub (if any) is in a writable location * @param stub */ protected <T> void validateOutputPath(final Stub<T> stub) { if (stub.getOutputFile() != null && !(IOUtils.isSpecialFile(stub.getOutputFile()))) { final File parentDir = stub.getOutputFile().getAbsoluteFile().getParentFile(); if (! (parentDir.canWrite() && parentDir.canExecute())) throw new UserException.CouldNotCreateOutputFile(stub.getOutputFile(), "either the containing directory doesn't exist or it isn't writable"); } }
/** * Provide a mechanism for injecting supplemental streams for external management. * @param stub Stream to manage. */ public <T> void addOutput(Stub<T> stub, Storage<T> storage) { stub.register(this); outputs.put(stub,storage); validateOutputPath(stub); }
/** * Initialize the output streams as specified by the user. * * @param outputTracker the tracker supplying the initialization data. */ private void initializeOutputStreams(final OutputTracker outputTracker) { for (final Map.Entry<ArgumentSource, Object> input : getInputs().entrySet()) { setReferenceFile(input.getValue()); outputTracker.addInput(input.getKey(), input.getValue()); } for (final Stub<?> stub : getOutputs()) { setReferenceFile(stub); stub.processArguments(argCollection); outputTracker.addOutput(stub); } outputTracker.prepareWalker(walker, getArguments().strictnessLevel); }