Class HecDss

java.lang.Object
hec.heclib.dss.HecDss

public class HecDss extends Object
HecDss objects are used to retrieve and store data sets in a DSS file, as well as several utility functions for DSS files. Data is retrieved and stored using DataContainers. DataContainers are simple classes that are database independent and are how most Hec classes exchange data.
  • Field Details

    • _dataManager

      protected DssDataManager _dataManager
      The DSS data manager
    • _filename

      protected String _filename
      The DSS file that this object represents
    • _startTime

      protected String _startTime
      the default start of the timewindow
    • _endTime

      protected String _endTime
      the default end of the timewindow
    • _trimMissing

      protected boolean _trimMissing
      specifies whether to trim missing values from start and end of regular time-series
    • _regularStoreMethod

      protected int _regularStoreMethod
    • _irregularStoreMethod

      protected int _irregularStoreMethod
  • Constructor Details

  • Method Details

    • open

      public static HecDss open(String dssFileName) throws Exception
      Throws:
      Exception
    • open

      public static HecDss open(String dssFileName, int dssVersion) throws Exception
      Throws:
      Exception
    • open

      public static HecDss open(String dssFileName, String timeWindow) throws Exception
      Throws:
      Exception
    • open

      public static HecDss open(String dssFileName, String startTime, String endTime) throws Exception
      Throws:
      Exception
    • open

      public static HecDss open(String dssFileName, boolean mustExist) throws Exception
      Throws:
      Exception
    • open

      public static HecDss open(String dssFileName, boolean mustExist, boolean isRemote) throws Exception
      Throws:
      Exception
    • open

      public static HecDss open(String dssFileName, boolean mustExist, boolean isRemote, int dssVersion) throws Exception
      Throws:
      Exception
    • getDssFilename

      public static boolean getDssFilename(String inputFilename, stringContainer outputFilename, boolean alwaysGetCanonical) throws IOException
      Retrieves the path for an input DSS file name, adding the ".dss" extension if necessary
      Parameters:
      inputFilename - The relative or absolute path of a DSS file, with or without the extension
      outputFilename - The (possibly absolute) path of the DSS file with the extension
      alwaysGetCanonical - Specifies whether to retrieve the absolute path for the DSS file even if the file doesn't exist.
      Returns:
      Whether the DSS file exists
      Throws:
      IOException
    • isOpened

      public boolean isOpened()
    • get

      public DataContainer get(String pathname) throws Exception
      Throws:
      Exception
    • get

      public DataContainer get(String pathname, String startTime, String endTime) throws Exception
      Throws:
      Exception
    • get

      public DataContainer get(String pathname, boolean readEntireSet) throws Exception
      Throws:
      Exception
    • get

      public DataContainer get(DSSIdentifier dssId) throws Exception
      Throws:
      Exception
    • get

      protected DataContainer get(DataReference dataSet) throws Exception
      Throws:
      Exception
    • put

      public void put(DataContainer dataContainer) throws Exception
      Throws:
      Exception
    • put

      public void put(DataContainerTransformer rsc) throws Exception
      Throws:
      Exception
    • read

      public IHecMath read(String pathname) throws Exception
      Throws:
      Exception
    • read

      public IHecMath read(String pathname, String timeWindow) throws Exception
      Throws:
      Exception
    • read

      public IHecMath read(String pathname, String startTime, String endTime) throws Exception
      Throws:
      Exception
    • read

      public IHecMath read(String pathname, String startTime, String endTime, boolean trimMissing) throws Exception
      Throws:
      Exception
    • write

      public int write(IHecMath math) throws Exception
      Throws:
      Exception
    • write

      public int write(IHecMath tsMath, String storeMethod) throws Exception
      Throws:
      Exception
    • write

      public int write(DataContainer dataContainer) throws Exception
      Throws:
      Exception
    • write

      public int write(DataContainerTransformer transformer) throws Exception
      Throws:
      Exception
    • getTimeSeriesExtents

      public boolean getTimeSeriesExtents(String pathname, HecTime start, HecTime end)
      Gets the time of the first data and last data in a data set, (not just a single pathname)
      Parameters:
      pathname - String
      start - HecTime - time of first piece of data
      end - HecTime - time of last piece of data
      Returns:
      boolean - true if found and time series; false if not TS
    • recordExists

      public boolean recordExists(String pathname)
    • getPathnameList

      public Vector getPathnameList()
      Gets a unsorted list of all pathnames in the file (This can be time consuming, so don't do often)
      Returns:
      Vector of strings with pathnames
    • getCondensedCatalog

      public List<CondensedReference> getCondensedCatalog()
      Returns a condensed list of pathnames in the file This means that each data set is in one data reference, which spans all time for that set, regardless of the number of records. This is very intensive, requiring sorting and such, so use sparingly
      Returns:
      Vector
    • close

      public void close()
      Explicitly close the DSS file
    • forceMultiUserAccess

      public void forceMultiUserAccess()
    • done

      public void done()
      Release the DSS file for this object
    • isRemote

      public boolean isRemote()
    • getFilename

      public String getFilename()
      get the filename
      Returns:
      the filename
    • getStartTime

      public String getStartTime()
      get the timewindow start time
      Returns:
      the start time
    • getEndTime

      public String getEndTime()
      get the timewindow end time
      Returns:
      the end time
    • getTrimMissing

      public boolean getTrimMissing()
      Gets the "trim missing data" state
      Returns:
      true if trim missing is on
    • getRegularStoreMethod

      public int getRegularStoreMethod()
    • getIrregularStoreMethod

      public int getIrregularStoreMethod()
    • getDataManager

      public DssDataManager getDataManager()
    • recordsUpdated

      public int recordsUpdated(long startTime, Vector<String> pathnames, Vector<Long> updateTimes, Vector<Integer> recordTypes)
      Retrieves information about records updated since the specified time.

      Any of the vector parameters may be null if that information is not required. Any of the vectors that are not null are cleared before being populated.

      Parameters:
      startTime - Time after which to report updated records - in Java milliseconds
      pathnames - The list of pathnames of the records that have been updated - may be null.
      updateTimes - The list of update times of the records that have been updated - may be null.
      recordTypes - The list of types of the records that have been updated - may be null.
      Returns:
      Zero if successful.
    • recordsUpdated

      public int recordsUpdated(HecTime startTime, Vector<String> pathnames, Vector<Long> updateTimes, Vector<Integer> recordTypes)
    • recordsUpdated

      public int recordsUpdated(String startTime, Vector<String> pathnames, Vector<Long> updateTimes, Vector<Integer> recordTypes)
    • recordsUpdated

      public Vector<String> recordsUpdated(long startTime)
    • recordsUpdated

      public Vector<String> recordsUpdated(HecTime startTime)
    • recordsUpdated

      public Vector<String> recordsUpdated(String startTime)
    • setFilename

      public void setFilename(String filename)
      Sets the filename
      Parameters:
      filename - the new filename
    • setTimeWindow

      public void setTimeWindow(String timeWindow)
      Sets the time window
      Parameters:
      timeWindow - - a string containing the time window, which can be a relative reference ("T-5D T") or a regular date time span ("18MAR2005 28MAR2005" or "18MAR2005 2400 28MAR2005 2400"
    • setTimeWindow

      public void setTimeWindow(String startTime, String endTime)
      Sets the time window
      Parameters:
      startTime - the default start of the timewindow
      endTime - the default end of the timewindow
    • setTrimMissing

      public void setTrimMissing(boolean trimMissing)
      Sets the "trim missing data" state

      If the "trim missing data" state is TRUE, blocks of missing data will be removed from the start and end of all regular time series records

      Parameters:
      trimMissing - the "trim missing data" state
    • setRegularStoreMethod

      public void setRegularStoreMethod(int method)
    • setIrregularStoreMethod

      public void setIrregularStoreMethod(int method)
    • duplicateRecords

      public int duplicateRecords(Vector pathnameList, Vector newPathnameList)
    • duplicateRecords

      public int duplicateRecords(String[] pathnameList, String[] newPathnameList)
    • renameRecords

      public int renameRecords(Vector pathnameList, Vector newPathnameList)
    • renameRecords

      public int renameRecords(String[] pathnameList, String[] newPathnameList)
    • copyRecordsFrom

      public int copyRecordsFrom(String toDSSFilename, Vector pathnameList)
    • copyRecordsFrom

      public int copyRecordsFrom(String toDSSFilename, String[] pathnameList)
    • copyRecordsInto

      public int copyRecordsInto(String fromDSSFilename, Vector pathnameList)
    • copyRecordsInto

      public int copyRecordsInto(String fromDSSFilename, String[] pathnameList)
    • delete

      public int delete(Vector pathnameList)
    • delete

      public int delete(String[] pathnameList)
    • getCatalogedPathnames

      public Vector getCatalogedPathnames()
      Retrieves a list of all cataloged pathnames. The catalog is not refreshed in the process.
      Returns:
      The list of cataloged pathnames.
    • getCatalogedPathnames

      public Vector getCatalogedPathnames(boolean forceNew)
      Retrieves a list of all cataloged pathnames, optionally refreshing the catalog in the process.
      Parameters:
      forceNew - Specifies whether to refresh the catalog before retrieving the pathnames
      Returns:
      The list of cataloged pathnames.
    • getCatalogedPathnames

      public Vector getCatalogedPathnames(String scanString)
      Searches the cataloged pathnames, returning a list of those which match the specified instructions. The catalog is not refreshed in the process.
      Parameters:
      scanString - The matching instructions for the search.
      Returns:
      The list of matching pathnames.
    • searchPathnames

      @Deprecated public Vector searchPathnames(String scanString)
      Deprecated.
    • getCatalogedPathnames

      public Vector getCatalogedPathnames(String scanString, boolean forceNew)
      Searches the cataloged pathnames, returning a list of those which match the specified instructions - optionally refreshing the catalog in the process.
      Parameters:
      scanString - The matching instructions for the search.
      forceNew - Specifies whether to refresh the catalog before performing the search.
      Returns:
      The list of matching pathnames.
    • checkForError

      protected void checkForError() throws Exception
      Throws:
      Exception