incubator-imperius-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jnee...@apache.org
Subject svn commit: r606479 [21/30] - in /incubator/imperius/trunk/trunk: ./ modules/ modules/imperius-javaspl/ modules/imperius-javaspl/resources/ modules/imperius-javaspl/resources/samples/ modules/imperius-javaspl/resources/samples/computersystem/ modules/i...
Date Sat, 22 Dec 2007 19:34:03 GMT
Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/ActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/ActionBlock.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/ActionBlock.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/ActionBlock.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,29 @@
+/*
+ * 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 Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements;
+
+
+import org.apache.imperius.spl.external.Actuator;
+
+public interface ActionBlock {
+	
+	boolean execute(Actuator ac);
+
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/BasicActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/BasicActionBlock.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/BasicActionBlock.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/BasicActionBlock.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,25 @@
+/*
+ * 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 Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements;
+
+public interface BasicActionBlock extends ActionBlock
+{
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/PolicyStatement.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/PolicyStatement.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/PolicyStatement.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/PolicyStatement.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,37 @@
+/*
+ * 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 Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements;
+
+import org.apache.imperius.spl.external.Actuator;
+import org.apache.imperius.spl.external.DataCollector;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+
+
+public interface PolicyStatement
+{
+    
+    int getPriority();
+    
+    int evaluate(DataCollector dc,Actuator ac) throws SPLException;
+    
+    String toString();
+    
+    String getAuditLogString();
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/AnchorMethodInvokeAction.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/AnchorMethodInvokeAction.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/AnchorMethodInvokeAction.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/AnchorMethodInvokeAction.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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 <prabalig@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");
+
+	}
+
+
+
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ArrowActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ArrowActionBlock.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ArrowActionBlock.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ArrowActionBlock.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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 <prabalig@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;
+        
+    }
+
+	
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ConcurrentActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ConcurrentActionBlock.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ConcurrentActionBlock.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ConcurrentActionBlock.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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 <prabalig@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;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/DoubleArgumentActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/DoubleArgumentActionBlock.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/DoubleArgumentActionBlock.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/DoubleArgumentActionBlock.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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 <prabalig@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");
+ 
+    }
+    
+  
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ExtrinsicMethodInvokeAction.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ExtrinsicMethodInvokeAction.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ExtrinsicMethodInvokeAction.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/ExtrinsicMethodInvokeAction.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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 <prabalig@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;
+	}
+
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/InvokePolicyAction.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/InvokePolicyAction.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/InvokePolicyAction.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/InvokePolicyAction.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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 <prabalig@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");
+
+	}
+
+
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/LogicalAndActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/LogicalAndActionBlock.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/LogicalAndActionBlock.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/LogicalAndActionBlock.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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 <prabalig@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;
+        
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/LogicalOrActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/LogicalOrActionBlock.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/LogicalOrActionBlock.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/LogicalOrActionBlock.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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 <prabalig@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;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/SetActionBlock.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/SetActionBlock.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/SetActionBlock.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/actions/impl/SetActionBlock.java Sat Dec 22 11:33:46 2007
@@ -0,0 +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 <prabalig@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");
+        
+    }
+
+	
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ArgumentImpl.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ArgumentImpl.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ArgumentImpl.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ArgumentImpl.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,176 @@
+/*
+ * 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 Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.impl;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Argument;
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.util.*;
+import org.apache.imperius.util.SPLLogger;
+
+public class ArgumentImpl implements Argument 
+{
+    private TypeInfo _type;
+    private String _name;
+   // private boolean _isArray;
+   // private String _referenceName = "";
+    private Object value=null;
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    
+    
+    private static final String sourceClass="Argument";
+    
+    
+    public ArgumentImpl(String type, String name, boolean isArray, String referenceName) throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Argument");
+        int tp = TypeConstants.getActualType(type); 
+        _type = new TypeInfo(tp,referenceName,isArray);
+        _name = name;
+       // _isArray = isArray;
+       // _referenceName = referenceName;
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Argument");
+        
+    }
+    
+    public ArgumentImpl(int type, String name, boolean isArray, String referenceName) throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Argument");
+        
+        _type = new TypeInfo(type,referenceName,isArray);
+        _name = name;
+     //   _isArray = isArray;
+     //   _referenceName = referenceName;
+        
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Argument");
+        
+    }
+    
+    /* (non-Javadoc)
+	 * @see org.apache.imperius.spl.parser.statements.impl.IArgument#getReferenceTypeName()
+	 */
+    public String getReferenceTypeName() 
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getReferenceTypeName");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getReferenceTypeName");
+        
+        return _type.getReferenceTypeName();
+    }
+    
+    /* (non-Javadoc)
+	 * @see org.apache.imperius.spl.parser.statements.impl.IArgument#setReferenceTypeName(java.lang.String)
+	 */
+    public void setReferenceTypeName(String name) 
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setReferenceTypeName");
+        
+        _type.setReferenceTypeName( name);
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setReferenceTypeName");
+        
+    }
+    
+    
+    
+    /* (non-Javadoc)
+	 * @see org.apache.imperius.spl.parser.statements.impl.IArgument#getName()
+	 */
+    public String getName() 
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getName");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getName");
+        
+        return _name;
+    }
+    
+    /* (non-Javadoc)
+	 * @see org.apache.imperius.spl.parser.statements.impl.IArgument#setName(java.lang.String)
+	 */
+    public void setName(String name) 
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setName");
+        
+        this._name = name;
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setName");
+        
+    }
+    
+    /* (non-Javadoc)
+	 * @see org.apache.imperius.spl.parser.statements.impl.IArgument#getType()
+	 */
+    public TypeInfo getType() 
+    {       
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getType");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getType");
+        
+        return _type;
+    }
+    
+    /* (non-Javadoc)
+	 * @see org.apache.imperius.spl.parser.statements.impl.IArgument#setType(java.lang.String)
+	 */
+    public void setType(String type) throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setType");
+        int tp = TypeConstants.getActualType(type);
+        
+        this._type = new TypeInfo(tp,null,false);
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setType");
+    }
+    
+    /* (non-Javadoc)
+	 * @see org.apache.imperius.spl.parser.statements.impl.IArgument#getIsArray()
+	 */
+    public boolean getIsArray()
+    {
+    	return _type.getIsArray();
+    }
+    
+    /* (non-Javadoc)
+	 * @see org.apache.imperius.spl.parser.statements.impl.IArgument#setIsArray(boolean)
+	 */
+    public void setIsArray(boolean a)
+    {
+    	_type.setIsArray(a);
+    }
+
+	/* (non-Javadoc)
+	 * @see org.apache.imperius.spl.parser.statements.impl.IArgument#getValue()
+	 */
+	public Object getValue() {
+		return value;
+	}
+
+	/* (non-Javadoc)
+	 * @see org.apache.imperius.spl.parser.statements.impl.IArgument#setValue(java.lang.Object)
+	 */
+	public void setValue(Object value) {
+		this.value = value;
+	}
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ConstantDefinition.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ConstantDefinition.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ConstantDefinition.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ConstantDefinition.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,99 @@
+/*
+ * 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 <prabalig@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class ConstantDefinition 
+{
+	private String ident;
+	private Expression initExpr;
+	private SPLSymbolTable symTab;
+	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+    private static final String sourceClass="ConstantDefinition";
+    
+	
+	public String getIdent() {  
+        
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getIdent");
+    
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getIdent");
+   
+		return ident;
+	}
+
+	public void setIdent(String ident) {    
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setIdent");
+    
+		this.ident = ident;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setIdent");
+        
+	}
+
+	public SPLSymbolTable getSymTab() {    
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSymTab");
+    
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSymTab");
+   
+		return symTab;
+	}
+
+	public void setSymTab(SPLSymbolTable symTab) {    
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setSymTab");
+    
+		this.symTab = symTab;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setSymTab");
+        
+	}
+
+	public Expression getInitExpr() {    
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getInitExpr");
+    
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getInitExpr");
+   
+		return initExpr;
+	}
+
+	public void setInitExpr(Expression initExpr) {    
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setInitExpr");
+    
+		this.initExpr = initExpr;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setInitExpr");
+        
+	}
+
+	public ConstantDefinition(String ident, Expression iExpr, SPLSymbolTable sTab)
+	{    
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ConstantDefinition");
+    
+		this.ident = ident;
+		this.initExpr = iExpr;
+		this.symTab = sTab;
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "ConstantDefinition");
+   
+	}
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/DeclarationStatement.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/DeclarationStatement.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/DeclarationStatement.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/DeclarationStatement.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,126 @@
+/*
+ * 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 Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.impl;
+
+import java.util.ArrayList;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.compiler.symboltable.PropertySymbol;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class DeclarationStatement 
+{
+	private ArrayList constantList = new ArrayList();
+	private ArrayList macroList = new ArrayList();
+	private SPLSymbolTable symTab;
+	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="DeclarationStatement";
+    
+	
+	public DeclarationStatement(ArrayList cList, ArrayList mList, SPLSymbolTable sTab)
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "DeclarationStatement");
+        
+		constantList = cList;
+		macroList = mList;
+		this.symTab = sTab;
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "DeclarationStatement");
+   
+	}
+
+	public ArrayList getConstantList() {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getConstantList");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getConstantList");
+   
+		return constantList;
+	}
+
+	public void setConstantList(ArrayList constantList) {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setConstantList");
+        
+		this.constantList = constantList;
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setConstantList");
+   
+	}
+
+	public ArrayList getMacroList() {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getMacroList");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getMacroList");
+   
+		return macroList;
+	}
+
+	public void setMacroList(ArrayList macroList) {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setMacroList");
+
+        this.macroList = macroList;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setMacroList");
+   
+	}
+
+	public SPLSymbolTable getSymTab() {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSymTab");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSymTab");
+   
+		return symTab;
+	}
+
+	public void setSymTab(SPLSymbolTable symTab) {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setSymTab");
+
+        this.symTab = symTab;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setSymTab");
+   
+	}
+	
+	public void evaluate() throws SPLException
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+        
+		for(int i=0; i<constantList.size(); i++)
+		{
+			ConstantDefinition cd = (ConstantDefinition)constantList.get(i);
+			Expression e=cd.getInitExpr();
+            if(logger.isLoggable(Level.FINE))
+                logger.fine(Thread.currentThread().getName()+"constant expression "+e.toString());
+            Object result = e.evaluate();
+			String constantSymbol = cd.getIdent();
+			PropertySymbol constantSym = (PropertySymbol)symTab.getSymbol(constantSymbol);
+            if(logger.isLoggable(Level.FINE))
+                logger.fine(Thread.currentThread().getName()+"constantSym name"+ constantSym.getName()+" current value:"+constantSym.getValue()+" setting value to:"+result.toString());
+            
+            constantSym.setValue(result);
+		}
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+   
+	}
+
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ImportStatement.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ImportStatement.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ImportStatement.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/ImportStatement.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,113 @@
+/*
+ * 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 Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.external.InstanceInfo;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class ImportStatement 
+{
+	
+	private List _importInstanceInfoList;
+	private Expression _expr;
+	private SPLSymbolTable _symTab;
+	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="ImportStatement";
+    
+    
+	
+
+	public SPLSymbolTable getSymTab() {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSymTab");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSymTab");
+   
+		return _symTab;
+	}
+
+	public void setSymTab(SPLSymbolTable symTab) {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setSymTab");
+        
+		this._symTab = symTab;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setSymTab");
+        
+	}
+
+	public ImportStatement(List importInstanceInfoList, Expression e,SPLSymbolTable symTab)
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "ImportStatement");
+        
+		
+		this._expr = e;
+		this._symTab = symTab;
+		_importInstanceInfoList=new ArrayList();
+		Iterator it=importInstanceInfoList.iterator();
+		while(it.hasNext())
+		{
+			InstanceInfo iinfo=(InstanceInfo)it.next();
+			//NRJ
+			//if(!iinfo.isCollectInstance())
+			{
+				this._importInstanceInfoList.add(iinfo);
+			}
+			
+			
+		}
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "ImportStatement");
+        
+	}
+
+	
+	public Expression getExpr() {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getExpr");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getExpr");
+   
+		return _expr;
+	}
+
+	public void setExpr(Expression expr) {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setExpr");
+        
+		this._expr = expr;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setExpr");
+        
+	}
+	
+	public List getImportInstanceInfoList()
+	{
+		return _importInstanceInfoList;
+		
+	}
+
+	
+
+	
+
+	
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/MacroDefinition.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/MacroDefinition.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/MacroDefinition.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/statements/impl/MacroDefinition.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,246 @@
+/*
+ * 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 Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.statements.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Argument;
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.util.*;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class MacroDefinition 
+{
+	private String _macroName;
+	private int _retType;
+	private List _argList = new ArrayList();
+	private Expression _macroExpression;
+	private SPLSymbolTable _macroSymTab;
+	private SPLSymbolTable _symTab;
+	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="MacroDefinition";
+    private boolean _isArray =false;
+    
+    public MacroDefinition(String mName, String retType,boolean isArray, ArrayList aList, 
+			Expression mE, SPLSymbolTable mSymTab, SPLSymbolTable sTab) throws SPLException
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "MacroDefinition");
+        
+		this._macroName = mName;
+        
+		this._retType = TypeConstants.getActualType(retType);
+		
+        
+        
+		
+		this._macroSymTab = mSymTab;
+		this._symTab = sTab;
+        this._isArray=isArray;
+		populateArgList(aList);
+        /*if(!array.equalsIgnoreCase(""))
+        {
+            this.isArray=true;
+        }*/
+		//System.out.println("created macro expression "+mName);
+		this._macroExpression = mE;
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "MacroDefinition");
+   
+	}
+	
+	public SPLSymbolTable getMacroSymTab() 
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getMacroSymTab");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getMacroSymTab");
+   
+		return _macroSymTab;
+	}
+
+	public Object evaluate() throws SPLException
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+        
+		Object returnValue = null;
+		returnValue = _macroExpression.evaluate();
+		
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+   
+		return returnValue;
+	}
+
+
+	public void setMacroSymTab(SPLSymbolTable macroSymTab) {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setMacroSymTab");
+        
+		this._macroSymTab = macroSymTab;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setMacroSymTab");
+        
+	}
+
+
+
+	public SPLSymbolTable getSymTab() {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSymTab");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSymTab");
+   
+		return _symTab;
+	}
+
+
+
+	public void setSymTab(SPLSymbolTable symTab) {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setSymTab");
+        
+		this._symTab = symTab;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setSymTab");
+        
+	}
+
+
+
+	public void setRetType(int retType) {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setRetType");
+        
+		this._retType = retType;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setRetType");
+        
+	}
+
+
+
+	
+
+	
+
+	private void populateArgList(ArrayList list) 
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "populateArgList");
+        
+		for(int i=0; i< list.size(); i++)
+		{
+			Argument e = (Argument)list.get(i);
+			TypeInfo argType = e.getType();
+			_argList.add(argType);
+			
+		}
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "populateArgList");
+        
+		
+	}
+
+	public List getArgList() 
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getArgList");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getArgList");
+   
+		return _argList;
+	}
+
+	public void setArgList(ArrayList argList) 
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setArgList");
+        
+		this._argList = argList;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setArgList");
+        
+	}
+
+	public Expression getMacroExpression() 
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getMacroExpression");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getMacroExpression");
+   
+		return _macroExpression;
+	}
+
+	public void setMacroExpression(Expression macroExpression) 
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setMacroExpression");
+        
+		this._macroExpression = macroExpression;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setMacroExpression");
+        
+	}
+
+	public String getMacroName() 
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getMacroName");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getMacroName");
+   
+		return _macroName;
+	}
+
+	public void setMacroName(String macroName) 
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setMacroName");
+        
+		this._macroName = macroName;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setMacroName");
+        
+	}
+
+	public int getRetType() 
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getRetType");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getRetType");
+   
+		return _retType;
+	}
+
+	public void setRetType(String retType) throws SPLException
+	{
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setRetType");
+        this._retType = TypeConstants.getActualType(retType);
+        
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setRetType");
+        
+	}
+	
+	public String getReferenceTypeName() throws SPLException
+	{
+		String refTypeName = _macroExpression.getReferenceTypeName();
+		return refTypeName;
+	}
+
+    public boolean isArray()
+    {
+        return _isArray;
+    }
+
+    public void setArray(boolean isArray)
+    {
+        this._isArray = isArray;
+    }
+
+
+}



Mime
View raw message