annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
1 package edu.unc.config;
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
2
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
3 import java.io.IOException;
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
4 import java.nio.file.Path;
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
5
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
6 import javax.xml.parsers.DocumentBuilder;
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
7 import javax.xml.parsers.DocumentBuilderFactory;
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
8 import javax.xml.parsers.ParserConfigurationException;
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
9
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
10 import org.w3c.dom.Document;
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
11 import org.xml.sax.SAXException;
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
12
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
13 public class GalaxyConfig {
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
14
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
15 /**
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
16 * Parse a Galaxy configuration file
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
17 * @param p
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
18 * @return
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
19 * @throws ParserConfigurationException
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
20 * @throws IOException
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
21 * @throws SAXException
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
22 */
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
23 public static GalaxyConfig parse(Path p) throws ParserConfigurationException, SAXException, IOException {
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
24 DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
25 DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
26 Document doc = dBuilder.parse(p.toFile());
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
27 return parse(doc);
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
28 }
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
29
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
30 /**
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
31 * Parse a Galaxy configuration XML
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
32 * @param doc
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
33 * @return
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
34 */
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
35 public static GalaxyConfig parse(Document doc) {
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
36 GalaxyConfig config = new GalaxyConfig();
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
37
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
38 // TODO Implement parser
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
39
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
40 return config;
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
41 }
1daf3026d231 Upload alpha version
timpalpant
parents:
diff changeset
42 }