org.objectweb.jonas_ejb.lib
Class EjbqlVariableVisitor

java.lang.Object
  extended byorg.objectweb.jonas_ejb.lib.EjbqlAbstractVisitor
      extended byorg.objectweb.jonas_ejb.lib.EjbqlVariableVisitor
All Implemented Interfaces:
EJBQLVisitor

public class EjbqlVariableVisitor
extends EjbqlAbstractVisitor

Implementation of a visitor that creates a map of pairs [name,QueryTreeField] for all defined identifiers of the query.

Author:
Christophe Ney [cney@batisseurs.com] contributor(s); - Helene Joanin: In the visit of the SELECT clause, do not forget to add the id in the ids structure if its not present. Indeed, the definition of this id is done in the FROM clause which is visited later. This is needed for ejbSelect query which allows path_expression in the SELECT clause. - Helene Joanin: Use of the NavigatorNodeFactory.getIn() for IN in the FROM part instead of NavigatorNodeFactory.getNavigatorNode() - Helene Joanin: Some modifications needed to take into account CollectionValuedPathExpression for the member of and is empty operators. - Helene Joanin: For the MemberOf implementation, do not more build an unique QueryTree, but a Map of pairs [name,QueryTreeField] - Helene Joanin: Add the ORDER BY clause. - Helene Joanin: Take into account the new interface of NavigatorNodeFactory. - Helene Joanin: IS EMPTY / IS NOT EMPTY

Nested Class Summary
 
Nested classes inherited from class org.objectweb.jonas_ejb.lib.EjbqlAbstractVisitor
EjbqlAbstractVisitor.IdValue, EjbqlAbstractVisitor.VisitorException
 
Constructor Summary
EjbqlVariableVisitor(ASTEJBQL ejbql, DeploymentCmp2Desc dd)
          constructor
 
Method Summary
 java.util.Map getFields()
          get the Map that was built from visiting the lexical query tree This map allows to get the org.objectweb.medor.api.Field from its name (ident or path).
 java.lang.String[] getName(java.lang.String id)
          get the abstract schema name or collection values path of the given identifier.
 void traceIds(java.lang.String msg)
          trace the ids structure
 java.lang.Object visit(ASTAbstractSchemaName node, java.lang.Object data)
          Push the Node to the stack
 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(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(ASTCollectionMemberDeclaration node, java.lang.Object data)
          visit child nodes
 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)
          visit child nodes
 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(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(ASTFromClause node, java.lang.Object data)
          visit child nodes
 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)
          store the pair identifier,Node from the Stack in HashMap
 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(ASTLikeExpression 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)
          Push the Node to the stack
 java.lang.Object visit(ASTRangeVariableDeclaration node, java.lang.Object data)
          visit child nodes
 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(ASTSingleValuedNavigation 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(ASTWhereClause node, java.lang.Object data)
          null implementation of the visit method for the corresponding parameter type
 
Methods inherited from class org.objectweb.jonas_ejb.lib.EjbqlAbstractVisitor
basePath, endsWith, mergePath, mergePath, splitPath, visit, visit, visit, visit, visit, visit, visit
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EjbqlVariableVisitor

public EjbqlVariableVisitor(ASTEJBQL ejbql,
                            DeploymentCmp2Desc dd)
                     throws java.lang.Exception
constructor

Parameters:
ejbql - root of the lexical tree
dd - Deployment Descriptor
Method Detail

getName

public java.lang.String[] getName(java.lang.String id)
get the abstract schema name or collection values path of the given identifier.


getFields

public java.util.Map getFields()
get the Map that was built from visiting the lexical query tree This map allows to get the org.objectweb.medor.api.Field from its name (ident or path).


traceIds

public void traceIds(java.lang.String msg)
trace the ids structure


visit

public java.lang.Object visit(ASTFromClause node,
                              java.lang.Object data)
visit child nodes

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTCollectionMemberDeclaration node,
                              java.lang.Object data)
visit child nodes

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTRangeVariableDeclaration node,
                              java.lang.Object data)
visit child nodes

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTCollectionValuedPathExpression node,
                              java.lang.Object data)
visit child nodes

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTAbstractSchemaName node,
                              java.lang.Object data)
Push the Node to the stack

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTIdentifier node,
                              java.lang.Object data)
store the pair identifier,Node from the Stack in HashMap

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTPath node,
                              java.lang.Object data)
Push the Node to the stack

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTSelectClause node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTIdentificationVariable node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTSingleValuedPathExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTWhereClause node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTSingleValuedNavigation node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTConditionalExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTConditionalTerm node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTConditionalFactor node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTBetweenExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTInExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTLikeExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTNullComparisonExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTEmptyCollectionComparisonExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTCollectionMemberExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTComparisonExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTArithmeticExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTArithmeticTerm node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTArithmeticFactor node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTStringExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTDatetimeExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTBooleanExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTEntityBeanExpression node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTFunctionsReturningStrings node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTFunctionsReturningNumerics node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTOrderByClause node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor

visit

public java.lang.Object visit(ASTOrderByItem node,
                              java.lang.Object data)
Description copied from class: EjbqlAbstractVisitor
null implementation of the visit method for the corresponding parameter type

Specified by:
visit in interface EJBQLVisitor
Overrides:
visit in class EjbqlAbstractVisitor