You are viewing a plain text version of this content. The canonical link for it is here.
Posted to imperius-commits@incubator.apache.org by ke...@apache.org on 2008/01/11 18:57:14 UTC

svn commit: r611261 [35/43] - in /incubator/imperius/trunk: ./ imperius-javaspl/ imperius-javaspl/src/main/java/org/apache/imperius/javaspl/ imperius-splcore/ imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/ imperius-splcore/src...

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java Fri Jan 11 10:56:30 2008
@@ -1,522 +1,522 @@
-/*
- * 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.util;
-
-
-
-import java.util.List;
-
-import org.apache.imperius.spl.external.Expression;
-import org.apache.imperius.spl.external.TypeConstants;
-import org.apache.imperius.spl.parser.exceptions.IllegalExpressionTypeException;
-import org.apache.imperius.spl.parser.exceptions.IllegalParameterTypeException;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.exceptions.TypesNotAssignableException;
-
-
-
-
-/**
- * Provides Number Expression Type resolution.
- * 
- */
-public class TypeResolver
-{
-    
-    
-
-//    private static final String sourceClass="TypeConstants";
-    
-    
-    
-    /*
-     * public static final byte BYTE = 0; public static final byte SHORT = 1;
-     * public static final byte INTEGER = 2; public static final byte LONG = 3;
-     * public static final byte FLOAT = 4; public static final byte DOUBLE = 5;
-     */
-
-    /**
-     * Determines the numeric type that should be used to interpret a collection
-     * of <code>Number</code> operands. Throws a
-     * <code>ClassCastException</code> if the operands collection contains
-     * objects that are not of type <code>Number</code>.
-     * 
-     * 
-     * @param operands
-     *            an array of <code>Number</code> operands
-     * @return a byte code corresponding to the resolved type
-     * @throws ClassCastException
-     *             if the collection does not contain <code>Number</code>
-     *             operands[i]s
-     * @throws IllegalExpressionTypeException
-     */
-    public static int resolveType(Number[] operands)
-            throws IllegalExpressionTypeException
-    {
-        
-        
-        int resolvedType = TypeConstants.byteType;
-        
-        for (int i = 0; i < operands.length; i++)
-        {
-            if (operands[i] instanceof Double)
-            {
-                resolvedType = TypeConstants.doubleType;
-                break;
-            }
-            else if (operands[i] instanceof Float)
-            {
-                if (resolvedType < TypeConstants.floatType)
-                    resolvedType = TypeConstants.floatType;
-            }
-            else if (operands[i] instanceof Long)
-            {
-                if (resolvedType < TypeConstants.longType)
-                    resolvedType = TypeConstants.longType;
-            }
-            else if (operands[i] instanceof Integer)
-            {
-                if (resolvedType < TypeConstants.intType)
-                    resolvedType = TypeConstants.intType;
-            }
-            else if (operands[i] instanceof Short)
-            {
-                if (resolvedType < TypeConstants.shortType)
-                    resolvedType = TypeConstants.shortType;
-            }
-        }
-
-        
-   
-        return resolvedType;
-    }
-    
-    /**
-     * Determines the numeric type that should be used to interpret the Object
-     * operands of a binary expression accoring to the Java Numeric Promotion
-     * rules.
-     * <p>
-     * 
-     * For reference: 2.6.9 Numeric Promotion Numeric promotion is applied to
-     * the operands of an arithmetic operator. Numeric promotion contexts allow
-     * the use of an identity conversion (Section 2.6.1) or a widening primitive
-     * conversion (Section 2.6.2). Numeric promotions are used to convert the
-     * operands of a numeric operator to a common type where an operation can be
-     * performed. The two kinds of numeric promotion are unary numeric promotion
-     * and binary numeric promotion. The analogous conversions in C are called
-     * "the usual unary conversions" and "the usual binary conversions." Numeric
-     * promotion is not a general feature of Java, but rather a property of the
-     * specific definitions of built-in operators. An operator that applies
-     * unary numeric promotion to a single operand of numeric type converts an
-     * operand of type byte, short, or char to int, and otherwise leaves the
-     * operand alone. The operands of the shift operators are promoted
-     * independently using unary numeric promotions.
-     * <p>
-     * 
-     * When an operator applies binary numeric promotion to a pair of numeric
-     * operands, the following rules apply, in order, using widening conversion
-     * (Section 2.6.2) to convert operands as necessary: If either operand is of
-     * type double, the other is converted to double. Otherwise, if either
-     * operand is of type float, the other is converted to float. Otherwise, if
-     * either operand is of type long, the other is converted to long.
-     * Otherwise, both operands are converted to type int.
-     * <p>
-     * Throws a <code>NullPointerException</code> if either operand is null.
-     * 
-     * @param leftOperand
-     *            left operand of a binary expression
-     * @param rightOperand
-     *            right operand of a binary expression
-     * @return a byte code corresponding to the resolved type
-     * @throws SPLException 
-     * @throws java.lang.NullPointerException
-     *             if there is null operand
-     */
-    public static TypeInfo binaryNumericPromotionResolver(TypeInfo ltOperand,
-            TypeInfo rtOperand) throws SPLException
-    {
-        int leftOperand = ltOperand.getType();
-        int rightOperand = rtOperand.getType();
-        
-        
-        if (leftOperand == TypeConstants.doubleType
-                || rightOperand == TypeConstants.doubleType)
-        {
-        
-            
-            return new TypeInfo(TypeConstants.doubleType);
-        }
-        else if (leftOperand == TypeConstants.floatType
-                || rightOperand == TypeConstants.floatType)
-        {
-        
-            
-        	return new TypeInfo(TypeConstants.floatType);
-        }
-        else if (leftOperand == TypeConstants.longType
-                || rightOperand == TypeConstants.longType)
-        {
-        
-            
-        	return new TypeInfo(TypeConstants.longType);
-        }
-        else
-        {
-           
-            
-            return new TypeInfo(TypeConstants.intType,null,false);
-        }
-        
-    }
-    
-    /**
-     * Determines the numeric type that should be used to interpret the Object
-     * operand of a unary expression accoring to the Java Numeric Promotion
-     * rules.
-     * <p>
-     * 
-     * For reference: 2.6.9 Numeric Promotion Numeric promotion is applied to
-     * the operands of an arithmetic operator. Numeric promotion contexts allow
-     * the use of an identity conversion (Section 2.6.1) or a widening primitive
-     * conversion (Section 2.6.2). Numeric promotions are used to convert the
-     * operands of a numeric operator to a common type where an operation can be
-     * performed. The two kinds of numeric promotion are unary numeric promotion
-     * and binary numeric promotion. The analogous conversions in C are called
-     * "the usual unary conversions" and "the usual binary conversions." Numeric
-     * promotion is not a general feature of Java, but rather a property of the
-     * specific definitions of built-in operators. An operator that applies
-     * unary numeric promotion to a single operand of numeric type converts an
-     * operand of type byte, short, or char to int, and otherwise leaves the
-     * operand alone. The operands of the shift operators are promoted
-     * independently using unary numeric promotions.
-     * <p>
-     * 
-     * When an operator applies binary numeric promotion to a pair of numeric
-     * operands, the following rules apply, in order, using widening conversion
-     * (Section 2.6.2) to convert operands as necessary: If either operand is of
-     * type double, the other is converted to double. Otherwise, if either
-     * operand is of type float, the other is converted to float. Otherwise, if
-     * either operand is of type long, the other is converted to long.
-     * Otherwise, both operands are converted to type int.
-     * <p>
-     * Throws a <code>NullPointerException</code> if either operand is null.
-     * 
-     * @param operand
-     *            operand of a unary expression
-     * @return a byte code corresponding to the resolved type
-     * @throws TypesNotAssignableException
-     * @throws java.lang.NullPointerException
-     *             if the operand is null
-     * 
-     * public static byte unaryNumericPromotionResolver(Number operand) throws
-     * NullPointerException {
-     * 
-     * if (operand instanceof Double) { return DOUBLE; }
-     * 
-     * if (operand instanceof Float) { return FLOAT; }
-     * 
-     * if(operand instanceof Long ) { return LONG; } // short byte char get
-     * converted to integer return INTEGER; h}
-     */
-    
-    public static boolean isTypeAssignableForEquality(TypeInfo leftType,
-            TypeInfo rightType)
-    {
-        
-        
-        boolean res = false;
-        //System.out.println("isTypeAssignableForEquality");
-        if (isNumeric(leftType) && isNumeric(rightType))
-        {
-            res = true;
-        }
-        else if (isBoolean(leftType) && isBoolean(rightType))
-        {
-            res = true;
-        }
-        else if (isString(leftType) && isString(rightType))
-        {
-            res = true;
-        }
-        else if (isCalendar(leftType) && isCalendar(rightType))
-        {
-            res = true;
-        }
-        else if (isReference(leftType) && isReference(rightType))
-        {
-            res = true;
-        }
-
-        
-   
-        return res;
-    }
-    
-    public static boolean isTypeAssignableForRelation(TypeInfo leftType,
-            TypeInfo rightType)
-    {
-      
-        
-        boolean res = false;
-        if (isNumeric(leftType) && isNumeric(rightType))
-        {
-            res = true;
-        }
-        else if (isString(leftType) && isString(rightType))
-        {
-            res = true;
-        }
-        else if (isCalendar(leftType) && isCalendar(rightType))
-        {
-            res = true;
-        }
-
-      
-   
-        return res;
-    }
-    
-    public static TypeInfo resolveType(TypeInfo leftType, TypeInfo rightType)
-            throws SPLException
-    {
-       
-   
-        // TBD
-        return binaryNumericPromotionResolver(leftType, rightType);
-        
-    }
-    
-    public static boolean isNumeric(TypeInfo type)
-    {
-       int tp = type.getType();
-        
-        if (tp == TypeConstants.byteType || tp == TypeConstants.shortType
-                || tp == TypeConstants.intType || tp == TypeConstants.longType
-                || tp == TypeConstants.floatType
-                || tp == TypeConstants.doubleType)
-        {
-       
-            
-            return true;
-        }
-
-       
-   
-        return false;
-    }
-    
-    public static boolean isBoolean(TypeInfo type)
-    {
-       int tp = type.getType();
-        
-        if (tp == TypeConstants.booleanType)
-        {
-          
-            
-            return true;
-        }
-
-     
-   
-        return false;
-    }
-    
-    public static boolean isReference(TypeInfo type)
-    {
-       int tp = type.getType();
-        
-        if (tp == TypeConstants.referenceType)
-        {
-       
-            
-            return true;
-        }
-
-
-   
-        return false;
-    }
-    
-    
-    public static boolean isString(TypeInfo tp)
-    {
-    	int type = tp.getType();
-        
-        if (type == TypeConstants.stringType)
-        {
-          
-            
-            return true;
-        }
-
-        
-   
-        return false;
-    }
-    
-    public static boolean isCalendar(TypeInfo tp)
-    {
-    	int type = tp.getType();
-        
-        if (type == TypeConstants.dateTime)
-        {
-   
-            
-            return true;
-        }
-
-   
-   
-        return false;
-    }
-    
-    /*public static boolean validateActualParameterTypes(ArrayList formalParams,
-            ArrayList passedParams) throws SPLException
-    {
-
-     
-        
-        if (formalParams.size() == passedParams.size())
-        {
-            for (int i = 0; i < formalParams.size(); i++)
-            {
-                Integer fParam = (Integer) formalParams.get(i);
-                Expression pParam = (Expression) passedParams.get(i);
-                
-                if (!TypeResolver.isTypeAssignableForEquality(
-                        fParam.intValue(), pParam.getType()))
-                {
-                   //System.out.println("type mismatch fParam.intValue()="+fParam.intValue()+" pParam.getType()"+pParam.getType());
-                  
-                    throw new IllegalParameterTypeException("param mismatch");
-                }
-                
-            }
-        }
-      
-        
-        return true;
-    }*/
-    
-    public static TypeInfo unaryNumericPromotionResolver(TypeInfo te)
-            throws NullPointerException
-    {
-    	int type = te.getType();
-    	TypeInfo retType = new TypeInfo();
-        
-        
-        if (type == TypeConstants.doubleType)
-        {
-        	retType.setType(TypeConstants.doubleType);
-            
-            return retType;
-        }
-        
-        if (type == TypeConstants.floatType)
-        {
-    
-        	retType.setType(TypeConstants.floatType);
-            return retType;
-        }
-        
-        if (type == TypeConstants.longType)
-        {
-        	retType.setType(TypeConstants.longType);
-            
-            return retType;
-        }
-
-      
-   
-        // short byte char get converted to integer
-        retType.setType(TypeConstants.intType);
-        return retType;
-    }
-    
-    public static boolean validateActualParameterTypes(List formalParams,
-            List passedParams) throws SPLException
-    {
-
-      
-        
-        if (formalParams.size() == passedParams.size())
-        {
-            for (int i = 0; i < formalParams.size(); i++)
-            {
-            	TypeInfo fParam = (TypeInfo) formalParams.get(i);
-                Expression pParam = (Expression) passedParams.get(i);
-                
-                if (!TypeResolver.isTypeAssignableForEquality(
-                        fParam, pParam.getType()))
-                {
-                   //System.out.println("type mismatch fParam.intValue()="+fParam+" pParam.getType()"+pParam.getType());
-       
-                    throw new IllegalParameterTypeException("param mismatch");
-                }
-                
-            }
-        }
-       
-        
-        return true;
-    }
-    
-    public static boolean areTypesEqual(TypeInfo t1, TypeInfo t2)
-    {
-    	boolean result = false;
-    	if(t1.getType() == t2.getType() && t1.getIsArray() == t2.getIsArray())
-    	{
-		
-    		if(t1.getType() == TypeConstants.referenceType)
-    		{
-    			if(t1.getReferenceTypeName().equalsIgnoreCase(t2.getReferenceTypeName()))
-    			{
-    				result = true;
-    			}
-    			else{
-    				result = false;
-    			}
-    		}
-    		else
-    		{
-    			result = true;
-    		}
-    		
-    	}
-    	
-    	
-    	return result;
-    }
-    
-    public static boolean isValidType(int tp)
-    {
-    
-    	if (tp > 0 && tp < 14)
-    	{
-    		return true;
-    	}
-    	else
-    	{
-    		return false;
-    	}
-    }
-    
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jn...@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.util;
+
+
+
+import java.util.List;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.IllegalExpressionTypeException;
+import org.apache.imperius.spl.parser.exceptions.IllegalParameterTypeException;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.exceptions.TypesNotAssignableException;
+
+
+
+
+/**
+ * Provides Number Expression Type resolution.
+ * 
+ */
+public class TypeResolver
+{
+    
+    
+
+//    private static final String sourceClass="TypeConstants";
+    
+    
+    
+    /*
+     * public static final byte BYTE = 0; public static final byte SHORT = 1;
+     * public static final byte INTEGER = 2; public static final byte LONG = 3;
+     * public static final byte FLOAT = 4; public static final byte DOUBLE = 5;
+     */
+
+    /**
+     * Determines the numeric type that should be used to interpret a collection
+     * of <code>Number</code> operands. Throws a
+     * <code>ClassCastException</code> if the operands collection contains
+     * objects that are not of type <code>Number</code>.
+     * 
+     * 
+     * @param operands
+     *            an array of <code>Number</code> operands
+     * @return a byte code corresponding to the resolved type
+     * @throws ClassCastException
+     *             if the collection does not contain <code>Number</code>
+     *             operands[i]s
+     * @throws IllegalExpressionTypeException
+     */
+    public static int resolveType(Number[] operands)
+            throws IllegalExpressionTypeException
+    {
+        
+        
+        int resolvedType = TypeConstants.byteType;
+        
+        for (int i = 0; i < operands.length; i++)
+        {
+            if (operands[i] instanceof Double)
+            {
+                resolvedType = TypeConstants.doubleType;
+                break;
+            }
+            else if (operands[i] instanceof Float)
+            {
+                if (resolvedType < TypeConstants.floatType)
+                    resolvedType = TypeConstants.floatType;
+            }
+            else if (operands[i] instanceof Long)
+            {
+                if (resolvedType < TypeConstants.longType)
+                    resolvedType = TypeConstants.longType;
+            }
+            else if (operands[i] instanceof Integer)
+            {
+                if (resolvedType < TypeConstants.intType)
+                    resolvedType = TypeConstants.intType;
+            }
+            else if (operands[i] instanceof Short)
+            {
+                if (resolvedType < TypeConstants.shortType)
+                    resolvedType = TypeConstants.shortType;
+            }
+        }
+
+        
+   
+        return resolvedType;
+    }
+    
+    /**
+     * Determines the numeric type that should be used to interpret the Object
+     * operands of a binary expression accoring to the Java Numeric Promotion
+     * rules.
+     * <p>
+     * 
+     * For reference: 2.6.9 Numeric Promotion Numeric promotion is applied to
+     * the operands of an arithmetic operator. Numeric promotion contexts allow
+     * the use of an identity conversion (Section 2.6.1) or a widening primitive
+     * conversion (Section 2.6.2). Numeric promotions are used to convert the
+     * operands of a numeric operator to a common type where an operation can be
+     * performed. The two kinds of numeric promotion are unary numeric promotion
+     * and binary numeric promotion. The analogous conversions in C are called
+     * "the usual unary conversions" and "the usual binary conversions." Numeric
+     * promotion is not a general feature of Java, but rather a property of the
+     * specific definitions of built-in operators. An operator that applies
+     * unary numeric promotion to a single operand of numeric type converts an
+     * operand of type byte, short, or char to int, and otherwise leaves the
+     * operand alone. The operands of the shift operators are promoted
+     * independently using unary numeric promotions.
+     * <p>
+     * 
+     * When an operator applies binary numeric promotion to a pair of numeric
+     * operands, the following rules apply, in order, using widening conversion
+     * (Section 2.6.2) to convert operands as necessary: If either operand is of
+     * type double, the other is converted to double. Otherwise, if either
+     * operand is of type float, the other is converted to float. Otherwise, if
+     * either operand is of type long, the other is converted to long.
+     * Otherwise, both operands are converted to type int.
+     * <p>
+     * Throws a <code>NullPointerException</code> if either operand is null.
+     * 
+     * @param leftOperand
+     *            left operand of a binary expression
+     * @param rightOperand
+     *            right operand of a binary expression
+     * @return a byte code corresponding to the resolved type
+     * @throws SPLException 
+     * @throws java.lang.NullPointerException
+     *             if there is null operand
+     */
+    public static TypeInfo binaryNumericPromotionResolver(TypeInfo ltOperand,
+            TypeInfo rtOperand) throws SPLException
+    {
+        int leftOperand = ltOperand.getType();
+        int rightOperand = rtOperand.getType();
+        
+        
+        if (leftOperand == TypeConstants.doubleType
+                || rightOperand == TypeConstants.doubleType)
+        {
+        
+            
+            return new TypeInfo(TypeConstants.doubleType);
+        }
+        else if (leftOperand == TypeConstants.floatType
+                || rightOperand == TypeConstants.floatType)
+        {
+        
+            
+        	return new TypeInfo(TypeConstants.floatType);
+        }
+        else if (leftOperand == TypeConstants.longType
+                || rightOperand == TypeConstants.longType)
+        {
+        
+            
+        	return new TypeInfo(TypeConstants.longType);
+        }
+        else
+        {
+           
+            
+            return new TypeInfo(TypeConstants.intType,null,false);
+        }
+        
+    }
+    
+    /**
+     * Determines the numeric type that should be used to interpret the Object
+     * operand of a unary expression accoring to the Java Numeric Promotion
+     * rules.
+     * <p>
+     * 
+     * For reference: 2.6.9 Numeric Promotion Numeric promotion is applied to
+     * the operands of an arithmetic operator. Numeric promotion contexts allow
+     * the use of an identity conversion (Section 2.6.1) or a widening primitive
+     * conversion (Section 2.6.2). Numeric promotions are used to convert the
+     * operands of a numeric operator to a common type where an operation can be
+     * performed. The two kinds of numeric promotion are unary numeric promotion
+     * and binary numeric promotion. The analogous conversions in C are called
+     * "the usual unary conversions" and "the usual binary conversions." Numeric
+     * promotion is not a general feature of Java, but rather a property of the
+     * specific definitions of built-in operators. An operator that applies
+     * unary numeric promotion to a single operand of numeric type converts an
+     * operand of type byte, short, or char to int, and otherwise leaves the
+     * operand alone. The operands of the shift operators are promoted
+     * independently using unary numeric promotions.
+     * <p>
+     * 
+     * When an operator applies binary numeric promotion to a pair of numeric
+     * operands, the following rules apply, in order, using widening conversion
+     * (Section 2.6.2) to convert operands as necessary: If either operand is of
+     * type double, the other is converted to double. Otherwise, if either
+     * operand is of type float, the other is converted to float. Otherwise, if
+     * either operand is of type long, the other is converted to long.
+     * Otherwise, both operands are converted to type int.
+     * <p>
+     * Throws a <code>NullPointerException</code> if either operand is null.
+     * 
+     * @param operand
+     *            operand of a unary expression
+     * @return a byte code corresponding to the resolved type
+     * @throws TypesNotAssignableException
+     * @throws java.lang.NullPointerException
+     *             if the operand is null
+     * 
+     * public static byte unaryNumericPromotionResolver(Number operand) throws
+     * NullPointerException {
+     * 
+     * if (operand instanceof Double) { return DOUBLE; }
+     * 
+     * if (operand instanceof Float) { return FLOAT; }
+     * 
+     * if(operand instanceof Long ) { return LONG; } // short byte char get
+     * converted to integer return INTEGER; h}
+     */
+    
+    public static boolean isTypeAssignableForEquality(TypeInfo leftType,
+            TypeInfo rightType)
+    {
+        
+        
+        boolean res = false;
+        //System.out.println("isTypeAssignableForEquality");
+        if (isNumeric(leftType) && isNumeric(rightType))
+        {
+            res = true;
+        }
+        else if (isBoolean(leftType) && isBoolean(rightType))
+        {
+            res = true;
+        }
+        else if (isString(leftType) && isString(rightType))
+        {
+            res = true;
+        }
+        else if (isCalendar(leftType) && isCalendar(rightType))
+        {
+            res = true;
+        }
+        else if (isReference(leftType) && isReference(rightType))
+        {
+            res = true;
+        }
+
+        
+   
+        return res;
+    }
+    
+    public static boolean isTypeAssignableForRelation(TypeInfo leftType,
+            TypeInfo rightType)
+    {
+      
+        
+        boolean res = false;
+        if (isNumeric(leftType) && isNumeric(rightType))
+        {
+            res = true;
+        }
+        else if (isString(leftType) && isString(rightType))
+        {
+            res = true;
+        }
+        else if (isCalendar(leftType) && isCalendar(rightType))
+        {
+            res = true;
+        }
+
+      
+   
+        return res;
+    }
+    
+    public static TypeInfo resolveType(TypeInfo leftType, TypeInfo rightType)
+            throws SPLException
+    {
+       
+   
+        // TBD
+        return binaryNumericPromotionResolver(leftType, rightType);
+        
+    }
+    
+    public static boolean isNumeric(TypeInfo type)
+    {
+       int tp = type.getType();
+        
+        if (tp == TypeConstants.byteType || tp == TypeConstants.shortType
+                || tp == TypeConstants.intType || tp == TypeConstants.longType
+                || tp == TypeConstants.floatType
+                || tp == TypeConstants.doubleType)
+        {
+       
+            
+            return true;
+        }
+
+       
+   
+        return false;
+    }
+    
+    public static boolean isBoolean(TypeInfo type)
+    {
+       int tp = type.getType();
+        
+        if (tp == TypeConstants.booleanType)
+        {
+          
+            
+            return true;
+        }
+
+     
+   
+        return false;
+    }
+    
+    public static boolean isReference(TypeInfo type)
+    {
+       int tp = type.getType();
+        
+        if (tp == TypeConstants.referenceType)
+        {
+       
+            
+            return true;
+        }
+
+
+   
+        return false;
+    }
+    
+    
+    public static boolean isString(TypeInfo tp)
+    {
+    	int type = tp.getType();
+        
+        if (type == TypeConstants.stringType)
+        {
+          
+            
+            return true;
+        }
+
+        
+   
+        return false;
+    }
+    
+    public static boolean isCalendar(TypeInfo tp)
+    {
+    	int type = tp.getType();
+        
+        if (type == TypeConstants.dateTime)
+        {
+   
+            
+            return true;
+        }
+
+   
+   
+        return false;
+    }
+    
+    /*public static boolean validateActualParameterTypes(ArrayList formalParams,
+            ArrayList passedParams) throws SPLException
+    {
+
+     
+        
+        if (formalParams.size() == passedParams.size())
+        {
+            for (int i = 0; i < formalParams.size(); i++)
+            {
+                Integer fParam = (Integer) formalParams.get(i);
+                Expression pParam = (Expression) passedParams.get(i);
+                
+                if (!TypeResolver.isTypeAssignableForEquality(
+                        fParam.intValue(), pParam.getType()))
+                {
+                   //System.out.println("type mismatch fParam.intValue()="+fParam.intValue()+" pParam.getType()"+pParam.getType());
+                  
+                    throw new IllegalParameterTypeException("param mismatch");
+                }
+                
+            }
+        }
+      
+        
+        return true;
+    }*/
+    
+    public static TypeInfo unaryNumericPromotionResolver(TypeInfo te)
+            throws NullPointerException
+    {
+    	int type = te.getType();
+    	TypeInfo retType = new TypeInfo();
+        
+        
+        if (type == TypeConstants.doubleType)
+        {
+        	retType.setType(TypeConstants.doubleType);
+            
+            return retType;
+        }
+        
+        if (type == TypeConstants.floatType)
+        {
+    
+        	retType.setType(TypeConstants.floatType);
+            return retType;
+        }
+        
+        if (type == TypeConstants.longType)
+        {
+        	retType.setType(TypeConstants.longType);
+            
+            return retType;
+        }
+
+      
+   
+        // short byte char get converted to integer
+        retType.setType(TypeConstants.intType);
+        return retType;
+    }
+    
+    public static boolean validateActualParameterTypes(List formalParams,
+            List passedParams) throws SPLException
+    {
+
+      
+        
+        if (formalParams.size() == passedParams.size())
+        {
+            for (int i = 0; i < formalParams.size(); i++)
+            {
+            	TypeInfo fParam = (TypeInfo) formalParams.get(i);
+                Expression pParam = (Expression) passedParams.get(i);
+                
+                if (!TypeResolver.isTypeAssignableForEquality(
+                        fParam, pParam.getType()))
+                {
+                   //System.out.println("type mismatch fParam.intValue()="+fParam+" pParam.getType()"+pParam.getType());
+       
+                    throw new IllegalParameterTypeException("param mismatch");
+                }
+                
+            }
+        }
+       
+        
+        return true;
+    }
+    
+    public static boolean areTypesEqual(TypeInfo t1, TypeInfo t2)
+    {
+    	boolean result = false;
+    	if(t1.getType() == t2.getType() && t1.getIsArray() == t2.getIsArray())
+    	{
+		
+    		if(t1.getType() == TypeConstants.referenceType)
+    		{
+    			if(t1.getReferenceTypeName().equalsIgnoreCase(t2.getReferenceTypeName()))
+    			{
+    				result = true;
+    			}
+    			else{
+    				result = false;
+    			}
+    		}
+    		else
+    		{
+    			result = true;
+    		}
+    		
+    	}
+    	
+    	
+    	return result;
+    }
+    
+    public static boolean isValidType(int tp)
+    {
+    
+    	if (tp > 0 && tp < 14)
+    	{
+    		return true;
+    	}
+    	else
+    	{
+    		return false;
+    	}
+    }
+    
+}

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

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/PropertiesLoader.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/PropertiesLoader.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/PropertiesLoader.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/PropertiesLoader.java Fri Jan 11 10:56:30 2008
@@ -1,94 +1,94 @@
-/*
- * 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.util;
-
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.util.Properties;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-
-
-public class PropertiesLoader 
-{
-	private static String CLASSNAME = "PropertiesLoader";
-
-	private static Logger logger = Logger.getLogger(PropertiesLoader.class.getName());
-	private static Properties props = null;
-	private static String PROPERTIES_FILE = "customexpressions.properties";
-	
-	private void _loadProperties() 
-	{
-		logger.entering(CLASSNAME,"PropertiesLoader:_loadProperties");
-		props = new Properties();
-		try
-		{
-			SPLLogger.SPL_HOME = System.getProperty("user.dir");
-			if(logger.isLoggable(Level.FINE))
-				logger.fine("Trying to Load " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
-			File propertiesFile = new File(SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
-			if(!propertiesFile.exists())
-			{	
-				FileWriter fstream = new FileWriter(SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
-				BufferedWriter out = new BufferedWriter(fstream);
-				out.write("SPL_CUSTOM_EXPRESSIONS");
-				out.write("\n");
-				out.write("SPL_CUSTOM_ACTIONS");
-				out.write("\n");
-				    //Close the output stream
-				out.close();
-				
-			}
-			FileInputStream inputStream = new FileInputStream(propertiesFile);
-			props.load(inputStream);
-			if(logger.isLoggable(Level.FINE))
-				logger.fine("Loaded " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
-			inputStream.close();
-		}
-		catch(FileNotFoundException fnfe)
-		{
-			logger.severe("File not found " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
-		}
-		catch(IOException ioe)
-		{
-			logger.severe("IO Exception loading " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
-		}
-		
-	}
-	
-	public Properties getProperties()
-	{
-		if(props == null)
-		{	
-			_loadProperties();
-		}
-		
-		return props;
-	}
-}	
-	
-	
+/*
+ * 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.util;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+
+
+public class PropertiesLoader 
+{
+	private static String CLASSNAME = "PropertiesLoader";
+
+	private static Logger logger = Logger.getLogger(PropertiesLoader.class.getName());
+	private static Properties props = null;
+	private static String PROPERTIES_FILE = "customexpressions.properties";
+	
+	private void _loadProperties() 
+	{
+		logger.entering(CLASSNAME,"PropertiesLoader:_loadProperties");
+		props = new Properties();
+		try
+		{
+			SPLLogger.SPL_HOME = System.getProperty("user.dir");
+			if(logger.isLoggable(Level.FINE))
+				logger.fine("Trying to Load " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+			File propertiesFile = new File(SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+			if(!propertiesFile.exists())
+			{	
+				FileWriter fstream = new FileWriter(SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+				BufferedWriter out = new BufferedWriter(fstream);
+				out.write("SPL_CUSTOM_EXPRESSIONS");
+				out.write("\n");
+				out.write("SPL_CUSTOM_ACTIONS");
+				out.write("\n");
+				    //Close the output stream
+				out.close();
+				
+			}
+			FileInputStream inputStream = new FileInputStream(propertiesFile);
+			props.load(inputStream);
+			if(logger.isLoggable(Level.FINE))
+				logger.fine("Loaded " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+			inputStream.close();
+		}
+		catch(FileNotFoundException fnfe)
+		{
+			logger.severe("File not found " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+		}
+		catch(IOException ioe)
+		{
+			logger.severe("IO Exception loading " + SPLLogger.SPL_HOME + File.separator + PROPERTIES_FILE);
+		}
+		
+	}
+	
+	public Properties getProperties()
+	{
+		if(props == null)
+		{	
+			_loadProperties();
+		}
+		
+		return props;
+	}
+}	
+	
+	

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

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLAuditLoggerClass.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLAuditLoggerClass.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLAuditLoggerClass.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLAuditLoggerClass.java Fri Jan 11 10:56:30 2008
@@ -1,95 +1,95 @@
-/*
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- * 
- *      http://www.apache.org/licenses/LICENSE-2.0
- * 
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-/**/
-
-/**
- * @author Prashant Baliga <pr...@in.ibm.com>
- *
- */
-
-package org.apache.imperius.util;
-
-import java.util.logging.Handler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-public class SPLAuditLoggerClass extends Logger
-{
-    private Logger internalLogger=null;
-    
-    public SPLAuditLoggerClass(String name, String resourceBundleName)
-    {
-        
-        super(name, resourceBundleName);
-        this.internalLogger=Logger.getLogger(name, resourceBundleName);
-        // TODO Auto-generated constructor stub
-    }
-    
-    
-    synchronized public void addHandler(Handler handler)
-    {
-        this.internalLogger.addHandler(handler);
-    }
-   
-    synchronized public void setLevel(Level level)
-    {
-        this.internalLogger.setLevel(level);
-    }
-    
-    synchronized public boolean isLoggable(Level level)
-    {
-        return internalLogger.isLoggable(level);
-    }
-    
-    synchronized public void fine(String msg)
-    {
-        String msgActual=Thread.currentThread().getName();
-        msgActual+=" "+msg;
-        this.internalLogger.fine(msgActual);
-        
-    }
-    
-    synchronized public void entering(String className, String msg)
-    {
-        String msgActual=Thread.currentThread().getName();
-        msgActual+=" "+msg;
-        this.internalLogger.entering(className, msgActual);
-        
-    }
-    
-    synchronized public void exiting(String className, String msg)
-    {
-        String msgActual=Thread.currentThread().getName();
-        msgActual+=" "+msg;
-        this.internalLogger.exiting(className, msgActual);
-        
-    }
-    
-    synchronized public void severe(String msg)
-    {
-        String msgActual=Thread.currentThread().getName();
-        msgActual+=" "+msg;
-        Logger.getAnonymousLogger();
-        this.internalLogger.severe(msgActual);
-        
-    }
-    
-  /*  public static final Logger getLogger(String name)
-    {
-        return new SPLLoggerClass(name,null);
-        // TODO Auto-generated constructor stub
-    }*/
-   
- 
-}
+/*
+ * 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.util;
+
+import java.util.logging.Handler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+public class SPLAuditLoggerClass extends Logger
+{
+    private Logger internalLogger=null;
+    
+    public SPLAuditLoggerClass(String name, String resourceBundleName)
+    {
+        
+        super(name, resourceBundleName);
+        this.internalLogger=Logger.getLogger(name, resourceBundleName);
+        // TODO Auto-generated constructor stub
+    }
+    
+    
+    synchronized public void addHandler(Handler handler)
+    {
+        this.internalLogger.addHandler(handler);
+    }
+   
+    synchronized public void setLevel(Level level)
+    {
+        this.internalLogger.setLevel(level);
+    }
+    
+    synchronized public boolean isLoggable(Level level)
+    {
+        return internalLogger.isLoggable(level);
+    }
+    
+    synchronized public void fine(String msg)
+    {
+        String msgActual=Thread.currentThread().getName();
+        msgActual+=" "+msg;
+        this.internalLogger.fine(msgActual);
+        
+    }
+    
+    synchronized public void entering(String className, String msg)
+    {
+        String msgActual=Thread.currentThread().getName();
+        msgActual+=" "+msg;
+        this.internalLogger.entering(className, msgActual);
+        
+    }
+    
+    synchronized public void exiting(String className, String msg)
+    {
+        String msgActual=Thread.currentThread().getName();
+        msgActual+=" "+msg;
+        this.internalLogger.exiting(className, msgActual);
+        
+    }
+    
+    synchronized public void severe(String msg)
+    {
+        String msgActual=Thread.currentThread().getName();
+        msgActual+=" "+msg;
+        Logger.getAnonymousLogger();
+        this.internalLogger.severe(msgActual);
+        
+    }
+    
+  /*  public static final Logger getLogger(String name)
+    {
+        return new SPLLoggerClass(name,null);
+        // TODO Auto-generated constructor stub
+    }*/
+   
+ 
+}

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

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLogger.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLogger.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLogger.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLogger.java Fri Jan 11 10:56:30 2008
@@ -1,140 +1,140 @@
-/*
- * 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.util;
-
-import java.io.IOException;
-import java.util.logging.FileHandler;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-import java.util.logging.SimpleFormatter;
-
-public class SPLLogger
-{
-    
-    private static SPLLogger splLogger;
-    
-    private static Logger logger = null;
-    
-    private static Logger auditLogger = null;
-    
-    public static boolean ENABLE_SPL_LOGGING = true;
-    
-
-    public static String SPL_HOME = System.getProperty("user.dir");
-
-    
-    public static String fileSeparator = "/";
-    
-    /** A private Constructor prevents any other class from instantiating. */
-    private SPLLogger()
-    {
-        //super();
-        FileHandler handler;
-        FileHandler handler1;
-        System.identityHashCode(Thread.currentThread());
-        try
-        {
-            String userHome = System.getProperty("SPLHOME");
-            if(userHome != null)
-            {
-            	SPL_HOME = userHome;
-            }
-        	System.out.println("SPLHOME" + SPL_HOME);
-            logger = Logger.getLogger(SPLLogger.class.getName(),null);
-            
-            auditLogger = Logger.getLogger("AuditLog",null);
-            
-            String enableLogging = System.getProperty("ENABLE_SPL_LOGGING");
-            if(enableLogging != null)
-            {
-            	if(enableLogging.equalsIgnoreCase("false"))
-            	{
-            		ENABLE_SPL_LOGGING = false;
-            	}
-            }
-
-     
-        	if(!ENABLE_SPL_LOGGING)
-            {
-                logger.setLevel(Level.SEVERE);
-                auditLogger.setLevel(Level.ALL);
-            }
-            else 
-            {
-                logger.setLevel(Level.ALL);
-                auditLogger.setLevel(Level.ALL);
-            }
-     
-            
-            handler = new FileHandler(SPL_HOME + fileSeparator + "SPL.log", false);
-            handler1 = new FileHandler(SPL_HOME + fileSeparator + "SPLAudit.log", true);
-            logger.addHandler(handler);
-            auditLogger.addHandler(handler1);
-            
-            logger.setLevel(Level.ALL);
-            auditLogger.setLevel(Level.ALL);
-            SimpleFormatter formatter = new SimpleFormatter();
-            
-            handler.setFormatter(formatter);
-            SimpleFormatter formatter1 = new SimpleFormatter();
-            handler1.setFormatter(formatter1);
-            
-            
-            
-            
-        }
-        catch (SecurityException e)
-        {
-            e.printStackTrace();
-        }
-        catch (IOException e)
-        {
-            e.printStackTrace();
-        }
-        
-    }
-    
-    public static synchronized SPLLogger getSPLLogger()
-    {
-        if (splLogger == null)
-        {
-            splLogger = new SPLLogger();
-        }
-        return splLogger;
-    }
-    
-    public Object clone() throws CloneNotSupportedException
-    {
-        throw new CloneNotSupportedException();
-    }
-    
-    public synchronized Logger getLogger()
-    {
-        
-        return logger;
-    }
-    
-    public synchronized Logger getAuditLogger()
-    {
-        
-        return auditLogger;
-    }
-    
-}
+/*
+ * 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.util;
+
+import java.io.IOException;
+import java.util.logging.FileHandler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import java.util.logging.SimpleFormatter;
+
+public class SPLLogger
+{
+    
+    private static SPLLogger splLogger;
+    
+    private static Logger logger = null;
+    
+    private static Logger auditLogger = null;
+    
+    public static boolean ENABLE_SPL_LOGGING = true;
+    
+
+    public static String SPL_HOME = System.getProperty("user.dir");
+
+    
+    public static String fileSeparator = "/";
+    
+    /** A private Constructor prevents any other class from instantiating. */
+    private SPLLogger()
+    {
+        //super();
+        FileHandler handler;
+        FileHandler handler1;
+        System.identityHashCode(Thread.currentThread());
+        try
+        {
+            String userHome = System.getProperty("SPLHOME");
+            if(userHome != null)
+            {
+            	SPL_HOME = userHome;
+            }
+        	System.out.println("SPLHOME" + SPL_HOME);
+            logger = Logger.getLogger(SPLLogger.class.getName(),null);
+            
+            auditLogger = Logger.getLogger("AuditLog",null);
+            
+            String enableLogging = System.getProperty("ENABLE_SPL_LOGGING");
+            if(enableLogging != null)
+            {
+            	if(enableLogging.equalsIgnoreCase("false"))
+            	{
+            		ENABLE_SPL_LOGGING = false;
+            	}
+            }
+
+     
+        	if(!ENABLE_SPL_LOGGING)
+            {
+                logger.setLevel(Level.SEVERE);
+                auditLogger.setLevel(Level.ALL);
+            }
+            else 
+            {
+                logger.setLevel(Level.ALL);
+                auditLogger.setLevel(Level.ALL);
+            }
+     
+            
+            handler = new FileHandler(SPL_HOME + fileSeparator + "SPL.log", false);
+            handler1 = new FileHandler(SPL_HOME + fileSeparator + "SPLAudit.log", true);
+            logger.addHandler(handler);
+            auditLogger.addHandler(handler1);
+            
+            logger.setLevel(Level.ALL);
+            auditLogger.setLevel(Level.ALL);
+            SimpleFormatter formatter = new SimpleFormatter();
+            
+            handler.setFormatter(formatter);
+            SimpleFormatter formatter1 = new SimpleFormatter();
+            handler1.setFormatter(formatter1);
+            
+            
+            
+            
+        }
+        catch (SecurityException e)
+        {
+            e.printStackTrace();
+        }
+        catch (IOException e)
+        {
+            e.printStackTrace();
+        }
+        
+    }
+    
+    public static synchronized SPLLogger getSPLLogger()
+    {
+        if (splLogger == null)
+        {
+            splLogger = new SPLLogger();
+        }
+        return splLogger;
+    }
+    
+    public Object clone() throws CloneNotSupportedException
+    {
+        throw new CloneNotSupportedException();
+    }
+    
+    public synchronized Logger getLogger()
+    {
+        
+        return logger;
+    }
+    
+    public synchronized Logger getAuditLogger()
+    {
+        
+        return auditLogger;
+    }
+    
+}

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

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLoggerClass.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLoggerClass.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLoggerClass.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLoggerClass.java Fri Jan 11 10:56:30 2008
@@ -1,74 +1,74 @@
-/*
- * 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.util;
-
-import java.util.logging.Logger;
-
-public class SPLLoggerClass extends Logger
-{
-    
-    public SPLLoggerClass(String name, String resourceBundleName)
-    {
-        super(name, resourceBundleName);
-        // TODO Auto-generated constructor stub
-    }
-    
-   
-    
-    public void fine(String msg)
-    {
-        String msgActual=Thread.currentThread().getName();
-        msgActual+=" "+msg;
-        super.fine(msgActual);
-        
-    }
-    
-    public void entering(String className, String msg)
-    {
-        String msgActual=Thread.currentThread().getName();
-        msgActual+=" "+msg;
-        super.entering(className, msgActual);
-        
-    }
-    
-    public void exiting(String className, String msg)
-    {
-        String msgActual=Thread.currentThread().getName();
-        msgActual+=" "+msg;
-        super.exiting(className, msgActual);
-        
-    }
-    
-    public void severe(String msg)
-    {
-        String msgActual=Thread.currentThread().getName();
-        msgActual+=" "+msg;
-        super.severe(msgActual);
-        
-    }
-    
-  /*  public static final Logger getLogger(String name)
-    {
-        return new SPLLoggerClass(name,null);
-        // TODO Auto-generated constructor stub
-    }*/
-   
-}
+/*
+ * 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.util;
+
+import java.util.logging.Logger;
+
+public class SPLLoggerClass extends Logger
+{
+    
+    public SPLLoggerClass(String name, String resourceBundleName)
+    {
+        super(name, resourceBundleName);
+        // TODO Auto-generated constructor stub
+    }
+    
+   
+    
+    public void fine(String msg)
+    {
+        String msgActual=Thread.currentThread().getName();
+        msgActual+=" "+msg;
+        super.fine(msgActual);
+        
+    }
+    
+    public void entering(String className, String msg)
+    {
+        String msgActual=Thread.currentThread().getName();
+        msgActual+=" "+msg;
+        super.entering(className, msgActual);
+        
+    }
+    
+    public void exiting(String className, String msg)
+    {
+        String msgActual=Thread.currentThread().getName();
+        msgActual+=" "+msg;
+        super.exiting(className, msgActual);
+        
+    }
+    
+    public void severe(String msg)
+    {
+        String msgActual=Thread.currentThread().getName();
+        msgActual+=" "+msg;
+        super.severe(msgActual);
+        
+    }
+    
+  /*  public static final Logger getLogger(String name)
+    {
+        return new SPLLoggerClass(name,null);
+        // TODO Auto-generated constructor stub
+    }*/
+   
+}

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