org.objectweb.jonas_ejb.lib
Class EjbqlAbstractVisitor

java.lang.Object
  extended by org.objectweb.jonas_ejb.lib.EjbqlAbstractVisitor
All Implemented Interfaces:
EJBQLVisitor
Direct Known Subclasses:
EjbqlLimitVisitor, EjbqlOrderByVisitor, EjbqlQueryFilterVisitor, EjbqlSelectVisitor, EjbqlVariableVisitor

public class EjbqlAbstractVisitor
extends java.lang.Object
implements EJBQLVisitor

Base class with visitor utility class and default implementation of visit methods Created on Sep 12, 2002

Author:
Christophe Ney [cney@batisseurs.com]: Initial developer, Helene Joanin: Add the toString() method to IdValue., Helene Joanin: Add some utility methods as endsWith(), basePath()., Helene Joanin: Take into account the ORDER BY clause., Helene Joanin: Take into account the EJBQL version 2.1 syntax.

Nested Class Summary
protected  class EjbqlAbstractVisitor.IdValue
          Values associated with each declared identifiers
protected  class EjbqlAbstractVisitor.VisitorException
          Runtime Exception used to wrap exceptions thrown in visit methods
 
Constructor Summary
EjbqlAbstractVisitor()
           
 
Method Summary
protected  java.lang.String[] basePath(java.lang.String[] path)
          merge the first tokens into a dot separated path.
protected  boolean endsWith(java.lang.String[] path, java.lang.String suffix)
           
protected  java.lang.String mergePath(java.lang.String[] path)
           
protected  java.lang.String mergePath(java.lang.String[] path, int begin, int length)
           
protected  java.lang.String[] splitPath(java.lang.String path)
          split a dot separated path into tokens
 java.lang.Object visit(ASTAbstractSchemaName node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTAggregateSelectExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTArithmeticExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTArithmeticFactor node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTArithmeticLiteral node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTArithmeticTerm node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTBetweenExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTBooleanExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTBooleanLiteral node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTCmpPathExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTCollectionMemberDeclaration node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTCollectionMemberExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTCollectionValuedPathExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTComparisonExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTConditionalExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTConditionalFactor node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTConditionalTerm node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTDatetimeExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTEJBQL node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTEmptyCollectionComparisonExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTEntityBeanExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTFloatingPointLiteral node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTFromClause node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTFunctionsReturningNumerics node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTFunctionsReturningStrings node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTIdentificationVariable node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTIdentifier node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTInExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTInputParameter node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTIntegerLiteral node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTLikeExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTLimitClause node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTLimitExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTLiteral node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTNullComparisonExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTOrderByClause node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTOrderByItem node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTPath node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTRangeVariableDeclaration node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTSelectClause node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTSelectExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTSingleValuedCmrPathExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTSingleValuedPathExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTStringExpression node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTStringLiteral node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(ASTWhereClause node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 java.lang.Object visit(SimpleNode node)
          Visit method to call from constructor.
 java.lang.Object visit(SimpleNode node, java.lang.Object data)
          Generic visit method that traverses all child nodes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EjbqlAbstractVisitor

public EjbqlAbstractVisitor()
Method Detail

splitPath

protected java.lang.String[] splitPath(java.lang.String path)
split a dot separated path into tokens

Parameters:
path - the input path
Returns:
the splitted path

mergePath

protected java.lang.String mergePath(java.lang.String[] path,
                                     int begin,
                                     int length)
Parameters:
path - the input path
begin - the beginning index
length - the length
Returns:
the merge of the tokens (from the begin index to the (begin+length) index into a dot separated path

mergePath

protected java.lang.String mergePath(java.lang.String[] path)
Parameters:
path - the input path
Returns:
the merge tokens into a dot separated path

endsWith

protected boolean endsWith(java.lang.String[] path,
                           java.lang.String suffix)
Parameters:
path - the input path
suffix - the input suffix
Returns:
true if the last token of the path is equal to the suffix.

basePath

protected java.lang.String[] basePath(java.lang.String[] path)
merge the first tokens into a dot separated path. (The last token is left)

Parameters:
path - the input path
Returns:
the base path

visit

public java.lang.Object visit(SimpleNode node)
                       throws java.lang.Exception
Visit method to call from constructor. Child node visitors get a java.util.Stack as data parameter.

Parameters:
node - the node to visit
Returns:
the stack
Throws:
java.lang.Exception - any nested exception thrown from other visit method

visit

public java.lang.Object visit(SimpleNode node,
                              java.lang.Object data)
Generic visit method that traverses all child nodes

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
the stack

visit

public java.lang.Object visit(ASTEJBQL node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTFromClause node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTCollectionMemberDeclaration node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTRangeVariableDeclaration node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTSingleValuedPathExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTCmpPathExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTSingleValuedCmrPathExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTCollectionValuedPathExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTSelectClause node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTSelectExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTAggregateSelectExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTOrderByClause node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTOrderByItem node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTLimitClause node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTLimitExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTWhereClause node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTConditionalExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTConditionalTerm node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTConditionalFactor node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTBetweenExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTInExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTLikeExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTNullComparisonExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTEmptyCollectionComparisonExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTCollectionMemberExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTComparisonExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTArithmeticExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTIntegerLiteral node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTFloatingPointLiteral node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTArithmeticTerm node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTArithmeticFactor node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTStringExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTDatetimeExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTBooleanExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTEntityBeanExpression node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTFunctionsReturningStrings node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTFunctionsReturningNumerics node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTAbstractSchemaName node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTIdentificationVariable node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTIdentifier node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTPath node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTLiteral node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTStringLiteral node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTArithmeticLiteral node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTBooleanLiteral node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null

visit

public java.lang.Object visit(ASTInputParameter node,
                              java.lang.Object data)
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Parameters:
node - the node to visit
data - the current stack
Returns:
null