iesl/rexa1-metatagger — pull request #3 by jakemannix (2014-10-18 06:12:59+00:00)
Title: Library-ization refactoring

To enable this code to be used as a library at Ai2, some refactoring of both the primary entry point (MetaTag), and to basically anywhere there was file I/O:

* MetaTag.main() now delegates most of its work to an instance (non-singleton) object to process individual xml input files, as a) static singletons are evil, and b) there wasn't any easy single-file-at-a-time entry point

* I modified ScalaPipelineComponent to consume and emit simple struct-like case class which currently has just the xml and the filename, but in general, should future-proof the API contract of the pipeline

* data files being read from the data/ directory have been moved to src/main/resources/data, which is bundled into the jar now, and accessed via a new helper method (in MetaTag now, but should be a more generic helper) - classpathDataInputStream(fileName: String), and in general, places where files are created or read from are now accessed via InputStream/OutputStream - this way we can toss them into ByteArrayXYZStream or ObjectXYZStream and pass them around inside the JVM instead of always handling files (which may not get cleaned up properly in a distributed environment).

* the build file wasn't giving this a proper ivy/maven build: there was no organization set, so that's been added.

* some additional null checks, exceptions caught, and slight formatting cleanup