incubator-imperius-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r611261 [29/43] - in /incubator/imperius/trunk: ./ imperius-javaspl/ imperius-javaspl/src/main/java/org/apache/imperius/javaspl/ imperius-splcore/ imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/ imperius-splcore/src...
Date Fri, 11 Jan 2008 18:57:14 GMT
Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ACPLParserMap.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ACPLParserMap.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ACPLParserMap.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ACPLParserMap.java Fri Jan 11 10:56:30 2008
@@ -1,599 +1,599 @@
-/*
- * 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.factory;
-
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.util.Iterator;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-
-import sun.rmi.runtime.Log;
-
-import java.util.List;
-
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expressions.impl.Abs;
-import org.apache.imperius.spl.parser.expressions.impl.Addition;
-import org.apache.imperius.spl.parser.expressions.impl.AllInCollection;
-import org.apache.imperius.spl.parser.expressions.impl.AnyInCollection;
-import org.apache.imperius.spl.parser.expressions.impl.ApplyToCollection;
-import org.apache.imperius.spl.parser.expressions.impl.AvrgInCollection;
-import org.apache.imperius.spl.parser.expressions.impl.Ceiling;
-import org.apache.imperius.spl.parser.expressions.impl.CollectionSize;
-import org.apache.imperius.spl.parser.expressions.impl.Concatenate;
-import org.apache.imperius.spl.parser.expressions.impl.Contains;
-import org.apache.imperius.spl.parser.expressions.impl.ContainsOnlyDigits;
-import org.apache.imperius.spl.parser.expressions.impl.ContainsOnlyLetters;
-import org.apache.imperius.spl.parser.expressions.impl.ContainsOnlyLettersOrDigits;
-import org.apache.imperius.spl.parser.expressions.impl.DateTimeConstant;
-import org.apache.imperius.spl.parser.expressions.impl.Division;
-import org.apache.imperius.spl.parser.expressions.impl.DoubleConstant;
-import org.apache.imperius.spl.parser.expressions.impl.EndsWith;
-import org.apache.imperius.spl.parser.expressions.impl.EqCollections;
-import org.apache.imperius.spl.parser.expressions.impl.Equal;
-import org.apache.imperius.spl.parser.expressions.impl.Exp;
-import org.apache.imperius.spl.parser.expressions.impl.FloatConstant;
-import org.apache.imperius.spl.parser.expressions.impl.Floor;
-import org.apache.imperius.spl.parser.expressions.impl.GetCurrentTime;
-import org.apache.imperius.spl.parser.expressions.impl.GetDayOfMonth;
-import org.apache.imperius.spl.parser.expressions.impl.GetDayOfWeek;
-import org.apache.imperius.spl.parser.expressions.impl.GetDayOfWeekInMonth;
-import org.apache.imperius.spl.parser.expressions.impl.GetDayOfYear;
-import org.apache.imperius.spl.parser.expressions.impl.GetHour12;
-import org.apache.imperius.spl.parser.expressions.impl.GetHour24;
-import org.apache.imperius.spl.parser.expressions.impl.GetMillisecond;
-import org.apache.imperius.spl.parser.expressions.impl.GetMinute;
-import org.apache.imperius.spl.parser.expressions.impl.GetMonth;
-import org.apache.imperius.spl.parser.expressions.impl.GetSecond;
-import org.apache.imperius.spl.parser.expressions.impl.GetWeekOfMonth;
-import org.apache.imperius.spl.parser.expressions.impl.GetWeekOfYear;
-import org.apache.imperius.spl.parser.expressions.impl.GetYear;
-import org.apache.imperius.spl.parser.expressions.impl.Greater;
-import org.apache.imperius.spl.parser.expressions.impl.GreaterOrEqual;
-import org.apache.imperius.spl.parser.expressions.impl.InCollection;
-import org.apache.imperius.spl.parser.expressions.impl.IntegerConstant;
-import org.apache.imperius.spl.parser.expressions.impl.IsAfter;
-import org.apache.imperius.spl.parser.expressions.impl.IsBefore;
-import org.apache.imperius.spl.parser.expressions.impl.IsWithin;
-import org.apache.imperius.spl.parser.expressions.impl.LeftSubstring;
-import org.apache.imperius.spl.parser.expressions.impl.Less;
-import org.apache.imperius.spl.parser.expressions.impl.LessOrEqual;
-import org.apache.imperius.spl.parser.expressions.impl.Ln;
-import org.apache.imperius.spl.parser.expressions.impl.Log10;
-import org.apache.imperius.spl.parser.expressions.impl.LogicalAnd;
-import org.apache.imperius.spl.parser.expressions.impl.LogicalNot;
-import org.apache.imperius.spl.parser.expressions.impl.LogicalOr;
-import org.apache.imperius.spl.parser.expressions.impl.LogicalXor;
-import org.apache.imperius.spl.parser.expressions.impl.LongConstant;
-import org.apache.imperius.spl.parser.expressions.impl.MatchesRegExp;
-import org.apache.imperius.spl.parser.expressions.impl.Max;
-import org.apache.imperius.spl.parser.expressions.impl.MaxInCollection;
-import org.apache.imperius.spl.parser.expressions.impl.MedianInCollection;
-import org.apache.imperius.spl.parser.expressions.impl.MiddleSubstring;
-import org.apache.imperius.spl.parser.expressions.impl.Min;
-import org.apache.imperius.spl.parser.expressions.impl.MinInCollection;
-import org.apache.imperius.spl.parser.expressions.impl.Mod;
-import org.apache.imperius.spl.parser.expressions.impl.Power;
-import org.apache.imperius.spl.parser.expressions.impl.Product;
-import org.apache.imperius.spl.parser.expressions.impl.ReplaceSubstring;
-import org.apache.imperius.spl.parser.expressions.impl.ReturnValues;
-import org.apache.imperius.spl.parser.expressions.impl.RightSubstring;
-import org.apache.imperius.spl.parser.expressions.impl.Rint;
-import org.apache.imperius.spl.parser.expressions.impl.Round;
-import org.apache.imperius.spl.parser.expressions.impl.SdInCollection;
-import org.apache.imperius.spl.parser.expressions.impl.ShortConstant;
-import org.apache.imperius.spl.parser.expressions.impl.SquareRoot;
-import org.apache.imperius.spl.parser.expressions.impl.StartsWith;
-import org.apache.imperius.spl.parser.expressions.impl.StringConstant;
-import org.apache.imperius.spl.parser.expressions.impl.StringLength;
-import org.apache.imperius.spl.parser.expressions.impl.SubCollection;
-import org.apache.imperius.spl.parser.expressions.impl.Substring;
-import org.apache.imperius.spl.parser.expressions.impl.Subtraction;
-import org.apache.imperius.spl.parser.expressions.impl.Sum;
-import org.apache.imperius.spl.parser.expressions.impl.ToBoolean;
-import org.apache.imperius.spl.parser.expressions.impl.ToLower;
-import org.apache.imperius.spl.parser.expressions.impl.ToMilliseconds;
-import org.apache.imperius.spl.parser.expressions.impl.ToREAL32;
-import org.apache.imperius.spl.parser.expressions.impl.ToREAL64;
-import org.apache.imperius.spl.parser.expressions.impl.ToSINT16;
-import org.apache.imperius.spl.parser.expressions.impl.ToSINT32;
-import org.apache.imperius.spl.parser.expressions.impl.ToSINT64;
-import org.apache.imperius.spl.parser.expressions.impl.ToString;
-import org.apache.imperius.spl.parser.expressions.impl.ToUpper;
-import org.apache.imperius.spl.parser.expressions.impl.Union;
-import org.apache.imperius.spl.parser.expressions.impl.Word;
-import org.apache.imperius.spl.parser.util.ExpressionUtility;
-import org.apache.imperius.util.SPLLogger;
-
-//import org.apache.imperius.spl.parser.expressions.impl.TimeConstant;
-
-
-/**
- * Provides mappings between known ACPL function elements and Java classes that
- * handle the elements. In the normal case, we put a mapping between the element
- * name and the com.ibm.autnomic.policy.am.expression expression implementing
- * the function. For a few special cases, like PolicyTimePeriod, we put a
- * handler class that is able to make the special conversion from XML to the
- * ACPL expression.
- * <p>
- * 
- * 
- * 
- */
-public class ACPLParserMap 
-{
-    
-    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-
-    private static final String _sourceClass="ACPLParserMap";
-    
-    
-//    private static final String _className = ACPLParserMap.class.getName();
-    
-    private static Properties _knownOperatorExpressionMap = new Properties();
-    private static Properties _knownActionExpressionMap = new Properties();
-    /*
-     * Set up the known map between ACPL element function names and handler
-     * classes
-     */
-    static
-    {
-        logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "Set up the known map between ACPL element function names and handler");
-
-        
-        try
-        {
-            
-            // BooleanExpression
-            
-            _addOperatorExpressionType("ToBoolean", ToBoolean.class);
-            _addOperatorExpressionType("And", LogicalAnd.class);
-            _addOperatorExpressionType("Or", LogicalOr.class);
-            _addOperatorExpressionType("Not", LogicalNot.class);
-            _addOperatorExpressionType("LogicalXor", LogicalXor.class);
-            _addOperatorExpressionType("Greater", Greater.class);
-            _addOperatorExpressionType("Less", Less.class);
-            _addOperatorExpressionType("Equal", Equal.class);
-            _addOperatorExpressionType("GreaterEqual", GreaterOrEqual.class);
-            _addOperatorExpressionType("LessEqual", LessOrEqual.class);
-            _addOperatorExpressionType("StartsWith", StartsWith.class);
-            _addOperatorExpressionType("Contains", Contains.class);
-            _addOperatorExpressionType("EndsWith", EndsWith.class);
-            _addOperatorExpressionType("IsAfter", IsAfter.class);
-            _addOperatorExpressionType("IsBefore", IsBefore.class);
-            _addOperatorExpressionType("IsWithin", IsWithin.class);
-            // addBuiltInExpressionType("Belongs", Belongs.class);
-            _addOperatorExpressionType("ContainsOnlyDigits", ContainsOnlyDigits.class);
-            _addOperatorExpressionType("ContainsOnlyLetters", ContainsOnlyLetters.class);
-            _addOperatorExpressionType("ContainsOnlyLettersOrDigits",
-                    ContainsOnlyLettersOrDigits.class);
-            
-            // NumericExpression
-            _addOperatorExpressionType("ShortConstant", ShortConstant.class);
-            _addOperatorExpressionType("IntConstant", IntegerConstant.class);
-            _addOperatorExpressionType("LongConstant", LongConstant.class);
-            _addOperatorExpressionType("FloatConstant", FloatConstant.class);
-            _addOperatorExpressionType("DoubleConstant", DoubleConstant.class);
-            _addOperatorExpressionType("ToShort", ToSINT16.class);
-            _addOperatorExpressionType("ToInt", ToSINT32.class);
-            _addOperatorExpressionType("ToLong", ToSINT64.class);
-            _addOperatorExpressionType("ToFloat", ToREAL32.class);
-            _addOperatorExpressionType("ToDouble", ToREAL64.class);
-            _addOperatorExpressionType("Plus", Addition.class);
-            _addOperatorExpressionType("Minus", Subtraction.class);
-            _addOperatorExpressionType("Product", Product.class);
-            _addOperatorExpressionType("Division", Division.class);
-            _addOperatorExpressionType("Mod", Mod.class);
-            _addOperatorExpressionType("Max", Max.class);
-            _addOperatorExpressionType("Min", Min.class);
-            _addOperatorExpressionType("Log", Log.class);
-            _addOperatorExpressionType("Exp", Exp.class);
-            _addOperatorExpressionType("Power", Power.class);
-            _addOperatorExpressionType("SquareRoot", SquareRoot.class);
-            _addOperatorExpressionType("Abs", Abs.class);
-            _addOperatorExpressionType("Round", Round.class);
-            _addOperatorExpressionType("Rint", Rint.class);
-            _addOperatorExpressionType("Floor", Floor.class);
-            _addOperatorExpressionType("Ceiling", Ceiling.class);
-            _addOperatorExpressionType("StringLength", StringLength.class);
-            _addOperatorExpressionType("GetDayOfMonth", GetDayOfMonth.class);
-            _addOperatorExpressionType("GetDayOfWeek", GetDayOfWeek.class);
-            _addOperatorExpressionType("GetDayOfWeekInMonth", GetDayOfWeekInMonth.class);
-            _addOperatorExpressionType("GetDayOfYear", GetDayOfYear.class);
-            _addOperatorExpressionType("GetHour12", GetHour12.class);
-            _addOperatorExpressionType("GetHour24", GetHour24.class);
-            // addBuiltInExpressionType("GetHourOfDay", GetHourOfDay.class);
-            _addOperatorExpressionType("GetMinute", GetMinute.class);
-            _addOperatorExpressionType("GetSecond", GetSecond.class);
-            _addOperatorExpressionType("GetMillisecond", GetMillisecond.class);
-            _addOperatorExpressionType("GetWeekOfMonth", GetWeekOfMonth.class);
-            _addOperatorExpressionType("GetWeekOfYear", GetWeekOfYear.class);
-            _addOperatorExpressionType("GetMonth", GetMonth.class);
-            _addOperatorExpressionType("GetYear", GetYear.class);
-            _addOperatorExpressionType("ToMilliseconds", ToMilliseconds.class);
-            _addOperatorExpressionType("Log10", Log10.class);
-            _addOperatorExpressionType("Ln", Ln.class);
-            
-            // StringExpression
-            
-            _addOperatorExpressionType("StringConstant", StringConstant.class);
-            _addOperatorExpressionType("ToString", ToString.class);
-            _addOperatorExpressionType("ToUpper", ToUpper.class);
-            _addOperatorExpressionType("ToLower", ToLower.class);
-            _addOperatorExpressionType("LeftSubString", LeftSubstring.class);
-            _addOperatorExpressionType("MiddleSubString", MiddleSubstring.class);
-            _addOperatorExpressionType("RightSubString", RightSubstring.class);
-            _addOperatorExpressionType("ReplaceSubString", ReplaceSubstring.class);
-            _addOperatorExpressionType("Word", Word.class);
-            _addOperatorExpressionType("Concatenate", Concatenate.class);
-            _addOperatorExpressionType("SubString", Substring.class);
-            _addOperatorExpressionType("MatchesRegExp", MatchesRegExp.class);
-            
-            // CalendarExpression
-            _addOperatorExpressionType("DateTimeConstant", DateTimeConstant.class);
-            //_addOperatorExpressionType("TimeConstant", TimeConstant.class);
-            
-            // BasicCollectionExpression
-            _addOperatorExpressionType("MinInCollection", MinInCollection.class);
-            _addOperatorExpressionType("InCollection", InCollection.class);
-            _addOperatorExpressionType("Union", Union.class);
-            _addOperatorExpressionType("MaxInCollection", MaxInCollection.class);
-            _addOperatorExpressionType("CollectionSize", CollectionSize.class);
-            _addOperatorExpressionType("Sum", Sum.class);
-            _addOperatorExpressionType("AvrgInCollection", AvrgInCollection.class);
-            _addOperatorExpressionType("EqCollection", EqCollections.class);
-            _addOperatorExpressionType("SubCollection", SubCollection.class);
-            _addOperatorExpressionType("SdInCollection", SdInCollection.class);
-            _addOperatorExpressionType("MedianInCollection", MedianInCollection.class);
-            _addOperatorExpressionType("AllInCollection", AllInCollection.class);
-            _addOperatorExpressionType("AnyInCollection", AnyInCollection.class);
-            _addOperatorExpressionType("ApplyToCollection", ApplyToCollection.class);
-            _addOperatorExpressionType("GetCurrentTime", GetCurrentTime.class);
-            
-            _loadCustomOperatorExpressionTypes();
-            
-            _addActionExpressionType("ReturnValues",ReturnValues.class);
-            
-            _loadCustomActionExpressionTypes();
-            
-        }
-        catch (Exception e)
-        {
-            logger.severe(e.getMessage());
-        }
-        logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "Set up the known map between ACPL element function names and handler");
-        
-    }
-    
-    /**
-     * Adds known types to the underlying ACPLParserMap via type class object.
-     * 
-     * @param typeLocalName
-     *            local name for the type within the namespace
-     * @param classObject
-     *            Class object representing the type class
-     * @throws IllegalArgumentException
-     *             if namespace, shortname, or classObject are <code>null</code>
-     */
-    private static void _addOperatorExpressionType(String typeLocalName, Class classObject)
-            throws SPLException
-    {
-        logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "addKnownType");
-
-        if (classObject == null || typeLocalName == null)
-        {
-//            Object[] args = new Object[]
-//            {
-//                    typeLocalName, classObject
-//            };
-          
-            logger.severe(Thread.currentThread().getName()+" "+"builtin method error");
-            throw new SPLException("builtin method error");
-        }
-        
-        _knownOperatorExpressionMap.put(typeLocalName.toLowerCase(), classObject.getName());
-
-        logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "addKnownType");
-       
-    }
-    
-    private static void _loadCustomActionExpressionTypes() throws SPLException 
-    {
-		List customActionList = ExpressionUtility.getListOfCustomActionTypes();
-		Iterator it = customActionList.iterator();
-		while(it.hasNext())
-		{
-			String customActionName = (String)it.next();
-			int lastIndexOfDot = customActionName.lastIndexOf('.');
-			
-			String actionShortName = customActionName.substring(lastIndexOfDot + 1);
-			try {
-				Class cl = Class.forName(customActionName);
-				_addActionExpressionType(actionShortName,cl);
-			} catch (ClassNotFoundException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				throw new SPLException("Class not found " + e);
-			} catch (SPLException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			
-		}
-		
-	}
-
-    /**
-     * Used by editor to load custom actions
-     * @param aCustomActionList
-     * @param aUrls
-     * @throws SPLException
-     */
-    public static void loadCustomActionExpressionTypes(List aCustomActionList,
-			URL[] aUrls) throws SPLException {
-
-    	List customActionList = aCustomActionList;
-		Iterator it = customActionList.iterator();
-		URLClassLoader uc = new URLClassLoader(aUrls);
-		while (it.hasNext()) {
-			String customActionName = (String) it.next();
-			int lastIndexOfDot = customActionName.lastIndexOf('.');
-
-			String actionShortName = customActionName.substring(lastIndexOfDot + 1);
-			try {
-				// Class cl = Class.forName(customActionName);
-				Class cl = uc.loadClass(customActionName.trim());
-				_addActionExpressionType(actionShortName, cl);
-			} catch (ClassNotFoundException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-				throw new SPLException("Class not found " + e);
-			} catch (SPLException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-		}
-	}
- 
-    /**
-     *  Used by editor to load custom expressions
-     * @param aCustomOperatorList
-     * @param aUrls
-     * @throws SPLException
-     */
-	public static void loadCustomOperatorExpressionTypes(List aCustomOperatorList,
-			URL[] aUrls) throws SPLException {
-		List customActionList = aCustomOperatorList;
-		Iterator it = customActionList.iterator();
-		URLClassLoader uc = new URLClassLoader(aUrls);
-		while (it.hasNext()) {
-			String customActionName = (String) it.next();
-			int lastIndexOfDot = customActionName.lastIndexOf('.');
-
-			String actionShortName = customActionName
-					.substring(lastIndexOfDot + 1);
-			try {
-//				Class cl = Class.forName(customActionName);
-				Class cl = uc.loadClass(customActionName.trim());
-				_addOperatorExpressionType(actionShortName, cl);
-			} catch (ClassNotFoundException e) {
-
-				e.printStackTrace();
-				throw new SPLException("Class not found " + e);
-			} catch (SPLException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-
-		}
-
-	}
-
-    
-    
-    
-
-	private static void _loadCustomOperatorExpressionTypes() throws SPLException 
-	{
-		List customActionList = ExpressionUtility.getListOfCustomExpressionTypes();
-		Iterator it = customActionList.iterator();
-		while(it.hasNext())
-		{
-			String customActionName = (String)it.next();
-			int lastIndexOfDot = customActionName.lastIndexOf('.');
-			
-			String actionShortName = customActionName.substring(lastIndexOfDot + 1);
-			try {
-				Class cl = Class.forName(customActionName);
-				_addOperatorExpressionType(actionShortName,cl);
-			} catch (ClassNotFoundException e) {
-				
-				e.printStackTrace();
-				throw new SPLException("Class not found " + e);
-			} catch (SPLException e) {
-				// TODO Auto-generated catch block
-				e.printStackTrace();
-			}
-			
-		}
-		
-	}
-
-	private static void _addActionExpressionType(String typeLocalName, Class classObject)
-    throws SPLException
-	{
-		logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "addBuiltInActionType");
-		
-		if (classObject == null || typeLocalName == null)
-		{
-//		    Object[] args = new Object[]
-//		    {
-//		            typeLocalName, classObject
-//		    };
-		  
-		    logger.severe(Thread.currentThread().getName()+" "+"builtin method error");
-		    throw new SPLException("builtin method error");
-		}
-		
-		_knownActionExpressionMap.put(typeLocalName.toLowerCase(), classObject.getName());
-		
-		logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "addKnownType");
-	
-	}
-	
-	
-    
-    /**
-   
-    
-    /**
-     * Returns the Class of a known type corresponding to the type with the
-     * given typeLocalName, or <code>null</code> if the type is not defined.
-     * <p>
-     * 
-     * Does not return user-defined type Classes.
-     * 
-     * @param typeLocalName
-     *            local name for the type
-     * @return Class the type, or <code>null</code> if it is undefined
-     * 
-     * @throws ClassNotFoundException
-     *             if the class can not be located
-     */
-    public static Class getClassForOperatorExpressionType(String typeLocalName)
-            throws ClassNotFoundException
-    {
-        logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
-        Class result = _getClassForExpressionType(typeLocalName,_knownOperatorExpressionMap);
-        
-       logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
-        
-        return result;
-    }
-    public static Class getClassForActionExpressionType(String typeLocalName)
-    	throws ClassNotFoundException
-	{
-		logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
-		
-		Class result = _getClassForExpressionType(typeLocalName,_knownActionExpressionMap);
-		
-		
-		logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
-		
-		return result;
-	}
-    
-    private static Class _getClassForExpressionType(String typeLocalName, Properties propMap)
-    throws ClassNotFoundException
-	{
-		logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
-		
-		
-		//System.out.println("ACPLParserMap::getClassForKnownType " + typeLocalName);
-		//String methodName = "getClassForKnownType(String, String)";
-		Class result = null;
-		
-		if (result == null)
-		{
-		    // Try to find user defined type and return
-		    String knownClass;
-		    try
-		    {
-		        knownClass = (String) propMap.get(typeLocalName.toLowerCase());
-		        if (knownClass != null)
-		        {
-		            //System.out.println(knownClass);
-		        }
-		        else
-		        {
-		            //System.out.println("knownPropertyMap does not contain "+ typeLocalName);
-		        }
-		    }
-		    catch (IllegalArgumentException e)
-		    {
-//		        Object[] args = new Object[]
-//		        {
-//		            typeLocalName
-//		        };
-		        // don't log message, calling class should log error message
-		        logger.severe(e.getMessage());
-		        throw new ClassNotFoundException();
-		        
-		    }
-		    if (knownClass == null)
-		    {
-		        result = Class.forName(typeLocalName.trim());
-		    }
-		    else
-		    {
-		        result = Class.forName(knownClass.trim());
-		    }
-		    
-		}
-		logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
-		
-		return result;
-	}
-    
-    
-   
-    
-    /**
-     * Returns <code>true</code> if the given type is a known type.
-     * 
-     * @param typeLocalName
-     *            local name for the type
-     * @return <code>true</code> if the given type is a known type
-     */
-    public static boolean isKnownOperatorExpressionType(String typeLocalName)
-    {
-        logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "isKnownBuiltInExpressionType");
-        
-        boolean result = _isKnownExpressionType(typeLocalName,_knownOperatorExpressionMap);
-        return result;
-       
-    }
-    
-    public static boolean isKnownActionExpressionType(String typeLocalName)
-    {
-        logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "isKnownActionExpressionType" 
-        		+ typeLocalName);
-        boolean result = _isKnownExpressionType(typeLocalName,_knownActionExpressionMap);
-        logger.exiting(_sourceClass,Thread.currentThread().getName()+" " + "isKnownActionExpressionType" + result);
-        return result;
-        
-       
-    }
-    
-    private static boolean _isKnownExpressionType(String typeName, Properties propMap)
-    {
-    	boolean result = false;
-    	
-    	result = propMap.containsKey(typeName.toLowerCase());
-    	
-    	return result;
-    	
-    }
-    
- 
-    
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.factory;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.logging.Logger;
+
+
+import sun.rmi.runtime.Log;
+
+import java.util.List;
+
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.impl.Abs;
+import org.apache.imperius.spl.parser.expressions.impl.Addition;
+import org.apache.imperius.spl.parser.expressions.impl.AllInCollection;
+import org.apache.imperius.spl.parser.expressions.impl.AnyInCollection;
+import org.apache.imperius.spl.parser.expressions.impl.ApplyToCollection;
+import org.apache.imperius.spl.parser.expressions.impl.AvrgInCollection;
+import org.apache.imperius.spl.parser.expressions.impl.Ceiling;
+import org.apache.imperius.spl.parser.expressions.impl.CollectionSize;
+import org.apache.imperius.spl.parser.expressions.impl.Concatenate;
+import org.apache.imperius.spl.parser.expressions.impl.Contains;
+import org.apache.imperius.spl.parser.expressions.impl.ContainsOnlyDigits;
+import org.apache.imperius.spl.parser.expressions.impl.ContainsOnlyLetters;
+import org.apache.imperius.spl.parser.expressions.impl.ContainsOnlyLettersOrDigits;
+import org.apache.imperius.spl.parser.expressions.impl.DateTimeConstant;
+import org.apache.imperius.spl.parser.expressions.impl.Division;
+import org.apache.imperius.spl.parser.expressions.impl.DoubleConstant;
+import org.apache.imperius.spl.parser.expressions.impl.EndsWith;
+import org.apache.imperius.spl.parser.expressions.impl.EqCollections;
+import org.apache.imperius.spl.parser.expressions.impl.Equal;
+import org.apache.imperius.spl.parser.expressions.impl.Exp;
+import org.apache.imperius.spl.parser.expressions.impl.FloatConstant;
+import org.apache.imperius.spl.parser.expressions.impl.Floor;
+import org.apache.imperius.spl.parser.expressions.impl.GetCurrentTime;
+import org.apache.imperius.spl.parser.expressions.impl.GetDayOfMonth;
+import org.apache.imperius.spl.parser.expressions.impl.GetDayOfWeek;
+import org.apache.imperius.spl.parser.expressions.impl.GetDayOfWeekInMonth;
+import org.apache.imperius.spl.parser.expressions.impl.GetDayOfYear;
+import org.apache.imperius.spl.parser.expressions.impl.GetHour12;
+import org.apache.imperius.spl.parser.expressions.impl.GetHour24;
+import org.apache.imperius.spl.parser.expressions.impl.GetMillisecond;
+import org.apache.imperius.spl.parser.expressions.impl.GetMinute;
+import org.apache.imperius.spl.parser.expressions.impl.GetMonth;
+import org.apache.imperius.spl.parser.expressions.impl.GetSecond;
+import org.apache.imperius.spl.parser.expressions.impl.GetWeekOfMonth;
+import org.apache.imperius.spl.parser.expressions.impl.GetWeekOfYear;
+import org.apache.imperius.spl.parser.expressions.impl.GetYear;
+import org.apache.imperius.spl.parser.expressions.impl.Greater;
+import org.apache.imperius.spl.parser.expressions.impl.GreaterOrEqual;
+import org.apache.imperius.spl.parser.expressions.impl.InCollection;
+import org.apache.imperius.spl.parser.expressions.impl.IntegerConstant;
+import org.apache.imperius.spl.parser.expressions.impl.IsAfter;
+import org.apache.imperius.spl.parser.expressions.impl.IsBefore;
+import org.apache.imperius.spl.parser.expressions.impl.IsWithin;
+import org.apache.imperius.spl.parser.expressions.impl.LeftSubstring;
+import org.apache.imperius.spl.parser.expressions.impl.Less;
+import org.apache.imperius.spl.parser.expressions.impl.LessOrEqual;
+import org.apache.imperius.spl.parser.expressions.impl.Ln;
+import org.apache.imperius.spl.parser.expressions.impl.Log10;
+import org.apache.imperius.spl.parser.expressions.impl.LogicalAnd;
+import org.apache.imperius.spl.parser.expressions.impl.LogicalNot;
+import org.apache.imperius.spl.parser.expressions.impl.LogicalOr;
+import org.apache.imperius.spl.parser.expressions.impl.LogicalXor;
+import org.apache.imperius.spl.parser.expressions.impl.LongConstant;
+import org.apache.imperius.spl.parser.expressions.impl.MatchesRegExp;
+import org.apache.imperius.spl.parser.expressions.impl.Max;
+import org.apache.imperius.spl.parser.expressions.impl.MaxInCollection;
+import org.apache.imperius.spl.parser.expressions.impl.MedianInCollection;
+import org.apache.imperius.spl.parser.expressions.impl.MiddleSubstring;
+import org.apache.imperius.spl.parser.expressions.impl.Min;
+import org.apache.imperius.spl.parser.expressions.impl.MinInCollection;
+import org.apache.imperius.spl.parser.expressions.impl.Mod;
+import org.apache.imperius.spl.parser.expressions.impl.Power;
+import org.apache.imperius.spl.parser.expressions.impl.Product;
+import org.apache.imperius.spl.parser.expressions.impl.ReplaceSubstring;
+import org.apache.imperius.spl.parser.expressions.impl.ReturnValues;
+import org.apache.imperius.spl.parser.expressions.impl.RightSubstring;
+import org.apache.imperius.spl.parser.expressions.impl.Rint;
+import org.apache.imperius.spl.parser.expressions.impl.Round;
+import org.apache.imperius.spl.parser.expressions.impl.SdInCollection;
+import org.apache.imperius.spl.parser.expressions.impl.ShortConstant;
+import org.apache.imperius.spl.parser.expressions.impl.SquareRoot;
+import org.apache.imperius.spl.parser.expressions.impl.StartsWith;
+import org.apache.imperius.spl.parser.expressions.impl.StringConstant;
+import org.apache.imperius.spl.parser.expressions.impl.StringLength;
+import org.apache.imperius.spl.parser.expressions.impl.SubCollection;
+import org.apache.imperius.spl.parser.expressions.impl.Substring;
+import org.apache.imperius.spl.parser.expressions.impl.Subtraction;
+import org.apache.imperius.spl.parser.expressions.impl.Sum;
+import org.apache.imperius.spl.parser.expressions.impl.ToBoolean;
+import org.apache.imperius.spl.parser.expressions.impl.ToLower;
+import org.apache.imperius.spl.parser.expressions.impl.ToMilliseconds;
+import org.apache.imperius.spl.parser.expressions.impl.ToREAL32;
+import org.apache.imperius.spl.parser.expressions.impl.ToREAL64;
+import org.apache.imperius.spl.parser.expressions.impl.ToSINT16;
+import org.apache.imperius.spl.parser.expressions.impl.ToSINT32;
+import org.apache.imperius.spl.parser.expressions.impl.ToSINT64;
+import org.apache.imperius.spl.parser.expressions.impl.ToString;
+import org.apache.imperius.spl.parser.expressions.impl.ToUpper;
+import org.apache.imperius.spl.parser.expressions.impl.Union;
+import org.apache.imperius.spl.parser.expressions.impl.Word;
+import org.apache.imperius.spl.parser.util.ExpressionUtility;
+import org.apache.imperius.util.SPLLogger;
+
+//import org.apache.imperius.spl.parser.expressions.impl.TimeConstant;
+
+
+/**
+ * Provides mappings between known ACPL function elements and Java classes that
+ * handle the elements. In the normal case, we put a mapping between the element
+ * name and the com.ibm.autnomic.policy.am.expression expression implementing
+ * the function. For a few special cases, like PolicyTimePeriod, we put a
+ * handler class that is able to make the special conversion from XML to the
+ * ACPL expression.
+ * <p>
+ * 
+ * 
+ * 
+ */
+public class ACPLParserMap 
+{
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+    private static final String _sourceClass="ACPLParserMap";
+    
+    
+//    private static final String _className = ACPLParserMap.class.getName();
+    
+    private static Properties _knownOperatorExpressionMap = new Properties();
+    private static Properties _knownActionExpressionMap = new Properties();
+    /*
+     * Set up the known map between ACPL element function names and handler
+     * classes
+     */
+    static
+    {
+        logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "Set up the known map between ACPL element function names and handler");
+
+        
+        try
+        {
+            
+            // BooleanExpression
+            
+            _addOperatorExpressionType("ToBoolean", ToBoolean.class);
+            _addOperatorExpressionType("And", LogicalAnd.class);
+            _addOperatorExpressionType("Or", LogicalOr.class);
+            _addOperatorExpressionType("Not", LogicalNot.class);
+            _addOperatorExpressionType("LogicalXor", LogicalXor.class);
+            _addOperatorExpressionType("Greater", Greater.class);
+            _addOperatorExpressionType("Less", Less.class);
+            _addOperatorExpressionType("Equal", Equal.class);
+            _addOperatorExpressionType("GreaterEqual", GreaterOrEqual.class);
+            _addOperatorExpressionType("LessEqual", LessOrEqual.class);
+            _addOperatorExpressionType("StartsWith", StartsWith.class);
+            _addOperatorExpressionType("Contains", Contains.class);
+            _addOperatorExpressionType("EndsWith", EndsWith.class);
+            _addOperatorExpressionType("IsAfter", IsAfter.class);
+            _addOperatorExpressionType("IsBefore", IsBefore.class);
+            _addOperatorExpressionType("IsWithin", IsWithin.class);
+            // addBuiltInExpressionType("Belongs", Belongs.class);
+            _addOperatorExpressionType("ContainsOnlyDigits", ContainsOnlyDigits.class);
+            _addOperatorExpressionType("ContainsOnlyLetters", ContainsOnlyLetters.class);
+            _addOperatorExpressionType("ContainsOnlyLettersOrDigits",
+                    ContainsOnlyLettersOrDigits.class);
+            
+            // NumericExpression
+            _addOperatorExpressionType("ShortConstant", ShortConstant.class);
+            _addOperatorExpressionType("IntConstant", IntegerConstant.class);
+            _addOperatorExpressionType("LongConstant", LongConstant.class);
+            _addOperatorExpressionType("FloatConstant", FloatConstant.class);
+            _addOperatorExpressionType("DoubleConstant", DoubleConstant.class);
+            _addOperatorExpressionType("ToShort", ToSINT16.class);
+            _addOperatorExpressionType("ToInt", ToSINT32.class);
+            _addOperatorExpressionType("ToLong", ToSINT64.class);
+            _addOperatorExpressionType("ToFloat", ToREAL32.class);
+            _addOperatorExpressionType("ToDouble", ToREAL64.class);
+            _addOperatorExpressionType("Plus", Addition.class);
+            _addOperatorExpressionType("Minus", Subtraction.class);
+            _addOperatorExpressionType("Product", Product.class);
+            _addOperatorExpressionType("Division", Division.class);
+            _addOperatorExpressionType("Mod", Mod.class);
+            _addOperatorExpressionType("Max", Max.class);
+            _addOperatorExpressionType("Min", Min.class);
+            _addOperatorExpressionType("Log", Log.class);
+            _addOperatorExpressionType("Exp", Exp.class);
+            _addOperatorExpressionType("Power", Power.class);
+            _addOperatorExpressionType("SquareRoot", SquareRoot.class);
+            _addOperatorExpressionType("Abs", Abs.class);
+            _addOperatorExpressionType("Round", Round.class);
+            _addOperatorExpressionType("Rint", Rint.class);
+            _addOperatorExpressionType("Floor", Floor.class);
+            _addOperatorExpressionType("Ceiling", Ceiling.class);
+            _addOperatorExpressionType("StringLength", StringLength.class);
+            _addOperatorExpressionType("GetDayOfMonth", GetDayOfMonth.class);
+            _addOperatorExpressionType("GetDayOfWeek", GetDayOfWeek.class);
+            _addOperatorExpressionType("GetDayOfWeekInMonth", GetDayOfWeekInMonth.class);
+            _addOperatorExpressionType("GetDayOfYear", GetDayOfYear.class);
+            _addOperatorExpressionType("GetHour12", GetHour12.class);
+            _addOperatorExpressionType("GetHour24", GetHour24.class);
+            // addBuiltInExpressionType("GetHourOfDay", GetHourOfDay.class);
+            _addOperatorExpressionType("GetMinute", GetMinute.class);
+            _addOperatorExpressionType("GetSecond", GetSecond.class);
+            _addOperatorExpressionType("GetMillisecond", GetMillisecond.class);
+            _addOperatorExpressionType("GetWeekOfMonth", GetWeekOfMonth.class);
+            _addOperatorExpressionType("GetWeekOfYear", GetWeekOfYear.class);
+            _addOperatorExpressionType("GetMonth", GetMonth.class);
+            _addOperatorExpressionType("GetYear", GetYear.class);
+            _addOperatorExpressionType("ToMilliseconds", ToMilliseconds.class);
+            _addOperatorExpressionType("Log10", Log10.class);
+            _addOperatorExpressionType("Ln", Ln.class);
+            
+            // StringExpression
+            
+            _addOperatorExpressionType("StringConstant", StringConstant.class);
+            _addOperatorExpressionType("ToString", ToString.class);
+            _addOperatorExpressionType("ToUpper", ToUpper.class);
+            _addOperatorExpressionType("ToLower", ToLower.class);
+            _addOperatorExpressionType("LeftSubString", LeftSubstring.class);
+            _addOperatorExpressionType("MiddleSubString", MiddleSubstring.class);
+            _addOperatorExpressionType("RightSubString", RightSubstring.class);
+            _addOperatorExpressionType("ReplaceSubString", ReplaceSubstring.class);
+            _addOperatorExpressionType("Word", Word.class);
+            _addOperatorExpressionType("Concatenate", Concatenate.class);
+            _addOperatorExpressionType("SubString", Substring.class);
+            _addOperatorExpressionType("MatchesRegExp", MatchesRegExp.class);
+            
+            // CalendarExpression
+            _addOperatorExpressionType("DateTimeConstant", DateTimeConstant.class);
+            //_addOperatorExpressionType("TimeConstant", TimeConstant.class);
+            
+            // BasicCollectionExpression
+            _addOperatorExpressionType("MinInCollection", MinInCollection.class);
+            _addOperatorExpressionType("InCollection", InCollection.class);
+            _addOperatorExpressionType("Union", Union.class);
+            _addOperatorExpressionType("MaxInCollection", MaxInCollection.class);
+            _addOperatorExpressionType("CollectionSize", CollectionSize.class);
+            _addOperatorExpressionType("Sum", Sum.class);
+            _addOperatorExpressionType("AvrgInCollection", AvrgInCollection.class);
+            _addOperatorExpressionType("EqCollection", EqCollections.class);
+            _addOperatorExpressionType("SubCollection", SubCollection.class);
+            _addOperatorExpressionType("SdInCollection", SdInCollection.class);
+            _addOperatorExpressionType("MedianInCollection", MedianInCollection.class);
+            _addOperatorExpressionType("AllInCollection", AllInCollection.class);
+            _addOperatorExpressionType("AnyInCollection", AnyInCollection.class);
+            _addOperatorExpressionType("ApplyToCollection", ApplyToCollection.class);
+            _addOperatorExpressionType("GetCurrentTime", GetCurrentTime.class);
+            
+            _loadCustomOperatorExpressionTypes();
+            
+            _addActionExpressionType("ReturnValues",ReturnValues.class);
+            
+            _loadCustomActionExpressionTypes();
+            
+        }
+        catch (Exception e)
+        {
+            logger.severe(e.getMessage());
+        }
+        logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "Set up the known map between ACPL element function names and handler");
+        
+    }
+    
+    /**
+     * Adds known types to the underlying ACPLParserMap via type class object.
+     * 
+     * @param typeLocalName
+     *            local name for the type within the namespace
+     * @param classObject
+     *            Class object representing the type class
+     * @throws IllegalArgumentException
+     *             if namespace, shortname, or classObject are <code>null</code>
+     */
+    private static void _addOperatorExpressionType(String typeLocalName, Class classObject)
+            throws SPLException
+    {
+        logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "addKnownType");
+
+        if (classObject == null || typeLocalName == null)
+        {
+//            Object[] args = new Object[]
+//            {
+//                    typeLocalName, classObject
+//            };
+          
+            logger.severe(Thread.currentThread().getName()+" "+"builtin method error");
+            throw new SPLException("builtin method error");
+        }
+        
+        _knownOperatorExpressionMap.put(typeLocalName.toLowerCase(), classObject.getName());
+
+        logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "addKnownType");
+       
+    }
+    
+    private static void _loadCustomActionExpressionTypes() throws SPLException 
+    {
+		List customActionList = ExpressionUtility.getListOfCustomActionTypes();
+		Iterator it = customActionList.iterator();
+		while(it.hasNext())
+		{
+			String customActionName = (String)it.next();
+			int lastIndexOfDot = customActionName.lastIndexOf('.');
+			
+			String actionShortName = customActionName.substring(lastIndexOfDot + 1);
+			try {
+				Class cl = Class.forName(customActionName);
+				_addActionExpressionType(actionShortName,cl);
+			} catch (ClassNotFoundException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+				throw new SPLException("Class not found " + e);
+			} catch (SPLException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			
+		}
+		
+	}
+
+    /**
+     * Used by editor to load custom actions
+     * @param aCustomActionList
+     * @param aUrls
+     * @throws SPLException
+     */
+    public static void loadCustomActionExpressionTypes(List aCustomActionList,
+			URL[] aUrls) throws SPLException {
+
+    	List customActionList = aCustomActionList;
+		Iterator it = customActionList.iterator();
+		URLClassLoader uc = new URLClassLoader(aUrls);
+		while (it.hasNext()) {
+			String customActionName = (String) it.next();
+			int lastIndexOfDot = customActionName.lastIndexOf('.');
+
+			String actionShortName = customActionName.substring(lastIndexOfDot + 1);
+			try {
+				// Class cl = Class.forName(customActionName);
+				Class cl = uc.loadClass(customActionName.trim());
+				_addActionExpressionType(actionShortName, cl);
+			} catch (ClassNotFoundException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+				throw new SPLException("Class not found " + e);
+			} catch (SPLException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+		}
+	}
+ 
+    /**
+     *  Used by editor to load custom expressions
+     * @param aCustomOperatorList
+     * @param aUrls
+     * @throws SPLException
+     */
+	public static void loadCustomOperatorExpressionTypes(List aCustomOperatorList,
+			URL[] aUrls) throws SPLException {
+		List customActionList = aCustomOperatorList;
+		Iterator it = customActionList.iterator();
+		URLClassLoader uc = new URLClassLoader(aUrls);
+		while (it.hasNext()) {
+			String customActionName = (String) it.next();
+			int lastIndexOfDot = customActionName.lastIndexOf('.');
+
+			String actionShortName = customActionName
+					.substring(lastIndexOfDot + 1);
+			try {
+//				Class cl = Class.forName(customActionName);
+				Class cl = uc.loadClass(customActionName.trim());
+				_addOperatorExpressionType(actionShortName, cl);
+			} catch (ClassNotFoundException e) {
+
+				e.printStackTrace();
+				throw new SPLException("Class not found " + e);
+			} catch (SPLException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+
+		}
+
+	}
+
+    
+    
+    
+
+	private static void _loadCustomOperatorExpressionTypes() throws SPLException 
+	{
+		List customActionList = ExpressionUtility.getListOfCustomExpressionTypes();
+		Iterator it = customActionList.iterator();
+		while(it.hasNext())
+		{
+			String customActionName = (String)it.next();
+			int lastIndexOfDot = customActionName.lastIndexOf('.');
+			
+			String actionShortName = customActionName.substring(lastIndexOfDot + 1);
+			try {
+				Class cl = Class.forName(customActionName);
+				_addOperatorExpressionType(actionShortName,cl);
+			} catch (ClassNotFoundException e) {
+				
+				e.printStackTrace();
+				throw new SPLException("Class not found " + e);
+			} catch (SPLException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			
+		}
+		
+	}
+
+	private static void _addActionExpressionType(String typeLocalName, Class classObject)
+    throws SPLException
+	{
+		logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "addBuiltInActionType");
+		
+		if (classObject == null || typeLocalName == null)
+		{
+//		    Object[] args = new Object[]
+//		    {
+//		            typeLocalName, classObject
+//		    };
+		  
+		    logger.severe(Thread.currentThread().getName()+" "+"builtin method error");
+		    throw new SPLException("builtin method error");
+		}
+		
+		_knownActionExpressionMap.put(typeLocalName.toLowerCase(), classObject.getName());
+		
+		logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "addKnownType");
+	
+	}
+	
+	
+    
+    /**
+   
+    
+    /**
+     * Returns the Class of a known type corresponding to the type with the
+     * given typeLocalName, or <code>null</code> if the type is not defined.
+     * <p>
+     * 
+     * Does not return user-defined type Classes.
+     * 
+     * @param typeLocalName
+     *            local name for the type
+     * @return Class the type, or <code>null</code> if it is undefined
+     * 
+     * @throws ClassNotFoundException
+     *             if the class can not be located
+     */
+    public static Class getClassForOperatorExpressionType(String typeLocalName)
+            throws ClassNotFoundException
+    {
+        logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
+        Class result = _getClassForExpressionType(typeLocalName,_knownOperatorExpressionMap);
+        
+       logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
+        
+        return result;
+    }
+    public static Class getClassForActionExpressionType(String typeLocalName)
+    	throws ClassNotFoundException
+	{
+		logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
+		
+		Class result = _getClassForExpressionType(typeLocalName,_knownActionExpressionMap);
+		
+		
+		logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
+		
+		return result;
+	}
+    
+    private static Class _getClassForExpressionType(String typeLocalName, Properties propMap)
+    throws ClassNotFoundException
+	{
+		logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
+		
+		
+		//System.out.println("ACPLParserMap::getClassForKnownType " + typeLocalName);
+		//String methodName = "getClassForKnownType(String, String)";
+		Class result = null;
+		
+		if (result == null)
+		{
+		    // Try to find user defined type and return
+		    String knownClass;
+		    try
+		    {
+		        knownClass = (String) propMap.get(typeLocalName.toLowerCase());
+		        if (knownClass != null)
+		        {
+		            //System.out.println(knownClass);
+		        }
+		        else
+		        {
+		            //System.out.println("knownPropertyMap does not contain "+ typeLocalName);
+		        }
+		    }
+		    catch (IllegalArgumentException e)
+		    {
+//		        Object[] args = new Object[]
+//		        {
+//		            typeLocalName
+//		        };
+		        // don't log message, calling class should log error message
+		        logger.severe(e.getMessage());
+		        throw new ClassNotFoundException();
+		        
+		    }
+		    if (knownClass == null)
+		    {
+		        result = Class.forName(typeLocalName.trim());
+		    }
+		    else
+		    {
+		        result = Class.forName(knownClass.trim());
+		    }
+		    
+		}
+		logger.exiting(_sourceClass,Thread.currentThread().getName()+" "+ "getClassForKnownType");
+		
+		return result;
+	}
+    
+    
+   
+    
+    /**
+     * Returns <code>true</code> if the given type is a known type.
+     * 
+     * @param typeLocalName
+     *            local name for the type
+     * @return <code>true</code> if the given type is a known type
+     */
+    public static boolean isKnownOperatorExpressionType(String typeLocalName)
+    {
+        logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "isKnownBuiltInExpressionType");
+        
+        boolean result = _isKnownExpressionType(typeLocalName,_knownOperatorExpressionMap);
+        return result;
+       
+    }
+    
+    public static boolean isKnownActionExpressionType(String typeLocalName)
+    {
+        logger.entering(_sourceClass,Thread.currentThread().getName()+" "+ "isKnownActionExpressionType" 
+        		+ typeLocalName);
+        boolean result = _isKnownExpressionType(typeLocalName,_knownActionExpressionMap);
+        logger.exiting(_sourceClass,Thread.currentThread().getName()+" " + "isKnownActionExpressionType" + result);
+        return result;
+        
+       
+    }
+    
+    private static boolean _isKnownExpressionType(String typeName, Properties propMap)
+    {
+    	boolean result = false;
+    	
+    	result = propMap.containsKey(typeName.toLowerCase());
+    	
+    	return result;
+    	
+    }
+    
+ 
+    
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ACPLParserMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ActionFactory.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ActionFactory.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ActionFactory.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ActionFactory.java Fri Jan 11 10:56:30 2008
@@ -1,120 +1,120 @@
-/*
- * 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.factory;
-
-import java.util.List;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.external.Expression;
-import org.apache.imperius.spl.parser.compiler.SPLTreeParserTokenTypes;
-import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.factory.ACPLParserMap;
-import org.apache.imperius.spl.parser.statements.ActionBlock;
-import org.apache.imperius.spl.parser.statements.actions.impl.AnchorMethodInvokeAction;
-import org.apache.imperius.spl.parser.statements.actions.impl.ArrowActionBlock;
-import org.apache.imperius.spl.parser.statements.actions.impl.ConcurrentActionBlock;
-import org.apache.imperius.spl.parser.statements.actions.impl.ExtrinsicMethodInvokeAction;
-import org.apache.imperius.spl.parser.statements.actions.impl.InvokePolicyAction;
-import org.apache.imperius.spl.parser.statements.actions.impl.LogicalAndActionBlock;
-import org.apache.imperius.spl.parser.statements.actions.impl.LogicalOrActionBlock;
-import org.apache.imperius.spl.parser.statements.actions.impl.SetActionBlock;
-import org.apache.imperius.util.SPLLogger;
-
-
-
-public class ActionFactory
-{
-    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-    private static final String sourceClass="ActionFactory";
-    
-    
-    public static ActionBlock createAction(ActionBlock ab1, ActionBlock ab2,
-            int type, SPLSymbolTable sTab)
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createAction");
-
-        ActionBlock returnBlock = null;
-        switch (type)
-        {
-            case SPLTreeParserTokenTypes.ARROW:
-                returnBlock = new ArrowActionBlock(ab1, ab2);
-                break;
-            
-            case SPLTreeParserTokenTypes.LOR:
-                returnBlock = new LogicalOrActionBlock(ab1, ab2);
-                break;
-            case SPLTreeParserTokenTypes.LAND:
-                returnBlock = new LogicalAndActionBlock(ab1, ab2);
-                break;
-            case SPLTreeParserTokenTypes.BOR:
-                returnBlock = new ConcurrentActionBlock(ab1, ab2);
-                
-        }
-
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createAction");
-       
-        return returnBlock;
-        
-    }
-    
-    /*
-     * x.y(...) y(...) set.y(...)
-     * 
-     */
-
-    public static ActionBlock createAction(String className1,
-            String classNameOrMethodName, List paramList, String set,
-            String op, Expression c, SPLSymbolTable symTab) throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createAction");
-
-        
-        ActionBlock returnBlock = null;
-        if (set.equalsIgnoreCase("Set"))
-        {
-           List anchorClasses=symTab.getAnchorData().getAnchorClassList();
-           
-           returnBlock = new SetActionBlock((String)anchorClasses.get(0), paramList, symTab);
-        }
-        else if(set.equalsIgnoreCase("InvokePolicy"))
-        {
-            returnBlock = new InvokePolicyAction(paramList);
-        }
-        
-        else  if (ACPLParserMap.isKnownActionExpressionType(className1))
-        {
-            returnBlock = new ExtrinsicMethodInvokeAction(className1, paramList, symTab);
-            
-        }
-        else
-        {
-            returnBlock = new AnchorMethodInvokeAction(className1,
-                    classNameOrMethodName, paramList, op, c, symTab);
-        }
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createAction");
-        
-        return returnBlock;
-        
-    }
-    
-   
-    
-}
+/*
+ * 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.factory;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.compiler.SPLTreeParserTokenTypes;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.factory.ACPLParserMap;
+import org.apache.imperius.spl.parser.statements.ActionBlock;
+import org.apache.imperius.spl.parser.statements.actions.impl.AnchorMethodInvokeAction;
+import org.apache.imperius.spl.parser.statements.actions.impl.ArrowActionBlock;
+import org.apache.imperius.spl.parser.statements.actions.impl.ConcurrentActionBlock;
+import org.apache.imperius.spl.parser.statements.actions.impl.ExtrinsicMethodInvokeAction;
+import org.apache.imperius.spl.parser.statements.actions.impl.InvokePolicyAction;
+import org.apache.imperius.spl.parser.statements.actions.impl.LogicalAndActionBlock;
+import org.apache.imperius.spl.parser.statements.actions.impl.LogicalOrActionBlock;
+import org.apache.imperius.spl.parser.statements.actions.impl.SetActionBlock;
+import org.apache.imperius.util.SPLLogger;
+
+
+
+public class ActionFactory
+{
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="ActionFactory";
+    
+    
+    public static ActionBlock createAction(ActionBlock ab1, ActionBlock ab2,
+            int type, SPLSymbolTable sTab)
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createAction");
+
+        ActionBlock returnBlock = null;
+        switch (type)
+        {
+            case SPLTreeParserTokenTypes.ARROW:
+                returnBlock = new ArrowActionBlock(ab1, ab2);
+                break;
+            
+            case SPLTreeParserTokenTypes.LOR:
+                returnBlock = new LogicalOrActionBlock(ab1, ab2);
+                break;
+            case SPLTreeParserTokenTypes.LAND:
+                returnBlock = new LogicalAndActionBlock(ab1, ab2);
+                break;
+            case SPLTreeParserTokenTypes.BOR:
+                returnBlock = new ConcurrentActionBlock(ab1, ab2);
+                
+        }
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createAction");
+       
+        return returnBlock;
+        
+    }
+    
+    /*
+     * x.y(...) y(...) set.y(...)
+     * 
+     */
+
+    public static ActionBlock createAction(String className1,
+            String classNameOrMethodName, List paramList, String set,
+            String op, Expression c, SPLSymbolTable symTab) throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createAction");
+
+        
+        ActionBlock returnBlock = null;
+        if (set.equalsIgnoreCase("Set"))
+        {
+           List anchorClasses=symTab.getAnchorData().getAnchorClassList();
+           
+           returnBlock = new SetActionBlock((String)anchorClasses.get(0), paramList, symTab);
+        }
+        else if(set.equalsIgnoreCase("InvokePolicy"))
+        {
+            returnBlock = new InvokePolicyAction(paramList);
+        }
+        
+        else  if (ACPLParserMap.isKnownActionExpressionType(className1))
+        {
+            returnBlock = new ExtrinsicMethodInvokeAction(className1, paramList, symTab);
+            
+        }
+        else
+        {
+            returnBlock = new AnchorMethodInvokeAction(className1,
+                    classNameOrMethodName, paramList, op, c, symTab);
+        }
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createAction");
+        
+        return returnBlock;
+        
+    }
+    
+   
+    
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ActionFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message