FileDocCategorySizeDatePackage
VersionRelease.javaAPI DocJBoss 4.2.112587Fri Jul 13 21:01:58 BST 2007None

VersionRelease

public class VersionRelease extends Object
A utility which goes through a standard dist build and tags every jar with the current build version using the jar file version manifest headers. The unique jars and their version info and md5 digests are output to the jboss.home/jar-versions.xml.
author
Scott.Stark@jboss.org
version
$Revision: 57187 $

Fields Summary
static byte[]
buffer
File
jbossHome
The jboss dist root directory
String
specVersion
String
specVendor
String
specTitle
String
implTitle
String
implURL
String
implVersion
String
implVendor
String
implVendorID
MessageDigest
md5
TreeSet
jars
Constructors Summary
public VersionRelease(String homeDir)


     
        
   
      jbossHome = new File(homeDir);
      if( jbossHome.exists() == false )
         throw new FileNotFoundException(jbossHome.getAbsolutePath() + " does not exist");
      specTitle = System.getProperty("specification.title");
      specVersion = System.getProperty("specification.version");
      specVendor = System.getProperty("specification.vendor");
      implTitle = System.getProperty("implementation.title");
      implURL = System.getProperty("implementation.url");
      implVersion = System.getProperty("implementation.version");
      implVendor = System.getProperty("implementation.vendor");
      implVendorID = System.getProperty("implementation.vendor.id");
      md5 = MessageDigest.getInstance("MD5");
   
Methods Summary
public static voidmain(java.lang.String[] args)

      VersionRelease vr = new VersionRelease(args[0]);
      vr.run();
   
voidprocessDir(java.io.File dir)

      File[] files = dir.listFiles();
      for(int f = 0; f < files.length; f ++)
      {
         File child = files[f];
         if( child.isDirectory() == true )
            processDir(child);
         else
            processFile(child);
      }
   
voidprocessFile(java.io.File file)

      System.out.println("Checking file: "+file);
      // See if this is a jar archive
      try
      {
         JarInfo info = new JarInfo(file, this);
         info.write(md5);
         jars.add(info);
      }
      catch(FileNotFoundException e)
      {
      }
      catch(Exception e)
      {
         e.printStackTrace();
      }
   
public voidrun()

      processDir(jbossHome);
      try
      {
         DocumentFactory df = DocumentFactory.getInstance();
         Document doc = df.createDocument();
         Element root = doc.addElement("jar-versions");
         Iterator iter = jars.iterator();
         while( iter.hasNext() )
         {
            JarInfo info = (JarInfo) iter.next();
            info.writeXML(root);
         }

         File versionsXml = new File(jbossHome, "jar-versions.xml");
         FileWriter versionInfo = new FileWriter(versionsXml);
         OutputFormat outformat = OutputFormat.createPrettyPrint();
         XMLWriter writer = new XMLWriter(versionInfo, outformat);
         writer.setEscapeText(true);
         writer.write(doc);
         writer.flush();
         versionInfo.close();
      }
      catch(IOException e)
      {
         e.printStackTrace();
      }