org.makumba.analyser
Class AnalysableExpression

java.lang.Object
  extended by javax.servlet.jsp.tagext.TagSupport
      extended by org.makumba.analyser.AnalysableElement
          extended by org.makumba.analyser.AnalysableExpression
All Implemented Interfaces:
Serializable, IterationTag, JspTag, Tag
Direct Known Subclasses:
CountFunctions, GenericListValueFunction

public abstract class AnalysableExpression
extends AnalysableElement

An analysable EL expression, used for creating "implicit objects" as per EL definition (see http://java.sun.com/products/jsp/2.1/docs/jsp-2_1-pfd2/javax/el/ELResolver.html) Implementations of this class can be retrieved by ELResolver-s in order to get status information, perform analysis-time tasks, etc.

Version:
$Id: AnalysableExpression.java,v 1.1 Jan 22, 2010 6:13:56 PM manu Exp $
Author:
Manuel Gay
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.makumba.analyser.AnalysableElement
AnalysableElement.FilePositionElementComparator
 
Field Summary
protected  ELData elData
           
protected  String expression
           
protected  MultipleKey key
           
protected  AnalysableTag parent
           
 
Fields inherited from class org.makumba.analyser.AnalysableElement
ANALYSIS_STATE
 
Fields inherited from class javax.servlet.jsp.tagext.TagSupport
id, pageContext
 
Fields inherited from interface javax.servlet.jsp.tagext.IterationTag
EVAL_BODY_AGAIN
 
Fields inherited from interface javax.servlet.jsp.tagext.Tag
EVAL_BODY_INCLUDE, EVAL_PAGE, SKIP_BODY, SKIP_PAGE
 
Constructor Summary
AnalysableExpression()
           
 
Method Summary
abstract  void analyze(PageCache pageCache)
          Performs analysis-time operations
protected  void checkNumberOfArguments(int argumentCount)
          Checks that the function has the expected number of arguments.
abstract  void doEndAnalyze(PageCache pageCache)
           
protected  Tag findParentWithClass(Class<?> clazz)
          Finds the first parent of this expression that is a tag of the specified type
 ElementData getElementData()
           
 MultipleKey getKey()
           
 AnalysableTag getParent()
           
abstract  String getPrefix()
          Gets the prefix of the makumba EL expression, e.g.
abstract  Object resolve(PageContext pc, PageCache pageCache)
          Resolves the expression at runtime
 void setELDataAtAnalysis(ELData ed)
          Sets the EL data and adapts the expression
abstract  void setKey(PageCache pageCache)
           
 void setParent(AnalysableTag parent)
           
 void treatELExpressionAtAnalysis(String expression)
           
abstract  String treatExpressionAtAnalysis(String expression)
          Modifies the expression before analysis.
 
Methods inherited from class org.makumba.analyser.AnalysableElement
checkTagFound, discardJSPParsingData, getAnalyzedElementData, getCurrentBodyTagData, getElementAfter, getElementBefore, getPageCache, getPageCache, getRunningElementData, getTagByAttribute, getTagById, getThreadElementStack, initializeThread, keepAnalysisState, setAnalyzedElementData, setRunningElementData
 
Methods inherited from class javax.servlet.jsp.tagext.TagSupport
doAfterBody, doEndTag, doStartTag, findAncestorWithClass, getId, getValue, getValues, release, removeValue, setId, setPageContext, setParent, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

elData

protected ELData elData

expression

protected String expression

parent

protected AnalysableTag parent

key

protected MultipleKey key
Constructor Detail

AnalysableExpression

public AnalysableExpression()
Method Detail

getElementData

public ElementData getElementData()
Specified by:
getElementData in class AnalysableElement

setELDataAtAnalysis

public void setELDataAtAnalysis(ELData ed)
Sets the EL data and adapts the expression


treatELExpressionAtAnalysis

public void treatELExpressionAtAnalysis(String expression)

setParent

public void setParent(AnalysableTag parent)

getParent

public AnalysableTag getParent()
Specified by:
getParent in interface Tag
Overrides:
getParent in class TagSupport

setKey

public abstract void setKey(PageCache pageCache)

getKey

public MultipleKey getKey()

analyze

public abstract void analyze(PageCache pageCache)
Performs analysis-time operations

Parameters:
cache - the PageCache available to this expression

doEndAnalyze

public abstract void doEndAnalyze(PageCache pageCache)

treatExpressionAtAnalysis

public abstract String treatExpressionAtAnalysis(String expression)
Modifies the expression before analysis. This is necessary because the expression that comes from page analysis is not tailored to the specific expression we want to handle

Returns:
the expression value, trimmed down to what is necessary for this kind of EL expression evaluator

getPrefix

public abstract String getPrefix()
Gets the prefix of the makumba EL expression, e.g. Value

Returns:
the prefix of this EL expression

resolve

public abstract Object resolve(PageContext pc,
                               PageCache pageCache)
                        throws LogicException
Resolves the expression at runtime

Parameters:
cache - the PageCache available to this expression
Throws:
LogicException

findParentWithClass

protected Tag findParentWithClass(Class<?> clazz)
Finds the first parent of this expression that is a tag of the specified type

Returns:
a parent Tag

checkNumberOfArguments

protected void checkNumberOfArguments(int argumentCount)
                               throws ProgrammerError
Checks that the function has the expected number of arguments. This should be enforced by the JSP compiler, but an additional check can't hurt

Throws:
ProgrammerError