|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.commsen.apropos.core.PropertiesManager
public class PropertiesManager
The class provides static synchronized methods for common operations on Property
and
PropertyPackage
like add, delete, update, etc. It is also responsible for persisting data
after any change and loading data form storage on startup.
Method Summary | |
---|---|
static PropertyPackage |
addProperty(java.lang.String packageName,
Property property)
Adds new Property in PropertyPackage called packageName by
calling PropertyPackage.addProperty(Property) . |
static void |
addPropertyPackage(PropertyPackage propertyPackage)
Adds new PropertyPackage . |
static PropertyPackage |
deleteProperty(java.lang.String packageName,
java.lang.String propertyName)
Deletes Property called propertyName from PropertyPackage
called packageName . |
static void |
deletePropertyPackage(java.lang.String packageName)
Deletes the PropertyPackage specified by packageName and all it's
children. |
static PropertyPackage |
getPropertyPackage(java.lang.String name)
Returns a clone of PropertyPackage called name . |
static java.util.List<java.lang.String> |
getPropertyPackagesNames()
Returns unmodifiable (read only) list of all package names |
static java.util.List<PropertyPackage> |
getRootPropertyPackages()
Returns unmodifiable (read only) list of all top level packages |
static PropertyPackage |
importProperties(java.lang.String packageName,
java.util.Properties externalProperties,
boolean overwrite)
Imports external properties into PropertyPackage called packageName . |
static PropertyPackage |
updateProperty(java.lang.String packageName,
Property property)
Updates Property in PropertyPackage called packageName . |
static PropertyPackage |
updateProperty(java.lang.String packageName,
java.lang.String oldPropertyName,
Property property)
Updates existing Property called oldPropertyName in
PropertyPackage called packageName with values from
property . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static void addPropertyPackage(PropertyPackage propertyPackage) throws PropertiesException
PropertyPackage
. NOTE: The object passed is cloned internally.
propertyPackage
- the PropertyPackage
to be added. Can not be null.
PropertiesException
- if package with that name already exists or if circular
parent/child relation is detected.
java.lang.IllegalArgumentException
- if propertyPackage
is nullpublic static java.util.List<PropertyPackage> getRootPropertyPackages()
public static java.util.List<java.lang.String> getPropertyPackagesNames()
public static PropertyPackage getPropertyPackage(java.lang.String name)
PropertyPackage
called name
. If no such
PropertyPackage
exists it will return null
.
PropertyPackage
called name
or null
.public static void deletePropertyPackage(java.lang.String packageName) throws PropertiesException
PropertyPackage
specified by packageName
and all it's
children.
packageName
-
PropertiesException
public static PropertyPackage addProperty(java.lang.String packageName, Property property) throws PropertiesException
Property
in PropertyPackage
called packageName
by
calling PropertyPackage.addProperty(Property)
.
packageName
- the name of the package. Can not be null
or empty.property
- the Property
to add. Can not be null
PropertyPackage
made after the property is added
PropertiesException
- if no package called packageName
found or if such
Property
already exists in this package
java.lang.IllegalArgumentException
- if any of the arguments is null
public static PropertyPackage updateProperty(java.lang.String packageName, Property property) throws PropertiesException
Property
in PropertyPackage
called packageName
. The
actual update is handled by PropertyPackage.updateProperty(Property)
packageName
- the name of the package. Can not be null
or empty.property
- the Property
to be updated. Can not be null
PropertyPackage
made after the property is updated
PropertiesException
- if no package called packageName
found or if no
such Property
exists in this package
java.lang.IllegalArgumentException
- if any of the arguments is null
public static PropertyPackage updateProperty(java.lang.String packageName, java.lang.String oldPropertyName, Property property) throws PropertiesException
Property
called oldPropertyName
in
PropertyPackage
called packageName
with values from
property
. The actual update is handled by
PropertyPackage.updateProperty(Property)
.
packageName
- the name of the package. Can not be null
or empty.oldPropertyName
- the name of the property to be updatedproperty
- the Property
object to get the values from. Can not be
null
PropertyPackage
made after the property is updated
PropertiesException
- if no package called packageName
found or if no
such Property
exists in this package
java.lang.IllegalArgumentException
- if any of the arguments is null
public static PropertyPackage importProperties(java.lang.String packageName, java.util.Properties externalProperties, boolean overwrite) throws PropertiesException
PropertyPackage
called packageName
.
The actual import is handled by PropertyPackage.importProperties(Properties, boolean)
.
packageName
- the name of the package. Can not be null
or empty.externalProperties
- the properties to import. This can not be null
overwrite
- boolean flag indicates whether to override existing properties
PropertyPackage
made after the properties are imported
PropertiesException
- if there is no package called packageName
java.lang.IllegalArgumentException
- if any of the arguments is null
public static PropertyPackage deleteProperty(java.lang.String packageName, java.lang.String propertyName) throws PropertiesException
Property
called propertyName
from PropertyPackage
called packageName
. The actual deletion is handled by
PropertyPackage.removeProperty(String)
.
packageName
- the name of the package. Can not be null
or empty.propertyName
- the name of the property to be updated
PropertyPackage
made after the property is deleted
PropertiesException
- if there is no package called packageName
or no
property called propertyName
java.lang.IllegalArgumentException
- if any of the arguments is null
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |