Package net.anotheria.anodoc.util
Class CommonHashtableModuleStorage
- java.lang.Object
-
- net.anotheria.anodoc.util.CommonHashtableModuleStorage
-
- All Implemented Interfaces:
IModuleStorage
public class CommonHashtableModuleStorage extends java.lang.Object implements IModuleStorage
This storage stores everything in a hashtable and stores this in the plain form (only IPlanDataObject and ICompositeDataObject) in ONE file.- Version:
- $Id: $Id
- Author:
- another
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringDEF_KEY_CFG_STORAGE_DIRECTORYKey for storage directory.static java.lang.StringDEF_STORAGE_DIRDefault name for storage directory.
-
Constructor Summary
Constructors Constructor Description CommonHashtableModuleStorage(java.lang.String aFilename, IModuleFactory aFactory)Constructor for CommonHashtableModuleStorage.CommonHashtableModuleStorage(java.lang.String aFilename, IModuleFactory aFactory, java.lang.String aCfgKeyStorageDir)Constructor for CommonHashtableModuleStorage.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddModuleListener(IModuleListener listener)Adds a module listener.voiddeleteModule(java.lang.String ownerId, java.lang.String copyId)Delete the specified instance.protected java.lang.StringgetFile(java.lang.String aFilename)getFile.protected java.lang.StringgetFileLock(java.lang.String aFilename)Return path for lock file by file name.ModuleloadModule(java.lang.String ownerId, java.lang.String copyId)Loads the specified instance.voidnotifyConfigurationFinished()notifyConfigurationFinished.voidremoveModuleListener(IModuleListener listener)Removes the module listener from the module storage.voidsaveModule(Module module)Saves the given instance permanently.voidsetStorageDir(java.lang.String value)Setter for the fieldstorageDir.
-
-
-
Field Detail
-
DEF_KEY_CFG_STORAGE_DIRECTORY
public static final java.lang.String DEF_KEY_CFG_STORAGE_DIRECTORY
Key for storage directory.- See Also:
- Constant Field Values
-
DEF_STORAGE_DIR
public static final java.lang.String DEF_STORAGE_DIR
Default name for storage directory.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CommonHashtableModuleStorage
public CommonHashtableModuleStorage(java.lang.String aFilename, IModuleFactory aFactory)Constructor for CommonHashtableModuleStorage.
- Parameters:
aFilename- aStringobject.aFactory- aIModuleFactoryobject.
-
CommonHashtableModuleStorage
public CommonHashtableModuleStorage(java.lang.String aFilename, IModuleFactory aFactory, java.lang.String aCfgKeyStorageDir)Constructor for CommonHashtableModuleStorage.
- Parameters:
aFilename- aStringobject.aFactory- aIModuleFactoryobject.aCfgKeyStorageDir- aStringobject.
-
-
Method Detail
-
loadModule
public Module loadModule(java.lang.String ownerId, java.lang.String copyId) throws NoStoredModuleEntityException
Loads the specified instance.- Specified by:
loadModulein interfaceIModuleStorage- Parameters:
ownerId- aStringobject.copyId- aStringobject.- Returns:
- loaded module
- Throws:
NoStoredModuleEntityException- if any.
-
saveModule
public void saveModule(Module module)
Saves the given instance permanently.- Specified by:
saveModulein interfaceIModuleStorage- Parameters:
module- aModuleobject.
-
deleteModule
public void deleteModule(java.lang.String ownerId, java.lang.String copyId)Delete the specified instance.- Specified by:
deleteModulein interfaceIModuleStorage- Parameters:
ownerId- aStringobject.copyId- aStringobject.
-
getFile
protected java.lang.String getFile(java.lang.String aFilename)
getFile.
- Parameters:
aFilename- aStringobject.- Returns:
- a
Stringobject.
-
getFileLock
protected java.lang.String getFileLock(java.lang.String aFilename)
Return path for lock file by file name.- Parameters:
aFilename- file name for dat file.- Returns:
- file name for lock file.
-
setStorageDir
public void setStorageDir(java.lang.String value)
Setter for the field
storageDir.- Parameters:
value- aStringobject.
-
addModuleListener
public void addModuleListener(IModuleListener listener)
Adds a module listener. Adds a service listener to this module storage.- Specified by:
addModuleListenerin interfaceIModuleStorage- Parameters:
listener- the listener to add.
-
removeModuleListener
public void removeModuleListener(IModuleListener listener)
Removes the module listener from the module storage. Removes the service listener from the module storage.- Specified by:
removeModuleListenerin interfaceIModuleStorage- Parameters:
listener- the listener to remove.
-
notifyConfigurationFinished
public void notifyConfigurationFinished()
notifyConfigurationFinished.
-
-