public interface ImaProperties
Properties are defined for the IBM MessageSight JMS client administered objects which are created using ImaJmsFactory. These administered objects implement the ImaProperties interface. The Connection, Session, MessageConsumer, and MessageProducer objects within the IBM MessageSight JMS client also implement the ImaProperties interface with read only properties using the properties of the objects from which they were created.
In the IBM MessageSight JMS client there are three administered objects:
To get the properties associated with any IBM MessageSight object, you can cast it to ImaProperties, or use ImaJmsFactory.getProperties(). In either case, you should either check that the object is an instance of ImaProperties, or catch the ClassCastException.
Each administered object has a set of properties and these have a simple validation routine. The validation is not done when the property is set, but when validate() is called. The single property validation methods throw a JMSException which is also an ImaJmsException. The multiple property form of validate returns an array of ImaJmsException objects. The properties are valid when the single property validate() methods do not throw exceptions, or when the multiple property form of validate() returns null.
The names of known properties are processed independent of case and the names are mapped to the preferred case when the property is set.
When a connection is created with a userid and password, the property "userid" is set on the connection object.
Modifier and Type | Field and Description |
---|---|
static String |
COPYRIGHT |
static boolean |
NOWARNINGS
Do not include warning messages in the array of strings returned by validate.
|
static boolean |
WARNINGS
Include warning messages in the array of strings returned by validate.
|
Modifier and Type | Method and Description |
---|---|
void |
addValidProperty(String name,
String validator)
Adds a property name to the set of properties to validate.
|
void |
clear()
Clears all properties.
|
boolean |
exists(String name)
Checks if a property has been set.
|
Object |
get(String name)
Returns the value of the specified property as an Object.
|
boolean |
getBoolean(String name,
boolean default_value)
Returns the value of the specified property as a boolean.
|
int |
getInt(String name,
int default_value)
Returns the value of the specified property as an int.
|
String |
getString(String name)
Returns the value of the specified property as a String.
|
Set<String> |
propertySet()
Returns the set of properties.
|
Object |
put(String name,
Object value)
Sets a property.
|
void |
putAll(Map<String,Object> map)
Sets multiple properties.
|
Object |
remove(String name)
Removes a property.
|
int |
size()
Gets the number of properties in this object.
|
ImaJmsException[] |
validate(boolean nowarn)
Validates all properties for this object.
|
void |
validate(String name,
boolean nowarn)
Validates the named property.
|
void |
validate(String name,
Object value,
boolean nowarn)
Validates the named property and value.
|
static final String COPYRIGHT
static final boolean WARNINGS
static final boolean NOWARNINGS
void clear() throws javax.jms.JMSException
IllegalStateException
- If the properties are read onlyjavax.jms.JMSException
boolean exists(String name)
name
- The name of the propertyObject get(String name)
name
- The name of the propertyint getInt(String name, int default_value)
If the property does not exist or cannot be converted to an integer, return the default_value.
name
- The name of the propertydefault_value
- The value to return if the property is missing or not an integer.boolean getBoolean(String name, boolean default_value)
If the property does not exist or cannot be converted to a boolean, return the default_value.
name
- The name of the propertydefault_value
- The value to return if the property is missing or not a boolean.String getString(String name)
name
- The name of the propertySet<String> propertySet()
Object put(String name, Object value) throws javax.jms.JMSException
Very little checking is done at the time of the set. It is strongly recommended that a validate method be run on the property either before or after it is set. Any serializable object can be set as a value.
name
- The name of the propertyvalue
- The new value for the propertyjavax.jms.JMSException
- For an internal error of if the object is not serializableIllegalStateException
- If the properties are read-onlyvoid putAll(Map<String,Object> map) throws javax.jms.JMSException
map
- A map of property name to property values.javax.jms.JMSException
- If any of the property names or values are not validIllegalStateException
- If the properties are read-onlyObject remove(String name)
name
- The name of the property to removeIllegalStateException
- If the properties are read-onlyint size()
ImaJmsException[] validate(boolean nowarn)
This form of validate is able to check that combinations of properties are correct.
nowarn
- Do not include warning messages in the array of messages returned.void validate(String name, boolean nowarn) throws javax.jms.JMSException
This form of validate can be used to validate a single property. It is not able to validate any case two or more properties are invalid in combination.
name
- The name of a propertynowarn
- Do not include warning messages in the array of messages returned.javax.jms.JMSException
- With the error which was found.
This JMSException will always an instance of ImaJmsException.void validate(String name, Object value, boolean nowarn) throws javax.jms.JMSException
The error string consists of a message ID followed by a colon (:) followed by the message text.
This form of validate can be used to validate a property before it is set. It can be used in an administration tool.
name
- The name of a propertyvalue
- The value to checknowarn
- Do not include warning messages in the array of messages returned.javax.jms.JMSException
- With the error which was found.
This JMSException will always an instance of ImaJmsException.void addValidProperty(String name, String validator)
The validation of property names is done in a case independent manner. The name as specified is considered the preferred form.
Added properties are not used by the IBM MessageSight JMS client, but are kept along with the system properties for use by an application.
If the name is already a valid property, this method has no effect.
The validator can be a string which begins with one of the characters:
name
- The name of the property to addvalidator
- The string indicating the type of the propertyIllegalStateException
- If the properties are read-onlyCopyright © Contributors to the Eclipse Foundation 2012-2021.