home *** CD-ROM | disk | FTP | other *** search
- import java.io.FileNotFoundException;
- import java.io.InputStream;
- import java.util.ArrayList;
- import java.util.List;
- import org.jdom.Document;
- import org.jdom.Element;
- import org.jdom.input.SAXBuilder;
-
- class JDOMAbout$Info {
- private static final String INFO_FILENAME = "META-INF/jdom-info.xml";
- final String title;
- final String version;
- final String copyright;
- final String description;
- final String license;
- final String support;
- final String website;
- final List authors = new ArrayList();
-
- JDOMAbout$Info() throws Exception {
- InputStream inputStream = this.getInfoFileStream();
- SAXBuilder builder = new SAXBuilder();
- Document doc = builder.build(inputStream);
- Element root = doc.getRootElement();
- this.title = root.getChildTextTrim("title");
- this.version = root.getChildTextTrim("version");
- this.copyright = root.getChildTextTrim("copyright");
- this.description = root.getChildTextTrim("description");
- this.license = root.getChildTextTrim("license");
- this.support = root.getChildTextTrim("support");
- this.website = root.getChildTextTrim("web-site");
-
- for(Element element : root.getChildren("author")) {
- JDOMAbout$Author author = new JDOMAbout$Author(element.getChildTextTrim("name"), element.getChildTextTrim("e-mail"));
- this.authors.add(author);
- }
-
- }
-
- private InputStream getInfoFileStream() throws FileNotFoundException {
- InputStream inputStream = this.getClass().getResourceAsStream("META-INF/jdom-info.xml");
- if (inputStream == null) {
- throw new FileNotFoundException("META-INF/jdom-info.xml not found; it should be within the JDOM JAR but wasn't found on the classpath");
- } else {
- return inputStream;
- }
- }
- }
-