|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mobicents.protocols.smpp.util.APIConfigFactory
public final class APIConfigFactory
Factory class for obtaining the API configuration. Alternative API
configurations can be specified by setting the
org.mobicents.smpp.configClass system property to the fully qualified
class name of a class that implements the APIConfig interface.
The default is PropertiesAPIConfig.
Normally, the getConfig() method will cache the loaded
configuration object on first call and return the cached config
on subsequent calls. If you want to override this behaviour and
never cache the loaded configuration object, set the
org.mobicents.smpp.cacheConfig system property to false.
For example, to run your application with a configuration implementation
called app.MyAPIConfig and with singleton caching turned off,
execute:
java -Dorg.mobicents.smpp.configClass=app.MyAPIConfig
-Dorg.mobicents.smpp.cacheConfig=false app.MainClass
| Field Summary | |
|---|---|
static String |
CACHE_CONFIG_PROP
The system property specifying the concrete implementation of APIConfig to read configuration properties from. |
static String |
CONFIG_CLASS_PROP
The system property to set to control whether a loaded configuration instance is cached as a singleton or not. |
| Method Summary | |
|---|---|
static APIConfig |
getConfig()
Get the API configuration. |
static APIConfig |
loadConfig()
Load and initialise an APIConfig instance. |
static void |
reset()
Reset this APIConfigFactory. |
static void |
setCachedConfig(APIConfig apiConfig)
Set the cached APIConfig instance that will be returned
from calls to getConfig(). |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final String CONFIG_CLASS_PROP
public static final String CACHE_CONFIG_PROP
APIConfig to read configuration properties from.
| Method Detail |
|---|
public static final APIConfig getConfig()
APIConfig
instance if the configuration has previously been loaded and
caching is enabled. If no configuration object has been cached,
return the result of calling loadConfig() (and cache
that result if caching is enabled).
The system property to enable and disable caching is read at every call to this method, so the cache strategy can be affected by Java code modifying this value.
InvalidConfigurationException - for the same reasons that
loadConfig throws this exception.public static final APIConfig loadConfig()
APIConfig instance. The type of
implementation to instantiate is read from the system property as
described in the class description.
InvalidConfigurationException - If the configuration class
cannot be found, it does not implement APIConfig or its
constructor is not visible or throws an exception.public static final void setCachedConfig(APIConfig apiConfig)
APIConfig instance that will be returned
from calls to getConfig(). This method allows
applications to set their own APIConfig implementation,
bypassing the loadConfig() logic.
apiConfig - The APIConfig instance to cache and
return from subsequent calls to getConfig().public static final void reset()
getConfig() will reload the API configuration.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||