|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.bea.p13n.advisor.AbstractAdvislet com.bea.p13n.rules.advislets.RulesAdvisletImpl
public class RulesAdvisletImpl
This class is the implementation class for a generic Advislet that handles rules based advice. It is designed to be extended by Advislets that wish to make use of the rules engine and provides a number of methods that can be overridden to change some of the default behaviour.
Required inputs to the Advislet are:
RULES_FILTER_CLASS_NAME
- the name of an ObjectFilter
class that should be used to filter the objects returned by the RulesManager.
RULES_INPUT_OBJECTS
- a Collection of input objects to be
passed to the RulesManager.
The output objects from rule evaluation are placed in a List in the Advice with the RESULTS key.
Field Summary | |
---|---|
static String |
IGNORE_RULE_NAME
The key name for the optional ignore rule name parameter. |
static String |
IGNORE_RULESET_NOT_FOUND
The key name for the optional ignore rule name parameter. |
static String |
RULESET_NAME
The key name for the optional rule set name parameter. |
Fields inherited from class com.bea.p13n.advisor.AbstractAdvislet |
---|
advisletMetadata, advisor, parametersMap |
Fields inherited from interface com.bea.p13n.advisor.AdviceConstants |
---|
RESULTS |
Constructor Summary | |
---|---|
RulesAdvisletImpl(Advisor advisor,
Metadata metadata)
Construct an instance of this object and bind it to its Advisor and Metadata instances. |
Method Summary | |
---|---|
protected void |
addResults(Advice advice,
Iterator iterator)
Adds the contents of a given iterator to a given advice. |
Advice |
getAdvice(AdviceRequest request)
Executes an AdviceRequest and returns the Advice object.s |
protected Object[] |
getInputObjects(Advice advice,
AdviceRequest request)
Returns the input objects for a given advice and advice request. |
protected ObjectFilter |
getObjectFilter(Advice advice,
AdviceRequest request)
Returns the object filter for a given advice and advice request. |
Object[] |
getRequiredAttributes()
Returns an array of required attributes for the advislet. |
protected String |
getRuleNameToFire(Advice advice,
AdviceRequest request)
Returns the name of the rule that must be fired for a given advice and advice request. |
protected String |
getRuleSetName(Advice advice,
AdviceRequest request)
Returns the rule set name for the given advice and advice request. |
protected RulesManager |
getRulesManager(Advice advice,
AdviceRequest request)
Returns a RulesManager instance for a given advice and advice request. |
boolean |
initialize(Map parameters,
Object parameterDocument)
Initialize this instance from its XML configuration environment. |
protected void |
sendRuleEvent(AdviceRequest request,
Advice advice)
Generates a rule event for tracking listeners. |
protected AdviceRequest |
setupRequest(Advice advice,
AdviceRequest request)
Sets up a given advice request. |
Methods inherited from class com.bea.p13n.advisor.AbstractAdvislet |
---|
getAdvisor, getMetadata, toString, validateAdviceRequest |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final String RULESET_NAME
public static final String IGNORE_RULE_NAME
public static final String IGNORE_RULESET_NOT_FOUND
Constructor Detail |
---|
public RulesAdvisletImpl(Advisor advisor, Metadata metadata)
Advisor
and Metadata
instances.
advisor
- The Advisor
instance.metadata
- The Metadata
instance.Method Detail |
---|
public boolean initialize(Map parameters, Object parameterDocument) throws AdvisorException
initialize
in interface AdvisletChainElement
initialize
in class AbstractAdvislet
paramters
- the configuration paramtersparameterDocument
- the XML Document node for the configuration environment
AdvisorException
- If an error occurs during initialization process.public Advice getAdvice(AdviceRequest request) throws IllegalArgumentException, AdvisorException
getAdvice
in interface Advislet
getAdvice
in class AbstractAdvislet
request
- the AdviceRequest containing the paramters for the request
IllegalArgumentException
- thrown if the adviceRequest parameter
is null or if it is an unsupported type.
AdvisorException
- thrown on an error when processing the request.protected Object[] getInputObjects(Advice advice, AdviceRequest request)
advice
- The target advice.request
- The target request.
protected AdviceRequest setupRequest(Advice advice, AdviceRequest request) throws AdvisorException
advice
- The current advice.request
- The current advice request.
AdvisorException
- On general Advisor exception.protected String getRuleSetName(Advice advice, AdviceRequest request) throws AdvisorException
advice
- The current advice.request
- The current advice request.
AdvisorException
- On general Advisor exception.protected String getRuleNameToFire(Advice advice, AdviceRequest request) throws AdvisorException
advice
- The current advice.request
- The current advice request.
AdvisorException
- On general Advisor exception.protected ObjectFilter getObjectFilter(Advice advice, AdviceRequest request) throws AdvisorException
advice
- The current advice.request
- The current advice request.
AdvisorException
- On general Advisor exception.protected void addResults(Advice advice, Iterator iterator) throws AdvisorException
advice
- The target advice.iterator
- The source iterator.
AdvisorException
- On general Advisor exception.public Object[] getRequiredAttributes()
Advislet
validateAdviceRequest
method to perform additional processing
above and beyond attribute type checking.
getRequiredAttributes
in interface Advislet
getRequiredAttributes
in class AbstractAdvislet
protected RulesManager getRulesManager(Advice advice, AdviceRequest request) throws AdvisorException
advice
- The current advice.request
- The current advice request.
AdvisorException
- On general Advisor exception.protected void sendRuleEvent(AdviceRequest request, Advice advice)
request
- The current advice request.advice
- The current advice.
|
Copyright © 2000, 2009, Oracle and/or its affiliates. All rights reserved. | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |