Package com.netscape.certsrv.base
Interface IConfigStore
- All Known Implementing Classes:
AuthenticationConfig
,AuthManagerConfig
,AuthManagersConfig
,AuthorizationConfig
,AuthzManagerConfig
,AuthzManagersConfig
,DatabaseConfig
,EngineConfig
,JssSubsystemConfig
,LDAPAuthenticationConfig
,LDAPConfig
,LDAPConnectionConfig
,PKISocketConfig
,PreOpConfig
,PropConfigStore
,PublishingConfig
,PublishingMapperConfig
,PublishingPublisherConfig
,PublishingRuleConfig
,RandomConfig
,SSLConfig
,SubsystemConfig
,SubsystemsConfig
,UGSubsystemConfig
public interface IConfigStore
An interface represents a configuration store.
A configuration store is an abstraction of a hierarchical store
to keep arbitrary data indexed by string names.
The following illustrates how a config store is used.
In the following example:
param1=value1 configStore1.param11=value11 configStore1.param12=value12 configStore1.subStore1.param111=value111 configStore1.subStore1.param112=value112 configStore2.param21=value21The top config store has parameters param1 and sub-stores configStore1 and configStore2.
The following illustrates how a config store is used.
// the top config store is passed to the following method. public void init(IConfigStore config) throws EBaseException { IConfigStore store = config; String valx = config.getString("param1"); // valx is "value1" <p> IConfigStore substore1 = config.getSubStore("configStore1"); String valy = substore1.getString("param11"); // valy is "value11" <p> IConfigStore substore2 = config.getSubStore("configStore2"); String valz = substore2.getString("param21"); // valz is "value21" <p> }
- Version:
- $Revision$, $Date$
-
Method Summary
Modifier and TypeMethodDescriptionvoid
clear()
Clear the config store.void
commit
(boolean createBackup) Store config into storage (file or LDAP).Gets a property.getBigInteger
(String name) Retrieves the given property as a big integer.getBigInteger
(String name, BigInteger defval) Retrieves the given property as a big integer.boolean
getBoolean
(String name) Retrieves the given property as a boolean.boolean
getBoolean
(String name, boolean defval) Retrieves the given property as a boolean.byte[]
getByteArray
(String name) Retrieves the value of a property as a byte array.byte[]
getByteArray
(String name, byte[] defval) Retrieves the value of a property as a byte array, using the given default value if property is not present.int
getInteger
(String name) Retrieves the given property as an integer.int
getInteger
(String name, int defval) Retrieves the given property as an integer.getName()
Gets the name of this Configuration Store.Get properties as a map.Retrives and enumeration of all properties in this config-store.Retrieves the value of the given property as a string.Retrieves the value of a given property as a string or the given default value if the property is not present.getSubStore
(String name) Retrieves the given sub-store.<T extends IConfigStore>
TgetSubStore
(String name, Class<T> clazz) Returns an enumeration of the names of the substores of this config-store.keys()
Returns an enumeration of the config store's keys.void
load()
Load config from storage storage (file or LDAP).void
load
(InputStream in) Reads a config store from an input stream.makeSubStore
(String name) Creates a nested sub-store with the specified name.Retrieves a property.void
putBigInteger
(String name, BigInteger value) Sets a property and its value as an integer.void
putBoolean
(String name, boolean value) Stores the given property and its value as a boolean.void
putByteArray
(String name, byte[] value) Stores the given property and value as a byte array.void
putInteger
(String name, int value) Sets a property and its value as an integer.void
Stores a property and its value as a string.void
void
removeSubStore
(String name) Removes sub-store with the given name.int
size()
Return the number of items in this substorevoid
store
(OutputStream out) Stores this config store to the specified output stream.
-
Method Details
-
get
Gets a property.- Parameters:
name
- The property name- Returns:
- property value
-
put
Retrieves a property.- Parameters:
name
- The property namevalue
- The property value
-
keys
Enumeration<String> keys()Returns an enumeration of the config store's keys.- Returns:
- a list of keys
- See Also:
-
clear
void clear()Clear the config store. -
load
Load config from storage storage (file or LDAP).- Throws:
Exception
- If an error occurs while loading.
-
commit
Store config into storage (file or LDAP).- Parameters:
createBackup
- true if a backup file should be created- Throws:
EBaseException
- failed to commit
-
load
Reads a config store from an input stream.- Parameters:
in
- input stream where the properties are located- Throws:
IOException
- If an IO error occurs while loading from input.
-
store
Stores this config store to the specified output stream.- Parameters:
out
- output stream where the properties should be serialized- Throws:
Exception
-
getName
String getName()Gets the name of this Configuration Store.- Returns:
- The name of this Configuration store
-
getString
Retrieves the value of the given property as a string.- Parameters:
name
- The name of the property to get- Returns:
- The value of the property as a String
- Throws:
EPropertyNotFound
- If the property is not presentEBaseException
- If an internal error occurred
-
getString
Retrieves the value of a given property as a string or the given default value if the property is not present.- Parameters:
name
- The property to retrivedefval
- The default value to return if the property is not present- Returns:
- The roperty value as a string
- Throws:
EBaseException
- If an internal error occurred
-
putString
Stores a property and its value as a string.- Parameters:
name
- The name of the propertyvalue
- The value as a string
-
getByteArray
Retrieves the value of a property as a byte array.- Parameters:
name
- The property name- Returns:
- The property value as a byte array
- Throws:
EPropertyNotFound
- If the property is not presentEBaseException
- If an internal error occurred
-
getByteArray
Retrieves the value of a property as a byte array, using the given default value if property is not present.- Parameters:
name
- The name of the propertydefval
- The default value if the property is not present.- Returns:
- The property value as a byte array.
- Throws:
EBaseException
- If an internal error occurred
-
putByteArray
Stores the given property and value as a byte array.- Parameters:
name
- The property namevalue
- The value as a byte array to store
-
getBoolean
Retrieves the given property as a boolean.- Parameters:
name
- The name of the property as a string.- Returns:
- The value of the property as a boolean.
- Throws:
EPropertyNotFound
- If the property is not presentEBaseException
- If an internal error occurred
-
getBoolean
Retrieves the given property as a boolean.- Parameters:
name
- The name of the propertydefval
- The default value to turn as a boolean if property is not present- Returns:
- The value of the property as a boolean.
- Throws:
EBaseException
- If an internal error occurred
-
putBoolean
Stores the given property and its value as a boolean.- Parameters:
name
- The property namevalue
- The value as a boolean
-
getInteger
Retrieves the given property as an integer.- Parameters:
name
- The property name- Returns:
- The property value as an integer
- Throws:
EPropertyNotFound
- If property is not foundEBaseException
- If an internal error occurred
-
getInteger
Retrieves the given property as an integer.- Parameters:
name
- The property name- Returns:
- int The default value to return as an integer
- Throws:
EBaseException
- If the value cannot be converted to a integer
-
putInteger
Sets a property and its value as an integer.- Parameters:
name
- parameter namevalue
- integer value
-
getBigInteger
Retrieves the given property as a big integer.- Parameters:
name
- The property name- Returns:
- The property value as a big integer
- Throws:
EPropertyNotFound
- If property is not foundEBaseException
- If an internal error occurred
-
getBigInteger
Retrieves the given property as a big integer.- Parameters:
name
- The property name- Returns:
- int The default value to return as a big integer
- Throws:
EBaseException
- If the value cannot be converted to a integer
-
putBigInteger
Sets a property and its value as an integer.- Parameters:
name
- parameter namevalue
- big integer value
-
makeSubStore
Creates a nested sub-store with the specified name.- Parameters:
name
- The name of the sub-store- Returns:
- The sub-store created
-
getSubStore
Retrieves the given sub-store.- Parameters:
name
- The name of the sub-store- Returns:
- The sub-store
-
getSubStore
-
removeSubStore
Removes sub-store with the given name. (Removes all properties and sub-stores under this sub-store.)- Parameters:
name
- The name of the sub-store to remove
-
remove
-
getPropertyNames
Enumeration<String> getPropertyNames()Retrives and enumeration of all properties in this config-store.- Returns:
- An enumeration of all properties in this config-store
-
getSubStoreNames
Enumeration<String> getSubStoreNames()Returns an enumeration of the names of the substores of this config-store.- Returns:
- An enumeration of the names of the sub-stores of this config-store
-
size
int size()Return the number of items in this substore -
getProperties
Get properties as a map.- Throws:
EBaseException
-