Class PropConfigStore
java.lang.Object
com.netscape.cmscore.base.PropConfigStore
- All Implemented Interfaces:
IConfigStore,Cloneable
- Direct Known Subclasses:
AuthenticationConfig,AuthManagerConfig,AuthManagersConfig,AuthorizationConfig,AuthzManagerConfig,AuthzManagersConfig,DatabaseConfig,EngineConfig,JssSubsystemConfig,LDAPAuthenticationConfig,LDAPConfig,LDAPConnectionConfig,PKISocketConfig,PreOpConfig,PublishingConfig,PublishingMapperConfig,PublishingPublisherConfig,PublishingRuleConfig,RandomConfig,SSLConfig,SubsystemConfig,SubsystemsConfig,UGSubsystemConfig
A class represents a in-memory configuration store.
Note this class takes advantage of the recursive nature of
property names. The current property prefix is kept in
mStoreName and the mSource usually points back to another
occurance of the same PropConfigStore, with longer mStoreName. IE
The chain ends when the store name is reduced down to it's original
value.
- Version:
- $Revision$, $Date$
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.slf4j.Loggerprotected SimplePropertiesThe source data for this substoreprotected StringThe name of this substoreprotected static final Stringprotected ConfigStorage -
Constructor Summary
ConstructorsModifierConstructorDescriptionPropConfigStore(ConfigStorage storage) PropConfigStore(String storeName) Constructs a property configuration store.protectedPropConfigStore(String name, SimpleProperties source) Constructs a configuration store. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()Clear the config store.clone()Cloning of property configuration store.voidcommit(boolean createBackup) Store config into storage (file or LDAP).Retrieves a property from the configuration file.getBigInteger(String name) Retrieves big integer value.getBigInteger(String name, BigInteger defval) Retrieves integer value.booleangetBoolean(String name) Retrieves boolean-based property value.booleangetBoolean(String name, boolean defval) Retrieves boolean-based property value.byte[]getByteArray(String name) Retrieves a byte array from the configuration file.byte[]getByteArray(String name, byte[] defval) Retrieves a byte array from the configuration file.protected StringgetFullName(String name) Converts the substore parameters.intgetInteger(String name) Retrieves integer value.intgetInteger(String name, int defval) Retrieves integer value.getName()Returns the name of this store.Retrieves lexicographically sorted properties as a map.Retrieves a list of property names.Retrieves the source configuration store where the properties are stored.Retrieves a property value.Retrieves a String from the configuration file.getSubStore(String name) Retrieves a sub store.<T extends IConfigStore>
TgetSubStore(String name, Class<T> clazz) Returns a list of sub store names.keys()Returns an enumeration of the config store's keys, hidding the store name.voidload()Load config from storage storage (file or LDAP).voidload(InputStream in) Reads a config store from an input stream.makeSubStore(String name) Creates a new sub store.voidFor debugging purposes.Puts a property into the configuration file.voidputBigInteger(String name, BigInteger val) Puts a big integer value.voidputBoolean(String name, boolean value) Puts boolean value into the configuration store.voidputByteArray(String name, byte[] value) Puts byte array into this configuration store.voidputInteger(String name, int val) Puts an integer value.voidPuts property value into this configuration store.voidRemoves a property from the configuration file.voidremoveSubStore(String name) Removes a sub store.intsize()Return the number of items in this substorevoidstore(OutputStream out) Stores this config store to the specified output stream.
-
Field Details
-
logger
public static final org.slf4j.Logger logger -
PROP_SUBSTORES
- See Also:
-
mStoreName
The name of this substore -
mSource
The source data for this substore -
storage
-
-
Constructor Details
-
PropConfigStore
public PropConfigStore() -
PropConfigStore
-
PropConfigStore
Constructs a property configuration store. This must be a brand new store without properties. The subclass must be a SourceConfigStore.- Parameters:
storeName- property store name- Throws:
EBaseException- failed to create configuration
-
PropConfigStore
Constructs a configuration store. The constructor is a helper class for substores. Source is the one that stores all the parameters. Each substore only store a substore name, and a reference to the source.- Parameters:
name- store namesource- list of properties- Throws:
EBaseException- failed to create configuration
-
-
Method Details
-
getName
Returns the name of this store.- Specified by:
getNamein interfaceIConfigStore- Returns:
- store name
-
getStorage
-
get
Retrieves a property from the configuration file.- Specified by:
getin interfaceIConfigStore- Parameters:
name- property name- Returns:
- property value
-
put
Puts a property into the configuration file. The values wont be updated to the file until save method is invoked.- Specified by:
putin interfaceIConfigStore- Parameters:
name- property namevalue- property value
-
remove
Removes a property from the configuration file.- Specified by:
removein interfaceIConfigStore- Parameters:
name- property name
-
keys
Returns an enumeration of the config store's keys, hidding the store name.- Specified by:
keysin interfaceIConfigStore- Returns:
- a list of keys
- See Also:
-
getProperties
Retrieves lexicographically sorted properties as a map.- Specified by:
getPropertiesin interfaceIConfigStore- Returns:
- map
-
size
public int size()Return the number of items in this substore- Specified by:
sizein interfaceIConfigStore
-
clear
public void clear()Description copied from interface:IConfigStoreClear the config store.- Specified by:
clearin interfaceIConfigStore
-
load
Description copied from interface:IConfigStoreLoad config from storage storage (file or LDAP).- Specified by:
loadin interfaceIConfigStore- Throws:
Exception- If an error occurs while loading.
-
commit
Description copied from interface:IConfigStoreStore config into storage (file or LDAP).- Specified by:
commitin interfaceIConfigStore- Parameters:
createBackup- true if a backup file should be created- Throws:
EBaseException- failed to commit
-
load
Reads a config store from an input stream.- Specified by:
loadin interfaceIConfigStore- Parameters:
in- input stream where properties are located- Throws:
IOException- failed to load
-
store
Stores this config store to the specified output stream.- Specified by:
storein interfaceIConfigStore- Parameters:
out- outputstream where the properties are saved- Throws:
Exception
-
getString
Retrieves a property value.- Specified by:
getStringin interfaceIConfigStore- Parameters:
name- property key- Returns:
- property value
- Throws:
EBaseException- failed to retrieve value
-
getString
Retrieves a String from the configuration file.- Specified by:
getStringin interfaceIConfigStore- Parameters:
name- property namedefval- the default object to return if name does not exist- Returns:
- property value
- Throws:
EBaseException- If an internal error occurred
-
putString
Puts property value into this configuration store.- Specified by:
putStringin interfaceIConfigStore- Parameters:
name- property keyvalue- property value
-
getByteArray
Retrieves a byte array from the configuration file.- Specified by:
getByteArrayin interfaceIConfigStore- Parameters:
name- property name- Returns:
- property value
- Throws:
IllegalArgumentException- if name is not set or is null.EBaseException- If an internal error occurred
-
getByteArray
Retrieves a byte array from the configuration file.- Specified by:
getByteArrayin interfaceIConfigStore- Parameters:
name- property namedefval- the default byte array to return if name does not exist- Returns:
- property value
- Throws:
EBaseException- If an internal error occurred
-
putByteArray
Puts byte array into this configuration store.- Specified by:
putByteArrayin interfaceIConfigStore- Parameters:
name- property keyvalue- byte array
-
getBoolean
Retrieves boolean-based property value.- Specified by:
getBooleanin interfaceIConfigStore- Parameters:
name- property key- Returns:
- boolean value
- Throws:
EBaseException- failed to retrieve
-
getBoolean
Retrieves boolean-based property value.- Specified by:
getBooleanin interfaceIConfigStore- Parameters:
name- property keydefval- default value- Returns:
- boolean value
- Throws:
EBaseException- failed to retrieve
-
putBoolean
Puts boolean value into the configuration store.- Specified by:
putBooleanin interfaceIConfigStore- Parameters:
name- property keyvalue- property value
-
getInteger
Retrieves integer value.- Specified by:
getIntegerin interfaceIConfigStore- Parameters:
name- property key- Returns:
- property value
- Throws:
EBaseException- failed to retrieve value
-
getInteger
Retrieves integer value.- Specified by:
getIntegerin interfaceIConfigStore- Parameters:
name- property keydefval- default value- Returns:
- property value
- Throws:
EBaseException- failed to retrieve value
-
putInteger
Puts an integer value.- Specified by:
putIntegerin interfaceIConfigStore- Parameters:
name- property keyval- property value- Throws:
EBaseException- failed to retrieve value
-
getBigInteger
Retrieves big integer value.- Specified by:
getBigIntegerin interfaceIConfigStore- Parameters:
name- property key- Returns:
- property value
- Throws:
EBaseException- failed to retrieve value
-
getBigInteger
Retrieves integer value.- Specified by:
getBigIntegerin interfaceIConfigStore- Parameters:
name- property keydefval- default value- Returns:
- property value
- Throws:
EBaseException- failed to retrieve value
-
putBigInteger
Puts a big integer value.- Specified by:
putBigIntegerin interfaceIConfigStore- Parameters:
name- property keyval- default value
-
makeSubStore
Creates a new sub store.- Specified by:
makeSubStorein interfaceIConfigStore- Parameters:
name- substore name- Returns:
- substore
-
removeSubStore
Removes a sub store.- Specified by:
removeSubStorein interfaceIConfigStore- Parameters:
name- substore name
-
getSubStore
Retrieves a sub store. A substore contains a list of properties and substores. For example,cms.ldap.host=ds.netscape.com cms.ldap.port=389"ldap" is a substore in above example. If the substore property itself is set, this method will treat the value as a reference. For example,cms.ldap = kms.ldap
- Specified by:
getSubStorein interfaceIConfigStore- Parameters:
name- substore name- Returns:
- substore
-
getSubStore
- Specified by:
getSubStorein interfaceIConfigStore
-
getPropertyNames
Retrieves a list of property names.- Specified by:
getPropertyNamesin interfaceIConfigStore- Returns:
- a list of string-based property names
-
getSubStoreNames
Returns a list of sub store names.- Specified by:
getSubStoreNamesin interfaceIConfigStore- Returns:
- list of substore names
-
getSource
Retrieves the source configuration store where the properties are stored.- Returns:
- source configuration store
-
printProperties
public void printProperties()For debugging purposes. Prints properties of this substore. -
getFullName
-
clone
-