edu.unh.sdb.datasource
Class DataSource

java.lang.Object
  extended by edu.unh.sdb.datasource.DataCollection
      extended by edu.unh.sdb.datasource.DataSource
All Implemented Interfaces:
Indexable
Direct Known Subclasses:
AliasDataSource, CacheDataSource, CellDataSource, CompositeDataSource, DynamicChunking, ForeignReferenceDataSource, MRDataSource, PhysicalDataSource, VRDataSource

public abstract class DataSource
extends DataCollection

The DataSource class provides a provides a view of the data in which each datum has a unique location within an N-dimensional index space. Many types of DataSource can be connected to one or more component DataSources to form a tree. The Root DataSource will communicate directly with the Lattice, while the various leaf DataSources are responsible for reading data from a file or network socket. The various internal DataSources perform tasks like taking a subset, Attribute Join or Spatial Join.


Field Summary
protected  FDLDescriptor fdlDescriptor
           
protected  boolean isActivated
           
protected  java.lang.String name
          The name of this DataSource object.
protected  java.lang.String wsName
           
 
Fields inherited from class edu.unh.sdb.datasource.DataCollection
attributeOrder, axisOrdering, axisWeights, bounds, dataOrder, dimensionality, numAttributes, pointOrder, recordDesc
 
Constructor Summary
protected DataSource(DataSource ds)
          Constructor sets all data members to copies of the corresponding members from the argument DataSource.
protected DataSource(java.lang.String dsname)
          Default constructor.
protected DataSource(java.lang.String aname, ISBounds db)
          Constructor sets the bounds member to the provided value and the recordDesc member to a single float attribute.
protected DataSource(java.lang.String aname, RecordDescriptor r, ISBounds db)
          Constructor sets the bounds and recordDesc members to the provided values.
 
Method Summary
 void activate()
          The DataSource will perform any initialization required in order to begin reading/processing data.
protected  void checkActivated()
          Check if the DataSource has been activated before trying to access data.
 void clearCache()
          Attempts to clear the filesystem cache executing a shell script at $HOME/bin/trc.
 IndexSpaceID copyBestID(IndexSpaceID id)
          Make a copy of the argument using a chosen subclass of IndexSpaceID.
static DataSource create(java.lang.String dsName, FDLDescriptor fdld)
          Creates and returns a PhysicalDataSource, given an FDLDescriptor that has already been initialized from an FDL file and an arbitrary name for the datasource.
static DataSource create(java.lang.String dsName, java.lang.String xmlFile)
          Creates and returns a DataSource.
static DataSource create(java.lang.String dsName, java.lang.String fdlfile, java.lang.String fileServerURL)
          Creates and returns a RemoteBFDS where the fileServerURL argument identifies the location of the DataSource
static DataSource createRemote(java.lang.String dsName, FDLDescriptor fdld, java.lang.String fileServerURL)
          Creates and returns a RemoteBFDS where the fileServerURL argument identifies the location of the DataSource
static DataSource createRemote(java.lang.String dsName, java.lang.String fdlfile, java.lang.String fileServerURL)
          Creates and returns a RemoteBFDS where the fileServerURL argument identifies the location of the DataSource
static DataSource createRemoteClient(java.lang.String dsName, FDLDescriptor fdld, java.lang.String fileServerURL)
           
static DataSource createRemoteClient(java.lang.String dsName, java.lang.String fdlfile, java.lang.String fileServerURL)
           
static DataSource createRemoteDataSource(java.lang.String dsName, FDLDescriptor fdld, java.lang.String fileServerURL)
           
static DataSource createRemoteDataSource(java.lang.String dsName, java.lang.String fdlfile, java.lang.String fileServerURL)
           
static DataSource createRemoteDataSourceUDP(FDLDescriptor fdld, java.lang.String dsName, java.lang.String fileServerURL)
           
static DataSource createRemoteUDP(java.lang.String dsName, FDLDescriptor fdld, java.lang.String fileServerURL)
           
static DataSource createRemoteUDP(java.lang.String dsName, java.lang.String fdlfile, java.lang.String fileServerURL)
           
 void deactivate()
          The DataSource will release any resources used during the readling or processing of data.
 java.lang.String dumpData()
          Write the values of the entire DataSource index space to a string in a nice format.
 boolean equals(java.lang.Object o)
          Returns true if this DataSource has the same bounds and RecordDescriptor as the argument DataSource.
 java.lang.String getName()
          Returns the name of this DataSource object.
 Values getValues()
          Return a Values array of all attributes in the entire DataSource in whatever type and order they are stored internally (either attribute order or point order for Granite-defined objects).
 boolean isActivated()
          Returns true if the datasource is activated, false otherwise.
static void main(java.lang.String[] args)
          ---------------------- main ---------------------------------- // just a little code to test the code that tries to be smarter about // finding files.
 java.lang.String toString()
          Return a String representing the object.
 java.lang.String toString(java.lang.String indent)
          Return a String representing the object indented by the argument string.
 
Methods inherited from class edu.unh.sdb.datasource.DataCollection
byteSize, computeOffset, computeOffset, copyBounds, createDataBlock, createDataBlock, createDataBlock, createDatum, createDatum, createDatum, createDatum, createDatum, createDatum, datum, datum, datum, datum, datum, datum, datum, dim, getAxisOrdering, getAxisWeight, getAxisWeights, getBounds, getByte, getBytes, getBytes, getBytes, getBytes, getBytes, getBytes, getBytesByAttribute, getBytesByAttribute, getBytesByPoint, getBytesByPoint, getDataOrder, getDimensionsArray, getDouble, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoubles, getDoublesByAttribute, getDoublesByAttribute, getDoublesByPoint, getDoublesByPoint, getFloat, getFloats, getFloats, getFloats, getFloats, getFloats, getFloats, getFloatsByAttribute, getFloatsByAttribute, getFloatsByPoint, getFloatsByPoint, getInt, getInts, getInts, getInts, getInts, getInts, getInts, getIntsByAttribute, getIntsByAttribute, getIntsByPoint, getIntsByPoint, getLowerBoundsArray, getNumAttributes, getRecordDescriptor, getShort, getShorts, getShorts, getShorts, getShorts, getShorts, getShorts, getShortsByAttribute, getShortsByAttribute, getShortsByPoint, getShortsByPoint, getStorageType, getValues, getValuesByAttribute, getValuesByPoint, longVolume, setAxisOrdering, setBounds, setRecordDescriptor, size, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, subblock, useBytesOnly, volume
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

name

protected java.lang.String name
The name of this DataSource object.


wsName

protected java.lang.String wsName

isActivated

protected boolean isActivated

fdlDescriptor

protected FDLDescriptor fdlDescriptor
Constructor Detail

DataSource

protected DataSource(java.lang.String dsname)
Default constructor.


DataSource

protected DataSource(java.lang.String aname,
                     RecordDescriptor r,
                     ISBounds db)
Constructor sets the bounds and recordDesc members to the provided values.


DataSource

protected DataSource(java.lang.String aname,
                     ISBounds db)
Constructor sets the bounds member to the provided value and the recordDesc member to a single float attribute.


DataSource

protected DataSource(DataSource ds)
Constructor sets all data members to copies of the corresponding members from the argument DataSource.

Method Detail

activate

public void activate()
The DataSource will perform any initialization required in order to begin reading/processing data. It is important that all child classes call super.activate()


deactivate

public void deactivate()
The DataSource will release any resources used during the readling or processing of data. It is important that all child classes call super.deactivate()


isActivated

public final boolean isActivated()
Returns true if the datasource is activated, false otherwise.


getName

public java.lang.String getName()
Returns the name of this DataSource object.


getValues

public Values getValues()
Return a Values array of all attributes in the entire DataSource in whatever type and order they are stored internally (either attribute order or point order for Granite-defined objects). This default implementation is really bad for large datasources -- it just creates a single DataBlock and does a getValues on that.

Specified by:
getValues in class DataCollection

copyBestID

public IndexSpaceID copyBestID(IndexSpaceID id)
Make a copy of the argument using a chosen subclass of IndexSpaceID. The subclass is chosen according to a combination of time and space considerations. The chosen subclass will always be able to represent this DataSource's Index Space or Base Resolution.


dumpData

public java.lang.String dumpData()
Write the values of the entire DataSource index space to a string in a nice format. Uses the DataSource axisOrdering and bounds.


toString

public java.lang.String toString()
Return a String representing the object.

Overrides:
toString in class java.lang.Object

toString

public java.lang.String toString(java.lang.String indent)
Return a String representing the object indented by the argument string.


equals

public boolean equals(java.lang.Object o)
Returns true if this DataSource has the same bounds and RecordDescriptor as the argument DataSource. Currently, the DataSource name is not considered in the comparison.

Overrides:
equals in class java.lang.Object

create

public static final DataSource create(java.lang.String dsName,
                                      java.lang.String xmlFile)
Creates and returns a DataSource. The first argument is an arbitrary name for the datasource. The second argment should be the name of an xfdl or fdl file. The child class of DataSource is determined by the file description file. If the passed in file name does not exist, and that name does not end in one of the typical extensions (.xfdl, .fdl, .xml), this method will append those extensions in that order and check for the existence of the file. If the filename includes directory specifications, the root of the path will be saved. If the file name specified in this FDL descriptor file, cannot be found, we will append the fdl file path root to the data file name and try to open that.


create

public static final DataSource create(java.lang.String dsName,
                                      java.lang.String fdlfile,
                                      java.lang.String fileServerURL)
Creates and returns a RemoteBFDS where the fileServerURL argument identifies the location of the DataSource


createRemote

public static final DataSource createRemote(java.lang.String dsName,
                                            FDLDescriptor fdld,
                                            java.lang.String fileServerURL)
Creates and returns a RemoteBFDS where the fileServerURL argument identifies the location of the DataSource


createRemote

public static final DataSource createRemote(java.lang.String dsName,
                                            java.lang.String fdlfile,
                                            java.lang.String fileServerURL)
Creates and returns a RemoteBFDS where the fileServerURL argument identifies the location of the DataSource


createRemoteUDP

public static final DataSource createRemoteUDP(java.lang.String dsName,
                                               FDLDescriptor fdld,
                                               java.lang.String fileServerURL)

createRemoteUDP

public static final DataSource createRemoteUDP(java.lang.String dsName,
                                               java.lang.String fdlfile,
                                               java.lang.String fileServerURL)

createRemoteDataSourceUDP

public static final DataSource createRemoteDataSourceUDP(FDLDescriptor fdld,
                                                         java.lang.String dsName,
                                                         java.lang.String fileServerURL)

createRemoteClient

public static final DataSource createRemoteClient(java.lang.String dsName,
                                                  FDLDescriptor fdld,
                                                  java.lang.String fileServerURL)

createRemoteClient

public static final DataSource createRemoteClient(java.lang.String dsName,
                                                  java.lang.String fdlfile,
                                                  java.lang.String fileServerURL)

createRemoteDataSource

public static final DataSource createRemoteDataSource(java.lang.String dsName,
                                                      java.lang.String fdlfile,
                                                      java.lang.String fileServerURL)

createRemoteDataSource

public static final DataSource createRemoteDataSource(java.lang.String dsName,
                                                      FDLDescriptor fdld,
                                                      java.lang.String fileServerURL)

create

public static final DataSource create(java.lang.String dsName,
                                      FDLDescriptor fdld)
Creates and returns a PhysicalDataSource, given an FDLDescriptor that has already been initialized from an FDL file and an arbitrary name for the datasource. The type of DataSource returned depends on the file descriptor.


clearCache

public void clearCache()
Attempts to clear the filesystem cache executing a shell script at $HOME/bin/trc.


main

public static void main(java.lang.String[] args)
---------------------- main ---------------------------------- // just a little code to test the code that tries to be smarter about // finding files.


checkActivated

protected final void checkActivated()
Check if the DataSource has been activated before trying to access data. If it has not been activated, activate it.*