Class CatalogQueryAgent

java.lang.Object
noaa.coastwatch.net.CatalogQueryAgent
Direct Known Subclasses:
OpendapQueryAgent

public abstract class CatalogQueryAgent extends Object
A CatalogQueryAgent is an abstract class for performing queries of earth data catalogs. The catalog may be queried using temporal and spatial criteria.
Since:
3.2.1
Author:
Peter Hollemans
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The Entry class holds information about one catalog entry.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected int
    The coverage as a percentage.
    protected Date
    The ending date.
    protected static final long
    The number of milliseconds per day.
    protected String
    The coverage region.
    protected boolean
    The search by coverage flag.
    protected boolean
    The search by time flag.
    protected Date
    The starting date.
    protected URL
    The catalog query URL.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    Creates a new catalog agent that uses the specified URL for performing queries.
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets all entries in the catalog by turning off time and coverage searching, and then calling getEntries().
    abstract List
    Gets the catalog data entries whose temporal and spatial properties match those currently set in the query agent.
    void
    setCoverageByRegion(String region, int coverage)
    Sets the spatial coverage constraints using a predefined region code.
    void
    setSearchByCoverage(boolean searchByCoverage)
    Sets the coverage search flag.
    void
    setSearchByTime(boolean searchByTime)
    Sets the time search flag.
    void
    setTimeByAge(double days)
    Sets the query time constraints by data age.
    void
    setTimeByDate(Date startDate, Date endDate)
    Sets the query time constraints by start and end date.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • MSEC_PER_DAY

      protected static final long MSEC_PER_DAY
      The number of milliseconds per day.
      See Also:
    • url

      protected URL url
      The catalog query URL.
    • searchByTime

      protected boolean searchByTime
      The search by time flag.
    • startDate

      protected Date startDate
      The starting date.
    • endDate

      protected Date endDate
      The ending date.
    • searchByCoverage

      protected boolean searchByCoverage
      The search by coverage flag.
    • region

      protected String region
      The coverage region.
    • coverage

      protected int coverage
      The coverage as a percentage.
  • Constructor Details

    • CatalogQueryAgent

      protected CatalogQueryAgent(URL url)
      Creates a new catalog agent that uses the specified URL for performing queries. By default, time and coverage searching are enabled unless disabled using setSearchByTime(boolean) or setSearchByCoverage(boolean).
      Parameters:
      url - the query url.
  • Method Details

    • setSearchByTime

      public void setSearchByTime(boolean searchByTime)
      Sets the time search flag.
      Parameters:
      searchByTime - the time flag, true to search by time, or false otherwise.
      See Also:
    • setSearchByCoverage

      public void setSearchByCoverage(boolean searchByCoverage)
      Sets the coverage search flag.
      Parameters:
      searchByCoverage - the coverage flag, true to search by coverage, or false otherwise.
      See Also:
    • setTimeByDate

      public void setTimeByDate(Date startDate, Date endDate)
      Sets the query time constraints by start and end date. The query will return data whose starting date falls in the specified range.
      Parameters:
      startDate - the starting data date.
      endDate - the ending data date.
    • setTimeByAge

      public void setTimeByAge(double days)
      Sets the query time constraints by data age. The query will return data whose starting date falls during the past specified number of days.
      Parameters:
      days - the data age in days.
    • setCoverageByRegion

      public void setCoverageByRegion(String region, int coverage)
      Sets the spatial coverage constraints using a predefined region code. The query will return data with at least the specified coverage in the region.
      Parameters:
      region - the coverage region code.
      coverage - the coverage as a percent.
    • getAllEntries

      public List getAllEntries() throws IOException
      Gets all entries in the catalog by turning off time and coverage searching, and then calling getEntries(). This is simply a convenience method for getting a complete catalog dump.
      Returns:
      all the entries in the catalog as a list.
      Throws:
      IOException - if an error occurred performing the query.
    • getEntries

      public abstract List getEntries() throws IOException
      Gets the catalog data entries whose temporal and spatial properties match those currently set in the query agent.
      Returns:
      the list of catalog Entry objects.
      Throws:
      IOException - if an error occurred performing the query.