You are viewing a plain text version of this content. The canonical link for it is here.
Posted to imperius-commits@incubator.apache.org by ke...@apache.org on 2008/01/11 18:57:14 UTC
svn commit: r611261 [31/43] - in /incubator/imperius/trunk: ./
imperius-javaspl/ imperius-javaspl/src/main/java/org/apache/imperius/javaspl/
imperius-splcore/
imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/
imperius-splcore/src...
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/AnchorMethodInvokeAction.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/AnchorMethodInvokeAction.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/AnchorMethodInvokeAction.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/AnchorMethodInvokeAction.java Fri Jan 11 10:56:30 2008
@@ -1,427 +1,427 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.statements.actions.impl;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Actuator;
-import org.apache.imperius.spl.external.Argument;
-import org.apache.imperius.spl.external.Expression;
-import org.apache.imperius.spl.parser.compiler.symboltable.MethodSymbol;
-import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expression.primary.PrimaryExpression;
-import org.apache.imperius.spl.parser.expressions.impl.AssignmentExpression;
-import org.apache.imperius.spl.parser.statements.BasicActionBlock;
-import org.apache.imperius.spl.parser.statements.impl.ArgumentImpl;
-import org.apache.imperius.spl.parser.util.ActuatorFactory;
-import org.apache.imperius.spl.parser.util.DataCollectorFactory;
-import org.apache.imperius.spl.parser.util.ExpressionUtility;
-import org.apache.imperius.spl.parser.util.TypeResolver;
-import org.apache.imperius.util.SPLLogger;
-
-//import com.ibm.ac.cimspl.CIMSPLTypeConstants;
-
-
-public class AnchorMethodInvokeAction implements BasicActionBlock
-{
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-
- private static final String sourceClass="MethodInvokeAction";
-
- private String _optClassName;
-
- private String _methodName;
-
- private SPLSymbolTable _symTab;
-
- private List _pList;
-
- private String _operatorType;
-
- private Expression _constantExpression;
-
-
-
- // cexp--->integer, compare action result with that, paramlist format--->
- public AnchorMethodInvokeAction(String optClassName, String methodName,
- List paramList, String op, Expression cExp, SPLSymbolTable symTab) throws SPLException
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "MethodInvokeAction");
-
-
- //System.out.println("creating MethodInvokeAction block " + optClassName+ " " + methodName);
- _optClassName = optClassName;
- _methodName = methodName;
- _pList = paramList;
- _symTab = symTab;
- if ((op != null) && (op != ""))
- {
- _operatorType = op;
- }
- _constantExpression = cExp;
- _validate();
-
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "MethodInvokeAction");
-
-
- }
-
- public static void validateActualParameters(SPLSymbolTable symTab,
- String classNameOrVariableName,
- String methodName,
- List pList) throws SPLException
- {
-
- MethodSymbol methodSym =
- (MethodSymbol)symTab.getSymbol(classNameOrVariableName + "." + methodName);
- List argTypeList = methodSym.getArgumentList();
- Iterator formalParamTypeIt = argTypeList.iterator();
- Iterator actualParamIt = pList.iterator();
- if(argTypeList.size() == pList.size())
- {
- while(formalParamTypeIt.hasNext() && actualParamIt.hasNext())
- {
- Argument formalArg = (Argument)formalParamTypeIt.next();
- Expression actualParam = (Expression)actualParamIt.next();
- if(!TypeResolver.isTypeAssignableForEquality(formalArg.getType(),actualParam.getType())
- || formalArg.getIsArray() != actualParam.isArray())
- {
- throw new SPLException("Formal and passed parameter types don't match for method "
- + methodName);
- }
-
- }
- }
- else
- {
- System.err.println("Number of Formal and passed parameters don't match for method "
- + methodName);
-// throw new SPLException("Number of Formal and passed parameters don't match for method "
-// + methodName);
- }
-
-
- }
-
- private void _validate() throws SPLException
- {
-
- validateActualParameters(_symTab,_optClassName,_methodName,_pList);
-
- }
-
- public static Object invokeClassMethod(SPLSymbolTable symTab,
- String className,
- String qualifier,
- String methodName,
- List paramList,
- Object targetObject)
- {
- List parameterObjects = new ArrayList();
-
- try
- {
-
- MethodSymbol methodSym =
- (MethodSymbol)symTab.getSymbol(className + "." + methodName);
- List argTypeList = methodSym.getArgumentList();
-
-
-
- for (int i = 0; i < paramList.size(); i++)
- {
- Expression exp = (Expression) paramList.get(i);
-
- if(exp instanceof AssignmentExpression)
- {
- //System.out.println("assignment Expression");
- Expression lhsExpression = null;
- Expression rhsExpression = null;
-
-
- AssignmentExpression assignmentExpression = (AssignmentExpression) exp;
- if (assignmentExpression.getLHSExpression() instanceof org.apache.imperius.spl.external.Expression)
- {
- lhsExpression = (Expression) assignmentExpression
- .getLHSExpression();
- }
- if (assignmentExpression.getRHSExpression() instanceof org.apache.imperius.spl.external.Expression)
- {
- rhsExpression = (Expression) assignmentExpression
- .getRHSExpression();
- }
- if ((lhsExpression == null) || (rhsExpression == null))
- {
- logger.severe("LHS or RHS or argument in method call is null : "+lhsExpression.toString()+" "+rhsExpression);
-
- throw new SPLException("LHS or RHS or argument in method call is null : "+lhsExpression.toString()+" "+rhsExpression);
-
- }
- //System.out.println("lhsExpression class "+ lhsExpression.getClass());
- //System.out.println("lhsExpression getPropertyName() "+ ((PrimaryExpression) lhsExpression).getPropertyName());
- // ((PrimaryExpression)lhsExpression).getPropertyName();
-
- String keyName = ((PrimaryExpression) lhsExpression)
- .getclassNameOrInstanceVariableName();
- //System.out.println("argument name= " + keyName);
-
- Object keyValue = rhsExpression.evaluate();
- //System.out.println("argument value= " + keyValue);
-
- String referenceTypeName="";
-
- if(TypeResolver.isReference(rhsExpression.getType()))
- {
-
- referenceTypeName = rhsExpression.getType().getReferenceTypeName();
- }
-
- if(keyValue!= null){
- Argument arg=new ArgumentImpl(rhsExpression.getType().getType(), keyName, rhsExpression.isArray(), referenceTypeName);
- arg.setValue(keyValue);
- //System.out.println("created new arg :"+keyName+" "+keyValue.toString());
- /*
- * Expression expression=(Expression)pList.get(i); String
- * nameAndValue=(String)expression.evaluate(); Key
- */
- parameterObjects.add(arg);
- }
-
- }
- else
- {
- //System.out.println("argument is not an assignment Expression");
-
- Object result = exp.evaluate();
- Argument arg=new ArgumentImpl(exp.getType().getType(), null, exp.isArray(), null);
- arg.setValue(result);
- parameterObjects.add(arg);
- }
-
- }
-
- Actuator ac = ActuatorFactory.getActuator();
-
- Object result = ac.invokeMethod(className, qualifier, targetObject,
- methodName, parameterObjects);
-
-
-
- //System.out.println("method invokation complete : "+className+" "+qualifier+" "+methodName+" "+targetObject);
- //System.out.println("method invokation result of invokation : "+result);
-
- // TO DO COMPARE RESULT WITH CONSTANT
-
-
-
- return result;
- }
- catch (SPLException e)
- {
- e.printStackTrace();
- logger.severe(e.getMessage());
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- return null;
- }
-
- }
-
- public boolean execute(Actuator ac)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
- boolean postExprResult=false;
- Object instance = _symTab.getInstance(_optClassName);
- String qualifier = _symTab.getQualifierForClass(_optClassName);
- Object result = invokeClassMethod(_symTab,_optClassName, qualifier, _methodName,_pList,instance);
-
- if(result != null )
- {
- if(_constantExpression == null)
- {
- postExprResult = true;
- }
- else
- {
- Expression constexpr=this._constantExpression;
- Object constresult;
- int compareResult=0;
- try{
- constresult=constexpr.evaluate();
- compareResult=ExpressionUtility.compare(result, constresult);
- }
- catch(SPLException e){
- e.printStackTrace();
- logger.severe(Thread.currentThread().getName()+" "+e.getMessage());
-
- }
- String operation=this._operatorType;
- if(operation.equalsIgnoreCase("==")){
- if(compareResult!=0)
- postExprResult=false;
- else
- postExprResult=true;
- }
- else if(operation.equalsIgnoreCase("!=")){
- if(compareResult==0)
- postExprResult=false;
- else
- postExprResult=true;
- }
- else if(operation.equalsIgnoreCase(">=")){
- if(compareResult < 0)
- postExprResult=false;
- else
- postExprResult=true;
- }
- else if(operation.equalsIgnoreCase(">")){
- if(compareResult <= 0)
- postExprResult=false;
- else
- postExprResult=true;
- }
- else if(operation.equalsIgnoreCase("<")){
- if(compareResult >= 0)
- postExprResult=false;
- else
- postExprResult=true;
- }
- else if(operation.equalsIgnoreCase("<=")){
- if(compareResult > 0)
- postExprResult=false;
- else
- postExprResult=true;
- }
- else {
- logger.severe(Thread.currentThread().getName()+" "+"operation did not match any of the standard expressions "+operation);
-
- }
- }
- //System.out.println("AnchorMethodInvokeAction returning "+postExprResult);
- return postExprResult;
- }
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
- return false;
-
- }
-
- public String getMethodName()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getMethodName");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getMethodName");
-
- return _methodName;
- }
-
- public void setMethodName(String methodName)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setMethodName");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setMethodName");
-
- _methodName = methodName;
- }
-
- public String getOptClassName()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getOptClassName");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getOptClassName");
-
- return _optClassName;
- }
-
- public void setOptClassName(String optClassName)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setOptClassName");
-
- _optClassName = optClassName;
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setOptClassName");
-
- }
-
- public List getPList()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getPList");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getPList");
-
- return _pList;
- }
-
- public void setPList(ArrayList list)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setPList");
-
- _pList = list;
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setPList");
-
- }
-
- public Expression getConstantExpression()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getConstantExpression");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getConstantExpression");
-
- return _constantExpression;
- }
-
- public void setConstantExpression(Expression constantExpression)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setConstantExpression");
-
- _constantExpression = constantExpression;
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setConstantExpression");
-
- }
-
- public String getOperatorType()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getOperatorType");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getOperatorType");
-
- return _operatorType;
- }
-
- public void setOperatorType(String operatorType)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setOperatorType");
-
- _operatorType = operatorType;
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setOperatorType");
-
- }
-
-
-
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.actions.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Actuator;
+import org.apache.imperius.spl.external.Argument;
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.compiler.symboltable.MethodSymbol;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expression.primary.PrimaryExpression;
+import org.apache.imperius.spl.parser.expressions.impl.AssignmentExpression;
+import org.apache.imperius.spl.parser.statements.BasicActionBlock;
+import org.apache.imperius.spl.parser.statements.impl.ArgumentImpl;
+import org.apache.imperius.spl.parser.util.ActuatorFactory;
+import org.apache.imperius.spl.parser.util.DataCollectorFactory;
+import org.apache.imperius.spl.parser.util.ExpressionUtility;
+import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.SPLLogger;
+
+//import com.ibm.ac.cimspl.CIMSPLTypeConstants;
+
+
+public class AnchorMethodInvokeAction implements BasicActionBlock
+{
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+ private static final String sourceClass="MethodInvokeAction";
+
+ private String _optClassName;
+
+ private String _methodName;
+
+ private SPLSymbolTable _symTab;
+
+ private List _pList;
+
+ private String _operatorType;
+
+ private Expression _constantExpression;
+
+
+
+ // cexp--->integer, compare action result with that, paramlist format--->
+ public AnchorMethodInvokeAction(String optClassName, String methodName,
+ List paramList, String op, Expression cExp, SPLSymbolTable symTab) throws SPLException
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "MethodInvokeAction");
+
+
+ //System.out.println("creating MethodInvokeAction block " + optClassName+ " " + methodName);
+ _optClassName = optClassName;
+ _methodName = methodName;
+ _pList = paramList;
+ _symTab = symTab;
+ if ((op != null) && (op != ""))
+ {
+ _operatorType = op;
+ }
+ _constantExpression = cExp;
+ _validate();
+
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "MethodInvokeAction");
+
+
+ }
+
+ public static void validateActualParameters(SPLSymbolTable symTab,
+ String classNameOrVariableName,
+ String methodName,
+ List pList) throws SPLException
+ {
+
+ MethodSymbol methodSym =
+ (MethodSymbol)symTab.getSymbol(classNameOrVariableName + "." + methodName);
+ List argTypeList = methodSym.getArgumentList();
+ Iterator formalParamTypeIt = argTypeList.iterator();
+ Iterator actualParamIt = pList.iterator();
+ if(argTypeList.size() == pList.size())
+ {
+ while(formalParamTypeIt.hasNext() && actualParamIt.hasNext())
+ {
+ Argument formalArg = (Argument)formalParamTypeIt.next();
+ Expression actualParam = (Expression)actualParamIt.next();
+ if(!TypeResolver.isTypeAssignableForEquality(formalArg.getType(),actualParam.getType())
+ || formalArg.getIsArray() != actualParam.isArray())
+ {
+ throw new SPLException("Formal and passed parameter types don't match for method "
+ + methodName);
+ }
+
+ }
+ }
+ else
+ {
+ System.err.println("Number of Formal and passed parameters don't match for method "
+ + methodName);
+// throw new SPLException("Number of Formal and passed parameters don't match for method "
+// + methodName);
+ }
+
+
+ }
+
+ private void _validate() throws SPLException
+ {
+
+ validateActualParameters(_symTab,_optClassName,_methodName,_pList);
+
+ }
+
+ public static Object invokeClassMethod(SPLSymbolTable symTab,
+ String className,
+ String qualifier,
+ String methodName,
+ List paramList,
+ Object targetObject)
+ {
+ List parameterObjects = new ArrayList();
+
+ try
+ {
+
+ MethodSymbol methodSym =
+ (MethodSymbol)symTab.getSymbol(className + "." + methodName);
+ List argTypeList = methodSym.getArgumentList();
+
+
+
+ for (int i = 0; i < paramList.size(); i++)
+ {
+ Expression exp = (Expression) paramList.get(i);
+
+ if(exp instanceof AssignmentExpression)
+ {
+ //System.out.println("assignment Expression");
+ Expression lhsExpression = null;
+ Expression rhsExpression = null;
+
+
+ AssignmentExpression assignmentExpression = (AssignmentExpression) exp;
+ if (assignmentExpression.getLHSExpression() instanceof org.apache.imperius.spl.external.Expression)
+ {
+ lhsExpression = (Expression) assignmentExpression
+ .getLHSExpression();
+ }
+ if (assignmentExpression.getRHSExpression() instanceof org.apache.imperius.spl.external.Expression)
+ {
+ rhsExpression = (Expression) assignmentExpression
+ .getRHSExpression();
+ }
+ if ((lhsExpression == null) || (rhsExpression == null))
+ {
+ logger.severe("LHS or RHS or argument in method call is null : "+lhsExpression.toString()+" "+rhsExpression);
+
+ throw new SPLException("LHS or RHS or argument in method call is null : "+lhsExpression.toString()+" "+rhsExpression);
+
+ }
+ //System.out.println("lhsExpression class "+ lhsExpression.getClass());
+ //System.out.println("lhsExpression getPropertyName() "+ ((PrimaryExpression) lhsExpression).getPropertyName());
+ // ((PrimaryExpression)lhsExpression).getPropertyName();
+
+ String keyName = ((PrimaryExpression) lhsExpression)
+ .getclassNameOrInstanceVariableName();
+ //System.out.println("argument name= " + keyName);
+
+ Object keyValue = rhsExpression.evaluate();
+ //System.out.println("argument value= " + keyValue);
+
+ String referenceTypeName="";
+
+ if(TypeResolver.isReference(rhsExpression.getType()))
+ {
+
+ referenceTypeName = rhsExpression.getType().getReferenceTypeName();
+ }
+
+ if(keyValue!= null){
+ Argument arg=new ArgumentImpl(rhsExpression.getType().getType(), keyName, rhsExpression.isArray(), referenceTypeName);
+ arg.setValue(keyValue);
+ //System.out.println("created new arg :"+keyName+" "+keyValue.toString());
+ /*
+ * Expression expression=(Expression)pList.get(i); String
+ * nameAndValue=(String)expression.evaluate(); Key
+ */
+ parameterObjects.add(arg);
+ }
+
+ }
+ else
+ {
+ //System.out.println("argument is not an assignment Expression");
+
+ Object result = exp.evaluate();
+ Argument arg=new ArgumentImpl(exp.getType().getType(), null, exp.isArray(), null);
+ arg.setValue(result);
+ parameterObjects.add(arg);
+ }
+
+ }
+
+ Actuator ac = ActuatorFactory.getActuator();
+
+ Object result = ac.invokeMethod(className, qualifier, targetObject,
+ methodName, parameterObjects);
+
+
+
+ //System.out.println("method invokation complete : "+className+" "+qualifier+" "+methodName+" "+targetObject);
+ //System.out.println("method invokation result of invokation : "+result);
+
+ // TO DO COMPARE RESULT WITH CONSTANT
+
+
+
+ return result;
+ }
+ catch (SPLException e)
+ {
+ e.printStackTrace();
+ logger.severe(e.getMessage());
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ return null;
+ }
+
+ }
+
+ public boolean execute(Actuator ac)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+ boolean postExprResult=false;
+ Object instance = _symTab.getInstance(_optClassName);
+ String qualifier = _symTab.getQualifierForClass(_optClassName);
+ Object result = invokeClassMethod(_symTab,_optClassName, qualifier, _methodName,_pList,instance);
+
+ if(result != null )
+ {
+ if(_constantExpression == null)
+ {
+ postExprResult = true;
+ }
+ else
+ {
+ Expression constexpr=this._constantExpression;
+ Object constresult;
+ int compareResult=0;
+ try{
+ constresult=constexpr.evaluate();
+ compareResult=ExpressionUtility.compare(result, constresult);
+ }
+ catch(SPLException e){
+ e.printStackTrace();
+ logger.severe(Thread.currentThread().getName()+" "+e.getMessage());
+
+ }
+ String operation=this._operatorType;
+ if(operation.equalsIgnoreCase("==")){
+ if(compareResult!=0)
+ postExprResult=false;
+ else
+ postExprResult=true;
+ }
+ else if(operation.equalsIgnoreCase("!=")){
+ if(compareResult==0)
+ postExprResult=false;
+ else
+ postExprResult=true;
+ }
+ else if(operation.equalsIgnoreCase(">=")){
+ if(compareResult < 0)
+ postExprResult=false;
+ else
+ postExprResult=true;
+ }
+ else if(operation.equalsIgnoreCase(">")){
+ if(compareResult <= 0)
+ postExprResult=false;
+ else
+ postExprResult=true;
+ }
+ else if(operation.equalsIgnoreCase("<")){
+ if(compareResult >= 0)
+ postExprResult=false;
+ else
+ postExprResult=true;
+ }
+ else if(operation.equalsIgnoreCase("<=")){
+ if(compareResult > 0)
+ postExprResult=false;
+ else
+ postExprResult=true;
+ }
+ else {
+ logger.severe(Thread.currentThread().getName()+" "+"operation did not match any of the standard expressions "+operation);
+
+ }
+ }
+ //System.out.println("AnchorMethodInvokeAction returning "+postExprResult);
+ return postExprResult;
+ }
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+ return false;
+
+ }
+
+ public String getMethodName()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getMethodName");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getMethodName");
+
+ return _methodName;
+ }
+
+ public void setMethodName(String methodName)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setMethodName");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setMethodName");
+
+ _methodName = methodName;
+ }
+
+ public String getOptClassName()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getOptClassName");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getOptClassName");
+
+ return _optClassName;
+ }
+
+ public void setOptClassName(String optClassName)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setOptClassName");
+
+ _optClassName = optClassName;
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setOptClassName");
+
+ }
+
+ public List getPList()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getPList");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getPList");
+
+ return _pList;
+ }
+
+ public void setPList(ArrayList list)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setPList");
+
+ _pList = list;
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setPList");
+
+ }
+
+ public Expression getConstantExpression()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getConstantExpression");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getConstantExpression");
+
+ return _constantExpression;
+ }
+
+ public void setConstantExpression(Expression constantExpression)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setConstantExpression");
+
+ _constantExpression = constantExpression;
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setConstantExpression");
+
+ }
+
+ public String getOperatorType()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getOperatorType");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getOperatorType");
+
+ return _operatorType;
+ }
+
+ public void setOperatorType(String operatorType)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setOperatorType");
+
+ _operatorType = operatorType;
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setOperatorType");
+
+ }
+
+
+
+}
Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/AnchorMethodInvokeAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ArrowActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ArrowActionBlock.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ArrowActionBlock.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ArrowActionBlock.java Fri Jan 11 10:56:30 2008
@@ -1,79 +1,79 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.statements.actions.impl;
-
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Actuator;
-import org.apache.imperius.spl.parser.statements.ActionBlock;
-import org.apache.imperius.util.SPLLogger;
-
-
-public class ArrowActionBlock extends DoubleArgumentActionBlock
-{
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-
- private static final String sourceClass="ArrowActionBlock";
-
-
- public ArrowActionBlock(ActionBlock a1, ActionBlock a2)
- {
- super(a1, a2);
-
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ArrowActionBlock");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "ArrowActionBlock");
-
- // TODO Auto-generated constructor stub
- }
-
- // @Override
- /**
- * If the block is of the form <action block >- ><action block> and the
- * first block returns failure, the second block is not evaluated and the
- * whole block returns failure. If the first block succeeds, the second
- * block is evaluated and the whole block returns whatever the second block
- * returns.
- */
- public boolean execute(Actuator ac)
- {
-
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
-
- boolean result = true;
-
- boolean result1 = _leftActionBlock.execute( ac);
- if (result1)
- {
- result = _rightActionBlock.execute( ac);
- }
- else
- {
- result = false;
- }
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- return result;
-
- }
-
-
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.actions.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Actuator;
+import org.apache.imperius.spl.parser.statements.ActionBlock;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class ArrowActionBlock extends DoubleArgumentActionBlock
+{
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+ private static final String sourceClass="ArrowActionBlock";
+
+
+ public ArrowActionBlock(ActionBlock a1, ActionBlock a2)
+ {
+ super(a1, a2);
+
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ArrowActionBlock");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "ArrowActionBlock");
+
+ // TODO Auto-generated constructor stub
+ }
+
+ // @Override
+ /**
+ * If the block is of the form <action block >- ><action block> and the
+ * first block returns failure, the second block is not evaluated and the
+ * whole block returns failure. If the first block succeeds, the second
+ * block is evaluated and the whole block returns whatever the second block
+ * returns.
+ */
+ public boolean execute(Actuator ac)
+ {
+
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+
+ boolean result = true;
+
+ boolean result1 = _leftActionBlock.execute( ac);
+ if (result1)
+ {
+ result = _rightActionBlock.execute( ac);
+ }
+ else
+ {
+ result = false;
+ }
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ return result;
+
+ }
+
+
+}
Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ArrowActionBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ConcurrentActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ConcurrentActionBlock.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ConcurrentActionBlock.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ConcurrentActionBlock.java Fri Jan 11 10:56:30 2008
@@ -1,63 +1,63 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.statements.actions.impl;
-
-
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Actuator;
-import org.apache.imperius.spl.parser.statements.ActionBlock;
-import org.apache.imperius.util.SPLLogger;
-
-
-public class ConcurrentActionBlock extends DoubleArgumentActionBlock
-{
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-
- private static final String sourceClass="ConcurrentActionBlock";
-
- public ConcurrentActionBlock(ActionBlock a1, ActionBlock a2)
- {
- super(a1, a2);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ConcurrentActionBlock");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "ConcurrentActionBlock");
-
- }
-
- // @Override
- /**
- * If the block is of the form <action block> || <action block>, both blocks
- * are evaluated concurrently and the whole block succeeds as soon as one of
- * the two internal blocks succeeds.
- */
- public boolean execute(Actuator ac)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
-
- boolean result1 = _leftActionBlock.execute(ac);
- boolean result2 = _rightActionBlock.execute(ac);
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- return result1 || result2;
- }
-
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.actions.impl;
+
+
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Actuator;
+import org.apache.imperius.spl.parser.statements.ActionBlock;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class ConcurrentActionBlock extends DoubleArgumentActionBlock
+{
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+ private static final String sourceClass="ConcurrentActionBlock";
+
+ public ConcurrentActionBlock(ActionBlock a1, ActionBlock a2)
+ {
+ super(a1, a2);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ConcurrentActionBlock");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "ConcurrentActionBlock");
+
+ }
+
+ // @Override
+ /**
+ * If the block is of the form <action block> || <action block>, both blocks
+ * are evaluated concurrently and the whole block succeeds as soon as one of
+ * the two internal blocks succeeds.
+ */
+ public boolean execute(Actuator ac)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+
+ boolean result1 = _leftActionBlock.execute(ac);
+ boolean result2 = _rightActionBlock.execute(ac);
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ return result1 || result2;
+ }
+
+}
Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ConcurrentActionBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/DoubleArgumentActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/DoubleArgumentActionBlock.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/DoubleArgumentActionBlock.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/DoubleArgumentActionBlock.java Fri Jan 11 10:56:30 2008
@@ -1,95 +1,95 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.statements.actions.impl;
-
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.parser.statements.ActionBlock;
-import org.apache.imperius.util.SPLLogger;
-
-
-
-public abstract class DoubleArgumentActionBlock implements ActionBlock
-{
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
- private static final String sourceClass="DoubleArgumentActionBlock";
-
-
- protected ActionBlock _leftActionBlock;
-
- protected ActionBlock _rightActionBlock;
-
-
-
- public DoubleArgumentActionBlock(ActionBlock a1, ActionBlock a2)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "DoubleArgumentActionBlock");
-
- _leftActionBlock = a1;
- _rightActionBlock = a2;
-
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "DoubleArgumentActionBlock");
-
- }
-
-
-
- public ActionBlock getLeftActionBlock()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getLeftActionBlock");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getLeftActionBlock");
-
- return _leftActionBlock;
- }
-
- public void setLeftActionBlock(ActionBlock leftActionBlock)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setLeftActionBlock");
-
-
- this._leftActionBlock = leftActionBlock;
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setLeftActionBlock");
-
- }
-
- public ActionBlock getRightActionBlock()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getRightActionBlock");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getRightActionBlock");
-
- return _rightActionBlock;
- }
-
- public void setRightActionBlock(ActionBlock rightActionBlock)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setRightActionBlock");
-
- this._rightActionBlock = rightActionBlock;
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setRightActionBlock");
-
- }
-
-
-
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.actions.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.parser.statements.ActionBlock;
+import org.apache.imperius.util.SPLLogger;
+
+
+
+public abstract class DoubleArgumentActionBlock implements ActionBlock
+{
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+ private static final String sourceClass="DoubleArgumentActionBlock";
+
+
+ protected ActionBlock _leftActionBlock;
+
+ protected ActionBlock _rightActionBlock;
+
+
+
+ public DoubleArgumentActionBlock(ActionBlock a1, ActionBlock a2)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "DoubleArgumentActionBlock");
+
+ _leftActionBlock = a1;
+ _rightActionBlock = a2;
+
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "DoubleArgumentActionBlock");
+
+ }
+
+
+
+ public ActionBlock getLeftActionBlock()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getLeftActionBlock");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getLeftActionBlock");
+
+ return _leftActionBlock;
+ }
+
+ public void setLeftActionBlock(ActionBlock leftActionBlock)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setLeftActionBlock");
+
+
+ this._leftActionBlock = leftActionBlock;
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setLeftActionBlock");
+
+ }
+
+ public ActionBlock getRightActionBlock()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getRightActionBlock");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getRightActionBlock");
+
+ return _rightActionBlock;
+ }
+
+ public void setRightActionBlock(ActionBlock rightActionBlock)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setRightActionBlock");
+
+ this._rightActionBlock = rightActionBlock;
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setRightActionBlock");
+
+ }
+
+
+
+}
Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/DoubleArgumentActionBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ExtrinsicMethodInvokeAction.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ExtrinsicMethodInvokeAction.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ExtrinsicMethodInvokeAction.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ExtrinsicMethodInvokeAction.java Fri Jan 11 10:56:30 2008
@@ -1,59 +1,59 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-
-package org.apache.imperius.spl.parser.statements.actions.impl;
-
-import java.util.List;
-
-import org.apache.imperius.spl.external.Actuator;
-import org.apache.imperius.spl.external.Expression;
-import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.factory.BuitInOperationExpressionFactory;
-import org.apache.imperius.spl.parser.statements.BasicActionBlock;
-
-
-public class ExtrinsicMethodInvokeAction implements BasicActionBlock
-{
- Expression _actionExpression = null;
- public ExtrinsicMethodInvokeAction(String methodName, List paramList, SPLSymbolTable sst) throws SPLException
- {
- _actionExpression =
- BuitInOperationExpressionFactory.createBuiltInAction(
- methodName, paramList, sst);
-
- }
-
- public boolean execute(Actuator ac)
- {
- try
- {
- _actionExpression.evaluate();
- return true;
- }
- catch (SPLException e)
- {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- return false;
- }
-
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.statements.actions.impl;
+
+import java.util.List;
+
+import org.apache.imperius.spl.external.Actuator;
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.factory.BuitInOperationExpressionFactory;
+import org.apache.imperius.spl.parser.statements.BasicActionBlock;
+
+
+public class ExtrinsicMethodInvokeAction implements BasicActionBlock
+{
+ Expression _actionExpression = null;
+ public ExtrinsicMethodInvokeAction(String methodName, List paramList, SPLSymbolTable sst) throws SPLException
+ {
+ _actionExpression =
+ BuitInOperationExpressionFactory.createBuiltInAction(
+ methodName, paramList, sst);
+
+ }
+
+ public boolean execute(Actuator ac)
+ {
+ try
+ {
+ _actionExpression.evaluate();
+ return true;
+ }
+ catch (SPLException e)
+ {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+}
Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ExtrinsicMethodInvokeAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/InvokePolicyAction.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/InvokePolicyAction.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/InvokePolicyAction.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/InvokePolicyAction.java Fri Jan 11 10:56:30 2008
@@ -1,204 +1,204 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.statements.actions.impl;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Actuator;
-import org.apache.imperius.spl.external.Expression;
-import org.apache.imperius.spl.external.InternalClient;
-import org.apache.imperius.spl.external.TypeConstants;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.statements.BasicActionBlock;
-import org.apache.imperius.spl.parser.util.InternalClientFactory;
-import org.apache.imperius.spl.parser.util.TypeInfo;
-import org.apache.imperius.util.SPLLogger;
-
-
-
-
-public class InvokePolicyAction implements BasicActionBlock
-{
-
- private List _paramList;
-
- private String _className;
-
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-
- public static final int POLICY_EVALUATED_SUCCESSFULLY = 0;
- public static final int POLICY_NOT_EVALUATED = 1;
- public static final int POLICY_EVALUATION_FAILED = -1;
-
-
- private static final String sourceClass="InvokePolicyAction";
-
-
- public InvokePolicyAction(List paramList)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "InvokePolicyAction");
- //System.out.println("creating InvokePolicyAction ");
-
-// _className = className;
- _paramList = paramList;
-
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "InvokePolicyAction");
-
- }
-
- public boolean execute(Actuator ac)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- //System.out.println("Executing InvokePolicy action on "+this.getClassName());
-
- Expression _lhsExp = null;
- Expression _rhsExp = null;
-
- TypeInfo lType=null;
- TypeInfo rType=null;
-
- try
- {
- //System.out.println("size of parameters in InvokePolicy action block :"+ this._paramList.size());
- if(_paramList.size() > 2 || _paramList.size() == 0)
- {
- logger.severe(
- "number of parameters passed to a InvokePolicyAction shoul be 2");
-
- throw new SPLException("Last Expression should be a collection");
- }
- if(_paramList.size()==1)
- {
- _lhsExp = (Expression)_paramList.get(0);
-
- lType=_lhsExp.getType();
-
-
- if (lType.getType() != TypeConstants.stringType)
- {
- logger.severe(
- "first Expression should be a string describing the Operation");
- throw new SPLException(
- "first Expression should be a string describing the Operation");
- }
-
- String policyName=(String)_lhsExp.evaluate();
- InternalClient ic=InternalClientFactory.getInternalClient();
- int returnValue=ic.invokePolicy(policyName, null, true);
- //System.out.println("policy evaluations return val="+returnValue);
- return true;
- }
- if(_paramList.size()==2)
- {
- _lhsExp = (Expression)_paramList.get(0);
- _rhsExp = (Expression)_paramList.get(1);
-
- lType=_lhsExp.getType();
- rType=_rhsExp.getType();
-
-
- if (lType.getType() != TypeConstants.stringType)
- {
- logger.severe(
- "first Expression should be a string describing the Operation");
- throw new SPLException(
- "first Expression should be a string describing the Operation");
- }
- String policyName=(String)_lhsExp.evaluate();
-
- Object rhsResult = _rhsExp.evaluate();
- //System.out.println("rhsResult , class " + rhsResult + " "+ rhsResult.getClass());
- if (!(rhsResult instanceof java.util.List))
- {
-
- logger.severe(
- "rhsResult is not of type List");
-
- throw new SPLException("rhsResult is not of type List");
- }
- List instanceList=(List)rhsResult;
- InternalClient ic=InternalClientFactory.getInternalClient();
- int returnValue=ic.invokePolicy(policyName, instanceList, true);
- //System.out.println("policy evaluations return val="+returnValue);
- return true;
-
- }
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- return false;
- }
- catch (SPLException e)
- {
- logger.severe(e.getMessage());
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- return false;
- }
-
-
- }
-
- public String getClassName()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getClassName");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getClassName");
-
- return _className;
- }
-
- public void setClassName(String className)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setClassName");
-
-
- _className = className;
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setClassName");
-
- }
-
- public List getParamList()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getParamList");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getParamList");
-
- return _paramList;
- }
-
- public void setParamList(ArrayList paramList)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
-
-
- _paramList = paramList;
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
-
- }
-
-
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.actions.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Actuator;
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.external.InternalClient;
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.statements.BasicActionBlock;
+import org.apache.imperius.spl.parser.util.InternalClientFactory;
+import org.apache.imperius.spl.parser.util.TypeInfo;
+import org.apache.imperius.util.SPLLogger;
+
+
+
+
+public class InvokePolicyAction implements BasicActionBlock
+{
+
+ private List _paramList;
+
+ private String _className;
+
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+ public static final int POLICY_EVALUATED_SUCCESSFULLY = 0;
+ public static final int POLICY_NOT_EVALUATED = 1;
+ public static final int POLICY_EVALUATION_FAILED = -1;
+
+
+ private static final String sourceClass="InvokePolicyAction";
+
+
+ public InvokePolicyAction(List paramList)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "InvokePolicyAction");
+ //System.out.println("creating InvokePolicyAction ");
+
+// _className = className;
+ _paramList = paramList;
+
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "InvokePolicyAction");
+
+ }
+
+ public boolean execute(Actuator ac)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ //System.out.println("Executing InvokePolicy action on "+this.getClassName());
+
+ Expression _lhsExp = null;
+ Expression _rhsExp = null;
+
+ TypeInfo lType=null;
+ TypeInfo rType=null;
+
+ try
+ {
+ //System.out.println("size of parameters in InvokePolicy action block :"+ this._paramList.size());
+ if(_paramList.size() > 2 || _paramList.size() == 0)
+ {
+ logger.severe(
+ "number of parameters passed to a InvokePolicyAction shoul be 2");
+
+ throw new SPLException("Last Expression should be a collection");
+ }
+ if(_paramList.size()==1)
+ {
+ _lhsExp = (Expression)_paramList.get(0);
+
+ lType=_lhsExp.getType();
+
+
+ if (lType.getType() != TypeConstants.stringType)
+ {
+ logger.severe(
+ "first Expression should be a string describing the Operation");
+ throw new SPLException(
+ "first Expression should be a string describing the Operation");
+ }
+
+ String policyName=(String)_lhsExp.evaluate();
+ InternalClient ic=InternalClientFactory.getInternalClient();
+ int returnValue=ic.invokePolicy(policyName, null, true);
+ //System.out.println("policy evaluations return val="+returnValue);
+ return true;
+ }
+ if(_paramList.size()==2)
+ {
+ _lhsExp = (Expression)_paramList.get(0);
+ _rhsExp = (Expression)_paramList.get(1);
+
+ lType=_lhsExp.getType();
+ rType=_rhsExp.getType();
+
+
+ if (lType.getType() != TypeConstants.stringType)
+ {
+ logger.severe(
+ "first Expression should be a string describing the Operation");
+ throw new SPLException(
+ "first Expression should be a string describing the Operation");
+ }
+ String policyName=(String)_lhsExp.evaluate();
+
+ Object rhsResult = _rhsExp.evaluate();
+ //System.out.println("rhsResult , class " + rhsResult + " "+ rhsResult.getClass());
+ if (!(rhsResult instanceof java.util.List))
+ {
+
+ logger.severe(
+ "rhsResult is not of type List");
+
+ throw new SPLException("rhsResult is not of type List");
+ }
+ List instanceList=(List)rhsResult;
+ InternalClient ic=InternalClientFactory.getInternalClient();
+ int returnValue=ic.invokePolicy(policyName, instanceList, true);
+ //System.out.println("policy evaluations return val="+returnValue);
+ return true;
+
+ }
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ return false;
+ }
+ catch (SPLException e)
+ {
+ logger.severe(e.getMessage());
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ return false;
+ }
+
+
+ }
+
+ public String getClassName()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getClassName");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getClassName");
+
+ return _className;
+ }
+
+ public void setClassName(String className)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setClassName");
+
+
+ _className = className;
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setClassName");
+
+ }
+
+ public List getParamList()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getParamList");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getParamList");
+
+ return _paramList;
+ }
+
+ public void setParamList(ArrayList paramList)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
+
+
+ _paramList = paramList;
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
+
+ }
+
+
+}
Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/InvokePolicyAction.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalAndActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalAndActionBlock.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalAndActionBlock.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalAndActionBlock.java Fri Jan 11 10:56:30 2008
@@ -1,65 +1,65 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.statements.actions.impl;
-
-
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Actuator;
-import org.apache.imperius.spl.parser.statements.ActionBlock;
-import org.apache.imperius.util.SPLLogger;
-
-
-
-public class LogicalAndActionBlock extends DoubleArgumentActionBlock
-{
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-
- private static final String sourceClass="LogicalAndActionBlock";
-
- public LogicalAndActionBlock(ActionBlock a1, ActionBlock a2)
- {
- super(a1, a2);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "LogicalAndActionBlock");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "LogicalAndActionBlock");
-
- // TODO Auto-generated constructor stub
- }
-
- // @Override
- /**
- * If the block is of the form <action block> && <action block>, both blocks
- * may be evaluated concurrently and the whole block succeeds if both
- * internal blocks return success.
- */
- public boolean execute(Actuator ac)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- boolean result = (_leftActionBlock.execute(ac) && _rightActionBlock.execute(ac));
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- return result;
-
- }
-
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.actions.impl;
+
+
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Actuator;
+import org.apache.imperius.spl.parser.statements.ActionBlock;
+import org.apache.imperius.util.SPLLogger;
+
+
+
+public class LogicalAndActionBlock extends DoubleArgumentActionBlock
+{
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+ private static final String sourceClass="LogicalAndActionBlock";
+
+ public LogicalAndActionBlock(ActionBlock a1, ActionBlock a2)
+ {
+ super(a1, a2);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "LogicalAndActionBlock");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "LogicalAndActionBlock");
+
+ // TODO Auto-generated constructor stub
+ }
+
+ // @Override
+ /**
+ * If the block is of the form <action block> && <action block>, both blocks
+ * may be evaluated concurrently and the whole block succeeds if both
+ * internal blocks return success.
+ */
+ public boolean execute(Actuator ac)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ boolean result = (_leftActionBlock.execute(ac) && _rightActionBlock.execute(ac));
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ return result;
+
+ }
+
+}
Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalAndActionBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalOrActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalOrActionBlock.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalOrActionBlock.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalOrActionBlock.java Fri Jan 11 10:56:30 2008
@@ -1,73 +1,73 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.statements.actions.impl;
-
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Actuator;
-import org.apache.imperius.spl.parser.statements.ActionBlock;
-import org.apache.imperius.util.SPLLogger;
-
-
-
-public class LogicalOrActionBlock extends DoubleArgumentActionBlock
-{
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-
- private static final String sourceClass="LogicalOrActionBlock";
-
-
- public LogicalOrActionBlock(ActionBlock a1, ActionBlock a2)
- {
- super(a1, a2);
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "LogicalOrActionBlock");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "LogicalOrActionBlock");
-
- // TODO Auto-generated constructor stub
- }
-
- // @Override
- /**
- * If the block is of the form <action block> | <action block>, the first
- * block is evaluated. If it succeeds, the whole block succeeds and the
- * second block is not evaluated. If the first block fails, the second block
- * is evaluated and the whole block returns whatever the second block
- * returns.
- */
- public boolean execute(Actuator ac)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
-
- boolean result = true;
- boolean res1 = _rightActionBlock.execute(ac);
- if (!res1)
- {
- result = _leftActionBlock.execute(ac);
- }
-
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- return result;
- }
-
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.actions.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Actuator;
+import org.apache.imperius.spl.parser.statements.ActionBlock;
+import org.apache.imperius.util.SPLLogger;
+
+
+
+public class LogicalOrActionBlock extends DoubleArgumentActionBlock
+{
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+ private static final String sourceClass="LogicalOrActionBlock";
+
+
+ public LogicalOrActionBlock(ActionBlock a1, ActionBlock a2)
+ {
+ super(a1, a2);
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "LogicalOrActionBlock");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "LogicalOrActionBlock");
+
+ // TODO Auto-generated constructor stub
+ }
+
+ // @Override
+ /**
+ * If the block is of the form <action block> | <action block>, the first
+ * block is evaluated. If it succeeds, the whole block succeeds and the
+ * second block is not evaluated. If the first block fails, the second block
+ * is evaluated and the whole block returns whatever the second block
+ * returns.
+ */
+ public boolean execute(Actuator ac)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+
+ boolean result = true;
+ boolean res1 = _rightActionBlock.execute(ac);
+ if (!res1)
+ {
+ result = _leftActionBlock.execute(ac);
+ }
+
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ return result;
+ }
+
+}
Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalOrActionBlock.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/SetActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/SetActionBlock.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/SetActionBlock.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/SetActionBlock.java Fri Jan 11 10:56:30 2008
@@ -1,180 +1,180 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-//
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-package org.apache.imperius.spl.parser.statements.actions.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Actuator;
-import org.apache.imperius.spl.external.Expression;
-import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expression.primary.PrimaryExpression;
-import org.apache.imperius.spl.parser.expressions.impl.AssignmentExpression;
-import org.apache.imperius.spl.parser.statements.BasicActionBlock;
-import org.apache.imperius.util.SPLLogger;
-
-
-
-
-public class SetActionBlock implements BasicActionBlock
-{
-
- private List _paramList;
-
- private String _className;
-
- private SPLSymbolTable _symTab;
-
- private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-
- private static final String sourceClass="SetActionBlock";
-
-
- public SetActionBlock(String className, List paramList, SPLSymbolTable symTab)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "SetActionBlock");
- //System.out.println("creating SetActionBlock "+className);
-
- _className = className;
- _paramList = paramList;
- _symTab = symTab;
-
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "SetActionBlock");
-
- }
-
- public boolean execute(Actuator ac)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- //System.out.println("Executing set action on "+this.getClassName());
- HashMap modifiedProperties = new HashMap();
- String instanceName = _className;
- try
- {
- //System.out.println("size of parameters in set action block :"+ this._paramList.size());
- for (int i = 0; i < _paramList.size(); i++)
- {
- if (_paramList.get(i) != null)
- {
- //System.out.println("setactionblock::paramList.get(i) "+ this._paramList.get(i));
- if (_paramList.get(i) instanceof AssignmentExpression)
- {
- AssignmentExpression assignmentExpression =
- (AssignmentExpression) _paramList.get(i);
- PrimaryExpression lhsExpression =
- (PrimaryExpression) assignmentExpression.getLHSExpression();
-
- Expression rhsExpression =
- (Expression) assignmentExpression.getRHSExpression();
- instanceName = lhsExpression.getclassNameOrInstanceVariableName();
- String keyName = lhsExpression.getPropertyName();
- /* int indOfDot = keyName.indexOf('.');
- if (indOfDot != -1)
- {
- instanceName = keyName.substring(0,indOfDot);
- keyName = keyName.substring(indOfDot + 1);
- }*/
-
- Object keyValue = rhsExpression.evaluate();
- modifiedProperties.put(keyName, keyValue);
-
- }
- else
- {
-
- logger.severe(Thread.currentThread().getName()+" "+"paramlist in SetActionBlock does not consist of asignment expressions");
- throw new SPLException("paramlist in SetActionBlock does not consist of asignment expressions");
-
- }
- }
- else
- {
- logger.severe(Thread.currentThread().getName()+" "+"the parameter at position " + i + " is null ");
- throw new SPLException("the parameter at position " + i + " is null ");
- }
-
- }
- Object instance = _symTab.getInstance(instanceName);
- String qualifier = _symTab.getQualifierForClass(_className);
- ac.modifyInstance(_className, qualifier, instance, modifiedProperties);
-
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- return true;
- }
- catch (SPLException e)
- {
- logger.severe(e.getMessage());
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
-
- return false;
- }
-
-
- }
-
- public String getClassName()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getClassName");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getClassName");
-
- return _className;
- }
-
- public void setClassName(String className)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setClassName");
-
-
- _className = className;
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setClassName");
-
- }
-
- public List getParamList()
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getParamList");
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getParamList");
-
- return _paramList;
- }
-
- public void setParamList(ArrayList paramList)
- {
- logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
-
-
- _paramList = paramList;
-
- logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
-
- }
-
-
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.actions.impl;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Actuator;
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expression.primary.PrimaryExpression;
+import org.apache.imperius.spl.parser.expressions.impl.AssignmentExpression;
+import org.apache.imperius.spl.parser.statements.BasicActionBlock;
+import org.apache.imperius.util.SPLLogger;
+
+
+
+
+public class SetActionBlock implements BasicActionBlock
+{
+
+ private List _paramList;
+
+ private String _className;
+
+ private SPLSymbolTable _symTab;
+
+ private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+ private static final String sourceClass="SetActionBlock";
+
+
+ public SetActionBlock(String className, List paramList, SPLSymbolTable symTab)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "SetActionBlock");
+ //System.out.println("creating SetActionBlock "+className);
+
+ _className = className;
+ _paramList = paramList;
+ _symTab = symTab;
+
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "SetActionBlock");
+
+ }
+
+ public boolean execute(Actuator ac)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ //System.out.println("Executing set action on "+this.getClassName());
+ HashMap modifiedProperties = new HashMap();
+ String instanceName = _className;
+ try
+ {
+ //System.out.println("size of parameters in set action block :"+ this._paramList.size());
+ for (int i = 0; i < _paramList.size(); i++)
+ {
+ if (_paramList.get(i) != null)
+ {
+ //System.out.println("setactionblock::paramList.get(i) "+ this._paramList.get(i));
+ if (_paramList.get(i) instanceof AssignmentExpression)
+ {
+ AssignmentExpression assignmentExpression =
+ (AssignmentExpression) _paramList.get(i);
+ PrimaryExpression lhsExpression =
+ (PrimaryExpression) assignmentExpression.getLHSExpression();
+
+ Expression rhsExpression =
+ (Expression) assignmentExpression.getRHSExpression();
+ instanceName = lhsExpression.getclassNameOrInstanceVariableName();
+ String keyName = lhsExpression.getPropertyName();
+ /* int indOfDot = keyName.indexOf('.');
+ if (indOfDot != -1)
+ {
+ instanceName = keyName.substring(0,indOfDot);
+ keyName = keyName.substring(indOfDot + 1);
+ }*/
+
+ Object keyValue = rhsExpression.evaluate();
+ modifiedProperties.put(keyName, keyValue);
+
+ }
+ else
+ {
+
+ logger.severe(Thread.currentThread().getName()+" "+"paramlist in SetActionBlock does not consist of asignment expressions");
+ throw new SPLException("paramlist in SetActionBlock does not consist of asignment expressions");
+
+ }
+ }
+ else
+ {
+ logger.severe(Thread.currentThread().getName()+" "+"the parameter at position " + i + " is null ");
+ throw new SPLException("the parameter at position " + i + " is null ");
+ }
+
+ }
+ Object instance = _symTab.getInstance(instanceName);
+ String qualifier = _symTab.getQualifierForClass(_className);
+ ac.modifyInstance(_className, qualifier, instance, modifiedProperties);
+
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ return true;
+ }
+ catch (SPLException e)
+ {
+ logger.severe(e.getMessage());
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+
+ return false;
+ }
+
+
+ }
+
+ public String getClassName()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getClassName");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getClassName");
+
+ return _className;
+ }
+
+ public void setClassName(String className)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setClassName");
+
+
+ _className = className;
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setClassName");
+
+ }
+
+ public List getParamList()
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getParamList");
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getParamList");
+
+ return _paramList;
+ }
+
+ public void setParamList(ArrayList paramList)
+ {
+ logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
+
+
+ _paramList = paramList;
+
+ logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
+
+ }
+
+
+}
Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/SetActionBlock.java
------------------------------------------------------------------------------
svn:eol-style = native