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 jn...@apache.org on 2008/08/18 12:50:42 UTC

svn commit: r686743 [9/10] - in /incubator/imperius/trunk: imperius-javaspl/src/main/java/org/apache/imperius/javaspl/ imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/ imperius-splcore/src/main/java/org/apache/imperius/spl/datas...

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/BuitInOperationExpressionFactory.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/BuitInOperationExpressionFactory.java?rev=686743&r1=686742&r2=686743&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/BuitInOperationExpressionFactory.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/BuitInOperationExpressionFactory.java Mon Aug 18 05:50:36 2008
@@ -17,7 +17,6 @@
  * under the License.  
  */
 //
-
 /**
  * @author Neeraj Joshi <jn...@us.ibm.com>
  *
@@ -36,397 +35,391 @@
 import org.apache.imperius.spl.parser.compiler.symboltable.Symbol;
 import org.apache.imperius.spl.parser.exceptions.SPLException;
 import org.apache.imperius.spl.parser.expression.primary.MacroExpression;
+import org.apache.imperius.util.Messages;
 import org.apache.imperius.util.SPLLogger;
 
+public class BuitInOperationExpressionFactory 
+{
 
-// import org.apache.imperius.spl.parser.expressions.MethodExpression;
+	/*
+	 * stringLength toUpper toLower concatenate substring matchesRegExp
+	 * leftSubstring rightSubstring middleSubstring replaceSubstring toShort
+	 * toInteger toLong toFloat toDouble toDoubleInteger toUnsignDoubleInteger
+	 * toLongInteger toUnsignLongInteger toInteger toUnsignInteger toShort
+	 * toUnsignShort toBoolean word startsWith endsWith contains
+	 * containsOnlyDigits containsOnlyLetters containsOnlyLettersOrDigits
+	 * containsOnlyLettersOrDigits("a1b2C3") like min max remainder power abs
+	 * toString toDouble toFloat toLong toDoubleInteger toUnsignDoubleInteger
+	 * toLongInteger toUnsignLongInteger toInteger toUnsignInteger toShort
+	 * toUnsignShort toBoolean round exp log sqrt floor ceiling getMillisecond
+	 * getSecond getMinute getHour12 getHour24 getDayOfWeek getDayOfWeekInMonth
+	 * getDayOfMonth getDayOfYear getWeekOfMonth getWeekOfYear getMonth getYear
+	 * isWithin toMilliseconds
+	 * 
+	 */
 
-public class BuitInOperationExpressionFactory
-{
-    /*
-     * stringLength toUpper toLower concatenate substring matchesRegExp
-     * leftSubstring rightSubstring middleSubstring replaceSubstring toShort
-     * toInteger toLong toFloat toDouble toDoubleInteger toUnsignDoubleInteger
-     * toLongInteger toUnsignLongInteger toInteger toUnsignInteger toShort
-     * toUnsignShort toBoolean word startsWith endsWith contains
-     * containsOnlyDigits containsOnlyLetters containsOnlyLettersOrDigits
-     * containsOnlyLettersOrDigits("a1b2C3") like min max remainder power abs
-     * toString toDouble toFloat toLong toDoubleInteger toUnsignDoubleInteger
-     * toLongInteger toUnsignLongInteger toInteger toUnsignInteger toShort
-     * toUnsignShort toBoolean round exp log sqrt floor ceiling getMillisecond
-     * getSecond getMinute getHour12 getHour24 getDayOfWeek getDayOfWeekInMonth
-     * getDayOfMonth getDayOfYear getWeekOfMonth getWeekOfYear getMonth getYear
-     * isWithin toMilliseconds
-     * 
-     */
-
-    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-
-    private static final String sourceClass="MethodExpressionFactory";
-    
-    
-    public static final String stringLength = "stringLength";
-    
-    public static final String toUpper = "toUpper";
-    
-    public static final String toLower = "toLower";
-    
-    public static final String concatenate = "concatenate";
-    
-    public static final String substring = "substring";
-    
-    public static final String matchesRegExp = "matchesRegExp";
-    
-    public static final String leftSubstring = "leftSubstring";
-    
-    public static final String rightSubstring = "rightSubstring";
-    
-    public static final String middleSubstring = "middleSubstring";
-    
-    public static final String replaceSubstring = "replaceSubstring";
-    
-    public static final String word = "word";
-    
-    public static final String startsWith = "startsWith";
-    
-    public static final String endsWith = "endsWith";
-    
-    public static final String contains = "contains";
-    
-    public static final String containsOnlyDigits = "containsOnlyDigits";
-    
-    public static final String containsOnlyLetters = "containsOnlyLetters";
-    
-    public static final String containsOnlyLettersOrDigits = "containsOnlyLettersOrDigits";
-    
-    // public static final String like = "like";
-    public static final String min = "min";
-    
-    public static final String max = "max";
-    
-    public static final String remainder = "remainder";
-    
-    public static final String power = "power";
-    
-    public static final String abs = "abs";
-    
-    public static final String toString = "toString";
-    
-    public static final String toDouble = "toDouble";
-    
-    public static final String toFloat = "toFloat";
-    
-    public static final String toLong = "toLong";
-    
-    public static final String toDoubleInteger = "toDoubleInteger";
-    
-    public static final String toUnsignDoubleInteger = "toUnsignDoubleInteger";
-    
-    public static final String toLongInteger = "toLongInteger";
-    
-    public static final String toUnsignLongInteger = "toUnsignLongInteger";
-    
-    public static final String toInteger = "toInteger";
-    
-    public static final String toUnsignInteger = "toUnsignInteger";
-    
-    public static final String toShort = "toShort";
-    
-    public static final String toUnsignShort = "toUnsignShort";
-    
-    public static final String toBoolean = "toBoolean";
-    
-    public static final String round = "round";
-    
-    public static final String exp = "exp";
-    
-    // public static final String log = "log";
-    public static final String sqrt = "sqrt";
-    
-    public static final String floor = "floor";
-    
-    public static final String ceiling = "ceiling";
-    
-    public static final String getMillisecond = "getMillisecond";
-    
-    public static final String getSecond = "getSecond";
-    
-    public static final String getMinute = "getMinute";
-    
-    public static final String getHour12 = "getHour12";
-    
-    public static final String getHour24 = "getHour24";
-    
-    public static final String getDayOfWeek = "getDayOfWeek";
-    
-    public static final String getDayOfWeekInMonth = "getDayOfWeekInMonth";
-    
-    public static final String getDayOfMonth = "getDayOfMonth";
-    
-    public static final String getDayOfYear = "getDayOfYear";
-    
-    public static final String getWeekOfMonth = "getWeekOfMonth";
-    
-    public static final String getWeekOfYear = "getWeekOfYear";
-    
-    public static final String getMonth = "getMonth";
-    
-    public static final String getYear = "getYear";
-    
-    public static final String isWithin = "isWithin";
-    
-    public static final String toMilliseconds = "toMilliseconds";
-    
-    public static final String minInCollection = "minInCollection";
-    
-    public static final String inCollection = "inCollection";
-    
-    public static final String union = "union";
-    
-    public static final String maxInCollection = "maxInCollection";
-    
-    public static final String collectionSize = "collectionSize";
-    
-    public static final String sum = "sum";
-    
-    public static final String avrgInCollection = "avrgInCollection";
-    
-    public static final String eqCollections = "eqCollections";
-    
-    public static final String subCollection = "subCollection";
-    
-    public static final String sdInCollection = "sdInCollection";
-    
-    public static final String medianInCollection = "medianInCollection";
-    
-    public static final String allInCollection = "allInCollection";
-    
-    public static final String anyInCollection = "anyInCollection";
-    
-    public static final String applyToCollection = "applyToCollection";
-    
-    public static final String log10 = "log10";
-    
-    public static final String ln = "ln";
-    
-    public static final String getCurrentTime = "getCurrentTime";
-    
-    public static final String invokePolicy = "invokePolicy";
-    
-    public static final String returnValue = "ReturnValue";
-    
-    public static Expression createExpression(String id1, String id2,
-            List pList, SPLSymbolTable symTab) throws SPLException
-    {
-
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
-
-        
-        boolean recurse = true;
-        Expression returnExpr = null;
-        if (!id1.equals("") && !id2.equals(""))
-        {
-            /*
-             * if(symTab.symbolExists(id1 + "." + id2, recurse)) { Symbol symbol =
-             * symTab.getSymbol(id1 + "." + id2); if(symbol instanceof
-             * MethodSymbol) { returnExpr = new
-             * MethodExpression((MethodSymbol)symbol,pList,symTab); } else {
-             * throw new SPLException("undefined method" + id1 + "." + id2); } }
-             */
-            logger.severe( "id1.id2 type of method calls not allowed");
-            
-            throw new SPLException(
-                    "id1.id2 type of method calls not allowed");
-        }
-        else if (!id1.equals("") && id2.equals(""))
-        {
-            
-            if (symTab.symbolExists(id1, recurse))
-            {
-                Symbol symbol = symTab.getSymbol(id1);
-                if (symbol instanceof MacroSymbol)
-                {
-                    returnExpr = new MacroExpression((MacroSymbol) symbol,
-                            (ArrayList)pList, symTab);
-                    
-                }
-                else if (symbol instanceof MethodSymbol)
-                {
-                    logger.severe( "id1.id2 type of method calls not allowed");
-                    
-                    throw new SPLException(
-                            "id1.id2 type of method calls not allowed");
-                }
-            }
-            else
-            {
-                if (ACPLParserMap.isKnownOperatorExpressionType(id1))
-                {
-                    //System.out.println("creating inbuilt function expression");
-                    returnExpr = createBuiltInExpression(id1, pList, symTab);
-                }
-                else
-                {
-                    logger.severe(Thread.currentThread().getName()+" "+"the symbol does not exist in the symbol table and is not a known inbuilt function");
-                    
-                    throw new SPLException(
-                            "the symbol does not exist in the symbol table and is not a known inbuilt function");
-                }
-            }
-        }
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
-       
-        return returnExpr;
-    }
-    
-    public static Expression createBuiltInExpression(String expName,
-            List paramList, SPLSymbolTable symTab)
-            throws SPLException
-    {
-
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createBuiltInExpression");
-
-        boolean isAction = false;
-        Expression returnExpression = _createBuiltInType(expName,paramList,symTab,isAction);
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createBuiltInExpression");
-        
-        return returnExpression;
-    }
-    
-    public static Expression createBuiltInAction(String expName,
-            List paramList, SPLSymbolTable symTab)
-            throws SPLException
-    {
-
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createBuiltInAction");
-
-        boolean isAction = true;
-        Expression returnExpression = _createBuiltInType(expName,paramList,symTab,isAction);
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createBuiltInAction");
-        
-        return returnExpression;
-    }
-    
-    
-    private static Expression _createBuiltInType(String expName,
-            List paramList, SPLSymbolTable symTab, boolean isAction)
-            throws SPLException
-    {
-
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createACPLExpression");
-
-        
-//        String methodName = "createExpression(String expName,ArrayList parameters, SPLSymbolTable symTab)";
-        //System.out.println("createACPLExpression::MethodExpressionFactory "+ expName);
-        Expression returnExpression = null;
-        // logger.entry(className, methodName, new Object[] { element });
-        Boolean validateExpression = Boolean.TRUE;
-        if (symTab.getSymbolTableType() == SPLSymbolTable.COLLECT)
-        {
-            validateExpression = Boolean.FALSE;
-        }
-        // String elementName = element.getLocalName();
-        Class handlerClass = null;
-        try
-        {
-        	if(!isAction)
-        	{	
-            //System.out.println("ACPLParserMap.getClassForKnownType(expName) "+ expName);
-        		handlerClass = ACPLParserMap.getClassForOperatorExpressionType(expName);
-        	}
-        	else
-        	{
-        		handlerClass = ACPLParserMap.getClassForActionExpressionType(expName);
-        	}
-            //System.out.println("handlerClass " + handlerClass.toString());
-            
-        }
-        catch (ClassNotFoundException e)
-        {
-//            Object[] args = new Object[]
-//            {
-//                expName.toString()
-//            };
-            // {ERROR_EXPRESSION_CREATION_CLASS_PATH,
-            // "Autonomic Manager Library cannot create an expression for
-            // element {0}
-            // because the expression handler class could not be found or
-            // loaded."},
-            logger.severe(Thread.currentThread().getName()+" "+"No such expression" + expName);
-            
-            throw new SPLException("No such expression" + expName);
-            
-        }
-        
-        /*
-         * There are two cases:
-         * 
-         * 1) the "regular" case like And expression, where the element has only
-         * children elements representing known functions. In the regular case,
-         * the children are converted to expression and passed as a Vector to
-         * the appropriate expression handler.
-         * 
-         * 2) a "SpecialCase" where the element has attributes or supporting
-         * elements that are not known functions (like PolicyTimePeriod). In
-         * this case, the whole element is passed to a SpecialCaseElementParser
-         * that does a special conversion to the appropriate expression handler.
-         */
-        {
-            // Do the normal case when the element just has children elements
-            // Do all children
-            
-            Class[] argClassArray =
-            {
-                    List.class, boolean.class
-            };
-            Object[] argObjectArray =
-            {
-                    paramList, validateExpression
-            };
-            
-            // Try to build the expression now
-            /*
-             * Constructor expressionConstructor; try { expressionConstructor =
-             * handlerClass.getConstructor(new Class[] { List.class,
-             * Boolean.class }); return
-             * (Expression)expressionConstructor.newInstance( new Object[] {
-             * parameters,validateExpression }); } catch (Exception e1) {
-             * Object[] elementArg = new Object[] { expName, handlerClass };
-             * 
-             * throw new SPLException("error instantiating"); }
-             */
-
-            Constructor exprConstructor;
-            try
-            {
-                Constructor[] ctors = handlerClass.getConstructors();
-                for (int k = 0; k < ctors.length; k++)
-                {
-                    //System.out.println("Constructor name: "+ ctors[k].getName());
-                    Class[] paramTps = ctors[k].getParameterTypes();
-                    for (int z = 0; z < paramTps.length; z++)
-                    {
-                        //System.out.println("param type " + paramTps[z].getName());
-                    }
-                }
-                exprConstructor = handlerClass.getConstructor(argClassArray);
-                returnExpression = (Expression) exprConstructor
-                        .newInstance(argObjectArray);
-                //System.out.println("returnExpression "+ returnExpression.toString());
-                
-            }
-            catch (Exception e)
-            {
-                logger.severe(Thread.currentThread().getName()+" "+"error instantiating" + e.getMessage());
-                throw new SPLException("error instantiating" + e.getMessage());
-            }
-        }
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createACPLExpression");
-        
-        return returnExpression;
-    }
+	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+	private static final String sourceClass = "MethodExpressionFactory";
+
+	public static final String stringLength = "stringLength";
+
+	public static final String toUpper = "toUpper";
+
+	public static final String toLower = "toLower";
+
+	public static final String concatenate = "concatenate";
+
+	public static final String substring = "substring";
+
+	public static final String matchesRegExp = "matchesRegExp";
+
+	public static final String leftSubstring = "leftSubstring";
+
+	public static final String rightSubstring = "rightSubstring";
+
+	public static final String middleSubstring = "middleSubstring";
+
+	public static final String replaceSubstring = "replaceSubstring";
+
+	public static final String word = "word";
+
+	public static final String startsWith = "startsWith";
+
+	public static final String endsWith = "endsWith";
+
+	public static final String contains = "contains";
+
+	public static final String containsOnlyDigits = "containsOnlyDigits";
+
+	public static final String containsOnlyLetters = "containsOnlyLetters";
+
+	public static final String containsOnlyLettersOrDigits = "containsOnlyLettersOrDigits";
+
+	public static final String min = "min";
+
+	public static final String max = "max";
+
+	public static final String remainder = "remainder";
+
+	public static final String power = "power";
+
+	public static final String abs = "abs";
+
+	public static final String toString = "toString";
+
+	public static final String toDouble = "toDouble";
+
+	public static final String toFloat = "toFloat";
+
+	public static final String toLong = "toLong";
+
+	public static final String toDoubleInteger = "toDoubleInteger";
+
+	public static final String toUnsignDoubleInteger = "toUnsignDoubleInteger";
+
+	public static final String toLongInteger = "toLongInteger";
+
+	public static final String toUnsignLongInteger = "toUnsignLongInteger";
+
+	public static final String toInteger = "toInteger";
+
+	public static final String toUnsignInteger = "toUnsignInteger";
+
+	public static final String toShort = "toShort";
+
+	public static final String toUnsignShort = "toUnsignShort";
+
+	public static final String toBoolean = "toBoolean";
+
+	public static final String round = "round";
+
+	public static final String exp = "exp";
+
+	public static final String sqrt = "sqrt";
+
+	public static final String floor = "floor";
+
+	public static final String ceiling = "ceiling";
+
+	public static final String getMillisecond = "getMillisecond";
+
+	public static final String getSecond = "getSecond";
+
+	public static final String getMinute = "getMinute";
 
+	public static final String getHour12 = "getHour12";
+
+	public static final String getHour24 = "getHour24";
+
+	public static final String getDayOfWeek = "getDayOfWeek";
+
+	public static final String getDayOfWeekInMonth = "getDayOfWeekInMonth";
+
+	public static final String getDayOfMonth = "getDayOfMonth";
+
+	public static final String getDayOfYear = "getDayOfYear";
+
+	public static final String getWeekOfMonth = "getWeekOfMonth";
+
+	public static final String getWeekOfYear = "getWeekOfYear";
+
+	public static final String getMonth = "getMonth";
+
+	public static final String getYear = "getYear";
+
+	public static final String isWithin = "isWithin";
+
+	public static final String toMilliseconds = "toMilliseconds";
+
+	public static final String minInCollection = "minInCollection";
+
+	public static final String inCollection = "inCollection";
+
+	public static final String union = "union";
+
+	public static final String maxInCollection = "maxInCollection";
+
+	public static final String collectionSize = "collectionSize";
+
+	public static final String sum = "sum";
+
+	public static final String avrgInCollection = "avrgInCollection";
+
+	public static final String eqCollections = "eqCollections";
+
+	public static final String subCollection = "subCollection";
+
+	public static final String sdInCollection = "sdInCollection";
+
+	public static final String medianInCollection = "medianInCollection";
+
+	public static final String allInCollection = "allInCollection";
+
+	public static final String anyInCollection = "anyInCollection";
+
+	public static final String applyToCollection = "applyToCollection";
+
+	public static final String log10 = "log10";
+
+	public static final String ln = "ln";
+
+	public static final String getCurrentTime = "getCurrentTime";
+
+	public static final String invokePolicy = "invokePolicy";
+
+	public static final String returnValue = "ReturnValue";
+
+	public static Expression createExpression(String id1, String id2,
+			List pList, SPLSymbolTable symTab) throws SPLException 
+	{
+
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createExpression");
+
+		boolean recurse = true;
+		Expression returnExpr = null;
+		if (!id1.equals("") && !id2.equals("")) 
+		{
+			/*
+			 * if(symTab.symbolExists(id1 + "." + id2, recurse)) { Symbol symbol =
+			 * symTab.getSymbol(id1 + "." + id2); if(symbol instanceof
+			 * MethodSymbol) { returnExpr = new
+			 * MethodExpression((MethodSymbol)symbol,pList,symTab); } else {
+			 * throw new SPLException("undefined method" + id1 + "." + id2); } }
+			 */
+			logger.severe("id1.id2 type of method calls not allowed");
+
+			throw new SPLException(Messages
+					.getString("SPL_EXPRESSION_FACTORY_EXCEPTION_MSG"));
+		} 
+		else if (!id1.equals("") && id2.equals("")) 
+		{
+
+			if (symTab.symbolExists(id1, recurse)) 
+			{
+				Symbol symbol = symTab.getSymbol(id1);
+				if (symbol instanceof MacroSymbol) 
+				{
+					returnExpr = new MacroExpression((MacroSymbol) symbol,
+							(ArrayList) pList, symTab);
+
+				} 
+				else if (symbol instanceof MethodSymbol) 
+				{
+					logger.severe("id1.id2 type of method calls not allowed");
+
+					throw new SPLException(Messages
+							.getString("SPL_EXPRESSION_FACTORY_EXCEPTION_MSG"));
+				}
+			} 
+			else 
+			{
+				if (ACPLParserMap.isKnownOperatorExpressionType(id1)) 
+				{
+					//System.out.println("creating inbuilt function expression");
+					returnExpr = createBuiltInExpression(id1, pList, symTab);
+				} 
+				else 
+				{
+					logger
+							.severe(Thread.currentThread().getName()
+									+ " "
+									+ "the symbol does not exist in the symbol table and is not a known inbuilt function");
+
+					throw new SPLException(Messages.getString(
+							"SPL_SYMBOL_DOES_NOT_EXIST_EXCEPTION_MSG",
+							new Object[] { "" }));
+				}
+			}
+		}
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createExpression");
+
+		return returnExpr;
+	}
+
+	public static Expression createBuiltInExpression(String expName,
+			List paramList, SPLSymbolTable symTab) throws SPLException 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createBuiltInExpression");
+
+		boolean isAction = false;
+		Expression returnExpression = _createBuiltInType(expName, paramList,
+				symTab, isAction);
 	
-    
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createBuiltInExpression");
+
+		return returnExpression;
+	}
+
+	public static Expression createBuiltInAction(String expName,
+			List paramList, SPLSymbolTable symTab) throws SPLException 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createBuiltInAction");
+
+		boolean isAction = true;
+		Expression returnExpression = _createBuiltInType(expName, paramList,
+				symTab, isAction);
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createBuiltInAction");
+
+		return returnExpression;
+	}
+
+	private static Expression _createBuiltInType(String expName,
+			List paramList, SPLSymbolTable symTab, boolean isAction)
+			throws SPLException 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createACPLExpression");
+
+		Expression returnExpression = null;
+		Boolean validateExpression = Boolean.TRUE;
+		if (symTab.getSymbolTableType() == SPLSymbolTable.COLLECT) 
+		{
+			validateExpression = Boolean.FALSE;
+		}
+		Class handlerClass = null;
+		try 
+		{
+			if (!isAction) 
+			{
+				handlerClass = ACPLParserMap
+						.getClassForOperatorExpressionType(expName);
+			} 
+			else 
+			{
+				handlerClass = ACPLParserMap
+						.getClassForActionExpressionType(expName);
+			}
+		} 
+		catch (ClassNotFoundException e) 
+		{
+			//            Object[] args = new Object[]
+			//            {
+			//                expName.toString()
+			//            };
+			// {ERROR_EXPRESSION_CREATION_CLASS_PATH,
+			// "Autonomic Manager Library cannot create an expression for
+			// element {0}
+			// because the expression handler class could not be found or
+			// loaded."},
+			logger.severe(Thread.currentThread().getName() + " "
+					+ "No such expression" + expName);
+
+			throw new SPLException(Messages.getString(
+					"SPL_CLASS_NOT_FOUND_EXCEPTION_MSG", new Object[] { e
+							.getLocalizedMessage() }));
+		}
+
+		/*
+		 * There are two cases:
+		 * 
+		 * 1) the "regular" case like And expression, where the element has only
+		 * children elements representing known functions. In the regular case,
+		 * the children are converted to expression and passed as a Vector to
+		 * the appropriate expression handler.
+		 * 
+		 * 2) a "SpecialCase" where the element has attributes or supporting
+		 * elements that are not known functions (like PolicyTimePeriod). In
+		 * this case, the whole element is passed to a SpecialCaseElementParser
+		 * that does a special conversion to the appropriate expression handler.
+		 */
+		{
+			// Do the normal case when the element just has children elements
+			// Do all children
+
+			Class[] argClassArray = { List.class, boolean.class };
+			Object[] argObjectArray = { paramList, validateExpression };
+
+			// Try to build the expression now
+			/*
+			 * Constructor expressionConstructor; try { expressionConstructor =
+			 * handlerClass.getConstructor(new Class[] { List.class,
+			 * Boolean.class }); return
+			 * (Expression)expressionConstructor.newInstance( new Object[] {
+			 * parameters,validateExpression }); } catch (Exception e1) {
+			 * Object[] elementArg = new Object[] { expName, handlerClass };
+			 * 
+			 * throw new SPLException("error instantiating"); }
+			 */
+
+			Constructor exprConstructor;
+			try 
+			{
+				Constructor[] ctors = handlerClass.getConstructors();
+				for (int k = 0; k < ctors.length; k++) 
+				{
+					//System.out.println("Constructor name: "+ ctors[k].getName());
+					Class[] paramTps = ctors[k].getParameterTypes();
+					for (int z = 0; z < paramTps.length; z++) 
+					{
+						//System.out.println("param type " + paramTps[z].getName());
+					}
+				}
+				exprConstructor = handlerClass.getConstructor(argClassArray);
+				returnExpression = (Expression) exprConstructor
+						.newInstance(argObjectArray);
+				//System.out.println("returnExpression "+ returnExpression.toString());
+
+			} 
+			catch (Exception e) 
+			{
+				logger.severe(Thread.currentThread().getName() + " "
+						+ "error instantiating" + e.getMessage());
+				throw new SPLException(e.getMessage());
+			}
+		}
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createACPLExpression");
+
+		return returnExpression;
+	}
+
 }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ExpressionFactory.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ExpressionFactory.java?rev=686743&r1=686742&r2=686743&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ExpressionFactory.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ExpressionFactory.java Mon Aug 18 05:50:36 2008
@@ -26,8 +26,6 @@
 
 import java.util.ArrayList;
 import java.util.List;
-import java.util.Calendar;
-import java.util.TimeZone;
 import java.util.logging.Logger;
 
 import org.apache.imperius.spl.external.Expression;
@@ -63,13 +61,9 @@
 import org.apache.imperius.spl.parser.expressions.impl.UnaryMinusExpression;
 import org.apache.imperius.spl.parser.expressions.impl.UnaryNotExpression;
 import org.apache.imperius.spl.parser.expressions.impl.UnaryPlusExpression;
-import org.apache.imperius.spl.parser.util.ExpressionUtility;
+import org.apache.imperius.util.Messages;
 import org.apache.imperius.util.SPLLogger;
 
-
-
-
-
 //PB: have added a utility to create java Calendar from the CIMDateTime string
 //PB: have added a utility to check if a string is a CIMDateTime string
 //that is parsed
@@ -86,26 +80,30 @@
 
 
 	public static Expression createExpression(Expression e1, Expression e2,
-			int type, SPLSymbolTable sTab) throws SPLException
-			{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
+			int type, SPLSymbolTable sTab) throws SPLException 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createExpression");
 
-		//System.out.println("creating expression " + e1.getClass() + " "+ e2.getClass() + " " + type);
+		// System.out.println("creating expression " + e1.getClass() + " "+
+		// e2.getClass() + " " + type);
 		Expression returnExpr = null;
 		List exprList = new ArrayList();
 
 		exprList.add(e1);
 		exprList.add(e2);
 		boolean validateExpr = true;
-		if (sTab.getSymbolTableType() == SPLSymbolTable.COLLECT)
+		if (sTab.getSymbolTableType() == SPLSymbolTable.COLLECT) 
 		{
-			//System.out.println("sTab.getSymbolTableType() == SPLSymbolTable.COLLECT");
+			// System.out.println("sTab.getSymbolTableType() ==
+			// SPLSymbolTable.COLLECT");
 			validateExpr = false;
 		}
-		switch (type)
+		switch (type) 
 		{
 		case SPLTreeParserTokenTypes.ASSIGN:
-			//System.out.println("Expression Factory::Creating assignment expression");
+			// System.out.println("Expression Factory::Creating assignment
+			// expression");
 			returnExpr = new AssignmentExpression(exprList, validateExpr);
 			break;
 
@@ -163,27 +161,29 @@
 
 		}
 
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createExpression");
 
 		return returnExpr;
 
-			}
+	}
 
 	public static Expression createExpression(Expression e1, int type,
-			SPLSymbolTable sTab) throws SPLException
-			{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
+			SPLSymbolTable sTab) throws SPLException 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createExpression");
 
 		Expression returnExpr = null;
 
 		List exprList = new ArrayList();
 		exprList.add(e1);
 		boolean validateExpr = true;
-		if (sTab.getSymbolTableType() == SPLSymbolTable.COLLECT)
+		if (sTab.getSymbolTableType() == SPLSymbolTable.COLLECT) 
 		{
 			validateExpr = false;
 		}
-		switch (type)
+		switch (type) 
 		{
 		case SPLTreeParserTokenTypes.UNARY_MINUS:
 			returnExpr = new UnaryMinusExpression(exprList, validateExpr);
@@ -198,23 +198,24 @@
 
 		}
 
-
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createExpression");
 
 		return returnExpr;
-
-			}
+	}
 
 	public static Expression createExpression(String val, int type)
-	throws SPLException
+			throws SPLException 
 	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createExpression");
 
 		Expression returnExpr = null;
-		switch (type)
+		switch (type) 
 		{
 		case TypeConstants.dateTime:
-			//System.out.println("Expression factory creating new date time: "+ val.toString());
+			// System.out.println("Expression factory creating new date time: "+
+			// val.toString());
 			returnExpr = new DateTimeConstant(val);
 			break;
 
@@ -224,8 +225,7 @@
 			break;
 
 		case TypeConstants.doubleType:
-			returnExpr = new DoubleConstant(Double.valueOf(val)
-					.doubleValue());
+			returnExpr = new DoubleConstant(Double.valueOf(val).doubleValue());
 			break;
 
 		case TypeConstants.floatType:
@@ -233,30 +233,31 @@
 			break;
 
 		case TypeConstants.intType:
-			returnExpr = new IntegerConstant(Integer.valueOf(val)
-					.intValue());
+			returnExpr = new IntegerConstant(Integer.valueOf(val).intValue());
 			break;
 		case TypeConstants.shortType:
 			returnExpr = new ShortConstant(Short.valueOf(val).shortValue());
 			break;
 
 		case TypeConstants.longType:
-			if(val.endsWith("L") ||val.endsWith("l"))
+			if (val.endsWith("L") || val.endsWith("l")) 
 			{
-				val=val.substring(0, val.length()-2);
+				val = val.substring(0, val.length() - 2);
 			}
 			returnExpr = new LongConstant(Long.valueOf(val).longValue());
 			break;
 
 		case TypeConstants.stringType:
-			String dateStr=(String) val;
-			if(DateTime.isDateTimeString(dateStr))
+			String dateStr = (String) val;
+			if (DateTime.isDateTimeString(dateStr)) 
 			{
-				//System.out.println("string is a date string createJavaDateTime "+val);
-				int size=dateStr.length();
-				returnExpr = new DateTimeConstant(dateStr.substring(1, size-1));
-			}
-			else
+				// System.out.println("string is a date string
+				// createJavaDateTime "+val);
+				int size = dateStr.length();
+				returnExpr = new DateTimeConstant(dateStr
+						.substring(1, size - 1));
+			} 
+			else 
 			{
 				returnExpr = new StringConstant(val);
 			}
@@ -268,47 +269,49 @@
 					.booleanValue());
 			break;
 
-			/*
-			 * case TypeConstants.referenceType : try { returnExpr = new
-			 * SelfExpression(); } catch (NonExistentSymbolException e) { //
-			 * TODO Auto-generated catch block e.printStackTrace(); } catch
-			 * (IllegalSymbolReferenceException e) { // TODO Auto-generated
-			 * catch block e.printStackTrace(); } catch
-			 * (IllegalExpressionTypeException e) { // TODO Auto-generated catch
-			 * block e.printStackTrace(); } break;
-			 */
+		/*
+		 * case TypeConstants.referenceType : try { returnExpr = new
+		 * SelfExpression(); } catch (NonExistentSymbolException e) { // TODO
+		 * Auto-generated catch block e.printStackTrace(); } catch
+		 * (IllegalSymbolReferenceException e) { // TODO Auto-generated catch
+		 * block e.printStackTrace(); } catch (IllegalExpressionTypeException e) { //
+		 * TODO Auto-generated catch block e.printStackTrace(); } break;
+		 */
 
 		}
 
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createExpression");
 
 		return returnExpr;
-
 	}
 
-	public static Expression createSelfExpression(SPLSymbolTable st)throws SPLException
+	public static Expression createSelfExpression(SPLSymbolTable st)
+			throws SPLException 
 	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createSelfExpression");
-
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createSelfExpression");
 
 		Expression expression = new SelfExpression(st);
 		//System.out.println("created self expression " + expression.toString());
 
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createSelfExpression");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createSelfExpression");
 
 		return expression;
 	}
 
 	public static Expression createCollectExpression(ArrayList pList,
-			Expression postCollect, SPLSymbolTable sTab)
-	throws SPLException
+			Expression postCollect, SPLSymbolTable sTab) throws SPLException 
 	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createCollectExpression");
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createCollectExpression");
 
 		Expression returnExpr = null;
 		returnExpr = new CollectOperation(pList, postCollect, sTab);
 
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createCollectExpression");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createCollectExpression");
 
 		return returnExpr;
 	}
@@ -318,105 +321,100 @@
 
 	public static Expression createPostCollectExpression(Expression arr1,
 			String propOrMethodName, Expression arrExp, ArrayList pList,
-			SPLSymbolTable sTab)throws SPLException
-			{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createPostCollectExpression");
-
+			SPLSymbolTable sTab) throws SPLException 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createPostCollectExpression");
 
 		Expression returnExpr = null;
 		returnExpr = new PostCollectExpression(arr1, propOrMethodName, arrExp,
 				pList, sTab);
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createPostCollectExpression");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createPostCollectExpression");
 
 		return returnExpr;
 
-			}
+	}
 
 	public static Expression createBasicCollectExpression(ArrayList pList,
-			SPLSymbolTable sTab) throws SPLException
-			{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createBasicCollectExpression");
+			SPLSymbolTable sTab) throws SPLException 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "createBasicCollectExpression");
 
 		Expression returnExpr = null;
 		returnExpr = new BasicCollectionExpression(pList, sTab);
-		if (returnExpr == null)
+		if (returnExpr == null) 
 		{
-			logger.severe(Thread.currentThread().getName()+" "+"Constructor BasicCollectionExpression(pList,sTab) returned null expression");
-			throw new SPLException(
-			"Constructor BasicCollectionExpression(pList,sTab) returned null expression");
-
+			logger
+					.severe(Thread.currentThread().getName()
+							+ " "
+							+ "Constructor BasicCollectionExpression(pList,sTab) returned null expression");
+			throw new SPLException(Messages
+					.getString("SPL_EXPRESSION_FACTORY_EXCEPTION1_MSG"));
 		}
 
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createBasicCollectExpression");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "createBasicCollectExpression");
 
 		return returnExpr;
-			}
+	}
 
-	public static Expression createExpression(String classOrOperationName, 
-			List paramOrIdentTupleList, 
-			boolean isBuiltInOperation,
-			SPLSymbolTable symTab) throws SPLException
-			{
+	public static Expression createExpression(String classOrOperationName,
+			List paramOrIdentTupleList, boolean isBuiltInOperation,
+			SPLSymbolTable symTab) throws SPLException 
+	{
 		Expression returnExpr = null;
-		if (isBuiltInOperation)
+		if (isBuiltInOperation) 
 		{
 			//System.out.println("isBuiltInOperation=true ");
-			if(symTab ==null)
+			if (symTab == null) 
 			{
 				//System.out.println("ExpressionFactory : symTab is null ");
 			}
-			returnExpr = BuitInOperationExpressionFactory.createExpression(classOrOperationName,
-					"", paramOrIdentTupleList, symTab);
+			returnExpr = BuitInOperationExpressionFactory.createExpression(
+					classOrOperationName, "", paramOrIdentTupleList, symTab);
 
-		}
-		else
+		} 
+		else 
 		{
 			//System.out.println("isBuiltInOperation=false "+classOrOperationName);
-			if(symTab ==null)
+			if (symTab == null) 
 			{
 				//System.out.println("ExpressionFactory : symTab is null ");
 			}
 			returnExpr = new PrimaryExpression(classOrOperationName,
-					paramOrIdentTupleList,symTab);
+					paramOrIdentTupleList, symTab);
 		}
 
-
 		return returnExpr;
 
-			}
-
-
-
-	/*public static Expression createExpression(String className,
-            String methodOrPropName, Expression arrExp, List pList,
-            boolean isMethod, SPLSymbolTable sTab) throws SPLException
-            {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
-
-        Expression returnExpr = null;
-
-        if (isMethod)
-        {
-
-            returnExpr = BuitInOperationExpressionFactory.createExpression(className,
-                    methodOrPropName, pList, sTab);
-
-        }
-        else
-        {
-
-            returnExpr = new PrimaryExpression(className, methodOrPropName,
-                    arrExp, sTab);
-
-        }
-
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
-
-        return returnExpr;
-
-            }*/
+	}
 
-	
-	
+	/*
+	 * public static Expression createExpression(String className, String
+	 * methodOrPropName, Expression arrExp, List pList, boolean isMethod,
+	 * SPLSymbolTable sTab) throws SPLException {
+	 * logger.entering(sourceClass,Thread.currentThread().getName()+" "+
+	 * "createExpression");
+	 * 
+	 * Expression returnExpr = null;
+	 * 
+	 * if (isMethod) {
+	 * 
+	 * returnExpr = BuitInOperationExpressionFactory.createExpression(className,
+	 * methodOrPropName, pList, sTab);
+	 *  } else {
+	 * 
+	 * returnExpr = new PrimaryExpression(className, methodOrPropName, arrExp,
+	 * sTab);
+	 *  }
+	 * 
+	 * 
+	 * logger.exiting(sourceClass,Thread.currentThread().getName()+" "+
+	 * "createExpression");
+	 * 
+	 * return returnExpr;
+	 *  }
+	 */
 }

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=686743&r1=686742&r2=686743&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 Mon Aug 18 05:50:36 2008
@@ -45,6 +45,7 @@
 import org.apache.imperius.spl.parser.util.ExpressionUtility;
 import org.apache.imperius.spl.parser.util.TypeInfo;
 import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.Messages;
 import org.apache.imperius.util.SPLLogger;
 
 public class AnchorMethodInvokeAction implements BasicActionBlock 
@@ -59,7 +60,7 @@
     private static final String sourceClass = "MethodInvokeAction";
 
     public AnchorMethodInvokeAction(String className, List identTupleList,
-            String operatorType, Expression constExpr, SPLSymbolTable symTable) 
+            String operatorType, Expression constExpr, SPLSymbolTable symTable) throws SPLException
     {
         logger.entering(sourceClass, Thread.currentThread().getName() + " "
                 + "MethodInvokeAction");
@@ -75,38 +76,31 @@
                 + "MethodInvokeAction");
     }
 
-    private void _validate() 
+    private void _validate() throws SPLException
     {
-        try 
+        boolean isArray = false;
+        if (!_identTupleList.isEmpty()) 
         {
-            boolean isArray = false;
-            if (!_identTupleList.isEmpty()) 
-            {
-                TypeInfo returnType = new TypeInfo(TypeConstants.referenceType,
-                        _className, isArray);
+            TypeInfo returnType = new TypeInfo(TypeConstants.referenceType,
+                    _className, isArray);
 
-                Iterator identTupleIt = _identTupleList.iterator();
-                int i = 0;
-                while (identTupleIt.hasNext()) 
+            Iterator identTupleIt = _identTupleList.iterator();
+            int i = 0;
+            while (identTupleIt.hasNext()) 
+            {
+                if (returnType.getType() == TypeConstants.referenceType) 
                 {
-                    if (returnType.getType() == TypeConstants.referenceType) 
+                    String referenceTypeName = returnType
+                            .getReferenceTypeName();
+                    IdentPrimaryTuple ipt = (IdentPrimaryTuple) identTupleIt
+                            .next();
+                    if (i++ == 0) 
                     {
-                        String referenceTypeName = returnType
-                                .getReferenceTypeName();
-                        IdentPrimaryTuple ipt = (IdentPrimaryTuple) identTupleIt
-                                .next();
-                        if (i++ == 0) 
-                        {
-                            ipt.setSymbolTable(_symTable);
-                        }
-                        returnType = ipt.validate(referenceTypeName);
+                        ipt.setSymbolTable(_symTable);
                     }
+                    returnType = ipt.validate(referenceTypeName);
                 }
             }
-        } 
-        catch (SPLException splex) 
-        {
-
         }
     }
 
@@ -114,10 +108,10 @@
             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()) 
@@ -131,8 +125,9 @@
                         || formalArg.getIsArray() != actualParam.isArray()) 
                 {
                     throw new SPLException(
-                            "Formal and passed parameter types don't match for method "
-                                    + methodName);
+							Messages
+									.getString("SPL_METHOD_PASSED_ARGUMENTS_EXCEPTION_MSG")
+									+ " " + methodName);
                 }
 
             }
@@ -255,8 +250,7 @@
         } 
         catch (SPLException e) 
         {
-            // TODO Auto-generated catch block
-            e.printStackTrace();
+
         }
         logger.exiting(sourceClass, Thread.currentThread().getName() + " "
                 + "execute");
@@ -268,10 +262,8 @@
             List paramList, Object targetObject) 
     {
         List parameterObjects = new ArrayList();
-
         try 
         {
-
             MethodSymbol methodSym = (MethodSymbol) symTab.getSymbol(className
                     + "." + methodName);
             List argTypeList = methodSym.getArgumentList();
@@ -303,11 +295,9 @@
                                         + " "
                                         + rhsExpression);
 
-                        throw new SPLException(
-                                "LHS or RHS or argument in method call is null : "
-                                        + lhsExpression.toString() + " "
-                                        + rhsExpression);
-
+                        throw new SPLException(Messages.getString(
+								"SPL_ASSIGNMENT_EXP_EXCEPTION_MSG",
+								new Object[] { lhsExpression, rhsExpression }));
                     }
                     //System.out.println("lhsExpression class "+ lhsExpression.getClass());
                     //System.out.println("lhsExpression getPropertyName() "+ ((PrimaryExpression) lhsExpression).getPropertyName());
@@ -327,6 +317,7 @@
 
                         referenceTypeName = rhsExpression.getType()
                                 .getReferenceTypeName();
+                        
                     }
 
                     if (keyValue != null) 
@@ -335,6 +326,7 @@
                                 .getType(), keyName, rhsExpression.isArray(),
                                 referenceTypeName);
                         arg.setValue(keyValue);
+
                         //System.out.println("created new arg :"+keyName+" "+keyValue.toString());
                         /*
                          * Expression expression=(Expression)pList.get(i); String
@@ -346,15 +338,43 @@
                 } 
                 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);
+                    boolean isArgCreated = false;
+                    if(argTypeList != null && argTypeList.size() > 0)
+                    {
+                    	Argument tempArg = null;
+	                    if(i < argTypeList.size())
+	                    {
+	                    	tempArg = (Argument)argTypeList.get(i);
+	                    	if(TypeResolver.isReference(tempArg.getType()))
+	                    	{
+	                    		if (TypeResolver.OBJECT_STRING.equals(tempArg
+										.getType().getReferenceTypeName())
+										&& TypeResolver.isString(exp.getType())) 
+	                    		{
+									Argument arg = new ArgumentImpl(tempArg
+											.getType().getType(), null, tempArg
+											.getType().getIsArray(),
+											TypeResolver.OBJECT_STRING);
+									arg.setValue(result);
+									parameterObjects.add(arg);
+									isArgCreated = true;
+								}
+	                    	}
+	                    }
+	                    else
+	                    {
+	                    	// throw exception
+	                    }
+                    } 
+                    if(!isArgCreated)
+                    {
+	                    Argument arg = new ArgumentImpl(exp.getType().getType(),
+	                            null, exp.isArray(), null);
+	                    arg.setValue(result);
+	                    parameterObjects.add(arg);
+                    }
                 }
-
             }
 
             Actuator ac = ActuatorFactory.getActuator();
@@ -374,7 +394,6 @@
         } 
         catch (SPLException e) 
         {
-            e.printStackTrace();
             logger.severe(e.getMessage());
 
             logger.exiting(sourceClass, Thread.currentThread().getName() + " "
@@ -382,7 +401,6 @@
 
             return null;
         }
-
     }
 
 }
\ No newline at end of file

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=686743&r1=686742&r2=686743&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 Mon Aug 18 05:50:36 2008
@@ -55,8 +55,6 @@
 		} 
 		catch (SPLException e) 
 		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
 		}
 		return false;
 	}

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=686743&r1=686742&r2=686743&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 Mon Aug 18 05:50:36 2008
@@ -17,7 +17,6 @@
  * under the License.  
  */
 //
-
 /**
  * @author Prashant Baliga <pr...@in.ibm.com>
  *
@@ -38,165 +37,171 @@
 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.Messages;
 import org.apache.imperius.util.SPLLogger;
 
+public class InvokePolicyAction implements BasicActionBlock {
 
+	private List _paramList;
 
+	private String _className;
 
-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");
-
-        Expression _lhsExp = null;
-        Expression _rhsExp = null;
-        TypeInfo lType = null;
-        
-        try
-        {
-            InternalClient internalClientObj = null;
-            // System.out.println("parameters List " + _paramList);
-            if(_paramList.size() == 0)
-            {
-                logger.severe("number of parameters passed to a InvokePolicyAction should be 2 or more");
-                throw new SPLException("Last Expression should be a collection");
-            } 
-            else 
-            {
-                internalClientObj = InternalClientFactory.getInternalClient(); 
-                _lhsExp = (Expression)_paramList.get(0);
-                lType=_lhsExp.getType();
-                if (lType.getType() != TypeConstants.stringType)
-                {
-                    logger.severe("first Expression should be a string describing the name of the policy to invoke");
-                    throw new SPLException("first Expression should be a string describing the name of the policy to invoke");
-                }
-                String policyName = (String)_lhsExp.evaluate();
-                
-                if(_paramList.size() > 1)
-                {
-                    // get second parameter
-                    _rhsExp = (Expression)_paramList.get(1);
-                    Object rhsResult = _rhsExp.evaluate();
-                    if ((rhsResult instanceof java.util.List))
-                    {
-                        List instanceInfoList = (List)rhsResult;
-                        internalClientObj.invokePolicy(policyName, instanceInfoList, true);
-                    }
-                    else
-                    {
-                        Map instanceInfoMap = new HashMap();
-                        Expression tempExpr = null;
-                        Object keyObj = null;
-                        Object valueObj = null;
-                        if(((_paramList.size()-1) % 2) == 0)
-                        {
-                            for(int i=1;i<_paramList.size();i++)
-                            {
-                                tempExpr = (Expression)_paramList.get(i);
-                                keyObj = tempExpr.evaluate();
-                                if(++i < _paramList.size())
-                                {
-                                    tempExpr = (Expression)_paramList.get(i);
-                                    valueObj = tempExpr.evaluate();
-                                }
-                                else
-                                {
-                                    logger.severe("instance names and instances passed are not same");
-                                    throw new SPLException("instance names and instances passed are not same");
-                                }
-                                instanceInfoMap.put(keyObj,valueObj);
-                            }
-                            internalClientObj.invokePolicy(policyName, instanceInfoMap);
-                        }
-                        else
-                        {
-                            throw new SPLException("number of parameters passed is insufficient to invoke the policy");
-                        }
-                    }
-                }
-                else
-                {
-                    internalClientObj.invokePolicy(policyName, null, true);
-                }
-            }
-            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");
+	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");
+
+		Expression _lhsExp = null;
+		Expression _rhsExp = null;
+		TypeInfo lType = null;
+
+		try 
+		{
+			InternalClient internalClientObj = null;
+			// System.out.println("parameters List " + _paramList);
+			if (_paramList.size() == 0) 
+			{
+				logger
+						.severe("number of parameters passed to a InvokePolicyAction should be 2 or more");
+				throw new SPLException(Messages.getString(
+						"SPL_NO_OF_ARGUMENTS_PASSED_ERROR_MSG", new Object[] {
+								"2 or more", "0" }));
+			} 
+			else 
+			{
+				internalClientObj = InternalClientFactory.getInternalClient();
+				_lhsExp = (Expression) _paramList.get(0);
+				lType = _lhsExp.getType();
+				if (lType.getType() != TypeConstants.stringType) 
+				{
+					logger
+							.severe("first Expression should be a string describing the name of the policy to invoke");
+					throw new SPLException(
+							Messages
+									.getString("SPL_INVOKE_POLICY_ACTION_EXCEPTION1_MSG"));
+				}
+				String policyName = (String) _lhsExp.evaluate();
+
+				if (_paramList.size() > 1) 
+				{
+					// get second parameter
+					_rhsExp = (Expression) _paramList.get(1);
+					Object rhsResult = _rhsExp.evaluate();
+					if ((rhsResult instanceof java.util.List)) 
+					{
+						List instanceInfoList = (List) rhsResult;
+						internalClientObj.invokePolicy(policyName,
+								instanceInfoList, true);
+					} 
+					else 
+					{
+						Map instanceInfoMap = new HashMap();
+						Expression tempExpr = null;
+						Object keyObj = null;
+						Object valueObj = null;
+						if (((_paramList.size() - 1) % 2) == 0) 
+						{
+							for (int i = 1; i < _paramList.size(); i++) 
+							{
+								tempExpr = (Expression) _paramList.get(i);
+								keyObj = tempExpr.evaluate();
+								if (++i < _paramList.size()) 
+								{
+									tempExpr = (Expression) _paramList.get(i);
+									valueObj = tempExpr.evaluate();
+								} 
+								else 
+								{
+									logger
+											.severe("instance names and instances passed are not same");
+									throw new SPLException(
+											"instance names and instances passed are not same");
+								}
+								instanceInfoMap.put(keyObj, valueObj);
+							}
+							internalClientObj.invokePolicy(policyName,
+									instanceInfoMap);
+						} else {
+							throw new SPLException(
+									"number of parameters passed is insufficient to invoke the policy");
+						}
+					}
+				} else {
+					internalClientObj.invokePolicy(policyName, null, true);
+				}
+			}
+			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;
+		_paramList = paramList;
 
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "setParamList");
 
-    }
+	}
 
 }

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=686743&r1=686742&r2=686743&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 Mon Aug 18 05:50:36 2008
@@ -36,6 +36,7 @@
 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.Messages;
 import org.apache.imperius.util.SPLLogger;
 
 
@@ -57,16 +58,16 @@
     
     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.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");
- 
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "SetActionBlock");
     }
     
     public boolean execute(Actuator ac)
@@ -110,23 +111,27 @@
                     {
 
     					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");
-    				
-                        }
+    					throw new SPLException(
+								Messages
+										.getString("SPL_SET_ACTION_BLOCK_EXCEPTION_MSG"));
+                    }
                 }
                 else
                 {
-                	logger.severe(Thread.currentThread().getName()+" "+"the parameter at position " + i + " is null ");
-					throw new SPLException("the parameter at position " + i + " is null ");
-				  }
-                
+					logger.severe(Thread.currentThread().getName() + " "
+							+ "the parameter at position " + i + " is null ");
+					throw new SPLException(Messages.getString(
+							"SPL_BLANK_EXPRESSION_PASSED_ERROR_MSG",
+							new Object[] { "" + i }));
+				}
             }
             Object instance = _symTab.getInstance(instanceName);
-            String qualifier = _symTab.getQualifierForClass(_className);
-             ac.modifyInstance(_className, qualifier, instance, modifiedProperties);
-            
+			String qualifier = _symTab.getQualifierForClass(_className);
+			ac.modifyInstance(_className, qualifier, instance,
+					modifiedProperties);
 
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "execute");
+			logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+					+ "execute");
             
             return true;
         }
@@ -138,48 +143,49 @@
      
             return false;
         }
-        
-      
     }
     
     public String getClassName()
     {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getClassName");
+        logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "getClassName");
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "getClassName");
 
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getClassName");
- 
-        return _className;
+		return _className;
     }
     
     public void setClassName(String className)
     {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setClassName");
+        logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "setClassName");
 
-        
-        _className = className;
-        logger.exiting(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.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "getParamList");
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "getParamList");
 
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getParamList");
- 
-        return _paramList;
+		return _paramList;
     }
     
     public void setParamList(ArrayList paramList)
     {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
+        logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "setParamList");
 
-        
-        _paramList = paramList;
-        
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setParamList");
-        
-    }
+		_paramList = paramList;
 
-	
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "setParamList");
+    }
 }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/DeclarationStatement.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/DeclarationStatement.java?rev=686743&r1=686742&r2=686743&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/DeclarationStatement.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/DeclarationStatement.java Mon Aug 18 05:50:36 2008
@@ -113,8 +113,7 @@
 		{
 			ConstantDefinition cd = (ConstantDefinition)constantList.get(i);
 			Expression e=cd.getInitExpr();
-            if(logger.isLoggable(Level.FINE))
-                logger.fine(Thread.currentThread().getName()+"constant expression "+e.toString());
+			logger.fine(Thread.currentThread().getName()+ "constant expression "+e.toString());
             Object result = e.evaluate();
 			String constantSymbol = cd.getIdent();
 			PropertySymbol constantSym = (PropertySymbol)symTab.getSymbol(constantSymbol);

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/PolicyDefinition.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/PolicyDefinition.java?rev=686743&r1=686742&r2=686743&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/PolicyDefinition.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/PolicyDefinition.java Mon Aug 18 05:50:36 2008
@@ -221,9 +221,8 @@
                 //System.out.println("keys string : "+this.symTab.getInstance().getKeys());
 //                if(auditLogger.isLoggable(Level.FINE))
 //                    auditLogger.fine(Thread.currentThread().getName()+" Executing Decision ");
-                boolean executionResult = 
-                	_decision.execute(ac);
-                System.out.println("     "+"decision executed :"+executionResult);
+                boolean executionResult = _decision.execute(ac);
+                // System.out.println("     "+"decision executed :"+executionResult);
                 auditloggerString+="     "+"decision executed :"+executionResult+"\n";
                 
 //                if(auditLogger.isLoggable(Level.FINE))
@@ -235,7 +234,7 @@
 //                        auditLogger.fine(Thread.currentThread().getName()+" Policy Evaluated Successfully ");
                     
                     result = SPLPolicy.POLICY_EVALUATED_SUCCESSFULLY;
-                    System.out.println("     "+"sub policy decision execution successful");
+                    // System.out.println("     "+"sub policy decision execution successful");
                     auditloggerString+="     "+"sub policy decision execution successful"+"\n";
                     
                     if(logger.isLoggable(Level.FINE))
@@ -251,7 +250,7 @@
 //                    auditLogger.severe(Thread.currentThread().getName()+" "+" Policy Evaluation Failed ");
                     
                     result = SPLPolicy.POLICY_EVALUATION_FAILED;
-                    System.out.println("     "+"sub policy decision execution failed");
+                    // System.out.println("     "+"sub policy decision execution failed");
                     auditloggerString+="     "+"sub policy decision execution failed"+"\n";
                     
 //                    auditLogger.severe(Thread.currentThread().getName()+" "+"PolicyDefinition Evalaute return value="+result);
@@ -275,7 +274,7 @@
                     logger.fine(Thread.currentThread().getName()+"Policy was not executed");
                //System.out.println(" CONDITION evaluated to FALSE ");
                 
-                System.out.println("     "+"sub policy decision not executed");
+                // System.out.println("     "+"sub policy decision not executed");
                 auditloggerString+="     "+"sub policy decision not executed"+"\n";
                 
                 logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
@@ -287,7 +286,7 @@
         }
         else
         {
-        	System.out.println("     "+"sub policy has no condition");
+        	// System.out.println("     "+"sub policy has no condition");
         	auditloggerString+="     "+"sub policy has no condition"+"\n";
             
             boolean executionResult=_decision.execute(ac);
@@ -302,7 +301,7 @@
 //                    auditLogger.fine(Thread.currentThread().getName()+"Policy without condition, was executed successfully");
                 
                 result = SPLPolicy.POLICY_EVALUATED_SUCCESSFULLY;
-                System.out.println("     "+"sub policy decision execution successful");
+                // System.out.println("     "+"sub policy decision execution successful");
                 auditloggerString+="     "+"sub policy decision execution successful"+"\n";
                 
                 if(logger.isLoggable(Level.FINE))
@@ -320,7 +319,7 @@
 //                    auditLogger.fine(Thread.currentThread().getName()+"Evaluation of Policy without condition Failed");
                 
                 result = SPLPolicy.POLICY_EVALUATION_FAILED;
-                System.out.println("     "+"sub policy decision execution failed");
+                // System.out.println("     "+"sub policy decision execution failed");
                 auditloggerString+="     "+"sub policy decision execution failed"+"\n";
                 
                //System.out.println(" POLICY_EVALUATION_FAILED ");

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/ExpressionUtility.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/ExpressionUtility.java?rev=686743&r1=686742&r2=686743&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/ExpressionUtility.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/ExpressionUtility.java Mon Aug 18 05:50:36 2008
@@ -38,9 +38,9 @@
 import org.apache.imperius.spl.parser.exceptions.IllegalExpressionTypeException;
 import org.apache.imperius.spl.parser.exceptions.SPLException;
 import org.apache.imperius.spl.parser.expressions.impl.DateTime;
+import org.apache.imperius.util.Messages;
 import org.apache.imperius.util.PropertiesLoader;
 import org.apache.imperius.util.SPLLogger;
-import org.w3c.dom.Element;
 
 
 public class ExpressionUtility
@@ -357,9 +357,13 @@
         }
         else
         {
-            logger.severe(Thread.currentThread().getName()+" "+"wrong operand type.");
+            logger.severe(Thread.currentThread().getName()
+					+ " "
+					+ Messages
+							.getString("SPL_WRONG_OPERAND_TYPE_EXCEPTION_MSG"));
             
-            throw new SPLException("wrong operand type.");
+            throw new SPLException(Messages
+					.getString("SPL_WRONG_OPERAND_TYPE_EXCEPTION_MSG"));
         }
     }
     
@@ -412,9 +416,14 @@
         }
         else
         { 
-            logger.severe(Thread.currentThread().getName()+" "+"wrong operand type.");
+            logger.severe(Thread.currentThread().getName()
+					+ " "
+					+ Messages
+							.getString("SPL_WRONG_OPERAND_TYPE_EXCEPTION_MSG"));
+
         
-            throw new SPLException("wrong operand type.");
+            throw new SPLException(Messages
+					.getString("SPL_WRONG_OPERAND_TYPE_EXCEPTION_MSG"));
         }
         
     }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/KeyStringToMapConvertor.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/KeyStringToMapConvertor.java?rev=686743&r1=686742&r2=686743&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/KeyStringToMapConvertor.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/KeyStringToMapConvertor.java Mon Aug 18 05:50:36 2008
@@ -44,8 +44,9 @@
         logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getMapOfKeys");
         
         String keyString = keyValues;
-        if(logger.isLoggable(Level.FINE))
-            logger.fine(Thread.currentThread().getName()+"keyString "+keyString);
+        
+        logger.fine(Thread.currentThread().getName() + "keyString :  "
+				+ keyString);
         
         //System.out.println("keyValues " + keyValues);
         keyString = keyString.substring(keyString.indexOf('.') + 1);
@@ -83,8 +84,8 @@
             }
             //System.out.println(" keyString keyName keyValue " + keyString + " "+ keyName + " " + keyValue);
             //System.out.println("CIMObjectInstance  keyName: "+ keyName.toLowerCase() + "  keyValue : " + keyValue);
-            if(logger.isLoggable(Level.FINE))
-                logger.fine(Thread.currentThread().getName()+"keyName, keyValue "+keyName+ " , "+ keyValue);
+            logger.fine(Thread.currentThread().getName() + "keyName, keyValue "
+					+ keyName + " , " + keyValue);
             
             keysMap.put(keyName, keyValue);
         }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeInfo.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeInfo.java?rev=686743&r1=686742&r2=686743&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeInfo.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeInfo.java Mon Aug 18 05:50:36 2008
@@ -27,6 +27,7 @@
 
 import org.apache.imperius.spl.external.TypeConstants;
 import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.util.Messages;
 
 
 public class TypeInfo 
@@ -65,7 +66,8 @@
 		}
 		else
 		{
-			throw new SPLException("invalid type" + splType);
+            throw new SPLException(Messages
+					.getString("SPL_WRONG_OPERAND_TYPE_EXCEPTION_MSG"));
 		}
 	}
 

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java?rev=686743&r1=686742&r2=686743&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java Mon Aug 18 05:50:36 2008
@@ -35,6 +35,7 @@
 import org.apache.imperius.spl.parser.exceptions.IllegalParameterTypeException;
 import org.apache.imperius.spl.parser.exceptions.SPLException;
 import org.apache.imperius.spl.parser.exceptions.TypesNotAssignableException;
+import org.apache.imperius.util.Messages;
 
 
 
@@ -46,7 +47,7 @@
 public class TypeResolver
 {
     
-    
+    public static final String OBJECT_STRING = "java.lang.Object";
 
 //    private static final String sourceClass="TypeConstants";
     
@@ -265,9 +266,19 @@
         {
             res = true;
         }
-        else if (isReference(leftType) && isReference(rightType))
+        else //if (isReference(leftType) && isReference(rightType))
         {
-            res = true;
+        	if(isReference(leftType))
+        	{
+        		if(OBJECT_STRING.equalsIgnoreCase(leftType.getReferenceTypeName()) && isString(rightType))
+        		{
+        			res = true;
+        		} 
+        		else if(isReference(rightType))
+        		{
+        			res = true;
+        		}
+        	}
         }
 
         
@@ -344,21 +355,15 @@
         return false;
     }
     
-    public static boolean isReference(TypeInfo type)
+    public static boolean isReference(TypeInfo type) 
     {
-       int tp = type.getType();
-        
-        if (tp == TypeConstants.referenceType)
-        {
-       
-            
-            return true;
-        }
-
-
-   
-        return false;
-    }
+		int tp = type.getType();
+		if (tp == TypeConstants.referenceType) 
+		{
+			return true;
+		}
+		return false;
+	}
     
     
     public static boolean isString(TypeInfo tp)
@@ -459,9 +464,6 @@
     public static boolean validateActualParameterTypes(List formalParams,
             List passedParams) throws SPLException
     {
-
-      
-        
         if (formalParams.size() == passedParams.size())
         {
             for (int i = 0; i < formalParams.size(); i++)
@@ -474,13 +476,12 @@
                 {
                    //System.out.println("type mismatch fParam.intValue()="+fParam+" pParam.getType()"+pParam.getType());
        
-                    throw new IllegalParameterTypeException("param mismatch");
+                    throw new IllegalParameterTypeException(Messages.getString(
+							"SPL_METHOD_PASSED_ARGUMENTS_EXCEPTION_MSG",
+							new Object[] { "" }));
                 }
-                
             }
         }
-       
-        
         return true;
     }
     

Added: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/Messages.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/Messages.java?rev=686743&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/Messages.java (added)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/Messages.java Mon Aug 18 05:50:36 2008
@@ -0,0 +1,64 @@
+package org.apache.imperius.util;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+public class Messages 
+{
+	private static final String BUNDLE_NAME = "org.apache.imperius.util.messages"; //$NON-NLS-1$
+	private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle
+			.getBundle(BUNDLE_NAME);
+
+	private static final MessageFormat formatter = new MessageFormat("");
+
+	
+	// Error messages
+	public static final String SPLOF0001E = "SPLOF0001E"; //$NON-NLS-1$
+	public static final String SPLOF0002E = "SPLOF0002E"; //$NON-NLS-1$
+	public static final String SPLOF0003E = "SPLOF0003E"; //$NON-NLS-1$
+	public static final String SPLOF0004E = "SPLOF0004E"; //$NON-NLS-1$
+	public static final String SPLOF0005E = "SPLOF0005E"; //$NON-NLS-1$
+	public static final String SPLOF0006E = "SPLOF0006E"; //$NON-NLS-1$
+	public static final String SPLOF0007E = "SPLOF0007E"; //$NON-NLS-1$
+	public static final String SPLOF0008E = "SPLOF0008E"; //$NON-NLS-1$
+	public static final String SPLOF0009E = "SPLOF0009E"; //$NON-NLS-1$
+	
+	
+	
+	// Info messages
+	public static final String SPLOF0400I = "SPLOF0400I"; //$NON-NLS-1$
+	public static final String SPLOF0401I = "SPLOF0401I"; //$NON-NLS-1$
+	public static final String SPLOF0402I = "SPLOF0402I"; //$NON-NLS-1$
+	public static final String SPLOF0403I = "SPLOF0403I"; //$NON-NLS-1$
+	public static final String SPLOF0404I = "SPLOF0404I"; //$NON-NLS-1$
+	public static final String SPLOF0405I = "SPLOF0405I"; //$NON-NLS-1$
+	public static final String SPLOF0406I = "SPLOF0406I"; //$NON-NLS-1$
+	public static final String SPLOF0407I = "SPLOF0407I"; //$NON-NLS-1$
+	public static final String SPLOF0408I = "SPLOF0408I"; //$NON-NLS-1$
+	public static final String SPLOF0409I = "SPLOF0409I"; //$NON-NLS-1$
+	
+	private Messages()
+	{
+		
+	}
+	
+	public static String getString(String key) 
+	{
+		try 
+		{
+			return RESOURCE_BUNDLE.getString(key);
+		} 
+		catch (MissingResourceException e) 
+		{
+			return '!' + key + '!';
+		}
+	}
+	
+	public static String getString(String key, Object[] params) 
+	{
+		formatter.applyPattern(RESOURCE_BUNDLE.getString(key));
+		String output = formatter.format(params);
+		return output;
+	}
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/Messages.java
------------------------------------------------------------------------------
    svn:eol-style = native