ucar.nc2.ft
Class FeatureDatasetImpl

java.lang.Object
  extended by ucar.nc2.ft.FeatureDatasetImpl
All Implemented Interfaces:
FeatureDataset, ucar.nc2.util.cache.FileCacheable

public abstract class FeatureDatasetImpl
extends java.lang.Object
implements FeatureDataset

Abstract superclass for implementations of FeatureDataset. Subclass must implement getFeatureClass(), and add specific functionality.

Since:
Sep 7, 2007
Author:
caron

Constructor Summary
FeatureDatasetImpl()
          No-arg constuctor
FeatureDatasetImpl(NetcdfDataset ncfile)
          Constructor when theres a NetcdfFile underneath
FeatureDatasetImpl(java.lang.String title, java.lang.String description, java.lang.String location)
          Constructor when theres no NetcdfFile underneath.
 
Method Summary
 void close()
          Close all resources associated with this dataset.
 Attribute findGlobalAttributeIgnoreCase(java.lang.String name)
          Return the global attribute with the given name, ignoring case.
 LatLonRect getBoundingBox()
          The boundingBox for the entire dataset.
 VariableSimpleIF getDataVariable(java.lang.String shortName)
          Get the named data Variable.
 java.util.List<VariableSimpleIF> getDataVariables()
          The data Variables available in this dataset.
 DateRange getDateRange()
          Date range for the entire dataset.
 java.lang.String getDescription()
          Text information about this dataset.
 void getDetailInfo(java.util.Formatter sf)
          Show debug / underlying implementation details
 java.util.Date getEndDate()
          Ending date for the entire dataset.
 java.util.List<Attribute> getGlobalAttributes()
          List of global attributes.
 java.lang.String getImplementationName()
          Show who is implementing
 java.lang.String getLocation()
          The URI location of the dataset
 NetcdfFile getNetcdfFile()
          Return underlying NetcdfFile, or null if none.
 java.util.Date getStartDate()
          Starting date for the entire dataset.
 java.lang.String getTitle()
          Title of the dataset.
 void setFileCache(ucar.nc2.util.cache.FileCache fileCache)
          FileCacheable must store the FileCache and call it on close():
 boolean sync()
          Sync() is called when the FileCacheable is found in the cache, before returning the object to the application.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ucar.nc2.ft.FeatureDataset
calcBounds, getFeatureType
 

Constructor Detail

FeatureDatasetImpl

public FeatureDatasetImpl()
No-arg constuctor


FeatureDatasetImpl

public FeatureDatasetImpl(java.lang.String title,
                          java.lang.String description,
                          java.lang.String location)
Constructor when theres no NetcdfFile underneath.

Parameters:
title - title of the dataset.
description - description of the dataset.
location - URI of the dataset

FeatureDatasetImpl

public FeatureDatasetImpl(NetcdfDataset ncfile)
Constructor when theres a NetcdfFile underneath

Parameters:
ncfile - adapt this NetcdfDataset
Method Detail

getNetcdfFile

public NetcdfFile getNetcdfFile()
Description copied from interface: FeatureDataset
Return underlying NetcdfFile, or null if none.

Specified by:
getNetcdfFile in interface FeatureDataset
Returns:
the underlying NetcdfFile, or null if none.

getTitle

public java.lang.String getTitle()
Description copied from interface: FeatureDataset
Title of the dataset.

Specified by:
getTitle in interface FeatureDataset
Returns:
the title of the dataset, or null

getDescription

public java.lang.String getDescription()
Description copied from interface: FeatureDataset
Text information about this dataset.

Specified by:
getDescription in interface FeatureDataset
Returns:
any text information about this dataset, or null.

getLocation

public java.lang.String getLocation()
Description copied from interface: FeatureDataset
The URI location of the dataset

Specified by:
getLocation in interface FeatureDataset
Specified by:
getLocation in interface ucar.nc2.util.cache.FileCacheable
Returns:
the URI location of the dataset, or null

getGlobalAttributes

public java.util.List<Attribute> getGlobalAttributes()
Description copied from interface: FeatureDataset
List of global attributes.

Specified by:
getGlobalAttributes in interface FeatureDataset
Returns:
List of type ucar.nc2.Attribute, may be empty but not null

findGlobalAttributeIgnoreCase

public Attribute findGlobalAttributeIgnoreCase(java.lang.String name)
Description copied from interface: FeatureDataset
Return the global attribute with the given name, ignoring case.

Specified by:
findGlobalAttributeIgnoreCase in interface FeatureDataset
Parameters:
name - attribute name
Returns:
the global attribute, or null

getDetailInfo

public void getDetailInfo(java.util.Formatter sf)
Description copied from interface: FeatureDataset
Show debug / underlying implementation details

Specified by:
getDetailInfo in interface FeatureDataset
Parameters:
sf - append info here

getDateRange

public DateRange getDateRange()
Description copied from interface: FeatureDataset
Date range for the entire dataset.

Specified by:
getDateRange in interface FeatureDataset
Returns:
the date range for the entire dataset, or null if unknown

getStartDate

public java.util.Date getStartDate()
Description copied from interface: FeatureDataset
Starting date for the entire dataset.

Specified by:
getStartDate in interface FeatureDataset
Returns:
the starting date for the entire dataset, or null if unknown

getEndDate

public java.util.Date getEndDate()
Description copied from interface: FeatureDataset
Ending date for the entire dataset.

Specified by:
getEndDate in interface FeatureDataset
Returns:
the ending date for the entire dataset, or null if unknown

getBoundingBox

public LatLonRect getBoundingBox()
Description copied from interface: FeatureDataset
The boundingBox for the entire dataset.

Specified by:
getBoundingBox in interface FeatureDataset
Returns:
the lat/lon boundingBox for the entire dataset, or null if unknown.

getDataVariables

public java.util.List<VariableSimpleIF> getDataVariables()
Description copied from interface: FeatureDataset
The data Variables available in this dataset. Should just be data variables others might be searching for, not metadata or coordinate system variables, etc. The shape of this VariableSimpleIF does not necessarily match the StructureData member.

Specified by:
getDataVariables in interface FeatureDataset
Returns:
List of subclass of VariableSimpleIF, may be empty but not null

getDataVariable

public VariableSimpleIF getDataVariable(java.lang.String shortName)
Description copied from interface: FeatureDataset
Get the named data Variable.

Specified by:
getDataVariable in interface FeatureDataset
Parameters:
shortName - of data Variable.
Returns:
VariableSimpleIF or null if not found

getImplementationName

public java.lang.String getImplementationName()
Description copied from interface: FeatureDataset
Show who is implementing

Specified by:
getImplementationName in interface FeatureDataset
Returns:
name of implementor

close

public void close()
           throws java.io.IOException
Description copied from interface: FeatureDataset
Close all resources associated with this dataset.

Specified by:
close in interface FeatureDataset
Specified by:
close in interface ucar.nc2.util.cache.FileCacheable
Throws:
java.io.IOException

sync

public boolean sync()
             throws java.io.IOException
Description copied from interface: ucar.nc2.util.cache.FileCacheable
Sync() is called when the FileCacheable is found in the cache, before returning the object to the application. FileCacheable has an opportunity to freshen itself. FileCacheable mag ignore this call.

Specified by:
sync in interface ucar.nc2.util.cache.FileCacheable
Returns:
true if FileCacheable was changed
Throws:
java.io.IOException - on i/o error.

setFileCache

public void setFileCache(ucar.nc2.util.cache.FileCache fileCache)
Description copied from interface: ucar.nc2.util.cache.FileCacheable
FileCacheable must store the FileCache and call it on close():
  public synchronized void close() throws java.io.IOException {
    if (isClosed) return;
    if (cache != null) {
      cache.release(this);
    } else {
      reallyClose();
    }
    isClosed = true;
   

Specified by:
setFileCache in interface ucar.nc2.util.cache.FileCacheable
Parameters:
fileCache - must store this, use it on close as above.