jsky.catalog.astrocat
Class AstroCatalog

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

public class AstroCatalog
extends 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.2 $
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.
 Object clone()
          Implementation of the clone method (makes a shallow copy).
 String getDescription()
          Return a description of the catalog, or null if not available
 URL getDocURL()
          Return a URL pointing to documentation for the catalog, or null if not available
 String getHandlerClass()
          Return the name of a class implementing the QueryResultHandler interface.
 String getHost()
          Return the host name where the catalog server lives
 String getId()
          Return the Id or short name of the catalog
 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(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
 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
 String getTitle()
          Return a string to display as a title for the catalog in a user interface
 String getType()
          Return the catalog type (one of the constants: CATALOG, ARCHIVE, DIRECTORY, LOCAL, IMAGE_SERVER)
 URL getURL()
          Return the URL of the XML file describing this catalog, if known, otherwise null.
 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(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(String description)
          Set the catalog description or copyright info
 void setDocURL(String docURL)
          Set a URL pointing to more information about the catalog
 void setHandlerClass(String handlerClass)
          May be set to the name of a class implementing the QueryResultHandler interface.
 void setHost(String host)
          Set the host name where the catalog server lives
 void setId(String id)
          Set the catalog ID (short name)
 void setName(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(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(String type)
          Set the catalog type (one of the constants: CATALOG, ARCHIVE, DIRECTORY, LOCAL, IMAGE_SERVER)
 void setURL(URL url)
          Set the URL of the XML file describing this catalog.
 void setURLPath(String path)
          Set the path name to the catalog server
 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 Object clone()
Implementation of the clone method (makes a shallow copy).

Specified by:
clone in interface Catalog
Overrides:
clone in class Object

getURL

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


setURL

public void setURL(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 String toString()
Return the name of the catalog

Overrides:
toString in class Object

setId

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


getId

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

Specified by:
getId in interface Catalog

setName

public void setName(String name)
Set the display name of the catalog

Specified by:
setName in interface Catalog

getName

public String getName()
Return the name of the catalog

Specified by:
getName in interface Catalog

setDescription

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


getDescription

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

Specified by:
getDescription in interface Catalog

setDocURL

public void setDocURL(String docURL)
Set a URL pointing to more information about the catalog


getDocURL

public 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(String type)
Set the catalog type (one of the constants: CATALOG, ARCHIVE, DIRECTORY, LOCAL, IMAGE_SERVER)


getType

public 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(String protocol)
Set the protocol to use to access the catalog. For example: "http", "file".


getProtocol

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


setHost

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


getHost

public 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(String path)
Set the path name to the catalog server


getURLPath

public 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(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 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 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(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 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:
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(String[] args)
Test cases



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