Oracle Corporation

com.bea.wlcp.wlng.api.storage.configuration
Interface ConfigurationStore


public interface ConfigurationStore

Interface to configuration store. The implementation holds an internal cache which is automatically distributed when values change, so service implementation shall not hold any cached values. It should instead register a cache listener if it needs to be notified when values change.
Note: This utility is intended for configuration parameters only, not traffic data.

Copyright © 2008 Oracle Corporation Systems, Inc. All Rights Reserved.

Field Summary
static int KEY_LENGTH
          Maximum length of key values.
static int NAME_LENGTH
          Maximum length of scope values.
static int STORE_TYPE_LOCAL
          Local (non distributed) service configuration data.
static int STORE_TYPE_SHARED
          Shared (distributed between WLNG instances) service configuration.
static int VALUE_LENGTH
          Maximum length of values.
 
Method Summary
 void addListener(ConfigurationListener listener)
          Add a cache listener for notifications of values changed on other instances of the store.
 Boolean getBoolean(String key)
          Get Boolean value for a certain key.
 Integer getInteger(String key)
          Get Integer value for a certain key.
 Long getLong(String key)
          Get Long value for a certain key.
 Serializable getSerializable(String key)
          Get Serializable value for a certain key.
 String getStoreName()
          Get store name.
 int getStoreType()
          Get store type.
 String getString(String key)
          Get String value for a certain key.
 void initialize(String key, Boolean defaultValue)
          Initialize key to specified default value of Boolean type.
 void initialize(String key, Integer defaultValue)
          Initialize key to specified default value of Integer type.
 void initialize(String key, Long defaultValue)
          Initialize key to specified default value of Long type.
 void initialize(String key, Serializable defaultValue)
          Initialize key to specified default value of Serializable type.
 void initialize(String key, String defaultValue)
          Initialize key to specified default value of String type.
 Set keySet()
          Returns a set view of the keys contained in this map.
 void removeListener(ConfigurationListener listener)
          Remove a previously added cache listener.
 void setBoolean(String key, Boolean value)
          Set value for a certain key.
 void setInteger(String key, Integer value)
          Set value for a certain key.
 void setLong(String key, Long value)
          Set value for a certain key.
 void setSerializable(String key, Serializable value)
          Set Serializable value for a certain key.
 void setString(String key, String value)
          Set value for a certain key.
 

Field Detail

KEY_LENGTH

public static final int KEY_LENGTH
Maximum length of key values.

See Also:
Constant Field Values

NAME_LENGTH

public static final int NAME_LENGTH
Maximum length of scope values.

See Also:
Constant Field Values

STORE_TYPE_LOCAL

public static final int STORE_TYPE_LOCAL
Local (non distributed) service configuration data.

See Also:
Constant Field Values

STORE_TYPE_SHARED

public static final int STORE_TYPE_SHARED
Shared (distributed between WLNG instances) service configuration.

See Also:
Constant Field Values

VALUE_LENGTH

public static final int VALUE_LENGTH
Maximum length of values.

See Also:
Constant Field Values
Method Detail

addListener

public void addListener(ConfigurationListener listener)
Add a cache listener for notifications of values changed on other instances of the store. Note: does not notify the listener(s) on the instance where the value was changed.

Parameters:
listener - configuration change listener.

getBoolean

public Boolean getBoolean(String key)
                   throws InvalidTypeException,
                          NotInitializedException
Get Boolean value for a certain key.

Parameters:
key - The key.
Returns:
The value.
Throws:
InvalidTypeException - if the key was initialized to other type than Boolean.
NotInitializedException - if the parameter has not been initialized.

getInteger

public Integer getInteger(String key)
                   throws InvalidTypeException,
                          NotInitializedException
Get Integer value for a certain key.

Parameters:
key - The key.
Returns:
The value.
Throws:
InvalidTypeException - if the key was initialized to other type than Integer.
NotInitializedException - if the parameter has not been initialized.

getLong

public Long getLong(String key)
             throws InvalidTypeException,
                    NotInitializedException
Get Long value for a certain key.

Parameters:
key - The key.
Returns:
The value.
Throws:
InvalidTypeException - if the key was initialized to other type than Long.
NotInitializedException - if the parameter has not been initialized.

getSerializable

public Serializable getSerializable(String key)
                             throws InvalidTypeException,
                                    NotInitializedException
Get Serializable value for a certain key. Note that this method can be expensive for large objects. It is not recommended for use in the transaction processing path. If the value is needed for this purpose, it is recommended that it is cached by the user in combination with a ConfigurationListener for reloading the cached value on update.

Parameters:
key - The key.
Returns:
The Serializable value.
Throws:
InvalidTypeException - if the key was initialized to other type than Serializable.
NotInitializedException - if the parameter has not been initialized.

getStoreName

public String getStoreName()
Get store name.

Returns:
The store name.

getStoreType

public int getStoreType()
Get store type.

Returns:
The store type. One of the ConfigurationStore.STORE_TYPE_*.

getString

public String getString(String key)
                 throws InvalidTypeException,
                        NotInitializedException
Get String value for a certain key.

Parameters:
key - The key.
Returns:
The value.
Throws:
InvalidTypeException - if the key was initialized to other type than String.
NotInitializedException - if the parameter has not been initialized.

initialize

public void initialize(String key,
                       Boolean defaultValue)
                throws InvalidTypeException,
                       ConfigurationException
Initialize key to specified default value of Boolean type.

Parameters:
key - The key.
defaultValue - The default value.
Throws:
InvalidTypeException - if the key was initialized to other type than Boolean.
ConfigurationException - if there was an error communicating with the database.

initialize

public void initialize(String key,
                       Integer defaultValue)
                throws InvalidTypeException,
                       ConfigurationException
Initialize key to specified default value of Integer type.

Parameters:
key - The key.
defaultValue - The default value.
Throws:
InvalidTypeException - if the key was initialized to other type than Integer.
ConfigurationException - if there was an error communicating with the database.

initialize

public void initialize(String key,
                       Long defaultValue)
                throws InvalidTypeException,
                       ConfigurationException
Initialize key to specified default value of Long type.

Parameters:
key - The key.
defaultValue - The default value.
Throws:
InvalidTypeException - if the key was initialized to other type than Long.
ConfigurationException - if there was an error communicating with the database.

initialize

public void initialize(String key,
                       Serializable defaultValue)
                throws InvalidTypeException,
                       ConfigurationException
Initialize key to specified default value of Serializable type.

Parameters:
key - The key.
defaultValue - The default Serializable value.
Throws:
InvalidTypeException - if the key was initialized to other type than Serializable.
ConfigurationException - if there was an error communicating with the database.

initialize

public void initialize(String key,
                       String defaultValue)
                throws InvalidTypeException,
                       ConfigurationException
Initialize key to specified default value of String type.

Parameters:
key - The key.
defaultValue - The default value.
Throws:
InvalidTypeException - if the key was initialized to other type than String.
ConfigurationException - if there was an error communicating with the database.

keySet

public Set keySet()
Returns a set view of the keys contained in this map.

Returns:
set contains the keys.

removeListener

public void removeListener(ConfigurationListener listener)
Remove a previously added cache listener.

Parameters:
listener - configuration change listener.

setBoolean

public void setBoolean(String key,
                       Boolean value)
                throws InvalidTypeException,
                       NotInitializedException,
                       ConfigurationException
Set value for a certain key.

Parameters:
key - The key.
value - The value.
Throws:
InvalidTypeException - if the key was initialized to other type than Boolean.
NotInitializedException - if the parameter has not been initialized.
ConfigurationException - if there was an error communicating with the database.

setInteger

public void setInteger(String key,
                       Integer value)
                throws InvalidTypeException,
                       NotInitializedException,
                       ConfigurationException
Set value for a certain key.

Parameters:
key - The key.
value - The value.
Throws:
InvalidTypeException - if the key was initialized to other type than Integer.
NotInitializedException - if the parameter has not been initialized.
ConfigurationException - if there was an error communicating with the database.

setLong

public void setLong(String key,
                    Long value)
             throws InvalidTypeException,
                    NotInitializedException,
                    ConfigurationException
Set value for a certain key.

Parameters:
key - The key.
value - The value.
Throws:
InvalidTypeException - if the key was initialized to other type than Long.
NotInitializedException - if the parameter has not been initialized.
ConfigurationException - if there was an error communicating with the database.

setSerializable

public void setSerializable(String key,
                            Serializable value)
                     throws InvalidTypeException,
                            NotInitializedException,
                            ConfigurationException
Set Serializable value for a certain key. Note that it is the responsibility of the user to enforce any concurrent access control, i.e. the configuration store does not provide any concurrency control or versioning of the value. The value is simple overwritten in the store.

Parameters:
key - The key.
value - The Serializable value.
Throws:
InvalidTypeException - if the key was initialized to other type than Serializable.
NotInitializedException - if the parameter has not been initialized.
ConfigurationException - if there was an error communicating with the database.

setString

public void setString(String key,
                      String value)
               throws InvalidTypeException,
                      NotInitializedException,
                      ConfigurationException
Set value for a certain key.

Parameters:
key - The key.
value - The value.
Throws:
InvalidTypeException - if the key was initialized to other type than String.
NotInitializedException - if the parameter has not been initialized.
ConfigurationException - if there was an error communicating with the database.

Oracle Corporation