annotate src/edu/unc/config/GalaxyConfig.java @ 2:e16016635b2a

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