com.apama.firewall
Event RuleClass


The Risk Firewall Rule Class event object defines the interface that is used by the Risk Firewall to communicate with and control Rule Classes.

A default implementation of a RuleClass can be implemented by using the RuleClassFactory object. This implementation can then be overridden as required by the applications own custom code. Although Users can choose to define and implement the RuleClass object directly without using the RuleClassFactory, but this is not the preferred method. Primarly as it is more susceptible to compatibility problems in the future if this interface is extended with more actions.
See Also:
com.apama.firewall.RuleClassFactory - The factory object used to create new RuleClass event objects
com.apama.firewall.RiskFirewall - The Risk Firewall object that instances of the RuleClass are registered with

Member Summary
 action<integer, com.apama.utils.Params, action< >, action<com.apama.utils.Error > >addRuleInstance

This action is called by the Risk Firewall when the application has requested to add a new Risk Firewall Rule instance.
 action<integer, com.apama.utils.Params, action< >, action<com.apama.utils.Error > >modifyRuleInstance

This action is called by the Risk Firewall when the application has requested to modify an existing Risk Firewall Rule instance.
 action<integer, action< >, action<com.apama.utils.Error > >removeRuleInstance

This action is called by the Risk Firewall when the application has requested to remove an existing Risk Firewall Rule instance.
 action<com.apama.firewall.QueryRequest, action<com.apama.firewall.QueryResponse, boolean > >evaluateRuleClassQuery

This action is called by the Risk Firewall whenever it needs the Rule Class to evaluate a query an order management request made against it.
 action<integer, com.apama.utils.Paramscom.apama.firewall.QueryRequest, action<integer, com.apama.firewall.QueryResponse > >evaluateRuleInstanceQuery

This action is called by the Risk Firewall whenever it needs the Rule Class to evaluate a query an order management request made against it.
 action<com.apama.firewall.QueryUpdate > returns booleanprocessRuleClassUpdate

This action is called by the Risk Firewall whenever an Order Update is sent from an Order Receiver that the Rule Class may want to process.
 action<integer, com.apama.firewall.QueryUpdate >processRuleInstanceUpdate

This action is called by the Risk Firewall whenever an Order Update is sent from an Order Receiver that the Rule Class may want to process.
 action< > returns stringgetRuleClassName

This action is called by the RiskFirewall when the RuleClass is being registered to get the Rule Class name.
 action< > returns stringgetRuleClassDescription

This action is called by the RiskFirewall when the RuleClass is being registered to get the Rule Class description.
 action< > returns com.apama.utils.ParamsSchemagetSchema

This action is called by the RiskFirewall when the RuleClass is being registered.
 action<action<com.apama.utils.Params > >getRuleClassState

This action is called by the Risk Firewall whenever it needs to query details and state about the RuleClass.
 action<integer, action<com.apama.utils.Params > >getRuleInstanceState

This action is called by the Risk Firewall whenever it needs to query details about a specific instance of the RuleClass using the instance identifier provided.
 
Member Detail

addRuleInstance

action<integer, com.apama.utils.Params, action< >, action<com.apama.utils.Error > > addRuleInstance
This action is called by the Risk Firewall when the application has requested to add a new Risk Firewall Rule instance.

An application unique instance identifier is provided for the new instance to be added, and a set of configuration parameters for the new Rule instance are also provided.

Once the custom Rule Class implementation has added the Rule instance the completion callback must be called. This is to allow Rule Classes to implement asynchronous operations in the action. If the custom Rule Class implementation needs to report an error encountered while adding the Rule instance, they may do this through the same callback action.

Parameters:
instanceId - The application unique instance identifier for the Rule instance to add
config - The configuration parameters object to use for this Rule instance
cbOnSuccess - The action callback to notify the RiskFirewall when the Rule instance has been added successfully
cbOnError - The action callback to notify the RiskFirewall when an error occurred adding the Rule instance

evaluateRuleClassQuery

action<com.apama.firewall.QueryRequest, action<com.apama.firewall.QueryResponse, boolean > > evaluateRuleClassQuery
This action is called by the Risk Firewall whenever it needs the Rule Class to evaluate a query an order management request made against it.

This action is called once on each Rule Class per-query. This allows the Rule Class implementation to evaluate the query based on some global state information first, or to evaluate all of its Rule Instances in a single action (perhaps for performance reasons). The QueryRequest object is provided which contains all the details for the request. A completion callback is also provided which must be called once the query has been evaluated. This allows the evaluation to be implemented in an asynchronous manner. The "doPerInstanceQueries" boolean parameter on the completion callback is used to instruct the Risk Firewall whether or not to call the evaluateRuleInstanceQuery action to evaluate the query against all Ruleinstances individually.

Parameters:
queryRequest - The QueryRequest object containing details of the request
cbCompleted - The action callback to notify the RiskFirewall of the response once the Query has been processed

evaluateRuleInstanceQuery

action<integer, com.apama.utils.Paramscom.apama.firewall.QueryRequest, action<integer, com.apama.firewall.QueryResponse > > evaluateRuleInstanceQuery
This action is called by the Risk Firewall whenever it needs the Rule Class to evaluate a query an order management request made against it.

This action is called by the Risk Firewall for each Rule instance that has been added by the Risk Firewall. It provides the Rule instance Id, and the configuration that the Rule instance was created with. The QueryRequest object is also provided, which contains all the details for the request. A completion callback is also provided which must be called once the query for this particular Rule instance has been evaluated. This allows the evaluation to be implemented in an asynchronous manner.

Parameters:
instanceId - The identifier of the Rule instance that is being evaluated
config - The configuration associated with the Rule instance being evaluated
queryRequest - The QueryRequest object containing details of the request
cbCompleted - The action callback to notify the RiskFirewall of the response once the Query has been processed

getRuleClassDescription

action< > returns string getRuleClassDescription
This action is called by the RiskFirewall when the RuleClass is being registered to get the Rule Class description.

Returns:
The description of the RuleClass implementation

getRuleClassName

action< > returns string getRuleClassName
This action is called by the RiskFirewall when the RuleClass is being registered to get the Rule Class name.

The implementation of this action should define a RuleClass name that is unique for the RiskFirewall that it is being registered with, otherwise registration will fail. The implementation of this action should not modify the name of the RuleClass once it has been registered.

Returns:
The name of the RuleClass implementation

getRuleClassState

action<action<com.apama.utils.Params > > getRuleClassState
This action is called by the Risk Firewall whenever it needs to query details and state about the RuleClass.

Once the custom Rule Class implementation has gathered the configuration details/state, the on completed callback must be called. This is to allow Rule Classes to implement asynchronous operations in the action.

Parameters:
cbCompleted - The action callback to notify the RiskFirewall with information/state about the Rule Class

getRuleInstanceState

action<integer, action<com.apama.utils.Params > > getRuleInstanceState
This action is called by the Risk Firewall whenever it needs to query details about a specific instance of the RuleClass using the instance identifier provided.

Once the custom Rule Class implementation has gathered the configuration details for the Rule instance, the on completed callback must be called. This is to allow Rule Classes to implement asynchronous operations in the action.

Parameters:
instanceId - The instance identifier for the Rule instance to get information for
cbCompleted - The action callback to notify the RiskFirewall with information about the Rule instance

getSchema

action< > returns com.apama.utils.ParamsSchema getSchema
This action is called by the RiskFirewall when the RuleClass is being registered.

The implementation of this action should define the schema for the configuration parameters that this RuleClass supports. The implementation of this action should not modify the schema of the RuleClass once it has been registered. Modifications to the schema will not take effect once the schema has been registered.

Returns:
The schema for the configuration parameters that this RuleClass supports

modifyRuleInstance

action<integer, com.apama.utils.Params, action< >, action<com.apama.utils.Error > > modifyRuleInstance
This action is called by the Risk Firewall when the application has requested to modify an existing Risk Firewall Rule instance.

The instance identifier for the Rule to modify (which was provided when the rule instance was added), and a set of configuration parameters that should be used to modify the Rule instance are also provided.

Once the custom Rule Class implementation has modified the Rule instance the completion callback must be called. This is to allow Rule Classes to implement asynchronous operations in the action. If the custom Rule Class implementation needs to report an error encountered while modifying the Rule instance, they may do this through the same callback action.

Parameters:
instanceId - The instance identifier for the Rule instance to modify
config - The configuration parameters object to use to modify this Rule instance
cbOnSuccess - The action callback to notify the RiskFirewall when the Rule instance has been modified successfully
cbOnError - The action callback to notify the RiskFirewall when an error occurred modifying the Rule instance

processRuleClassUpdate

action<com.apama.firewall.QueryUpdate > returns boolean processRuleClassUpdate
This action is called by the Risk Firewall whenever an Order Update is sent from an Order Receiver that the Rule Class may want to process.

This action is called once on each Rule Class per Order Update. This allows the Rule Class implementation to evaluate the Order Update based on some global state information first, or to evaluate all of its Rule Instances in a single action (perhaps for performance reasons).

The returned boolean is used to instruct the Risk Firewall whether or not to call the processInstanceOrderUpdate action to evaluate the Order Update against all matching Rule Instances individually.

Parameters:
queryUpdate - The Query Update to process
Returns:
True to call processInstanceOrderUpdate per matching instance.

processRuleInstanceUpdate

action<integer, com.apama.firewall.QueryUpdate > processRuleInstanceUpdate
This action is called by the Risk Firewall whenever an Order Update is sent from an Order Receiver that the Rule Class may want to process.

This action is called for each Rule instance that matches the Order Update. It provides the Rule instance Id that has been matched. It is possible for this action to be called with an instance Id not seen before in evaluateRuleInstanceQuery if an instance has been added after an Order has already been sent through the Risk Firewall.

Parameters:
instanceId - The identifier of the Rule instance that is being evaluated
queryUpdate - The Query Update to process

removeRuleInstance

action<integer, action< >, action<com.apama.utils.Error > > removeRuleInstance
This action is called by the Risk Firewall when the application has requested to remove an existing Risk Firewall Rule instance.

The instance identifier for the Rule to remove (which was provided when the rule instance was added) is provided.

Once the custom Rule Class implementation has removed the Rule instance the completion callback must be called. This is to allow Rule Classes to implement asynchronous operations in the action. If the custom Rule Class implementation needs to report an error encountered while modifying the Rule instance, they may do this through the same callback action.

Parameters:
instanceId - The instance identifier for the Rule instance to remove
cbOnSuccess - The action callback to notify the RiskFirewall when the Rule instance has been removed successfully
cbOnError - The action callback to notify the RiskFirewall when an error occurred removing the Rule instance