ucar.nc2.ft
Class FeatureDatasetImpl

java.lang.Object
  extended by ucar.nc2.ft.FeatureDatasetImpl
All Implemented Interfaces:
FeatureDataset, FileCacheable
Direct Known Subclasses:
PointDatasetImpl

public abstract class FeatureDatasetImpl
extends Object
implements FeatureDataset

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

Since:
Sep 7, 2007
Author:
caron

Field Summary
protected  LatLonRect boundingBox
           
protected  List<VariableSimpleIF> dataVariables
           
protected  DateRange dateRange
           
protected  String desc
           
protected  FileCache fileCache
           
protected  String location
           
protected  NetcdfDataset ncfile
           
protected  Formatter parseInfo
           
protected  String title
           
 
Constructor Summary
  FeatureDatasetImpl()
          No-arg constuctor
protected FeatureDatasetImpl(FeatureDatasetImpl from)
           
  FeatureDatasetImpl(NetcdfDataset ncfile)
          Constructor when theres a NetcdfFile underneath
  FeatureDatasetImpl(String title, String description, String location)
          Constructor when theres no NetcdfFile underneath.
 
Method Summary
 void close()
          Close all resources associated with this dataset.
 Attribute findGlobalAttributeIgnoreCase(String name)
          Return the global attribute with the given name, ignoring case.
 LatLonRect getBoundingBox()
          The boundingBox for the entire dataset.
 VariableSimpleIF getDataVariable(String shortName)
          Get the named data Variable.
 List<VariableSimpleIF> getDataVariables()
          The data Variables available in this dataset.
 DateRange getDateRange()
          Date range for the entire dataset.
 String getDescription()
          Text information about this dataset.
 void getDetailInfo(Formatter sf)
          Show debug / underlying implementation details
 Date getEndDate()
          Ending date for the entire dataset.
 List<Attribute> getGlobalAttributes()
          List of global attributes.
 String getImplementationName()
          Show who is implementing
 String getLocation()
          The URI location of the dataset
 NetcdfFile getNetcdfFile()
          Return underlying NetcdfFile, or null if none.
 Date getStartDate()
          Starting date for the entire dataset.
 String getTitle()
          Title of the dataset.
protected  void setBoundingBox(LatLonRect boundingBox)
           
protected  void setDateRange(DateRange dateRange)
           
protected  void setDescription(String desc)
           
 void setFileCache(FileCache fileCache)
          If the FileCache is set, the FileCacheable object must store it and call FileCache.release() on FileCacheable.close():
protected  void setLocationURI(String location)
           
protected  void setTitle(String title)
           
 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
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface ucar.nc2.ft.FeatureDataset
calcBounds, getFeatureType
 

Field Detail

ncfile

protected NetcdfDataset ncfile

title

protected String title

desc

protected String desc

location

protected String location

dataVariables

protected List<VariableSimpleIF> dataVariables

parseInfo

protected Formatter parseInfo

dateRange

protected DateRange dateRange

boundingBox

protected LatLonRect boundingBox

fileCache

protected FileCache fileCache
Constructor Detail

FeatureDatasetImpl

protected FeatureDatasetImpl(FeatureDatasetImpl from)

FeatureDatasetImpl

public FeatureDatasetImpl()
No-arg constuctor


FeatureDatasetImpl

public FeatureDatasetImpl(String title,
                          String description,
                          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

setTitle

protected void setTitle(String title)

setDescription

protected void setDescription(String desc)

setLocationURI

protected void setLocationURI(String location)

setDateRange

protected void setDateRange(DateRange dateRange)

setBoundingBox

protected void setBoundingBox(LatLonRect boundingBox)

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 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 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 String getLocation()
Description copied from interface: FeatureDataset
The URI location of the dataset

Specified by:
getLocation in interface FeatureDataset
Specified by:
getLocation in interface FileCacheable
Returns:
the URI location of the dataset, or null

getGlobalAttributes

public 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(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(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 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 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 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 shapes of the VariableSimpleIF do 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(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 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 IOException
Description copied from interface: FeatureDataset
Close all resources associated with this dataset.

Specified by:
close in interface FeatureDataset
Specified by:
close in interface FileCacheable
Throws:
IOException

sync

public boolean sync()
             throws IOException
Description copied from interface: 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 FileCacheable
Returns:
true if FileCacheable was changed
Throws:
IOException - on i/o error.

setFileCache

public void setFileCache(FileCache fileCache)
Description copied from interface: FileCacheable
If the FileCache is set, the FileCacheable object must store it and call FileCache.release() on FileCacheable.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 FileCacheable
Parameters:
fileCache - must store this, use it on close as above.


Copyright © 1999-2011 UCAR/Unidata. All Rights Reserved.