0
|
1 package edu.unc.config;
|
|
2
|
|
3 import java.io.IOException;
|
|
4 import java.nio.file.Path;
|
|
5
|
|
6 import javax.xml.parsers.DocumentBuilder;
|
|
7 import javax.xml.parsers.DocumentBuilderFactory;
|
|
8 import javax.xml.parsers.ParserConfigurationException;
|
|
9
|
|
10 import org.w3c.dom.Document;
|
|
11 import org.xml.sax.SAXException;
|
|
12
|
|
13 public class GalaxyConfig {
|
|
14
|
|
15 /**
|
|
16 * Parse a Galaxy configuration file
|
|
17 * @param p
|
|
18 * @return
|
|
19 * @throws ParserConfigurationException
|
|
20 * @throws IOException
|
|
21 * @throws SAXException
|
|
22 */
|
|
23 public static GalaxyConfig parse(Path p) throws ParserConfigurationException, SAXException, IOException {
|
|
24 DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
|
25 DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
|
|
26 Document doc = dBuilder.parse(p.toFile());
|
|
27 return parse(doc);
|
|
28 }
|
|
29
|
|
30 /**
|
|
31 * Parse a Galaxy configuration XML
|
|
32 * @param doc
|
|
33 * @return
|
|
34 */
|
|
35 public static GalaxyConfig parse(Document doc) {
|
|
36 GalaxyConfig config = new GalaxyConfig();
|
|
37
|
|
38 // TODO Implement parser
|
|
39
|
|
40 return config;
|
|
41 }
|
|
42 }
|