jsky.catalog.irsa
Class IRSAConfig

java.lang.Object
  extended by jsky.catalog.AbstractCatalogDirectory
      extended by jsky.catalog.irsa.IRSAConfig
All Implemented Interfaces:
Cloneable, TreeModel, Catalog, CatalogDirectory, QueryResult

public class IRSAConfig
extends AbstractCatalogDirectory

Reads an IRSA XML catalog description (Holdings) file and stores information about the catalogs defined there.

Version:
$Revision: 1.3 $
Author:
Allan Brighton

Field Summary
 
Fields inherited from interface jsky.catalog.Catalog
ARCHIVE, CATALOG, DIRECTORY, IMAGE_SERVER, LOCAL, NAME_SERVER
 
Constructor Summary
IRSAConfig(String configFileOrURL)
          Parse the given IRSA XML file or URL.
IRSAConfig(String name, String configFileOrURL)
          Parse the given IRSA XML file or URL.
IRSAConfig(String name, URL url)
          Parse the IRSA XML catalog config file pointed to by the given URL.
IRSAConfig(URL url, HTMLQueryResultHandler handler)
          Parse the IRSA XML file from the already opened input stream.
 
Method Summary
 void addCatalogDirectory(String urlStr)
          Add a catalog directory to the catalog list.
static IRSAConfig getConfigFile()
          If the catalog config file has already been loaded, return an object describing the contents, otherwise search for an IRSA XML catalog config file, load the contents if found, and return the object for it.
static CatalogDirectory getDirectory()
          This method is called once at startup to load the top level catalog directory
 CatalogDirectory loadSubDir(URL url)
          Attempt to read a catalog subdirectory from the given URL and return a CatalogDirectory object for it.
static void main(String[] args)
          Test cases
 CatalogDirectory reload()
          Reload the catalog config file and return the new object for it.
 void save()
          Save the catalog descriptions to a set of IRSA XML files under ~/.jsky/irsa/.
 void save(String dirName)
          Save the catalog descriptions to a set of IRSA XML files under the given directory.
static void setConfigFile(URL url)
          Set the URL to use for the default catalog config file.
 
Methods inherited from class jsky.catalog.AbstractCatalogDirectory
addCatalog, addCatalog, addTreeModelListener, clone, getCatalog, getCatalog, getCatalogList, getCatalogs, getChild, getChildCount, getDescription, getDocURL, getHTMLQueryResultHandler, getId, getIndexOfChild, getName, getNameServers, getNumCatalogs, getNumParams, getParamDesc, getParamDesc, getParent, getPath, getPath, getRoot, getRootCatalogDirectory, getTitle, getType, getURL, indexOf, isImageServer, isLeaf, isLocal, moveCatalog, moveCatalogToEnd, query, removeCatalog, removeTreeModelListener, replaceCatalog, setCatalogs, setHTMLQueryResultHandler, setId, setName, setParent, setRegionArgs, setURL, toString, valueForPathChanged
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IRSAConfig

public IRSAConfig(String name,
                  URL url)
Parse the IRSA XML catalog config file pointed to by the given URL.

Parameters:
name - the display name for the config file
url - the URL of the config file

IRSAConfig

public IRSAConfig(String name,
                  String configFileOrURL)
Parse the given IRSA XML file or URL.

Parameters:
name - the display name for the config file
configFileOrURL - the file name or URL of the config file

IRSAConfig

public IRSAConfig(String configFileOrURL)
Parse the given IRSA XML file or URL.

Parameters:
configFileOrURL - the file name or URL of the config file

IRSAConfig

public IRSAConfig(URL url,
                  HTMLQueryResultHandler handler)
Parse the IRSA XML file from the already opened input stream. The URL is passed as a reference.

Parameters:
url - the URL of the config file
handler - used to report HTML errors from the HTTP server
Method Detail

getDirectory

public static CatalogDirectory getDirectory()
This method is called once at startup to load the top level catalog directory


getConfigFile

public static IRSAConfig getConfigFile()
If the catalog config file has already been loaded, return an object describing the contents, otherwise search for an IRSA XML catalog config file, load the contents if found, and return the object for it.

First the jsky.catalog.irsa.config system property is checked. If set, it should be the URL string or file name of the config file.

Next, the file ~/.jsky/nph-catlist.xml is checked. This file is created automatically when the user makes any changes in the catalog configuration or plot symbol settings in the table display/configure window.

Finally, a default URL s used. It may be set by calling "setConfigFile" and defaults to a config file included in this package (as a resource file: jsky/catalog/irsa/conf/nph-catlist.xml).

Returns:
a IRSAConfig object constructed from the file.

reload

public CatalogDirectory reload()
Reload the catalog config file and return the new object for it.


loadSubDir

public CatalogDirectory loadSubDir(URL url)
Attempt to read a catalog subdirectory from the given URL and return a CatalogDirectory object for it.

Returns:
the new CatalogDirectory
Throws:
RuntimeException - if the catalog directory could not be created

setConfigFile

public static void setConfigFile(URL url)
Set the URL to use for the default catalog config file.

Parameters:
url - points to the IRSA XML catalog config file

addCatalogDirectory

public void addCatalogDirectory(String urlStr)
Add a catalog directory to the catalog list.

Parameters:
urlStr - the URL of a catalog config file.

save

public void save()
Save the catalog descriptions to a set of IRSA XML files under ~/.jsky/irsa/.


save

public void save(String dirName)
          throws IOException
Save the catalog descriptions to a set of IRSA XML files under the given directory.

Parameters:
dirName - the directory name in which to store the XML files (must end with a file separator)
Throws:
IOException

main

public static void main(String[] args)
Test cases



Copyright © 2015 Central Laboratory of the Research Councils. All Rights Reserved.