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 2007/12/22 19:34:03 UTC

svn commit: r606479 [20/30] - in /incubator/imperius/trunk/trunk: ./ modules/ modules/imperius-javaspl/ modules/imperius-javaspl/resources/ modules/imperius-javaspl/resources/samples/ modules/imperius-javaspl/resources/samples/computersystem/ modules/i...

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/UnaryNotExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/UnaryNotExpression.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/UnaryNotExpression.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/UnaryNotExpression.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,103 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.SingleArgumentExpression;
+import org.apache.imperius.spl.parser.util.TypeInfo;
+import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class UnaryNotExpression extends SingleArgumentExpression implements
+        Expression
+{
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="UnaryNotExpression";
+    
+    
+    
+    public UnaryNotExpression(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "UnaryNotExpression");
+
+        if (validateExpression)
+        {
+            if (!validate())
+            {
+                logger.severe(
+                "validation error:   wrong data type passed in.");
+                
+                throw new SPLException(
+                        "validation error:   wrong data type passed in.");
+            }
+        }
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "UnaryNotExpression");
+        
+    }
+    
+    // @Override
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        
+        Boolean result = (Boolean) _exp.evaluate();
+        Boolean result1 = new Boolean(!result.booleanValue());
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate "+result1);
+        
+        return result1;
+    }
+    
+    // @Override
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        TypeInfo tp = _exp.getType();
+        if (TypeResolver.isBoolean(tp))
+        {
+            _dataType.copy(tp);
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return true;
+        }
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+     
+        return false;
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        String retStr= this._exp.toString() + "(...!...)";
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return retStr;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/UnaryPlusExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/UnaryPlusExpression.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/UnaryPlusExpression.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/UnaryPlusExpression.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,101 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.NumericExpression;
+import org.apache.imperius.spl.parser.expressions.SingleArgumentExpression;
+import org.apache.imperius.spl.parser.util.*;
+import org.apache.imperius.util.SPLLogger;
+
+
+
+public class UnaryPlusExpression extends SingleArgumentExpression implements
+        NumericExpression
+{
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="UnaryPlusExpression";
+    
+    
+    
+    public UnaryPlusExpression(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "UnaryPlusExpression");
+
+        if (validateExpression)
+        {
+            if (!validate())
+            {
+                logger.severe(
+                "validation error:   wrong data type passed in.");
+                
+                throw new SPLException(
+                        "validation error:   wrong data type passed in.");
+            }
+        }
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "UnaryPlusExpression");
+        
+    }
+    
+    // @Override
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+        Object result = _exp.evaluate(); 
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+     
+        // TODO Auto-generated method stub
+        return result;
+    }
+    
+    // @Override
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        if (TypeResolver.isNumeric(_exp.getType()))
+        {
+            _dataType.copy(_exp.getType());
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return true;
+        }
+        // TODO Auto-generated method stub
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+        
+        return false;
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        String retStr= this._exp.toString() + "(...++...)";
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return retStr;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Union.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Union.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Union.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Union.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,194 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.DoubleArgumentExpression;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class Union extends DoubleArgumentExpression implements Expression
+{
+    
+    // private BasicCollectionExpression basicCollection=null;
+    public String className = Union.class.toString();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="Union";
+    
+    
+    
+    public Union(List exprList, boolean evaluateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Union");
+
+       //System.out.println("Union");
+        // this.basicCollection=new BasicCollectionExpression(exprList,new
+        // SPLSymbolTable());
+        
+        if (evaluateExpression)
+        {
+           //System.out.println("evaluateExpression " + evaluateExpression);
+            if (!validate())
+            {
+
+                logger.severe(
+                        "validation error: wrong data type passed in "
+                        + this._dataType);
+             
+                throw new SPLException(
+                        "validation error: wrong data type passed in "
+                                + this._dataType);
+            }
+            
+        }
+       
+       // this._isArray = true;
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Union");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+       //System.out.println("Union:evaluate");
+        Object lhsResult = this._lhsExp.evaluate();
+        Object rhsResult = this._rhsExp.evaluate();
+        
+        if (!(lhsResult instanceof java.util.List))
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"lhsResult is not of type List");
+            throw new SPLException("lhsResult is not of type List");
+        }
+        else
+        {
+           //System.out.println("lhsResult is of type List");
+        }
+        if (!(rhsResult instanceof java.util.List))
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"rhsResult is not of type List");
+            throw new SPLException("rhsResult is not of type List");
+        }
+        else
+        {
+           //System.out.println("rhsResult is of type List");
+        }
+        
+        List lhsResultarray = (List) lhsResult;
+        List rhsResultarray = (List) rhsResult;
+        List unionResult = new ArrayList();
+       //System.out.println("lhsResultarray " + lhsResultarray.toString());
+       //System.out.println("rhsResultarray " + rhsResultarray.toString());
+        // List resultList=rhsResultarray;
+        Iterator lhsResultarrayIt = lhsResultarray.iterator();
+        while (lhsResultarrayIt.hasNext())
+        {
+            Object lhsResultarrayElement = lhsResultarrayIt.next();
+           //System.out.println("element from Lhs ResultArray "+ lhsResultarrayElement + "  "+ lhsResultarrayElement.getClass());
+           //System.out.println("element added to result List");
+            unionResult.add(lhsResultarrayElement);
+            
+        }
+        Iterator rhsResultarrayIt = rhsResultarray.iterator();
+        while (rhsResultarrayIt.hasNext())
+        {
+            Object rhsResultarrayElement = rhsResultarrayIt.next();
+           //System.out.println("element from Lhs ResultArray "+ lhsResultarrayElement + "  "+ lhsResultarrayElement.getClass());
+           //System.out.println("element added to result List");
+            unionResult.add(rhsResultarrayElement);
+           
+        }
+       //System.out.println("resultList " + rhsResultarray.toString());
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate "+unionResult.toString());
+        
+        return unionResult;
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+       //System.out.println("Union : validate ");
+        Expression lhsExpression = (Expression) this._lhsExp;
+        Expression rhsExpression = (Expression) this._rhsExp;
+        _dataType.copy(_lhsExp.getType());
+        
+        if ((lhsExpression == null) || (rhsExpression == null))
+        {
+           //System.out.println("Union : One or more expressions are null ");
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return false;
+        }
+        if (lhsExpression.getType().getType() != rhsExpression.getType().getType())
+        {
+           //System.out.println("Union : lhs Type !=rhs Type "+ lhsExpression.getType() + ":" + rhsExpression.getType());
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return false;
+        }
+        if (lhsExpression.isArray())
+        {
+           //System.out.println("lhsExpression.getType() ==TypeConstants.basicCollectionType");
+            if (rhsExpression.isArray())
+            {
+               //System.out.println("rhsExpression.getType() ==TypeConstants.basicCollectionType");
+                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                
+                return true;
+                
+            }
+            else
+            {
+               //System.out.println("rhsExpression.getType() !=TypeConstants.basicCollectionType");
+                logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+                
+                return false;
+            }
+        }
+        else
+        {
+           //System.out.println("lhsExpression.getType() !=TypeConstants.basicCollectionType");
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return false;
+        }
+        
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        String retStr= "( "+this._lhsExp.toString() + " Union " + this._rhsExp.toString()+" )";
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return retStr;
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Word.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Word.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Word.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expressions/impl/Word.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,187 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <pr...@in.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.expressions.impl;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.expressions.StringExpression;
+import org.apache.imperius.spl.parser.expressions.TripleArgumentExpression;
+import org.apache.imperius.spl.parser.util.TypeInfo;
+import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class Word extends TripleArgumentExpression implements StringExpression
+{
+    
+    public static final String className = Word.class.getName();
+    
+    private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+    private static final String sourceClass="Word";
+    
+    
+    
+    public Word(List exprList, boolean validateExpression)
+            throws SPLException
+    {
+        super(exprList);
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "Word");
+
+        if (validateExpression)
+        {
+            if (!validate())
+            {
+                logger.severe(Thread.currentThread().getName()+" "+"validation error: " + className
+                        + " has wrong data type passed in.");
+                
+                throw new SPLException("validation error: " + className
+                        + " has wrong data type passed in.");
+            }
+        }
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "Word");
+        
+    }
+    
+    public Object evaluate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+
+        try
+        {
+            String o1 = (String) _lhsExp.evaluate();
+            String o2 = (String) _midExp.evaluate();
+            Number o3 = (Number) _rhsExp.evaluate();
+            String result = _word(o1, o2, ((Integer) o3).intValue());
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate" + result);
+            
+            return result;
+        }
+        catch (Exception e)
+        {
+            logger.severe(Thread.currentThread().getName()+" "+"evaluation error: " + e.toString());
+            
+            throw new SPLException("evaluation error: " + e.toString());
+        }
+    }
+    
+    /**
+     * Returns a substring from the <code>baseString</code> with
+     * <code>n</code> words where words are defined as 1 or more characters
+     * between <code>separatorStrings</code>.
+     * <p>
+     * 
+     * @param baseString
+     *            base string
+     * @param separatorString
+     *            string of character(s) that represent a word delimiter
+     * @param numberOfWords
+     *            number of words to return in the substring
+     * @return the substring with up to numberOfWords in the substring
+     */
+    private String _word(String baseString, String separatorString,
+            int numberOfWords)
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "word");
+
+        
+        if (numberOfWords < 0)
+        {
+            logger.severe(
+            "NumberOfWords must be non-negative.");
+            
+            throw new IllegalArgumentException(
+                    "NumberOfWords must be non-negative.");
+        }
+        if (numberOfWords == 0){
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "word");
+        
+            return "";
+            }
+        
+        int pos = baseString.indexOf(separatorString);
+        int foundWords = 0;
+        int lastpos = 0;
+        int substringEnd = 0;
+        int separatorLength = separatorString.length();
+        
+        while (foundWords < numberOfWords && pos >= 0)
+        {
+            if (pos > lastpos + separatorLength)
+            {
+                // found a word
+                foundWords++;
+                substringEnd = pos;
+            }
+            lastpos = pos;
+            pos = baseString.indexOf(separatorString, pos + separatorLength);
+        }
+        if (substringEnd > 0)
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "word");
+            
+            return baseString.substring(0, substringEnd);
+        }
+        else
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "word");
+            
+            return "";
+        }
+    }
+    
+    public boolean validate() throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        TypeInfo lType = _lhsExp.getType();
+        TypeInfo mType = _midExp.getType();
+        TypeInfo rType = _rhsExp.getType();
+        
+        if (!lType.getIsArray() && !mType.getIsArray() && !rType.getIsArray() &&
+        		TypeResolver.isString(lType) && TypeResolver.isString(mType)
+                && TypeResolver.isNumeric(rType))
+        {
+            _dataType.setType(TypeConstants.stringType);
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+            
+            return true;
+        }
+
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+     
+        return false;
+    }
+    
+    public String toString()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+        String retStr= "Word( "+this._lhsExp.toString()+" , "+this._midExp.toString()+" , "+this._rhsExp.toString()+" )";
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return retStr;
+    }
+
+
+    
+}

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

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

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/factory/BuitInOperationExpressionFactory.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/factory/BuitInOperationExpressionFactory.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/factory/BuitInOperationExpressionFactory.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/factory/BuitInOperationExpressionFactory.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,427 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jn...@us.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.factory;
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.compiler.symboltable.MacroSymbol;
+import org.apache.imperius.spl.parser.compiler.symboltable.MethodSymbol;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+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.SPLLogger;
+
+
+// import org.apache.imperius.spl.parser.expressions.MethodExpression;
+
+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;
+    }
+
+	
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/factory/ExpressionFactory.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/factory/ExpressionFactory.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/factory/ExpressionFactory.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/factory/ExpressionFactory.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,417 @@
+/*
+ * 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 <jn...@us.ibm.com>
+ *
+ */
+package org.apache.imperius.spl.parser.factory;
+
+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;
+import org.apache.imperius.spl.external.TypeConstants;
+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.expression.primary.*;
+import org.apache.imperius.spl.parser.expressions.impl.Addition;
+import org.apache.imperius.spl.parser.expressions.impl.AssignmentExpression;
+import org.apache.imperius.spl.parser.expressions.impl.BooleanConstant;
+import org.apache.imperius.spl.parser.expressions.impl.CharConstant;
+import org.apache.imperius.spl.parser.expressions.impl.DateTime;
+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.Equal;
+import org.apache.imperius.spl.parser.expressions.impl.FloatConstant;
+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.IntegerConstant;
+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.LogicalAnd;
+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.NotEqual;
+import org.apache.imperius.spl.parser.expressions.impl.Product;
+import org.apache.imperius.spl.parser.expressions.impl.ShortConstant;
+import org.apache.imperius.spl.parser.expressions.impl.StringConstant;
+import org.apache.imperius.spl.parser.expressions.impl.Subtraction;
+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.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
+public class ExpressionFactory
+{
+
+	private static String GMT = "GMT";
+
+	private static int UTC_MULTIPLIER = 60000;
+
+	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+	private static final String sourceClass="ExpressionFactory";
+
+
+	public static Expression createExpression(Expression e1, Expression e2,
+			int type, SPLSymbolTable sTab) throws SPLException
+			{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
+
+		//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)
+		{
+			//System.out.println("sTab.getSymbolTableType() == SPLSymbolTable.COLLECT");
+			validateExpr = false;
+		}
+		switch (type)
+		{
+		case SPLTreeParserTokenTypes.ASSIGN:
+			//System.out.println("Expression Factory::Creating assignment expression");
+			returnExpr = new AssignmentExpression(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.LOR:
+			returnExpr = new LogicalOr(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.LAND:
+			returnExpr = new LogicalAnd(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.BXOR:
+			returnExpr = new LogicalXor(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.NOT_EQUAL:
+			returnExpr = new NotEqual(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.EQUAL:
+			returnExpr = new Equal(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.LT:
+			returnExpr = new Less(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.GT:
+			returnExpr = new Greater(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.LE:
+			returnExpr = new LessOrEqual(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.GE:
+			returnExpr = new GreaterOrEqual(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.PLUS:
+			returnExpr = new Addition(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.MINUS:
+			returnExpr = new Subtraction(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.DIV:
+			returnExpr = new Division(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.STAR:
+			returnExpr = new Product(exprList, validateExpr);
+			break;
+
+		}
+
+		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");
+
+		Expression returnExpr = null;
+
+		List exprList = new ArrayList();
+		exprList.add(e1);
+		boolean validateExpr = true;
+		if (sTab.getSymbolTableType() == SPLSymbolTable.COLLECT)
+		{
+			validateExpr = false;
+		}
+		switch (type)
+		{
+		case SPLTreeParserTokenTypes.UNARY_MINUS:
+			returnExpr = new UnaryMinusExpression(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.UNARY_PLUS:
+			returnExpr = new UnaryPlusExpression(exprList, validateExpr);
+			break;
+
+		case SPLTreeParserTokenTypes.UNARY_NOT:
+			returnExpr = new UnaryNotExpression(exprList, validateExpr);
+
+		}
+
+
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
+
+		return returnExpr;
+
+			}
+
+	public static Expression createExpression(String val, int type)
+	throws SPLException
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
+
+		Expression returnExpr = null;
+		switch (type)
+		{
+		case TypeConstants.dateTime:
+			//System.out.println("Expression factory creating new date time: "+ val.toString());
+			returnExpr = new DateTimeConstant(val);
+			break;
+
+		case TypeConstants.charType:
+			char[] cArr = val.toCharArray();
+			returnExpr = new CharConstant(cArr[0]);
+			break;
+
+		case TypeConstants.doubleType:
+			returnExpr = new DoubleConstant(Double.valueOf(val)
+					.doubleValue());
+			break;
+
+		case TypeConstants.floatType:
+			returnExpr = new FloatConstant(Float.valueOf(val).floatValue());
+			break;
+
+		case TypeConstants.intType:
+			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"))
+			{
+				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))
+			{
+				//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);
+			}
+
+			break;
+
+		case TypeConstants.booleanType:
+			returnExpr = new BooleanConstant(Boolean.valueOf(val)
+					.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;
+			 */
+
+		}
+
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createExpression");
+
+		return returnExpr;
+
+	}
+
+	public static Expression createSelfExpression(SPLSymbolTable st)throws SPLException
+	{
+		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");
+
+		return expression;
+	}
+
+	public static Expression createCollectExpression(ArrayList pList,
+			Expression postCollect, SPLSymbolTable sTab)
+	throws SPLException
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createCollectExpression");
+
+		Expression returnExpr = null;
+		returnExpr = new CollectOperation(pList, postCollect, sTab);
+
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createCollectExpression");
+
+		return returnExpr;
+	}
+
+	// exp =
+	// ExpressionFactory.createPostCollectExpression(id.getText(),arrExp,pList);
+
+	public static Expression createPostCollectExpression(Expression arr1,
+			String propOrMethodName, Expression arrExp, ArrayList pList,
+			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");
+
+		return returnExpr;
+
+			}
+
+	public static Expression createBasicCollectExpression(ArrayList pList,
+			SPLSymbolTable sTab) throws SPLException
+			{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createBasicCollectExpression");
+
+		Expression returnExpr = null;
+		returnExpr = new BasicCollectionExpression(pList, sTab);
+		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.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createBasicCollectExpression");
+
+		return returnExpr;
+			}
+
+	public static Expression createExpression(String classOrOperationName, 
+			List paramOrIdentTupleList, 
+			boolean isBuiltInOperation,
+			SPLSymbolTable symTab) throws SPLException
+			{
+		Expression returnExpr = null;
+		if (isBuiltInOperation)
+		{
+			//System.out.println("isBuiltInOperation=true ");
+			if(symTab ==null)
+			{
+				//System.out.println("ExpressionFactory : symTab is null ");
+			}
+			returnExpr = BuitInOperationExpressionFactory.createExpression(classOrOperationName,
+					"", paramOrIdentTupleList, symTab);
+
+		}
+		else
+		{
+			//System.out.println("isBuiltInOperation=false "+classOrOperationName);
+			if(symTab ==null)
+			{
+				//System.out.println("ExpressionFactory : symTab is null ");
+			}
+			returnExpr = new PrimaryExpression(classOrOperationName,
+					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;
+
+            }*/
+
+	
+	
+}