home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2005 June / PCpro_2005_06.ISO / files / opensource / rssowl / rssowl_win32_1_1.exe / rssowl.jar / JDOMAbout$Info.class (.txt) < prev    next >
Encoding:
Java Class File  |  2004-09-09  |  2.9 KB  |  70 lines

  1. import java.io.FileNotFoundException;
  2. import java.io.InputStream;
  3. import java.util.LinkedList;
  4. import java.util.List;
  5. import java.util.StringTokenizer;
  6. import java.util.jar.JarFile;
  7. import java.util.zip.ZipEntry;
  8. import org.jdom.Document;
  9. import org.jdom.Element;
  10. import org.jdom.input.SAXBuilder;
  11.  
  12. class JDOMAbout$Info {
  13.    // $FF: synthetic field
  14.    private final JDOMAbout this$0;
  15.    String title;
  16.    String version;
  17.    String copyright;
  18.    String description;
  19.    List authors;
  20.    String license;
  21.    String support;
  22.    String website;
  23.  
  24.    JDOMAbout$Info(JDOMAbout this$0) throws Exception {
  25.       this.this$0 = this$0;
  26.       String INFO_FILENAME = "META-INF/info.xml";
  27.       SAXBuilder builder = new SAXBuilder();
  28.       JarFile jarFile = null;
  29.       ZipEntry zipEntry = null;
  30.       String classpath = System.getProperty("java.class.path");
  31.       StringTokenizer tokenizer = new StringTokenizer(classpath, ";:");
  32.  
  33.       while(tokenizer.hasMoreTokens() && zipEntry == null) {
  34.          String token = tokenizer.nextToken();
  35.  
  36.          try {
  37.             jarFile = new JarFile(token);
  38.             zipEntry = jarFile.getEntry("META-INF/info.xml");
  39.          } catch (Exception var15) {
  40.          }
  41.       }
  42.  
  43.       if (zipEntry == null) {
  44.          throw new FileNotFoundException("META-INF/info.xml not found; it should be within the JDOM JAR but isn't");
  45.       } else {
  46.          InputStream in = jarFile.getInputStream(zipEntry);
  47.          Document doc = builder.build(in);
  48.          Element root = doc.getRootElement();
  49.          this.title = root.getChildTextTrim("title");
  50.          this.version = root.getChildTextTrim("version");
  51.          this.copyright = root.getChildTextTrim("copyright");
  52.          this.description = root.getChildTextTrim("description");
  53.          this.license = root.getChildTextTrim("license");
  54.          this.support = root.getChildTextTrim("support");
  55.          this.website = root.getChildTextTrim("web-site");
  56.          List authorElements = root.getChildren("author");
  57.          this.authors = new LinkedList();
  58.  
  59.          for(Element element : authorElements) {
  60.             this$0.getClass();
  61.             JDOMAbout$Author author = new JDOMAbout$Author(this$0);
  62.             author.name = element.getChildTextTrim("name");
  63.             author.email = element.getChildTextTrim("e-mail");
  64.             this.authors.add(author);
  65.          }
  66.  
  67.       }
  68.    }
  69. }
  70.