jsky.catalog
Class CatalogFactory

java.lang.Object
  extended by jsky.catalog.CatalogFactory

public class CatalogFactory
extends java.lang.Object

Used to manage access to a known list of catalogs. Catalogs may be registered by name and later searched for by name.


Constructor Summary
CatalogFactory()
           
 
Method Summary
static Catalog getCatalogByName(java.lang.String catalogName)
          This method returns a Catalog object that can be used to query the given catalog, or null if no such object was found.
static java.util.List getCatalogsByType(java.lang.String type)
          This method returns a list of Catalog objects that have the given type, in the order in which they were registered.
static java.util.Iterator iterator()
          Returns an Iterator to visit each registered catalog in sorted order.
static void registerCatalog(Catalog catalog, boolean overwrite)
          Register the given catalog.
static void unregisterCatalog(Catalog catalog)
          Unregister the given catalog, removing it from the list of known catalogs.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CatalogFactory

public CatalogFactory()
Method Detail

registerCatalog

public static void registerCatalog(Catalog catalog,
                                   boolean overwrite)
Register the given catalog. The argument may be any object that implements the Catalog interface and will be used for any access to that catalog. Since the catalog may not actually be used, the constructor should not open any connections until needed.

Parameters:
catalog - An object to use to query the catalog.
overwrite - if true, the given catalog object replaces any previously defined catalog with the same name, otherwise only the first catalog registered with a given name is actually registered.

getCatalogByName

public static Catalog getCatalogByName(java.lang.String catalogName)
This method returns a Catalog object that can be used to query the given catalog, or null if no such object was found.

Parameters:
catalogName - The name of a registered catalog
Returns:
The object to use to query the catalog, or null if not found.

getCatalogsByType

public static java.util.List getCatalogsByType(java.lang.String type)
This method returns a list of Catalog objects that have the given type, in the order in which they were registered.

Parameters:
type - The catalog type (as returned by Catalog.getType())
Returns:
the list of Catalog objects found

unregisterCatalog

public static void unregisterCatalog(Catalog catalog)
Unregister the given catalog, removing it from the list of known catalogs.

Parameters:
catalog - The catalog to be removed from the list.

iterator

public static java.util.Iterator iterator()
Returns an Iterator to visit each registered catalog in sorted order.

Returns:
The Iterator object for a sorted list of Catalogs.