jsky.catalog.skycat
Class SkycatCatalog

java.lang.Object
  extended by jsky.catalog.skycat.SkycatCatalog
All Implemented Interfaces:
java.lang.Cloneable, Catalog, PlotableCatalog, QueryResult

public class SkycatCatalog
extends java.lang.Object
implements PlotableCatalog

Represents a catalog as described in a Skycat style catalog config file. The (keyword: value) pairs in the config file are stored here in a Properties object.

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
SkycatCatalog(SkycatConfigEntry entry)
          Initialize the catalog from the given catalog configuration entry.
SkycatCatalog(SkycatConfigEntry entry, HTMLQueryResultHandler handler)
          Initialize the catalog from the given catalog configuration entry.
SkycatCatalog(SkycatConfigEntry entry, SkycatTable table)
          Initialize the catalog from the given catalog configuration entry.
SkycatCatalog(SkycatTable table)
          Initialize the catalog from the given table.
 
Method Summary
protected  ProgressPanel _getProgressPanel(java.lang.String title)
          Return a panel for displaying the progress of a query.
protected  void _setMaxRows(QueryArgs queryArgs, SearchCondition[] sc)
          Check for a "Max Objects" argument and if found, set queryArgs.maxRows with the value.
protected  void _setQueryRegion(QueryArgs queryArgs, SearchCondition[] sc)
          Determine the query region based on the given query arguments
 java.lang.Object clone()
          Implementation of the clone method (makes a shallow copy).
 SkycatConfigEntry getConfigEntry()
          Return the object used to manage the configuration info for this catalog
 java.lang.String getDescription()
          Return a description of the catalog (same as name here)
 java.net.URL getDocURL()
          Return a URL pointing to documentation for the catalog, or null if not available
 double getEquinox()
          Return the value of the "equinox" property, if defined, otherwise 2000.
 java.lang.String getId()
          Return the id of the catalog (same as name here)
 java.lang.String getName()
          Return the name of the catalog
 int getNumParams()
          If this catalog can be querried, return the number of query parameters that it accepts
 int getNumSymbols()
          Return the number of plot symbol definitions associated with this catalog.
 FieldDesc getParamDesc(int i)
          Return a description of the ith query parameter
 FieldDesc getParamDesc(java.lang.String name)
          Return a description of the named query parameter
 CatalogDirectory getParent()
          Return a reference to the parent catalog directory, or null if not known.
 Catalog[] getPath()
          Return an array of Catalog or CatalogDirectory objects representing the path from the root catalog directory to this catalog.
 int getQueryCount()
          Returns the number of querries made so far
 java.lang.String getShortName()
          Return a short name or alias for the catalog
 TablePlotSymbol getSymbolDesc(int i)
          Return the ith plot symbol description
 TablePlotSymbol[] getSymbols()
          Return the array of symbol descriptions
 SkycatTable getTable()
          Return the table data (for local catalogs) or null, if not known.
 java.lang.String getTitle()
          Return the title of the catalog (same as name here)
 java.lang.String getType()
          Return the catalog type (normally one of the Catalog constants: CATALOG, ARCHIVE, DIRECTORY, LOCAL, IMAGE_SERVER)
 boolean isImageServer()
          Return true if this object represents an image server.
 boolean isLocal()
          Return true if this is a local catalog, and false if it requires network access or if a query could hang.
 boolean isPix()
          Return true if the catalog has X and Y columns (assumed to be image pixel coordinates)
 boolean isSymbolsEdited()
          Return true if the user edited the plot symbol definitions otherwise false
 boolean isWCS()
          Return true if the catalog has RA and DEC coordinate columns
static void main(java.lang.String[] args)
          Test cases
 QueryResult query(QueryArgs queryArgs)
          Query the catalog using the given argument and return the result.
 void saveSymbolConfig()
          Save the catalog symbol information to disk with the user's changes
 void setConfigEntry(SkycatConfigEntry entry)
          Set the object used to manage the configuration info for this catalog
 void setHTMLQueryResultHandler(HTMLQueryResultHandler handler)
          Optional handler, used to report HTML format errors from HTTP servers
 void setName(java.lang.String name)
          Set the name of the catalog
 void setParent(CatalogDirectory catDir)
          Set the parent catalog directory
 void setRegionArgs(QueryArgs queryArgs, CoordinateRadius region)
          Given a description of a region of the sky (center point and radius range), and the current query argument settings, set the values of the corresponding query parameters.
 void setSymbols(TablePlotSymbol[] symbols)
          Set the array of catalog table plot symbol definitions for use with this catalog
 void setSymbolsEdited(boolean edited)
          Set to true if the user edited the plot symbol definitions (default: false)
 java.lang.String toString()
          Return the name of the catalog
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SkycatCatalog

public SkycatCatalog(SkycatConfigEntry entry)
Initialize the catalog from the given catalog configuration entry.

Parameters:
entry - the catalog configuration file entry describing the catalog

SkycatCatalog

public SkycatCatalog(SkycatConfigEntry entry,
                     SkycatTable table)
Initialize the catalog from the given catalog configuration entry.

Parameters:
entry - the catalog configuration file entry describing the catalog
table - the data for the catalog (optional, only for local catalgs)

SkycatCatalog

public SkycatCatalog(SkycatTable table)
Initialize the catalog from the given table.

Parameters:
table - the data for the catalog (optional, only for local catalgs)

SkycatCatalog

public SkycatCatalog(SkycatConfigEntry entry,
                     HTMLQueryResultHandler handler)
Initialize the catalog from the given catalog configuration entry.

Parameters:
entry - the catalog configuration file entry describing the catalog
handler - used to report HTML errors from the HTTP server
Method Detail

clone

public java.lang.Object clone()
Implementation of the clone method (makes a shallow copy).

Specified by:
clone in interface Catalog
Overrides:
clone in class java.lang.Object

setName

public void setName(java.lang.String name)
Set the name of the catalog

Specified by:
setName in interface Catalog

getName

public java.lang.String getName()
Return the name of the catalog

Specified by:
getName in interface Catalog

getConfigEntry

public SkycatConfigEntry getConfigEntry()
Return the object used to manage the configuration info for this catalog


getQueryCount

public int getQueryCount()
Returns the number of querries made so far


setConfigEntry

public void setConfigEntry(SkycatConfigEntry entry)
Set the object used to manage the configuration info for this catalog


getTable

public SkycatTable getTable()
Return the table data (for local catalogs) or null, if not known.


toString

public java.lang.String toString()
Return the name of the catalog

Overrides:
toString in class java.lang.Object

getId

public java.lang.String getId()
Return the id of the catalog (same as name here)

Specified by:
getId in interface Catalog

getTitle

public java.lang.String getTitle()
Return the title of the catalog (same as name here)

Specified by:
getTitle in interface Catalog

getDescription

public java.lang.String getDescription()
Return a description of the catalog (same as name here)

Specified by:
getDescription in interface Catalog

getDocURL

public java.net.URL getDocURL()
Return a URL pointing to documentation for the catalog, or null if not available

Specified by:
getDocURL in interface Catalog

getNumParams

public int getNumParams()
If this catalog can be querried, return the number of query parameters that it accepts

Specified by:
getNumParams in interface Catalog

getParamDesc

public FieldDesc getParamDesc(int i)
Return a description of the ith query parameter

Specified by:
getParamDesc in interface Catalog

getParamDesc

public FieldDesc getParamDesc(java.lang.String name)
Return a description of the named query parameter

Specified by:
getParamDesc in interface Catalog

getNumSymbols

public int getNumSymbols()
Return the number of plot symbol definitions associated with this catalog.

Specified by:
getNumSymbols in interface PlotableCatalog

getSymbolDesc

public TablePlotSymbol getSymbolDesc(int i)
Return the ith plot symbol description

Specified by:
getSymbolDesc in interface PlotableCatalog

getSymbols

public TablePlotSymbol[] getSymbols()
Return the array of symbol descriptions

Specified by:
getSymbols in interface PlotableCatalog

setSymbols

public void setSymbols(TablePlotSymbol[] symbols)
Set the array of catalog table plot symbol definitions for use with this catalog

Specified by:
setSymbols in interface PlotableCatalog

setSymbolsEdited

public void setSymbolsEdited(boolean edited)
Set to true if the user edited the plot symbol definitions (default: false)

Specified by:
setSymbolsEdited in interface PlotableCatalog

isSymbolsEdited

public boolean isSymbolsEdited()
Return true if the user edited the plot symbol definitions otherwise false

Specified by:
isSymbolsEdited in interface PlotableCatalog

saveSymbolConfig

public void saveSymbolConfig()
Save the catalog symbol information to disk with the user's changes

Specified by:
saveSymbolConfig in interface PlotableCatalog

getShortName

public java.lang.String getShortName()
Return a short name or alias for the catalog


isWCS

public boolean isWCS()
Return true if the catalog has RA and DEC coordinate columns


getEquinox

public double getEquinox()
Return the value of the "equinox" property, if defined, otherwise 2000.


isPix

public boolean isPix()
Return true if the catalog has X and Y columns (assumed to be image pixel coordinates)


isLocal

public boolean isLocal()
Return true if this is a local catalog, and false if it requires network access or if a query could hang. A local catalog query is run in the event dispatching thread, while others are done in a separate thread.

Specified by:
isLocal in interface Catalog

isImageServer

public boolean isImageServer()
Return true if this object represents an image server.

Specified by:
isImageServer in interface Catalog

getType

public java.lang.String getType()
Return the catalog type (normally one of the Catalog constants: CATALOG, ARCHIVE, DIRECTORY, LOCAL, IMAGE_SERVER)

Specified by:
getType in interface Catalog

setParent

public void setParent(CatalogDirectory catDir)
Set the parent catalog directory

Specified by:
setParent in interface Catalog

getParent

public CatalogDirectory getParent()
Return a reference to the parent catalog directory, or null if not known.

Specified by:
getParent in interface Catalog

getPath

public Catalog[] getPath()
Return an array of Catalog or CatalogDirectory objects representing the path from the root catalog directory to this catalog.

Specified by:
getPath in interface Catalog

query

public QueryResult query(QueryArgs queryArgs)
                  throws java.io.IOException
Query the catalog using the given argument and return the result.

Specified by:
query in interface Catalog
Parameters:
queryArgs - An object describing the query arguments.
Returns:
An object describing the result of the query.
Throws:
java.io.IOException

_getProgressPanel

protected ProgressPanel _getProgressPanel(java.lang.String title)
Return a panel for displaying the progress of a query.


_setQueryRegion

protected void _setQueryRegion(QueryArgs queryArgs,
                               SearchCondition[] sc)
                        throws java.io.IOException
Determine the query region based on the given query arguments

Throws:
java.io.IOException

_setMaxRows

protected void _setMaxRows(QueryArgs queryArgs,
                           SearchCondition[] sc)
Check for a "Max Objects" argument and if found, set queryArgs.maxRows with the value.


setHTMLQueryResultHandler

public void setHTMLQueryResultHandler(HTMLQueryResultHandler handler)
Optional handler, used to report HTML format errors from HTTP servers


setRegionArgs

public void setRegionArgs(QueryArgs queryArgs,
                          CoordinateRadius region)
Given a description of a region of the sky (center point and radius range), and the current query argument settings, set the values of the corresponding query parameters.

Specified by:
setRegionArgs in interface Catalog
Parameters:
queryArgs - (in/out) describes the query arguments
region - (in) describes the query region (center and radius range)

main

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