Package hec.clientapp.model
Class Manager
java.lang.Object
java.util.Observable
hec.lang.NamedType
hec.clientapp.model.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 Summary
FieldsModifier and TypeFieldDescriptionprotected mil.army.usace.hec.rmi.server.RmiFileCallBackImplprotected mil.army.usace.hec.rmi.server.RemoteWrapperprotected Identifierprotected longprotected Vectorprotected ManagerProxyListprotected booleanprotected booleanprotected booleanprotected mil.army.usace.hec.rmi.server.RemoteWrapperprotected UserInterfaceprotected Stringprotected mil.army.usace.hec.rmi.server.RemoteWrapperstatic final StringFields inherited from class hec.lang.NamedType
_description, _ignoreModifiedEvents, _index, _isValid, _modified, _name, defaultDescription, defaultName, DESCRIPTION_CHANGED, NAME_CHANGED, RENAME_EVENT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddModifiableListener(hec.event.ModifiableListener listener) booleanbackupFile(String backupDir) protected voidcomputeComplete(Object obj) booleancopyFile(Identifier oldPathId, Identifier newPathId) Copies a file based on an identifiers, returns false if there is a problem.booleandeleteFile(Identifier deleteFileId) deletes a file specified by the argument Identifier - returns true if successfulvoiddeleting()called when the manager proxy is deleting the manager allows the manager to do any additional clean required.voidfinalize()mil.army.usace.hec.rmi.server.RemoteWrappergetCommonDataList(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.mil.army.usace.hec.rmi.csinterface.DSSManagerreturn the Workspace's DSSFileManager.mil.army.usace.hec.rmi.server.RemoteWrappergetFieldObject(Field fld) This method allows access to java.lang.reflect.Field objects within the implementing class.mil.army.usace.hec.rmi.csinterface.RmiFileManagerget the RmiFileManager for this ManagerintReturns the offset from GMT that all time data for this manager is referencedlongreturn the managers last modified time.return the managers last modified time as a stringprotected longgetModTime(int index, String cl, long lastModifiedTime) protected longgetModTime(String idPath, String cl, long lastModifiedTime) getPath()booleanget whether this manager's file is read onlygetRelativePath(String abspath) Get the path relative to the workspace directory from an absolute path.booleanprotected IdentifiergetSaveAsId(String directory, String filePrefix, int index) get the Identifier for the destination for duplicating dataprotected IdentifiergetSaveAsId(String directory, String filePrefix, int index, Identifier srcId) intmil.army.usace.hec.rmi.server.RemoteWrapperinthasLock()see if this object has it's lock.abstract voidinit()booleanbooleanThis method returns true if the manager is loaded by means of a forecast.voidThis method acts as a hook to let the manager know that all steps required to load a manager are complete.booleanmakeAbsolutePath(String relpath) Make and absolute path from a path relative to the workspace directory.makeAbsolutePath(String relpath, boolean relToParent) Make and absolute path from a path relative to the workspace directory.makeAbsolutePathFromWatershed(String relpath) converts a relative path to an absolute path based on the base watershed.Deprecated.makeRelativePathFromWatershed(String abspath) converts an absolute path to a relative path based on the base watershed.booleancalled during saveAs to allow managers to modify themselves as necessary, returns true if there are changes madenewFile(Identifier newFileId) Create a file based on an identifier, returns null if there is a problem.create a new tsrecord proxynewTSRecordProxy(TSLocation2 location) voidprotected voidnotifyModifiableListeners(boolean flag) openFile(Identifier openFileId) Open a file based on an identifier, returns null if the file does not exist of if there is a problem.voidprintErrorMessage(String msg) This method prints the detailed error messagevoidprintLogMessage(String msg) This method prints the detailed log messagevoidprintMessage(String msg) This method prints the detailed messagevoidThis method prints the separatorvoidprintStatus(String msg) This method prints the detailed statusvoidprintTableRow(boolean isHeader, String tableRow) This method prints the table rowvoidThis method prints the detailed Warning messagebooleanreadFile(Identifier id) booleanrefreshData(Manager origMgr) refresh this managers data from the origMgr's databooleancalled when thisManagercontains otherManagers(ie an Alternative) so that it can tell all of it's childManagersto reload.booleanbooleanreLoadFile(Identifier id) voidremove the callback from the file.voidremoveModifiableListener(hec.event.ModifiableListener listener) voidrenamed(Identifier id) called to rename the manager.booleancalled when thisManagercontains otherManagers(ie an Alternative) so that it can tell all of it's childManagersto save.booleantell this Manager's ManagerProxy to savesaveManagerAs(String directory, String filePrefix) duplicate our data file to a new file and add a new Manager that uses itsaveManagerAs(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 specifiedbooleansetFieldObject(Field fld, Object fobj) This allows access to fields withing the implementing object to set there data.voidvoidset this manager's last modified time based on the RmiWorkspace's current time.voidsetLastModifiedTime(long modTime) voidbooleansetLocked(int lockType) lock or unlock this managerprotected booleanvoidsetModified(boolean flag) Set the modified flag to true or false.voidvoidvoidsetProgress(int i) voidvoidsetReadOnly(boolean b) set this manager's file as read only or notvoidsetReloadOk(boolean reloadOk) mil.army.usace.hec.rmi.server.RemoteWrappersetUserInterface(mil.army.usace.hec.rmi.server.RemoteWrapper uiWrap) voidsetWorkspace(mil.army.usace.hec.rmi.server.RemoteWrapper Workspace) toString()voidcalled when the manager proxy is unloading the managerbooleanwriteFile(Identifier id) protected voidMethods inherited from class hec.lang.NamedType
clone, compareTo, fireModifiedStateChanged, getDescription, getDisplayName, getIgnoreModifiedEvents, getIndex, getName, isModified, isValid, readResolve, rename, set, setDescription, setIgnoreModifiedEvents, setIndex, setName, setValid, update, useRecursiveModifiedTestMethods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChangedMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface rma.lang.Modifiable
isModified
-
Field Details
-
LASTMODIFIED_STRING
- See Also:
-
_lastModifiedTime
protected long _lastModifiedTime -
_dssFileManagerWrapper
protected transient mil.army.usace.hec.rmi.server.RemoteWrapper _dssFileManagerWrapper -
_userInterface
-
_identifier
-
_Workspace
protected transient mil.army.usace.hec.rmi.server.RemoteWrapper _Workspace -
_callBack
protected transient mil.army.usace.hec.rmi.server.RmiFileCallBackImpl _callBack -
_proxyList
-
_uiWrapper
protected transient mil.army.usace.hec.rmi.server.RemoteWrapper _uiWrapper -
_reloadOk
protected transient boolean _reloadOk -
_readOnly
protected transient boolean _readOnly -
_modifiableListeners
-
_reloadFailed
protected transient boolean _reloadFailed -
_wkspPath
-
-
Constructor Details
-
Manager
public Manager() -
Manager
-
-
Method Details
-
getCommonDataList
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
-
getCallback
public mil.army.usace.hec.rmi.server.RemoteWrapper getCallback() -
removeCallBack
public void removeCallBack()remove the callback from the file. -
getIdentifier
-
setWorkspace
public void setWorkspace(mil.army.usace.hec.rmi.server.RemoteWrapper Workspace) -
getWorkspace
public mil.army.usace.hec.rmi.server.RemoteWrapper getWorkspace() -
getWorkspacePath
-
setProxyList
-
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
-
modifiyForSaveAs
public boolean modifiyForSaveAs()called during saveAs to allow managers to modify themselves as necessary, returns true if there are changes made -
loadSaveAsFile
-
reLoadFile
-
reLoadFile
public boolean reLoadFile() -
reLoadChildManagers
public boolean reLoadChildManagers()called when thisManagercontains otherManagers(ie an Alternative) so that it can tell all of it's childManagersto reload. By default it just callsreLoadFile()- Returns:
- true if the reload was successful
-
saveChildManagers
public boolean saveChildManagers()called when thisManagercontains otherManagers(ie an Alternative) so that it can tell all of it's childManagersto save. By default it just calls_proxyList.saveManager(hec.lang.UserId.getUserId(), this)- Returns:
- true if the save was successful
-
writeLastModTime
-
writeFile
-
setManagersModifiedTime
-
setPath
-
getPath
-
getDirectory
-
getFilename
-
makeRelativePath
Deprecated.Depreciated in favor of getRelativePath to match workspace call -
getRelativePath
Get the path relative to the workspace directory from an absolute path. This method calls the getRelativePath from its workspace. -
makeAbsolutePath
Make and absolute path from a path relative to the workspace directory. This method calls the makeAbsolutePath from its workspace. -
makeAbsolutePath
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
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
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
- Parameters:
ui-- Returns:
-
getUserInterface
-
setUserInterface
public mil.army.usace.hec.rmi.server.RemoteWrapper setUserInterface(mil.army.usace.hec.rmi.server.RemoteWrapper uiWrap) -
printLogMessage
This method prints the detailed log message- Specified by:
printLogMessagein interfaceMessagePrinter- Parameters:
msg- The detailed String log message
-
printErrorMessage
This method prints the detailed error message- Specified by:
printErrorMessagein interfaceMessagePrinter- Parameters:
msg- The detailed String error message
-
printWarningMessage
This method prints the detailed Warning message- Specified by:
printWarningMessagein interfaceMessagePrinter- Parameters:
msg- The detailed String Warning message
-
printMessage
This method prints the detailed message- Specified by:
printMessagein interfaceMessagePrinter- Parameters:
msg- The detailed String message
-
printStatus
This method prints the detailed status- Parameters:
msg- The detailed String status
-
setLineAttributes
-
printTableRow
This method prints the table row- Parameters:
isHeader- Boolean is headertableRow- The String table row
-
printSeparator
public void printSeparator()This method prints the separator -
computeComplete
-
setProgress
public void setProgress(int i) -
isCanceled
public boolean isCanceled() -
getInputITSDataSet
- Specified by:
getInputITSDataSetin interfaceTsRecordContainer
-
getOutputITSDataSet
- Specified by:
getOutputITSDataSetin interfaceTsRecordContainer
-
getInputTSDataSet
-
getOutputTSDataSet
-
notify
- Specified by:
notifyin interfacemil.army.usace.hec.rmi.csinterface.CallBackInterface
-
newTSRecordProxy
- Specified by:
newTSRecordProxyin interfaceTsRecordContainer
-
newTSRecordProxy
create a new tsrecord proxy -
deleteFile
deletes a file specified by the argument Identifier - returns true if successful -
openFile
Open a file based on an identifier, returns null if the file does not exist of if there is a problem. -
newFile
Create a file based on an identifier, returns null if there is a problem. -
copyFile
Copies a file based on an identifiers, returns false if there is a problem.- Throws:
RemoteException
-
getFieldObject
Description copied from interface:FieldAccessorThis method allows access to java.lang.reflect.Field objects within the implementing class.- Specified by:
getFieldObjectin interfaceFieldAccessor- Overrides:
getFieldObjectin classNamedType- Parameters:
fld- The field to get.- Returns:
- The data object that is stored in the given field
-
setFieldObject
Description copied from interface:FieldAccessorThis allows access to fields withing the implementing object to set there data.- Specified by:
setFieldObjectin interfaceFieldAccessor- Overrides:
setFieldObjectin classNamedType- Parameters:
fld- The java field object representing the member field to be setfobj- The data to set in that field- Returns:
- returns true if successful
-
setReloadOk
public void setReloadOk(boolean reloadOk) -
getReloadOk
public boolean getReloadOk() -
finalize
-
unloading
public void unloading()called when the manager proxy is unloading the manager -
renamed
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:NamedTypeSet the modified flag to true or false.- Specified by:
setModifiedin interfacerma.lang.Modifiable- Overrides:
setModifiedin classNamedType
-
getLastModifiedTime
public long getLastModifiedTime()return the managers last modified time. -
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
-
getModTime
-
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
-
saveManager
public boolean saveManager()tell this Manager's ManagerProxy to save -
saveManagerAs
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
refresh this managers data from the origMgr's data -
getSaveAsId
get the Identifier for the destination for duplicating data -
getSaveAsId
-
setLocked
public boolean setLocked(int lockType) lock or unlock this manager- Specified by:
setLockedin interfaceLockableObject- 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:
hasLockin interfaceLockableObject- 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:
addModifiableListenerin classNamedType
-
removeModifiableListener
public void removeModifiableListener(hec.event.ModifiableListener listener) - Overrides:
removeModifiableListenerin classNamedType
-
notifyModifiableListeners
protected void notifyModifiableListeners(boolean flag) -
toString
-