Class InvDatasetFeatureCollection

java.lang.Object
thredds.featurecollection.InvDatasetFeatureCollection
All Implemented Interfaces:
Closeable, AutoCloseable
Direct Known Subclasses:
InvDatasetFcFmrc, InvDatasetFcGrib, InvDatasetFcPoint

@ThreadSafe public abstract class InvDatasetFeatureCollection extends Object implements Closeable
Abstract superclass for Feature Collection Datasets. This is a InvCatalogRef subclass. So the reference is placed in the parent, but the catalog itself isnt constructed until the following call from DataRootHandler.makeDynamicCatalog(): match.dataRoot.featCollection.makeCatalog(match.remaining, path, baseURI);

The DatasetFeatureCollection object is held in the DataRootManager's FeatureCollectionCache; it may get closed and recreated.

Since:
Mar 3, 2010
  • Field Details

    • LATEST_DATASET_CATALOG

      protected static final String LATEST_DATASET_CATALOG
      See Also:
    • VARIABLES

      protected static final String VARIABLES
      See Also:
    • FILES

      protected static final String FILES
      See Also:
    • useNetcdfJavaBuilders

      protected static final boolean useNetcdfJavaBuilders
      See Also:
    • allowedServices

      protected static AllowedServices allowedServices
    • contextName

      protected static String contextName
    • parent

      protected thredds.server.catalog.FeatureCollectionRef parent
    • orgService

      protected thredds.client.catalog.Service orgService
    • virtualService

      protected thredds.client.catalog.Service virtualService
    • latestService

      protected thredds.client.catalog.Service latestService
    • downloadService

      protected thredds.client.catalog.Service downloadService
    • name

      protected final String name
    • configPath

      protected final String configPath
    • fcType

      protected final thredds.featurecollection.FeatureCollectionType fcType
    • config

      protected final thredds.featurecollection.FeatureCollectionConfig config
    • topDirectory

      protected String topDirectory
    • datasetCollection

      protected thredds.inventory.MFileCollectionManager datasetCollection
    • state

    • first

      protected boolean first
    • lock

      protected final Object lock
  • Constructor Details

    • InvDatasetFeatureCollection

      protected InvDatasetFeatureCollection(thredds.server.catalog.FeatureCollectionRef parent, thredds.featurecollection.FeatureCollectionConfig config)
  • Method Details

    • setContextName

      public static void setContextName(String c)
    • setAllowedServices

      public static void setAllowedServices(AllowedServices _allowedServices)
    • buildCatalogServiceHref

      protected static String buildCatalogServiceHref(String path)
    • factory

      public static InvDatasetFeatureCollection factory(thredds.server.catalog.FeatureCollectionRef parent, thredds.featurecollection.FeatureCollectionConfig config)
    • makeDefaultServices

      protected void makeDefaultServices()
    • close

      public void close()
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
    • makeCollection

      protected void makeCollection()
    • processEvent

      public void processEvent(thredds.inventory.CollectionUpdateEvent event)
    • showStatus

      public void showStatus(Formatter f)
    • showStatusShort

      public String showStatusShort(String type)
    • _showStatus

      protected void _showStatus(Formatter f, boolean summaryOnly, String type) throws IOException
      Throws:
      IOException
    • getPath

      protected String getPath()
    • updateCollection

      protected abstract void updateCollection(InvDatasetFeatureCollection.State localState, thredds.inventory.CollectionUpdateType force)
    • getCatalogHref

      protected String getCatalogHref(String what)
    • firstInit

      protected void firstInit()
    • checkState

      protected InvDatasetFeatureCollection.State checkState() throws IOException
      A request has come in, check that the state has been initialized. this is called from the request thread.
      Returns:
      a copy of the State
      Throws:
      IOException
    • update

      protected void update(thredds.inventory.CollectionUpdateType force) throws IOException
      Collection was changed, update internal objects. called by CollectionUpdater, trigger via handleCollectionEvent, so in a quartz scheduler thread
      Parameters:
      force - update type
      Throws:
      IOException
    • getName

      public String getName()
    • getConfigPath

      public String getConfigPath()
    • getLatestFileName

      public String getLatestFileName()
    • getTopDirectoryLocation

      public String getTopDirectoryLocation()
    • getConfig

      public thredds.featurecollection.FeatureCollectionConfig getConfig()
    • getDatasetCollectionManager

      public thredds.inventory.MCollection getDatasetCollectionManager()
    • getLogger

      public org.slf4j.Logger getLogger()
    • makeFullName

      protected String makeFullName(thredds.client.catalog.DatasetNode ds)
    • makeCatalog

      public abstract thredds.client.catalog.builder.CatalogBuilder makeCatalog(String match, String orgPath, URI catURI) throws IOException
      Get one of the catalogs contained in this collection, called by DataRootHandler.makeDynamicCatalog()
      Parameters:
      match - match.remaining
      orgPath - the path for the request.
      catURI - the base URI for the catalog to be made, used to resolve relative URLs.
      Returns:
      containing catalog
      Throws:
      IOException
    • makeDatasetTop

      protected abstract thredds.client.catalog.builder.DatasetBuilder makeDatasetTop(URI catURI, InvDatasetFeatureCollection.State localState) throws IOException
      Throws:
      IOException
    • makeCatalogTop

      protected thredds.client.catalog.builder.CatalogBuilder makeCatalogTop(URI catURI, InvDatasetFeatureCollection.State localState) throws IOException, URISyntaxException
      Make the containing catalog of this feature collection "http://server:port/thredds/catalog/path/catalog.xml"
      Parameters:
      catURI - base URI of the request
      localState - current state to use
      Returns:
      the top FMRC catalog
      Throws:
      IOException - on I/O error
      URISyntaxException - if path is misformed
    • makeCatalogFiles

      protected thredds.client.catalog.builder.CatalogBuilder makeCatalogFiles(URI catURI, InvDatasetFeatureCollection.State localState, List<String> filenames, boolean addLatest) throws IOException
      Throws:
      IOException
    • makeMetadataLink

      protected String makeMetadataLink(String datasetName, String metadata)
    • makeUriResolved

      protected thredds.client.catalog.ThreddsMetadata.UriResolved makeUriResolved(URI baseURI, String href)
    • makeLatest

      public thredds.client.catalog.builder.CatalogBuilder makeLatest(String matchPath, String reqPath, URI catURI) throws IOException
      Throws:
      IOException
    • getPointDataset

      public ucar.nc2.ft.FeatureDatasetPoint getPointDataset(String matchPath) throws IOException
      Get the associated Point Dataset, if any. called by DatasetHandler.openPointDataset()
      Parameters:
      matchPath - match.remaining
      Returns:
      Grid Dataset, or null if n/a
      Throws:
      IOException - on error
    • getGridDataset

      public ucar.nc2.dt.grid.GridDataset getGridDataset(String matchPath) throws IOException
      Get the associated Grid Dataset, if any. called by DatasetHandler.openGridDataset()
      Parameters:
      matchPath - match.remaining
      Returns:
      Grid Dataset, or null if n/a
      Throws:
      IOException - on error
    • getGridCoverage

      public ucar.nc2.ft2.coverage.CoverageCollection getGridCoverage(String matchPath) throws IOException
      Throws:
      IOException
    • getSimpleGeometryDataset

      public ucar.nc2.ft2.simpgeometry.SimpleGeometryFeatureDataset getSimpleGeometryDataset(String matchPath) throws IOException
      Throws:
      IOException
    • getNetcdfDataset

      public ucar.nc2.dataset.NetcdfDataset getNetcdfDataset(String matchPath) throws IOException
      Get the dataset named by the path. called by DatasetHandler.getNetcdfFile()
      Parameters:
      matchPath - remaining path from match
      Returns:
      requested dataset
      Throws:
      IOException - if read error
    • getFile

      public File getFile(String remaining)