thredds.cataloggen
Class CatalogGen

java.lang.Object
  extended by thredds.cataloggen.CatalogGen

public class CatalogGen
extends Object

CatalogGen crawls dataset sources given in a CatalogGenConfig file to produce THREDDS catalogs. To generate a catalog from a config file:

   String inFileName = "file:/home/edavis/testCatGenConfig.xml";
   String outFileName = "/home/edavis/testCatGenConfig-results.xml";
   StringBuffer log = new StringBuffer();
   CatalogGen catGen = new CatalogGen( inFileName);
   if ( catGen.isValid( log))
   {
     catGen.expand();
     catGen.writeCatalog( outFileName);
   }
 

Version:
$Ver$
Author:
Ethan Davis

Field Summary
protected  InvCatalogFactory catFactory
          The catalog factory that knows about CatalogGenConfig metadata.
 
Constructor Summary
CatalogGen(InputStream configDocInputStream, URL configDocURL)
          Constructs the CatalogGen for the given config document InputStream.
CatalogGen(URL configDocURL)
          Constructs the CatalogGen for the given config document.
 
Method Summary
 InvCatalog expand()
          Expand the catalog.
 List getCatalogRefInfoList()
           
 boolean isValid(StringBuilder out)
          Checks the validity of the configuration file.
 void setCatalogExpiresDate(DateType expiresDate)
           
 void writeCatalog(String outFileName)
          Writes the catalog as XML.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

catFactory

protected InvCatalogFactory catFactory
The catalog factory that knows about CatalogGenConfig metadata.

Constructor Detail

CatalogGen

public CatalogGen(URL configDocURL)
Constructs the CatalogGen for the given config document.

Parameters:
configDocURL - - the URL of the configuration document

CatalogGen

public CatalogGen(InputStream configDocInputStream,
                  URL configDocURL)
Constructs the CatalogGen for the given config document InputStream.

Parameters:
configDocInputStream - - the InputStream from which to read the config document.
configDocURL - - the URL for the config document.
Method Detail

getCatalogRefInfoList

public List getCatalogRefInfoList()

isValid

public boolean isValid(StringBuilder out)
Checks the validity of the configuration file.

Parameters:
out - - a StringBuffer with validity error and warning messages.
Returns:
- true if no errors, false if errors exist

expand

public InvCatalog expand()
Expand the catalog. Each of the CatalogGenConfig metadata elements is expanded into its constituent datasets.


setCatalogExpiresDate

public void setCatalogExpiresDate(DateType expiresDate)

writeCatalog

public void writeCatalog(String outFileName)
                  throws IOException
Writes the catalog as XML. The catalog is written to the file given in outFileName. If outFileName is null, the catalog is written to standard out.

Parameters:
outFileName - - the pathname of the output file.
Throws:
IOException - if can't write catalog


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.