Mercurial > repos > timpalpant > java_genomics_toolkit
diff java-genomics-toolkit/src/edu/unc/config/GalaxyConfig.java @ 0:1daf3026d231
Upload alpha version
author | timpalpant |
---|---|
date | Mon, 13 Feb 2012 21:55:55 -0500 |
parents | |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/java-genomics-toolkit/src/edu/unc/config/GalaxyConfig.java Mon Feb 13 21:55:55 2012 -0500 @@ -0,0 +1,42 @@ +package edu.unc.config; + +import java.io.IOException; +import java.nio.file.Path; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; + +import org.w3c.dom.Document; +import org.xml.sax.SAXException; + +public class GalaxyConfig { + + /** + * Parse a Galaxy configuration file + * @param p + * @return + * @throws ParserConfigurationException + * @throws IOException + * @throws SAXException + */ + public static GalaxyConfig parse(Path p) throws ParserConfigurationException, SAXException, IOException { + DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); + DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); + Document doc = dBuilder.parse(p.toFile()); + return parse(doc); + } + + /** + * Parse a Galaxy configuration XML + * @param doc + * @return + */ + public static GalaxyConfig parse(Document doc) { + GalaxyConfig config = new GalaxyConfig(); + + // TODO Implement parser + + return config; + } +}