Class Manager

All Implemented Interfaces:
AsciiSerializable, FieldAccessor, LockableObject, MessagePrinter, TsRecordContainer, Serializable, Cloneable, Comparable, Observer, mil.army.usace.hec.rmi.csinterface.CallBackInterface, rma.lang.Modifiable
Direct Known Subclasses:
GVDataSet, ManagerProxyListManager, ModelAlt, ModelManager, Operations, PDCDataSet, RssAlt, RssRun, RssSystem, SimulationRun, StreamAlignment, TSDataSet, XMLManager

public abstract class Manager extends NamedType implements mil.army.usace.hec.rmi.csinterface.CallBackInterface, LockableObject, TsRecordContainer, MessagePrinter
Abstract base class for model objects that are associated with files. Manager objects collect and manage other objects and organize persistance of data in disk files. They also provide a point of connection to user interface functions for posting messages, status and progess to the UI.
See Also:
  • Field Details

    • LASTMODIFIED_STRING

      public static final String LASTMODIFIED_STRING
      See Also:
    • _lastModifiedTime

      protected long _lastModifiedTime
    • _dssFileManagerWrapper

      protected transient mil.army.usace.hec.rmi.server.RemoteWrapper _dssFileManagerWrapper
    • _userInterface

      protected transient UserInterface _userInterface
    • _identifier

      protected transient Identifier _identifier
    • _Workspace

      protected transient mil.army.usace.hec.rmi.server.RemoteWrapper _Workspace
    • _callBack

      protected transient mil.army.usace.hec.rmi.server.RmiFileCallBackImpl _callBack
    • _proxyList

      protected transient ManagerProxyList _proxyList
    • _uiWrapper

      protected transient mil.army.usace.hec.rmi.server.RemoteWrapper _uiWrapper
    • _reloadOk

      protected transient boolean _reloadOk
    • _readOnly

      protected transient boolean _readOnly
    • _modifiableListeners

      protected transient Vector _modifiableListeners
    • _reloadFailed

      protected transient boolean _reloadFailed
    • _wkspPath

      protected transient String _wkspPath
  • Constructor Details

    • Manager

      public Manager()
    • Manager

      public Manager(String name)
  • Method Details

    • getCommonDataList

      public CommonDataList getCommonDataList(String theDataObjectClass, String theModel)
      Returns the data list responsible for managing objects of the given class Returns the server or client data list depending on which side the manager is instantiated.
    • getUnitSystem

      public int getUnitSystem()
    • getGmtOffset

      public int getGmtOffset()
      Returns the offset from GMT that all time data for this manager is referenced
    • isForecastManager

      public boolean isForecastManager()
      This method returns true if the manager is loaded by means of a forecast. The check is made by looking at the first character of the file which starts with '_' for all forecast manager files.
    • loadComplete

      public void loadComplete()
      This method acts as a hook to let the manager know that all steps required to load a manager are complete.
    • setIdentifier

      public void setIdentifier(Identifier id)
    • getCallback

      public mil.army.usace.hec.rmi.server.RemoteWrapper getCallback()
    • removeCallBack

      public void removeCallBack()
      remove the callback from the file.
    • getIdentifier

      public Identifier getIdentifier()
    • setWorkspace

      public void setWorkspace(mil.army.usace.hec.rmi.server.RemoteWrapper Workspace)
    • getWorkspace

      public mil.army.usace.hec.rmi.server.RemoteWrapper getWorkspace()
    • getWorkspacePath

      public String getWorkspacePath()
    • setProxyList

      public void setProxyList(ManagerProxyList pl)
    • getProxyList

      public ManagerProxyList getProxyList()
    • getDSSFileManager

      public mil.army.usace.hec.rmi.csinterface.DSSManager getDSSFileManager()
      return the Workspace's DSSFileManager.
      Returns:
      the Workspace's DSSFileManager or null if there is no Workspace or an Exception occurs
    • getDSSFileManagerWrapper

      public mil.army.usace.hec.rmi.server.RemoteWrapper getDSSFileManagerWrapper()
    • init

      public abstract void init()
    • readFile

      public boolean readFile(Identifier id)
    • modifiyForSaveAs

      public boolean modifiyForSaveAs()
      called during saveAs to allow managers to modify themselves as necessary, returns true if there are changes made
    • loadSaveAsFile

      public boolean loadSaveAsFile(Identifier id)
    • reLoadFile

      public boolean reLoadFile(Identifier id)
    • reLoadFile

      public boolean reLoadFile()
    • reLoadChildManagers

      public boolean reLoadChildManagers()
      called when this Manager contains other Managers (ie an Alternative) so that it can tell all of it's child Managers to reload. By default it just calls reLoadFile()
      Returns:
      true if the reload was successful
    • saveChildManagers

      public boolean saveChildManagers()
      called when this Manager contains other Managers (ie an Alternative) so that it can tell all of it's child Managers to save. By default it just calls _proxyList.saveManager(hec.lang.UserId.getUserId(), this)
      Returns:
      true if the save was successful
    • writeLastModTime

      protected void writeLastModTime(BufferedWriter out)
    • writeFile

      public boolean writeFile(Identifier id)
    • setManagersModifiedTime

      protected boolean setManagersModifiedTime(Identifier id)
    • setPath

      public void setPath(String path)
    • getPath

      public String getPath()
    • getDirectory

      public String getDirectory()
    • getFilename

      public String getFilename()
    • makeRelativePath

      @Deprecated public String makeRelativePath(String s)
      Deprecated.
      Depreciated in favor of getRelativePath to match workspace call
    • getRelativePath

      public String getRelativePath(String abspath)
      Get the path relative to the workspace directory from an absolute path. This method calls the getRelativePath from its workspace.
    • makeAbsolutePath

      public String makeAbsolutePath(String relpath)
      Make and absolute path from a path relative to the workspace directory. This method calls the makeAbsolutePath from its workspace.
    • makeAbsolutePath

      public String makeAbsolutePath(String relpath, boolean relToParent)
      Make and absolute path from a path relative to the workspace directory. This method calls the makeAbsolutePath from its workspace.
      Parameters:
      relpath -
      relToParent - true to make the path relative to the parent workspace
      Returns:
    • makeAbsolutePathFromWatershed

      public String makeAbsolutePathFromWatershed(String relpath)
      converts a relative path to an absolute path based on the base watershed. This will return the same path whether the network is part of the base watershed or a simulation.
      Parameters:
      relpath - a relative path
      Returns:
      an absolute path
    • makeRelativePathFromWatershed

      public String makeRelativePathFromWatershed(String abspath)
      converts an absolute path to a relative path based on the base watershed. This will return the same path whether the network is part of the base watershed or a simulation.
      Parameters:
      abspath - an absolute path
      Returns:
      a relative path
    • setUserInterface

      public UserInterface setUserInterface(UserInterface ui)
      Parameters:
      ui -
      Returns:
    • getUserInterface

      public UserInterface getUserInterface()
    • setUserInterface

      public mil.army.usace.hec.rmi.server.RemoteWrapper setUserInterface(mil.army.usace.hec.rmi.server.RemoteWrapper uiWrap)
    • printLogMessage

      public void printLogMessage(String msg)
      This method prints the detailed log message
      Specified by:
      printLogMessage in interface MessagePrinter
      Parameters:
      msg - The detailed String log message
    • printErrorMessage

      public void printErrorMessage(String msg)
      This method prints the detailed error message
      Specified by:
      printErrorMessage in interface MessagePrinter
      Parameters:
      msg - The detailed String error message
    • printWarningMessage

      public void printWarningMessage(String msg)
      This method prints the detailed Warning message
      Specified by:
      printWarningMessage in interface MessagePrinter
      Parameters:
      msg - The detailed String Warning message
    • printMessage

      public void printMessage(String msg)
      This method prints the detailed message
      Specified by:
      printMessage in interface MessagePrinter
      Parameters:
      msg - The detailed String message
    • printStatus

      public void printStatus(String msg)
      This method prints the detailed status
      Parameters:
      msg - The detailed String status
    • setLineAttributes

      public void setLineAttributes(HtmlAttributes a)
    • printTableRow

      public void printTableRow(boolean isHeader, String tableRow)
      This method prints the table row
      Parameters:
      isHeader - Boolean is header
      tableRow - The String table row
    • printSeparator

      public void printSeparator()
      This method prints the separator
    • computeComplete

      protected void computeComplete(Object obj)
    • setProgress

      public void setProgress(int i)
    • isCanceled

      public boolean isCanceled()
    • getInputITSDataSet

      public ITSDataSet getInputITSDataSet()
      Specified by:
      getInputITSDataSet in interface TsRecordContainer
    • getOutputITSDataSet

      public ITSDataSet getOutputITSDataSet()
      Specified by:
      getOutputITSDataSet in interface TsRecordContainer
    • getInputTSDataSet

      public TSDataSet getInputTSDataSet()
    • getOutputTSDataSet

      public TSDataSet getOutputTSDataSet()
    • notify

      public void notify(String message)
      Specified by:
      notify in interface mil.army.usace.hec.rmi.csinterface.CallBackInterface
    • newTSRecordProxy

      public TSRecordProxy newTSRecordProxy(TSLocation2 location)
      Specified by:
      newTSRecordProxy in interface TsRecordContainer
    • newTSRecordProxy

      public TSRecordProxy newTSRecordProxy(TSLocation loc)
      create a new tsrecord proxy
    • deleteFile

      public boolean deleteFile(Identifier deleteFileId)
      deletes a file specified by the argument Identifier - returns true if successful
    • openFile

      public Identifier openFile(Identifier openFileId)
      Open a file based on an identifier, returns null if the file does not exist of if there is a problem.
    • newFile

      public Identifier newFile(Identifier newFileId)
      Create a file based on an identifier, returns null if there is a problem.
    • copyFile

      public boolean copyFile(Identifier oldPathId, Identifier newPathId) throws RemoteException
      Copies a file based on an identifiers, returns false if there is a problem.
      Throws:
      RemoteException
    • getFieldObject

      public Object getFieldObject(Field fld)
      Description copied from interface: FieldAccessor
      This method allows access to java.lang.reflect.Field objects within the implementing class.
      Specified by:
      getFieldObject in interface FieldAccessor
      Overrides:
      getFieldObject in class NamedType
      Parameters:
      fld - The field to get.
      Returns:
      The data object that is stored in the given field
    • setFieldObject

      public boolean setFieldObject(Field fld, Object fobj)
      Description copied from interface: FieldAccessor
      This allows access to fields withing the implementing object to set there data.
      Specified by:
      setFieldObject in interface FieldAccessor
      Overrides:
      setFieldObject in class NamedType
      Parameters:
      fld - The java field object representing the member field to be set
      fobj - The data to set in that field
      Returns:
      returns true if successful
    • setReloadOk

      public void setReloadOk(boolean reloadOk)
    • getReloadOk

      public boolean getReloadOk()
    • finalize

      public void finalize() throws Throwable
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • unloading

      public void unloading()
      called when the manager proxy is unloading the manager
    • renamed

      public void renamed(Identifier id)
      called to rename the manager.
    • deleting

      public void deleting()
      called when the manager proxy is deleting the manager allows the manager to do any additional clean required.
    • setModifiedFalse

      public void setModifiedFalse()
    • setModified

      public void setModified(boolean flag)
      Description copied from class: NamedType
      Set the modified flag to true or false.
      Specified by:
      setModified in interface rma.lang.Modifiable
      Overrides:
      setModified in class NamedType
    • getLastModifiedTime

      public long getLastModifiedTime()
      return the managers last modified time.
    • getLastModifiedTimeString

      public String getLastModifiedTimeString()
      return the managers last modified time as a string
    • setLastModifiedTime

      public void setLastModifiedTime(long modTime)
    • setLastModifiedTime

      public void setLastModifiedTime()
      set this manager's last modified time based on the RmiWorkspace's current time.
    • getModTime

      protected long getModTime(int index, String cl, long lastModifiedTime)
    • getModTime

      protected long getModTime(String idPath, String cl, long lastModifiedTime)
    • setReadOnly

      public void setReadOnly(boolean b)
      set this manager's file as read only or not
    • getReadOnly

      public boolean getReadOnly()
      get whether this manager's file is read only
    • backupFile

      public boolean backupFile(String backupDir)
    • saveManager

      public boolean saveManager()
      tell this Manager's ManagerProxy to save
    • saveManagerAs

      public Manager saveManagerAs(String directory, String filePrefix)
      duplicate our data file to a new file and add a new Manager that uses it
      Returns:
      the new manager
    • saveManagerAs

      public Manager saveManagerAs(String directory, String filePrefix, ManagerProxyListContainer container)
      duplicate our data file to a new file and add a new Manager that uses it to the ManagerProxyListContainer specified
      Returns:
      the new Manager
    • refreshData

      public boolean refreshData(Manager origMgr)
      refresh this managers data from the origMgr's data
    • getSaveAsId

      protected Identifier getSaveAsId(String directory, String filePrefix, int index)
      get the Identifier for the destination for duplicating data
    • getSaveAsId

      protected Identifier getSaveAsId(String directory, String filePrefix, int index, Identifier srcId)
    • setLocked

      public boolean setLocked(int lockType)
      lock or unlock this manager
      Specified by:
      setLocked in interface LockableObject
      Parameters:
      lockType - = FileLock.UNLOCK (to unlock), FileLock.READ_LOCK or FileLock.WRITE_LOCK
      See Also:
    • hasLock

      public int hasLock()
      see if this object has it's lock.
      Specified by:
      hasLock in interface LockableObject
      Returns:
      FileLock.NO_LOCK, FileLock.READ_LOCK, FileLock.WRITE_LOCK
    • getFileManager

      public mil.army.usace.hec.rmi.csinterface.RmiFileManager getFileManager()
      get the RmiFileManager for this Manager
    • addModifiableListener

      public void addModifiableListener(hec.event.ModifiableListener listener)
      Overrides:
      addModifiableListener in class NamedType
    • removeModifiableListener

      public void removeModifiableListener(hec.event.ModifiableListener listener)
      Overrides:
      removeModifiableListener in class NamedType
    • notifyModifiableListeners

      protected void notifyModifiableListeners(boolean flag)
    • toString

      public String toString()
      Overrides:
      toString in class NamedType