com.ibm.wbi
Class RequestInfo

java.lang.Object
  |
  +--com.ibm.wbi.RequestInfo
Direct Known Subclasses:
MarkupLanguageInfo

public class RequestInfo
extends java.lang.Object

The RequestInfo object is intended to house information about a particular request being serviced by Megs. The RequestInfo contains methods to add rule values to be matched against Meg conditions. For example, if a Meg condition is something like condition= url=*ibm.com*, then for a request with a rule for url specified as www.ibm.com, that Meg would be invoked. Likewise if the value was www.cnn.com, that Meg would not be invoked.


Constructor Summary
RequestInfo()
          Constuct a new RequestInfo object.
 
Method Summary
 void addRule(java.lang.String rule, java.lang.String value)
          Add an attriute/value pair that will be evaluated by the rules engine.
 RequestInfo createInstance()
          Create an empty instance of this RequestInfo class.
 java.util.Enumeration getAllExtraRuleKeys()
          Gets an enumeration of all keys in the extra key/value set.
 java.lang.String getExtraRuleKey(java.lang.String key)
          Gets the requested value from the list of key/value pairs for the Meg rule engine to consider.
 java.lang.String getRequestCharEncoding()
           
 java.lang.String getResponseCharEncoding()
           
 java.lang.String getRule(java.lang.String rule)
          Get the rule attribute value from the specified key.
 java.util.Enumeration getRuleAttributes()
          Get an enumeration of the rule attributes.
 java.util.Dictionary getRuleBundle()
          This returns the bundle of rules (attributes) and their corresponding rule value.
 java.util.Enumeration getRuleValues()
          Get an enumeration of the rule values.
 java.lang.Object getTransactionData(java.lang.Object key)
          Access a key/value pair that is associated with this transaction.
 java.util.Enumeration getTransactionDataElements()
          Get an enumeration of the values in the transaction data.
 java.util.Enumeration getTransactionDataKeys()
          Get an enumeration of the keys in the transaction data.
 void populateInstance(RequestInfo toCopy)
          Populate the object from the passed in RequestInfo (make this object a copy of the passed in one).
 boolean removeRule(java.lang.String rule)
          Remove a attribute/value pair (rule) from being evaluated by the rules engine.
 void setExtraRuleKey(java.lang.String key, java.lang.String value)
          Sets an extra key/value pair for the rule engine to consider.
 void setTransactionData(java.lang.Object key, java.lang.Object value)
          Store a key/value pair that is associated with this transaction.
 java.lang.String toString()
          Produce a brief human-readable description of the request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

RequestInfo

public RequestInfo()
Constuct a new RequestInfo object.
Method Detail

toString

public java.lang.String toString()
Produce a brief human-readable description of the request. This description need not be unique. It will be turned into a unique transaction request and stored in the Transaction object associated with this request.
Overrides:
toString in class java.lang.Object
Returns:
A brief human-readable description of the request.

createInstance

public RequestInfo createInstance()
Create an empty instance of this RequestInfo class.
Returns:
The RequestInfo object.

populateInstance

public void populateInstance(RequestInfo toCopy)
Populate the object from the passed in RequestInfo (make this object a copy of the passed in one).
Parameters:
toCopy - The RequestInfo to populate from.

addRule

public void addRule(java.lang.String rule,
                    java.lang.String value)
Add an attriute/value pair that will be evaluated by the rules engine. The attribute (or rule) is specified the in the plugin condition and is compared to the value specified here. The rule value is case-insensitive and will be stored as lower case letters.
Parameters:
rule - The attribute (or rule).
value - The value of the rule.

removeRule

public boolean removeRule(java.lang.String rule)
Remove a attribute/value pair (rule) from being evaluated by the rules engine. The rule value is case-insensitive.
Parameters:
rule - The attribute of the rule to remove.
Returns:
true if removed; false if not found.

getRule

public java.lang.String getRule(java.lang.String rule)
Get the rule attribute value from the specified key. The rule value is case-insensitive.
Parameters:
rule - The attribute (or rule).
Returns:
The value associated with the attribute (or rule).

getRuleAttributes

public java.util.Enumeration getRuleAttributes()
Get an enumeration of the rule attributes.
Returns:
Rule attribute enumeration.

getRuleValues

public java.util.Enumeration getRuleValues()
Get an enumeration of the rule values.
Returns:
Rule value enumeration.

getRuleBundle

public java.util.Dictionary getRuleBundle()
This returns the bundle of rules (attributes) and their corresponding rule value.
Returns:
The rule bundle.

setExtraRuleKey

public void setExtraRuleKey(java.lang.String key,
                            java.lang.String value)
Sets an extra key/value pair for the rule engine to consider. Any previous value for the key is replaced with the new one. These keys can be set by one Meg and then used to switch other Megs in and out of the Meg chain by having their rule conditions depend on the values of these keys.
Parameters:
key - The key to store the value under. Must begin with a '$' character.
value - The value to store under the key.

getExtraRuleKey

public java.lang.String getExtraRuleKey(java.lang.String key)
Gets the requested value from the list of key/value pairs for the Meg rule engine to consider.
Parameters:
key - The key for which a value is needed. Must begin with a '$' character.
Returns:
The value stored under the given key; "" if key not defined.

getAllExtraRuleKeys

public java.util.Enumeration getAllExtraRuleKeys()
Gets an enumeration of all keys in the extra key/value set. These keys can be set by one Meg and then used to switch other Megs in and out of the Meg chain by having their rules depend on the values of these keys.
Returns:
An enumeration of all the keys in the extra key/value set.

setTransactionData

public void setTransactionData(java.lang.Object key,
                               java.lang.Object value)
Store a key/value pair that is associated with this transaction. Any other Meg can access this data using the getTransactionData() method on the RequestInfo object in it's own RequestEvent. This mechanism can be used to communicate precomputed results between Megs. The data is not available to a Meg operating on a different transaction (request).
Parameters:
key - The key which the data is stored.
value - The data to store.

getTransactionData

public java.lang.Object getTransactionData(java.lang.Object key)
Access a key/value pair that is associated with this transaction.
Parameters:
key - The key under which the data is stored.
Returns:
The value of the data stored.

getTransactionDataElements

public java.util.Enumeration getTransactionDataElements()
Get an enumeration of the values in the transaction data.
Returns:
An enumeration of transaction data values.

getTransactionDataKeys

public java.util.Enumeration getTransactionDataKeys()
Get an enumeration of the keys in the transaction data.
Returns:
An enumeration of transaction data keys.

getRequestCharEncoding

public java.lang.String getRequestCharEncoding()
                                        throws com.ibm.wbi.NotCharDataException

getResponseCharEncoding

public java.lang.String getResponseCharEncoding()
                                         throws com.ibm.wbi.NotCharDataException