Class HecDSSFileAccess

java.lang.Object
hec.heclib.dss.HecDSSFileAccess
All Implemented Interfaces:
Cloneable
Direct Known Subclasses:
HecDssCatalog, HecLocationManager

public class HecDSSFileAccess extends Object implements Cloneable
  • Field Details

    • MESS_LEVEL_NONE

      public static final int MESS_LEVEL_NONE
      See Also:
    • MESS_LEVEL_CRITICAL

      public static final int MESS_LEVEL_CRITICAL
      See Also:
    • MESS_LEVEL_TERSE

      public static final int MESS_LEVEL_TERSE
      See Also:
    • MESS_LEVEL_GENERAL

      public static final int MESS_LEVEL_GENERAL
      See Also:
    • MESS_LEVEL_USER_DIAG

      public static final int MESS_LEVEL_USER_DIAG
      See Also:
    • MESS_LEVEL_INTERNAL_DIAG_1

      public static final int MESS_LEVEL_INTERNAL_DIAG_1
      See Also:
    • MESS_LEVEL_INTERNAL_DIAG_2

      public static final int MESS_LEVEL_INTERNAL_DIAG_2
      See Also:
    • MESS_METHOD_GENERAL

      public static final int MESS_METHOD_GENERAL
      See Also:
    • MESS_METHOD_GLOBAL

      public static final int MESS_METHOD_GLOBAL
      See Also:
    • MESS_METHOD_GET

      public static final int MESS_METHOD_GET
      See Also:
    • MESS_METHOD_PUT

      public static final int MESS_METHOD_PUT
      See Also:
    • MESS_METHOD_READ

      public static final int MESS_METHOD_READ
      See Also:
    • MESS_METHOD_WRITE

      public static final int MESS_METHOD_WRITE
      See Also:
    • MESS_METHOD_PERM

      public static final int MESS_METHOD_PERM
      See Also:
    • MESS_METHOD_OPEN

      public static final int MESS_METHOD_OPEN
      See Also:
    • MESS_METHOD_CHECK

      public static final int MESS_METHOD_CHECK
      See Also:
    • MESS_METHOD_LOCKING

      public static final int MESS_METHOD_LOCKING
      See Also:
    • MESS_METHOD_TS_READ

      public static final int MESS_METHOD_TS_READ
      See Also:
    • MESS_METHOD_TS_WRITE

      public static final int MESS_METHOD_TS_WRITE
      See Also:
    • MESS_METHOD_ALIAS

      public static final int MESS_METHOD_ALIAS
      See Also:
    • MESS_METHOD_COPY

      public static final int MESS_METHOD_COPY
      See Also:
    • MESS_METHOD_UTILITY

      public static final int MESS_METHOD_UTILITY
      See Also:
    • MESS_METHOD_CATALOG

      public static final int MESS_METHOD_CATALOG
      See Also:
    • MESS_METHOD_FILE_CHECK

      public static final int MESS_METHOD_FILE_CHECK
      See Also:
    • MESS_METHOD_JNI

      public static final int MESS_METHOD_JNI
      See Also:
    • CONDENSED_CATALOG

      public static final int CONDENSED_CATALOG
      See Also:
    • ABBREVIATED_CATALOG

      public static final int ABBREVIATED_CATALOG
      See Also:
    • FULL_CATALOG

      public static final int FULL_CATALOG
      See Also:
    • _defaultDSSFileName

      protected static String _defaultDSSFileName
    • _defaultDirectory

      protected static String _defaultDirectory
    • _severeErrorIndex

      protected static int _severeErrorIndex
    • _severeErrorRaised

      protected static boolean _severeErrorRaised
    • _severeErrorMessages

      protected static Vector<DSSErrorMessage> _severeErrorMessages
    • _maxNumberReopensForError

      public static int _maxNumberReopensForError
    • _numberReopensForError

      public static int _numberReopensForError
    • _fileData

      protected HecDSSFileDataManager _fileData
  • Constructor Details

    • HecDSSFileAccess

      public HecDSSFileAccess(String DssFileName)
    • HecDSSFileAccess

      public HecDSSFileAccess()
  • Method Details

    • catchSevereErrors

      public static void catchSevereErrors()
      When called, catchSevereErrors() indicates that the calling software will check the status of severe errors after calls to the DSS software. Like Java's throw / catch proceedure, if a severe error is detected, and this statement has not been called, DSS will abort the process more damage to the DSS file and an excessive number of error messages. Errros can occur from a broken file link (a system error usually caused by how MS FAT handles files), or overwritten arrays (DSS tries to detect this before the file is damaged - one reason for the abort). Errors are checked by calling checkForSevereError(int dssTable[]) The error message is retrieved by calling lastSevereErrorMessage() Although the error flags may be cleared by clearSevereError(), it is usually best to print the error message and give the user a chance to save their files, then exit. This function only needs to be called once, at the beginning of the program.
    • done

      public void done()
    • setDefaultDSSFileName

      public static void setDefaultDSSFileName(String dssFileName)
    • setDefaultDirectory

      public static void setDefaultDirectory(String directoryName)
    • defaultDSSFileName

      public static String defaultDSSFileName()
    • defaultDirectory

      public static String defaultDirectory()
    • DSSFileName

      public String DSSFileName()
    • fileOpened

      public boolean fileOpened()
    • fileAccessible

      public boolean fileAccessible()
    • getDssFileVersion

      public int getDssFileVersion()
    • getDssFileVersion

      public static int getDssFileVersion(String dssFileName)
    • doesDSSFileExist

      public static boolean doesDSSFileExist(String dssFileName)
    • setUnit

      public static void setUnit(int unitNumber)
    • setDSSFileName

      public int setDSSFileName(String dssFileName)
    • setDSSFileName

      public int setDSSFileName(String dssFileName, int version)
    • forceMultiUserAccess

      public int forceMultiUserAccess()
    • checkAccessReset

      public int checkAccessReset(boolean forceReopen, int quiescentTimeMills)
    • setSpaceReclaimation

      public int setSpaceReclaimation(boolean turnOn)
    • setSpaceReclaimationPerm

      public int setSpaceReclaimationPerm(int reclaimLevel)
    • isFileRemote

      public boolean isFileRemote()
    • setDSSFileName

      public int setDSSFileName(String dssFileName, boolean fileMustExist)
    • setDSSFileName

      public int setDSSFileName(String dssFileName, boolean fileMustExist, int dssVersion)
    • open

      public int open(String dssFileName, boolean fileMustExist, int dssVersion)
    • open

      public int open()
    • close

      public void close()
    • closeDSSFile

      public void closeDSSFile()
    • closeAll

      public void closeAll()
    • closeAndClear

      public void closeAndClear()
    • close

      public static void close(String fileName, boolean ignoreCasePath)
    • closeAllFiles

      public static void closeAllFiles()
      calling closeAllFiles should be avoided. better to call done() to release the file. A DSS file is similar to other files…. you open it, use it, and then close it. This is a lazy check to be sure everything is on disk at the very end of the program. could crash other programs that are actively using DSS files. quirk: doesn't do anything if CWMS_HOME environment variable is set
    • requestSecondAccess

      protected int[] requestSecondAccess()
    • fileStatus

      public void fileStatus()
    • checkForSevereFileError

      public boolean checkForSevereFileError()
    • checkForSevereError

      public boolean checkForSevereError(int[] dssTable)
    • checkForSevereError

      public static boolean checkForSevereError()
    • checkForError

      public int checkForError()
    • clearError

      public void clearError()
    • clearSevereError

      public void clearSevereError()
    • clearSevereError

      public void clearSevereError(boolean reopenFile)
    • getLastError

      public DSSErrorMessage getLastError()
    • lastSevereErrorMessage

      public DSSErrorMessage lastSevereErrorMessage()
    • allSevereErrorMessages

      public List<DSSErrorMessage> allSevereErrorMessages()
    • numberRecords

      public int numberRecords()
    • getNumberRecords

      public int getNumberRecords()
    • checkSystemError

      public int checkSystemError()
    • checkPathnameBins

      public int checkPathnameBins()
    • checkLinks

      public int checkLinks()
    • checkAllPathnames

      public int checkAllPathnames()
    • getFileLastWriteTime

      public HecTime getFileLastWriteTime()
    • getFileLastWriteTimeMillis

      public long getFileLastWriteTimeMillis()
    • getFileInfo

      public void getFileInfo(stringContainer dssVersion, intContainer numberRecords, intContainer numberDeletedRecords, HecDouble pointerEfficiency, HecDouble fileSizeKbytes, HecDouble deadSpaceKbytes, HecTime creationDate, HecTime lastWriteTime)
    • getProcessStatus

      public void getProcessStatus(int[] numberRecs, int[] currentRec)
    • setInterrupt

      public void setInterrupt(boolean interrupt)
    • clearStatus

      public void clearStatus()
    • getCollectionList

      public String[] getCollectionList(String seedPathname)
      Returns a string array of all the pathnames in a single collection in a DSS file. Any of the pathnames from the collection can be used as a seed (defining the remainder of the pathname). The sequence for the seed does not have to exist (i.e., you can use "000000", even if there is not a pathname with the sequence 000000.
      Parameters:
      seedPathname - String
      Returns:
      String[]
    • getCollectionSequenceList

      public String[] getCollectionSequenceList(String seedPathname)
      Returns a string array of all the sequences in a single collection in a DSS file. Any of the pathnames from the collection can be used as a seed (defining the remainder of the pathname).
      Parameters:
      seedPathname - String
      Returns:
      String[] sequences (e.g., "000042", "000053", ...)
    • getCollectionSize

      public int getCollectionSize(String seedPathname)
      Searches the database to count the number of records in a collection, given a pathname in the sequence Because this searches the database, it should be used sparingly Recommended to call getCollectionList(seedPathname) instead and use the size of that.
      Parameters:
      seedPathname - String
      Returns:
      int
    • cleanDSSFileName

      public static boolean cleanDSSFileName(String inName, stringContainer outName)
    • appendNameToDirectory

      public static String appendNameToDirectory(String directory, String name)
    • zsetMessageLevel

      public static void zsetMessageLevel(int methodID, int levelID)
    • zgetMessageLevel

      public static int zgetMessageLevel(int methodID)
    • zset

      public static void zset(String parameter, String alpha, int number)
    • zsetFile

      public int zsetFile(String parameter, String alpha, int number)
    • processStatus

      public static void processStatus(int[] numberRecs, int[] currentRec, int[] numberErrors)
    • setMessageLevel

      public static void setMessageLevel(int level)
    • flushMessages

      public int flushMessages()
    • setDss

      public static void setDss(String settings)
    • zinqir

      public int zinqir(String parameter)
    • zinquire

      public long zinquire(String parameter)
    • zinqir

      public void zinqir(String parameter, stringContainer alpha, int[] number)
    • zquery

      public static void zquery(String parameter, stringContainer alpha, int[] number)
    • getMessageLevel

      public static int getMessageLevel()
    • zquery

      public static int zquery(String parameter, stringContainer alpha)
    • writeAccess

      public boolean writeAccess()
    • nextTimeSeriesPathname

      public String nextTimeSeriesPathname(String path)
    • debugLook

      public int[] debugLook(long address, int numberWords)
      debugLook - a class only used for debugging file internals
      Parameters:
      address - long
      numberWords - int
    • debugLook7

      public long[] debugLook7(long address, int numberWords)
    • debugModify

      public void debugModify(long address, long value)
      debugModify - a class only used for debugging to change file internals
      Parameters:
      address - int
    • getIrregBeginningDate

      public static int getIrregBeginningDate(String ePart, int jul, int[] year, int[] month, int[] day, int[] block)
      getIrregBeginningDate - an internal class to get the date of the beginning of an irregular time series block
      Parameters:
      ePart - String
      jul - int
      year - int[]
      month - int[]
      day - int[]
      block - int[]
      Returns:
      int
    • getPathnameList

      @Deprecated public String[] getPathnameList(boolean forceUpdate)
      Deprecated.
      DEPRECIATED, use HecDssCatalog class. public String[] getCatalog(boolean sorted, String pathWithWildChars)
      Returns:
      String[] - a sorted list of pathnames. Null or 0 if this function could not get a list This is here for compatibility only!
    • clone

      public Object clone()
      Overrides:
      clone in class Object
    • getTSRecordInfo

      public int getTSRecordInfo(String pathname, HecTime start, HecTime end, stringContainer units, stringContainer type)
      Get information about an individual time series record (pathname) This includes the time of the first and last values in the record, and the records units and type. This is for a single record, not an entire data set. Returns status of 0 = OK, ERROR = error
    • 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
    • zmessage

      public void zmessage(String message)