|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.mobicents.protocols.smpp.util.AbstractAPIConfig
public abstract class AbstractAPIConfig
Abstract base class for APIConfig instances. Provides some basic
functionality useful across all APIConfig instances.
Boolean values: Any of the strings "true", "on" or "yes" will evaluate to a boolean true. The strings "false", "off" or "no" will all evaluate to a boolean false. Additionally, booleans can be numeric, where zero is evaluated as false and a non-zero value is evaluated as true.
Numbers: Numbers can be specified in any of decimal, hexadecimal, binary or octal notations. Decimal is the default. Prefixing a number with "0x" causes it to be parsed as hexadecimal. Prefixing a number with '0' causes it to be parsed as octal. Suffixing the number with a 'b' causes it to be parsed as binary. For example:
Decimal numbers may also be modified with a multiplier. Suffixing the letters 'k' or 'm' at the end of a decimal number multiples it by 1024 and 1048576 respectively. This is useful for specifying a number or kilobytes or megabytes. For example
| Field Summary |
|---|
| Fields inherited from interface org.mobicents.protocols.smpp.util.APIConfig |
|---|
BIND_TIMEOUT, DEFAULT_ALPHABET, DEFAULT_VERSION, EVENT_DISPATCHER_CLASS, EVENT_THREAD_POOL_SIZE, LAX_VERSIONS, LINK_AUTO_FLUSH, LINK_AUTOCLOSE_SNOOP, LINK_BUFFERSIZE_IN, LINK_BUFFERSIZE_OUT, LINK_TIMEOUT, SEGMENT_SIZE, TOO_MANY_IO_EXCEPTIONS |
| Constructor Summary | |
|---|---|
AbstractAPIConfig()
|
|
| Method Summary | ||
|---|---|---|
protected long |
convertToNumber(String num)
Convert a number string into a long, taking into account
base and multiplication specifiers. |
|
boolean |
getBoolean(String property)
Get a property as a boolean value. |
|
boolean |
getBoolean(String property,
boolean defaultValue)
Get a property as a boolean value. |
|
|
getClassInstance(String property,
Class<T> type)
Instantiate a new instance of a class whose class name is specified in property. |
|
|
getClassInstance(String property,
Class<T> type,
T defaultValue)
Instantiate a new instance of a class whose class name is specified in property, returning a default value if the property is not set. |
|
int |
getInt(String property)
Get the value for a property, parsed as a Java int. |
|
int |
getInt(String property,
int defaultValue)
Get the value for a property, parsed as a Java int. |
|
long |
getLong(String property)
Get the value for a property, parsed as a Java long. |
|
long |
getLong(String property,
long defaultValue)
Get the value for a property, parsed as a Java long. |
|
String |
getProperty(String property,
String defaultValue)
Get the value for a property or return a default value if it is not set. |
|
short |
getShort(String property)
Get the value for a property, parsed as a Java short. |
|
short |
getShort(String property,
short defaultValue)
Get the value of a property, parsed as a short. |
|
boolean |
isSet(String property)
Determine if a property is set in the configuration. |
|
protected boolean |
toBoolean(String value)
Convert a string value to a boolean. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.mobicents.protocols.smpp.util.APIConfig |
|---|
getProperty, initialise, reloadAPIConfig |
| Constructor Detail |
|---|
public AbstractAPIConfig()
| Method Detail |
|---|
public boolean isSet(String property)
APIConfig
isSet in interface APIConfigproperty - The name of the property to test.
public String getProperty(String property,
String defaultValue)
APIConfig
getProperty in interface APIConfigproperty - The name of the property to retrieve.defaultValue - The value to return if property is not
set.
property.
public short getShort(String property)
throws InvalidConfigurationException,
PropertyNotFoundException
APIConfigshort.
getShort in interface APIConfigproperty - the name of the property to retrive.
InvalidConfigurationException - if the value is not a valid short.
PropertyNotFoundException - if property is not
found in the configuration.
public short getShort(String property,
short defaultValue)
APIConfigshort. If the
property is not set, the default value is returned.
getShort in interface APIConfigproperty - The name of the property to retrieve the value for.defaultValue - The default value to return if the property is
not set.
property.
public int getInt(String property)
throws InvalidConfigurationException,
PropertyNotFoundException
APIConfigint.
getInt in interface APIConfigproperty - the name of the property to retrive.
InvalidConfigurationException - if the value is not a valid
integer.
PropertyNotFoundException - if
property is not found in the configuration.
public int getInt(String property,
int defaultValue)
APIConfigint. If
the property is not found, the default value is returned.
getInt in interface APIConfigproperty - the name of the property to retrive.defaultValue - the value to return if the property does not exist.
public long getLong(String property)
throws InvalidConfigurationException,
PropertyNotFoundException
APIConfiglong.
getLong in interface APIConfigproperty - the name of the property to retrive.
InvalidConfigurationException - if the value is not a valid long.
PropertyNotFoundException - if property is not
found in the configuration.
public long getLong(String property,
long defaultValue)
APIConfiglong. If
the property is not found, the default value is returned.
getLong in interface APIConfigproperty - the name of the property to retrieve.defaultValue - the value to return if the property does not exist.
public boolean getBoolean(String property)
throws InvalidConfigurationException,
PropertyNotFoundException
APIConfigAPIConfig.getBoolean(String, boolean) for details of how a boolean
value can be specified.
getBoolean in interface APIConfigproperty - The name of the property to retrieve.
InvalidConfigurationException - if the property has a value
that cannot be parsed or interpreted as boolean.
PropertyNotFoundException - if property is not
found in the configuration.
public boolean getBoolean(String property,
boolean defaultValue)
APIConfigtrue. Any of 'off',
'no' or 'false' will evaluate to false. Boolean
parameters may also be specified as a number, where zero will equate to
false while non-zero will equate to true.
All other words will result in an InvalidConfigurationException being
thrown.
getBoolean in interface APIConfigproperty - the name of the property to look up.defaultValue - the value to return if the property does not exist.
public <T> T getClassInstance(String property,
Class<T> type)
APIConfig
getClassInstance in interface APIConfigT - The expected type of the instantiated class.property - The name of a property whose value is the fully
qualified name of a class to instantiate.type - The expected type of the instantiated class. This may
specify a super-class or interface of the actually instantiated
class.
public <T> T getClassInstance(String property,
Class<T> type,
T defaultValue)
APIConfig
getClassInstance in interface APIConfigT - The expected type of the instantiated class.property - The name of a property whose value is the fully
qualified name of a class to instantiate.type - The expected type of the instantiated class. This may
specify a super-class or interface of the actually instantiated
class.
protected boolean toBoolean(String value)
value - The value to determine a boolean value for.
InvalidConfigurationException - If value is not
a valid boolean value.
protected long convertToNumber(String num)
throws NumberFormatException
long, taking into account
base and multiplication specifiers.
num - The String representing the number.
NumberFormatException - If the String cannot be parsed as a number.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||