public static void runOnHDFS(final UserGroupInformation userGroupInformation, final Configuration conf,
                                 final Consumer<FileSystem> func) {
        try {
            userGroupInformation.doAs(new PrivilegedExceptionAction<Void>() {
                @Override
                public Void run() {
                    final FileSystem hdfs = getHDFS(conf);

                    // run the passed lambda
                    func.accept(hdfs);

                    return null;
                }
            });
        } catch (final InterruptedException e) {
            // Continue to interrupt this thread.
            Thread.currentThread().interrupt();
        } catch (final IOException e) {
            throw new UncheckedIOException(e);
        }
    }
Creates an output stream for a file on an Hadoop Distributed File System
<p>
TODO Need to add in proper security so it can connect to a secured
(kerberos?) cluster
stroom-pipeline/src/main/java/stroom/pipeline/writer/HDFSFileAppender.java