Beispiel #1
0
 /**
  * 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");
   }
 }
Beispiel #2
0
 /**
  * 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);
 }