AbstractAdvislet Class

com.bea.p13n.advisor
AbstractAdvislet Class

public abstract class AbstractAdvislet

    extends Object
    implements AdviceConstants, AdviceRequestConstants, Advislet

An abstract class which provides some default method implementations for classes wishing to implement the Advislet interface.


Hierarchy
Object
  AbstractAdvislet
All Implemented Interfaces

AdviceConstants, AdviceRequestConstants, Advislet, AdvisletChainElement
Direct Known Subclasses

CatalogQueryAdvisletImpl, ContentQueryAdvisletImpl, RulesAdvisletImpl

Field Summary

protected Metadata
advisletMetadata
The metadata for the Advislet
protected Advisor
advisor
The Advisor associated with this Advislet instance.
protected Map
parametersMap
The parameters Map for the Advislet
 

Constructor Summary

AbstractAdvislet(Advisor advisor, Metadata advisletMetadata)

Constructs a new AbstractAdvislet associated with the Advisor supplied.
 

Method Summary

public Advice
getAdvice(AdviceRequest request)
Makes recommendations based on the AdviceRequest passed in.
protected Advisor
getAdvisor()
Gets the Advisor associated with this Advislet.
public Metadata
getMetadata()
Returns the metadata for the Advislet.
public Object[]
getRequiredAttributes()
Returns an array of required attributes for the advislet.
public boolean
initialize(Map parameters, Object parameterDocument)
Initializes this with the given parameters and a parameterDocument.
public String
toString()
Returns a String representation of this.
public void
validateAdviceRequest(AdviceRequest request)
Allows for custom AdviceRequest validation logic in addition to the required attribute checking performed by the Advisor.
 
Methods from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
   
Methods from interface com.bea.p13n.advisor.Advislet
getAdvice, getRequiredAttributes, validateAdviceRequest
 
Methods from interface com.bea.p13n.advisor.AdvisletChainElement
getMetadata, initialize
 

Field Detail

advisletMetadata

protected Metadata advisletMetadata
The metadata for the Advislet


advisor

protected Advisor advisor
The Advisor associated with this Advislet instance.


parametersMap

protected Map parametersMap
The parameters Map for the Advislet

 

Constructor Detail

AbstractAdvislet

public AbstractAdvislet(Advisor advisor, 
                        Metadata advisletMetadata)
Constructs a new AbstractAdvislet associated with the Advisor supplied.
 

Method Detail

getAdvice(AdviceRequest) Method

public Advice getAdvice(AdviceRequest request)
throws IllegalArgumentException, AdvisorException
Description copied from Advislet.getAdvice(AdviceRequest)
Makes recommendations based on the AdviceRequest passed in.

Parameters

request
The advice request for which to make a recommendation.

Returns

The advice which contain the recommendations based on the type of request made.

Exceptions

IllegalArgumentException
AdvisorException

getAdvisor() Method

protected Advisor getAdvisor()
Gets the Advisor associated with this Advislet.

Returns

The Advisor set as the parent.

getMetadata() Method

public Metadata getMetadata()
Returns the metadata for the Advislet.

Returns

the metadata for the Advislet.

getRequiredAttributes() Method

public Object[] getRequiredAttributes()
Description copied from Advislet.getRequiredAttributes()
Returns an array of required attributes for the advislet. The array contains pairs of items: even items are attribute names while odd items are the Class for the item. This information is used by the Advisor to ensure Advislets are not invoked with invalid parameters. Overide the validateAdviceRequest method to perform additional processing above and beyond attribute type checking.

Returns

an array that contains the attributes required by the Advislet.

initialize(Map, Object) Method

public boolean initialize(Map parameters, 
                          Object parameterDocument)
throws AdvisorException
Initializes this with the given parameters and a parameterDocument.

Parameters

parameters
A map containing key-value pairs.
parameterDocument
An Object representing a parameter document.

Returns

returns true if this operation is successful, otherwise returns false.

Exceptions

AdvisorException
If an error occurs during initialization process.

toString() Method

public String toString()
Returns a String representation of this.

Overrides
Object.toString()

Returns

a String representation of this.

validateAdviceRequest(AdviceRequest) Method

public void validateAdviceRequest(AdviceRequest request)
throws IllegalArgumentException
Description copied from Advislet.validateAdviceRequest(AdviceRequest)
Allows for custom AdviceRequest validation logic in addition to the required attribute checking performed by the Advisor.

Parameters

request
the request to validate.

Exceptions

IllegalArgumentException