com.cometway.om
Class FilePropsContainer

java.lang.Object
  extended by com.cometway.om.FilePropsContainer
All Implemented Interfaces:
IPropsContainer

public class FilePropsContainer
extends java.lang.Object
implements IPropsContainer

The FilePropsContainer is a PropsContainer that keeps a file of all the props. When props are changed, a new file is written.


Constructor Summary
FilePropsContainer(java.io.File rootfile)
          This creates a new instance of FilePropsContainer that uses the File object given as a parameter.
FilePropsContainer(java.lang.String rootdir)
          This creates a new instance of FilePropsContainer that uses the fully qualifed file pathname given by the parameter.
 
Method Summary
 void copy(IPropsContainer ipc)
          This method copies the property name and value pairs to the IPropsContainer given as a parameter.
protected  void dispose()
          This method removes the file that stored properties of this Container.
 java.util.Enumeration enumerateProps()
          This method returns all the property names of the properties in this container.
protected  java.lang.String getObjectID()
           
 java.lang.Object getProperty(java.lang.String s)
          This method gets a the cached value of the property name given as the parameter.
static void main(java.lang.String[] args)
           
 boolean removeProperty(java.lang.String s)
          This method removes the property name and the associated value given by the parameter.
protected  void setObjectID(java.lang.String newID)
           
 void setProperty(java.lang.String s, java.lang.Object o)
          This method sets a property value whose name is given by the first parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilePropsContainer

public FilePropsContainer(java.lang.String rootdir)
This creates a new instance of FilePropsContainer that uses the fully qualifed file pathname given by the parameter.

Parameters:
rootdir - This is the fully qualified file path to store properties.

FilePropsContainer

public FilePropsContainer(java.io.File rootfile)
This creates a new instance of FilePropsContainer that uses the File object given as a parameter.

Parameters:
rootfile - This is the File which properties will be stored.
Method Detail

getProperty

public java.lang.Object getProperty(java.lang.String s)
This method gets a the cached value of the property name given as the parameter.

Specified by:
getProperty in interface IPropsContainer
Parameters:
s - This is the name of the property whose value to retrieve.
Returns:
Returns the value of the property whose name is the parameter.

removeProperty

public boolean removeProperty(java.lang.String s)
This method removes the property name and the associated value given by the parameter.

Specified by:
removeProperty in interface IPropsContainer
Parameters:
s - This is the name of the property to remove.
Returns:
Returns true IFF the property name and value where removed successfully.

setProperty

public void setProperty(java.lang.String s,
                        java.lang.Object o)
This method sets a property value whose name is given by the first parameter. If this name had a previous value, it will be lost. If there was no property whose name is given by the first parameter, a new cache is created for this property and the value written to it.

Specified by:
setProperty in interface IPropsContainer
Parameters:
s - This is the name of the property whose value is to be set.
o - This is the value which to set the property to.

copy

public void copy(IPropsContainer ipc)
This method copies the property name and value pairs to the IPropsContainer given as a parameter.

Specified by:
copy in interface IPropsContainer
Parameters:
ipc - The IPropsContainer to copy the properties TO.

enumerateProps

public java.util.Enumeration enumerateProps()
This method returns all the property names of the properties in this container.

Specified by:
enumerateProps in interface IPropsContainer
Returns:
an Enumeration of keys

dispose

protected void dispose()
This method removes the file that stored properties of this Container.


setObjectID

protected void setObjectID(java.lang.String newID)

getObjectID

protected java.lang.String getObjectID()

main

public static void main(java.lang.String[] args)