ucar.unidata.data
Class DataInstance

java.lang.Object
  extended by ucar.unidata.data.DataInstance
Direct Known Subclasses:
GridDataInstance, PointDataInstance

public class DataInstance
extends Object

A superclass for data instances. It's a wrapper for a Data object that allows quick access to metadata about it.

This class is thread-compatible.

Version:
$Revision: 1.47 $
Author:
IDV development team

Field Summary
protected  DataChoice dataChoice
          The DataChoice associated with the instance
protected  DataSelection dataSelection
          The dataselection for the choice
protected  boolean haveBeenInitialized
          flag for initialization
protected  boolean inError
          flag for errors
protected static LogUtil.LogCategory log_
          logging category
protected  Hashtable myRequestProperties
          Extra request properties
 
Constructor Summary
DataInstance(DataChoice dataChoice, DataSelection dataSelection, Hashtable requestProperties)
          Create a new DataInstance.
DataInstance(DataChoice dataChoice, DataSelection dataSelection, Hashtable requestProperties, Data theData)
          Create a new DataInstance.
 
Method Summary
protected  void checkInit()
          Check if this has been initialized.
 boolean dataOk()
          Is the data held by this DataInstance ok.
 Data getData()
          Calls getData, passing in the member DataSelection
 Data getData(DataSelection dataSelection)
          Get the data using the specified sub selection.
 Data getData(DataSelection dataSelection, Hashtable requestProperties)
          Get the data using the specified sub selection and extra request properties
 DataChoice getDataChoice()
          Get the DataChoice associated with this instance.
 DataSelection getDataSelection()
           
protected static int getNextId()
          Get the next instance id.
 String getParamName()
          Get the parameter name associated with this instance.
protected  void init()
          Initialize the instance
 boolean needsInitialization()
          Does this data instance need to be initialized
 void reInitialize()
          Reinitilize this instance.
protected  void setData(Data newData)
          _more_
 void setDataSelection(DataSelection dataSelection)
          Set the data selection
 void setTheData(Data d)
          Have this be setTheData so it is not the same signature as getData in case this gets persisted
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log_

protected static LogUtil.LogCategory log_
logging category


haveBeenInitialized

protected boolean haveBeenInitialized
flag for initialization


inError

protected boolean inError
flag for errors


dataChoice

protected DataChoice dataChoice
The DataChoice associated with the instance


dataSelection

protected DataSelection dataSelection
The dataselection for the choice


myRequestProperties

protected Hashtable myRequestProperties
Extra request properties

Constructor Detail

DataInstance

public DataInstance(DataChoice dataChoice,
                    DataSelection dataSelection,
                    Hashtable requestProperties)
             throws VisADException,
                    RemoteException
Create a new DataInstance.

Parameters:
dataChoice - choice for data
dataSelection - sub-selection criteria
requestProperties - extra request properties
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

DataInstance

public DataInstance(DataChoice dataChoice,
                    DataSelection dataSelection,
                    Hashtable requestProperties,
                    Data theData)
             throws VisADException,
                    RemoteException
Create a new DataInstance.

Parameters:
dataChoice - choice for data
dataSelection - sub-selection criteria
requestProperties - extra request properties
theData - Any initial data. Usually is null.
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem
Method Detail

init

protected void init()
             throws VisADException,
                    RemoteException
Initialize the instance

Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

needsInitialization

public boolean needsInitialization()
Does this data instance need to be initialized

Returns:
needs to be initialized

checkInit

protected void checkInit()
Check if this has been initialized. If not, initialize.


reInitialize

public void reInitialize()
                  throws VisADException,
                         RemoteException
Reinitilize this instance. Set internal fields to null and call init()

Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

getDataSelection

public DataSelection getDataSelection()

getDataChoice

public DataChoice getDataChoice()
Get the DataChoice associated with this instance.

Returns:
associated DataChoice

setTheData

public void setTheData(Data d)
Have this be setTheData so it is not the same signature as getData in case this gets persisted

Parameters:
d - data to use

getData

public Data getData()
             throws VisADException,
                    RemoteException
Calls getData, passing in the member DataSelection

Returns:
the Data for this instance
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

getData

public Data getData(DataSelection dataSelection)
             throws VisADException,
                    RemoteException
Get the data using the specified sub selection.

Parameters:
dataSelection - sub selection criteria
Returns:
the data
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

getData

public Data getData(DataSelection dataSelection,
                    Hashtable requestProperties)
             throws VisADException,
                    RemoteException
Get the data using the specified sub selection and extra request properties

Parameters:
dataSelection - sub selection criteria
requestProperties - extra request properties
Returns:
the data specific to the request
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

setData

protected void setData(Data newData)
_more_

Parameters:
newData - _more_

setDataSelection

public void setDataSelection(DataSelection dataSelection)
Set the data selection

Parameters:
dataSelection - the data selection

dataOk

public boolean dataOk()
               throws VisADException,
                      RemoteException
Is the data held by this DataInstance ok. That is, is it non-null.

Returns:
true if the data is okay
Throws:
RemoteException - Java RMI problem
VisADException - VisAD problem

getParamName

public String getParamName()
Get the parameter name associated with this instance.

Returns:
name of the pararmeter

getNextId

protected static int getNextId()
Get the next instance id.

Returns:
next instance id