1
|
package eu.etaxonomy.taxeditor.editor.workingSet;
|
2
|
|
3
|
import java.io.File;
|
4
|
import java.io.IOException;
|
5
|
import java.net.URISyntaxException;
|
6
|
import java.net.URL;
|
7
|
|
8
|
import javax.xml.bind.JAXBContext;
|
9
|
import javax.xml.bind.JAXBException;
|
10
|
import javax.xml.bind.Unmarshaller;
|
11
|
|
12
|
import org.bgbm.prometheus.xml.ONTOLOGYDETAILS;
|
13
|
import org.bgbm.prometheus.xml.TreeNode;
|
14
|
import org.eclipse.core.runtime.FileLocator;
|
15
|
import org.eclipse.core.runtime.Path;
|
16
|
import org.eclipse.core.runtime.Platform;
|
17
|
|
18
|
public class PrometheusOntology {
|
19
|
|
20
|
public static ONTOLOGYDETAILS createOntology() {
|
21
|
try {
|
22
|
|
23
|
URL url = null;
|
24
|
URL iconUrl = FileLocator.find(Platform.getBundle("eu.etaxonomy.taxeditor.editor"), new Path("icons/Ontology.xml"), null);
|
25
|
// URL url = PrometheusOntology.class.getResource("Ontology.xml");
|
26
|
File file = null;
|
27
|
try {
|
28
|
file = new File(FileLocator.resolve(iconUrl).toURI());
|
29
|
} catch (URISyntaxException | IOException e) {
|
30
|
// TODO Auto-generated catch block
|
31
|
e.printStackTrace();
|
32
|
}
|
33
|
JAXBContext jaxbContext = JAXBContext.newInstance(ONTOLOGYDETAILS.class, TreeNode.class);
|
34
|
|
35
|
Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
|
36
|
ONTOLOGYDETAILS unmarshal = (ONTOLOGYDETAILS) jaxbUnmarshaller.unmarshal(file);
|
37
|
return unmarshal;
|
38
|
|
39
|
} catch (JAXBException e) {
|
40
|
e.printStackTrace();
|
41
|
}
|
42
|
return null;
|
43
|
}
|
44
|
|
45
|
public static void main(String[] args) {
|
46
|
createOntology();
|
47
|
}
|
48
|
}
|