org.mobicents.protocols.smpp.util
Class PropertiesAPIConfig

java.lang.Object
  extended by org.mobicents.protocols.smpp.util.AbstractAPIConfig
      extended by org.mobicents.protocols.smpp.util.PropertiesAPIConfig
All Implemented Interfaces:
Serializable, APIConfig

public class PropertiesAPIConfig
extends AbstractAPIConfig
implements APIConfig, Serializable

Base implementation of the APIConfig which reads its properties from a Java properties file, loaded from a predefined location.

When initialised, this implementation searches for a file named "smppapi.properties". This file needs to be on the classpath in one of the following locations:

  1. smppapi.properties
  2. com/smppapi.properties
  3. com/adenki/smppapi.properties
  4. com/adenki/smpp/smppapi.properties
  5. com/adenki/smpp/util/smppapi.properties

Version:
$Id: PropertiesAPIConfig.java 475 2009-07-12 17:30:47Z orank $
See Also:
Serialized Form

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
PropertiesAPIConfig()
          Construct a new APIConfig object which reads properties from the default properties resource.
PropertiesAPIConfig(URL propertiesURL)
          Construct a new APIConfig object which reads properties from the specified URL.
 
Method Summary
 String getProperty(String property)
          Get the value for a property.
 void initialise()
          Initialise this properties instance.
 boolean isSet(String property)
          Determine if a property is set in the configuration.
 void reconfigure(URL newURL)
          Reconfigure this PropertiesAPIConfig to load its properties from a new URL, and reload the configuration.
 boolean reloadAPIConfig()
          Cause the API properties to be reloaded.
 Object remove(String property)
           
 void setProperty(String property, String value)
           
 
Methods inherited from class org.mobicents.protocols.smpp.util.AbstractAPIConfig
convertToNumber, getBoolean, getBoolean, getClassInstance, getClassInstance, getInt, getInt, getLong, getLong, getProperty, getShort, getShort, toBoolean
 
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
getBoolean, getBoolean, getClassInstance, getClassInstance, getInt, getInt, getLong, getLong, getProperty, getShort, getShort
 

Constructor Detail

PropertiesAPIConfig

public PropertiesAPIConfig()
Construct a new APIConfig object which reads properties from the default properties resource.


PropertiesAPIConfig

public PropertiesAPIConfig(URL propertiesURL)
Construct a new APIConfig object which reads properties from the specified URL.

Parameters:
propertiesURL - The URL to read properties from.
Method Detail

isSet

public boolean isSet(String property)
Description copied from interface: APIConfig
Determine if a property is set in the configuration.

Specified by:
isSet in interface APIConfig
Overrides:
isSet in class AbstractAPIConfig
Parameters:
property - The name of the property to test.
Returns:
true if the property is set, false if not.

initialise

public void initialise()
Description copied from interface: APIConfig
Initialise this properties instance. The APIConfigFactory will call this method once after it has instantiated the configuration implementation so that any implementation-specific actions can be carried out.

Specified by:
initialise in interface APIConfig

reloadAPIConfig

public boolean reloadAPIConfig()
Description copied from interface: APIConfig
Cause the API properties to be reloaded. The properties will be re-read from the same location as they were initially loaded from. If the resource has disappeared or is no longer accessible, the properties will not be loaded and false will be returned to the caller.

Specified by:
reloadAPIConfig in interface APIConfig
Returns:
true if the properties were successfully reloaded, false otherwise.

reconfigure

public void reconfigure(URL newURL)
                 throws IOException
Reconfigure this PropertiesAPIConfig to load its properties from a new URL, and reload the configuration.

Parameters:
newURL - The new URL to load properties from.
Throws:
IOException - If the properties cannot be loaded from the newURL. If this exception is thrown, the API configuration will be left in an indeterminate state.

getProperty

public String getProperty(String property)
                   throws PropertyNotFoundException
Description copied from interface: APIConfig
Get the value for a property.

Specified by:
getProperty in interface APIConfig
Parameters:
property - The name of the property to retrieve.
Returns:
The value for property.
Throws:
PropertyNotFoundException - if property is not found in the configuration.

setProperty

public void setProperty(String property,
                        String value)

remove

public Object remove(String property)


Copyright © 2011 Mobicents. All Rights Reserved.