jsky.catalog.astrocat
Class AstroCatalog

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

public class AstroCatalog
extends java.lang.Object
implements PlotableCatalog

Represents a catalog server, as described in an AstroCat XML catalog description file. This class is responsible for generating the catalog query.

Version:
$Revision: 1.1 $
Author:
Allan Brighton

Field Summary
 
Fields inherited from interface jsky.catalog.Catalog
ARCHIVE, CATALOG, DIRECTORY, IMAGE_SERVER, LOCAL
 
Constructor Summary
AstroCatalog()
          Default constructor
 
Method Summary
protected  void _setMaxRows(QueryArgs queryArgs, SearchCondition[] sc)
          Check for a "Max Objects" argument and if found, set queryArgs.maxRows with the value.
 java.lang.Object clone()
          Implementation of the clone method (makes a shallow copy).
 java.lang.String getDescription()
          Return a description of the catalog, or null if not available
 java.net.URL getDocURL()
          Return a URL pointing to documentation for the catalog, or null if not available
 java.lang.String getHandlerClass()
          Return the name of a class implementing the QueryResultHandler interface.
 java.lang.String getHost()
          Return the host name where the catalog server lives
 java.lang.String getId()
          Return the Id or short name of the catalog
 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, if found, otherwise null.
 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 getPort()
          Return the host name where the catalog server lives
 java.lang.String getProtocol()
          Return the protocol to use to access the catalog.
 TablePlotSymbol getSymbolDesc(int i)
          Return the ith plot symbol description
 TablePlotSymbol[] getSymbols()
          Return the array of symbol descriptions
 java.lang.String getTitle()
          Return a string to display as a title for the catalog in a user interface
 java.lang.String getType()
          Return the catalog type (one of the constants: CATALOG, ARCHIVE, DIRECTORY, LOCAL, IMAGE_SERVER)
 java.net.URL getURL()
          Return the URL of the XML file describing this catalog, if known, otherwise null.
 java.lang.String getURLPath()
          Return the path name to the catalog 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 isSymbolsEdited()
          Return true if the user edited the plot symbol definitions otherwise false
static void main(java.lang.String[] args)
          Test cases
 QueryResult query(QueryArgs queryArgs)
          Query the catalog using the given arguments and return the result.
 void saveSymbolConfig()
          Save the catalog symbol information to disk with the user's changes
 void setDescription(java.lang.String description)
          Set the catalog description or copyright info
 void setDocURL(java.lang.String docURL)
          Set a URL pointing to more information about the catalog
 void setHandlerClass(java.lang.String handlerClass)
          May be set to the name of a class implementing the QueryResultHandler interface.
 void setHost(java.lang.String host)
          Set the host name where the catalog server lives
 void setId(java.lang.String id)
          Set the catalog ID (short name)
 void setName(java.lang.String name)
          Set the display name of the catalog
 void setParams(FieldDesc[] params)
          Set the array of query parameters for this catalog
 void setParent(CatalogDirectory dir)
          Set the parent catalog directory
 void setPort(int port)
          Set the host name where the catalog server lives
 void setProtocol(java.lang.String protocol)
          Set the protocol to use to access the catalog.
 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)
 void setType(java.lang.String type)
          Set the catalog type (one of the constants: CATALOG, ARCHIVE, DIRECTORY, LOCAL, IMAGE_SERVER)
 void setURL(java.net.URL url)
          Set the URL of the XML file describing this catalog.
 void setURLPath(java.lang.String path)
          Set the path name to the catalog server
 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

AstroCatalog

public AstroCatalog()
Default constructor

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

getURL

public java.net.URL getURL()
Return the URL of the XML file describing this catalog, if known, otherwise null.


setURL

public void setURL(java.net.URL url)
Set the URL of the XML file describing this catalog.


getParent

public CatalogDirectory getParent()
Description copied from interface: Catalog
Return a reference to the parent catalog directory, or null if not known.

Specified by:
getParent in interface Catalog

setParent

public void setParent(CatalogDirectory dir)
Description copied from interface: Catalog
Set the parent catalog directory

Specified by:
setParent 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

toString

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

Overrides:
toString in class java.lang.Object

setId

public void setId(java.lang.String id)
Set the catalog ID (short name)


getId

public java.lang.String getId()
Return the Id or short name of the catalog

Specified by:
getId in interface Catalog

setName

public void setName(java.lang.String name)
Set the display 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

setDescription

public void setDescription(java.lang.String description)
Set the catalog description or copyright info


getDescription

public java.lang.String getDescription()
Return a description of the catalog, or null if not available

Specified by:
getDescription in interface Catalog

setDocURL

public void setDocURL(java.lang.String docURL)
Set a URL pointing to more information about the 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

setType

public void setType(java.lang.String type)
Set the catalog type (one of the constants: CATALOG, ARCHIVE, DIRECTORY, LOCAL, IMAGE_SERVER)


getType

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

Specified by:
getType in interface Catalog

setProtocol

public void setProtocol(java.lang.String protocol)
Set the protocol to use to access the catalog. For example: "http", "file".


getProtocol

public java.lang.String getProtocol()
Return the protocol to use to access the catalog. For example: "http", "file".


setHost

public void setHost(java.lang.String host)
Set the host name where the catalog server lives


getHost

public java.lang.String getHost()
Return the host name where the catalog server lives


setPort

public void setPort(int port)
Set the host name where the catalog server lives


getPort

public int getPort()
Return the host name where the catalog server lives


setURLPath

public void setURLPath(java.lang.String path)
Set the path name to the catalog server


getURLPath

public java.lang.String getURLPath()
Return the path name to the catalog server


setParams

public void setParams(FieldDesc[] params)
Set the array of query parameters for this catalog


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

setHandlerClass

public void setHandlerClass(java.lang.String handlerClass)
May be set to the name of a class implementing the QueryResultHandler interface. An instance of this class is then created to handle the result from the catalog server.


getHandlerClass

public java.lang.String getHandlerClass()
Return the name of a class implementing the QueryResultHandler interface. An instance of this class is then created to handle the result from the catalog server.


getTitle

public java.lang.String getTitle()
Return a string to display as a title for the catalog in a user interface

Specified by:
getTitle 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, if found, otherwise null.

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

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)

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

query

public QueryResult query(QueryArgs queryArgs)
                  throws java.io.IOException
Query the catalog using the given arguments and return the result. The result of a query may be any class that implements the QueryResult interface. It is up to the calling class to interpret and display the result. In the general case where the result is downloaded via HTTP, The URLQueryResult class may be used.

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

_setMaxRows

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


main

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