Module PropRepository
Repository which provides read and write access to stored property sets. Currently, only a file based repository is implemented. However, it is planned to use the same interface to provide access to property sets that are stored, e.g., in a data base or that are provided via a web service etc. Such services can simply be implemented by providing the same interface as the one specified here.
Functions
Tables
Functions
- _M:getPropSetData (name)
-
Return administrative information for a given property set.
Parameters
-
name: name of the property set
Return value:
table with administrative information (see module description for a list of used keys)
- _M:getPropSetList ()
-
Get a list of property sets available in the repository.
Return value:
a list containing the names of the available property sets.
- _M:loadPropSet (name)
-
Load property set from file.
Parameters
-
name: name of the property set
Return value:
content of the property set as string
- _M:lockPropSet (name)
-
Read and lock property set for exclusive write access.
Parameters
-
name: name of the property set
Return value:
content of the property set as string
- _M:new (dir)
-
Create new property repository. The given directory is scanned for files which match the pattern *.properties. Access to these property sets is provided through the repository.
Parameters
-
dir: name of the directory which contains the property sets (optional, default: current directory).
Return value:
a new property repository object.
- _M:unlockPropSet (name)
-
Remove lock for exclusive write access.
Parameters
-
name: name of the property set
- _M:writePropSet (name, content)
-
Write content of property set. The property set must have been locked before. After the write operation the lock is automatically removed.
Parameters
-
name: name of the property set
-
content: new content of the property set.
Tables
- _M
- Class definition
Fields
-
dir: the base directory of the property repository.
-
propsets: a map with property set names as keys and tables with administrative information related to the property set as values (used keys in the tables: file=file name, handle=file handle if file is opened, status=flag indicating the lock status of the file).