incubator-imperius-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From daw...@apache.org
Subject svn commit: r820060 [1/3] - in /incubator/imperius/trunk: ./ imperius-javaspl/src/main/java/org/apache/imperius/javaspl/ imperius-splcore/ imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/ imperius-splcore/src/main/java/org/apache/imper...
Date Tue, 29 Sep 2009 18:29:48 GMT
Author: dawood
Date: Tue Sep 29 18:29:44 2009
New Revision: 820060

URL: http://svn.apache.org/viewvc?rev=820060&view=rev
Log:
Many changes to fix logged bugs, and some bug fixes from IBM. Also hooks to support policy transformation and analysis.

Added:
    incubator/imperius/trunk/.antlr-eclipse
    incubator/imperius/trunk/imperius-splcore/SPL.log.lck
    incubator/imperius/trunk/javaspl-samples/PolicyStorage.DAT   (with props)
    incubator/imperius/trunk/javaspl-samples/SPL.log.lck
    incubator/imperius/trunk/javaspl-samples/resources/samples/bugfix/
    incubator/imperius/trunk/javaspl-samples/resources/samples/bugfix/policies/
    incubator/imperius/trunk/javaspl-samples/resources/samples/bugfix/policies/Imperius20.spl
    incubator/imperius/trunk/javaspl-samples/resources/samples/bugfix/policies/Imperius22.spl
    incubator/imperius/trunk/javaspl-samples/resources/samples/bugfix/policies/Imperius23.spl
    incubator/imperius/trunk/javaspl-samples/resources/samples/bugfix/policies/Imperius24.spl
    incubator/imperius/trunk/javaspl-samples/resources/samples/bugfix/policies/Imperius25.spl
    incubator/imperius/trunk/javaspl-samples/resources/samples/bugfix/policies/Imperius26.spl
    incubator/imperius/trunk/javaspl-samples/resources/samples/bugfix/policies/Imperius28.spl
    incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/bugfix/
    incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/bugfix/Bar.java
    incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/bugfix/ByteArrayFactory.java
    incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/bugfix/MyList.java
    incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/bugfix/RunBugFixTest.java
    incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/bugfix/SimpleBean1.java
    incubator/imperius/trunk/javaspl-samples/src/main/java/org/apache/imperius/javaspl/samples/bugfix/SimpleBean2.java
Modified:
    incubator/imperius/trunk/build.xml
    incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaActuatorImpl.java
    incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaDataCollectorImpl.java
    incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaSPLTypeConstants.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyDataStore.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/external/InternalClient.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/impl/PolicyManagerImpl.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/IdentPrimaryTuple.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/SPLSymbolTable.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/BasicCollectionExpression.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/CollectOperation.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/PostCollectExpression.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/PrimaryExpression.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/SelfExpression.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/DoubleArgumentExpression.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/MultipleArgumentExpression.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/QuadrupleArgumentExpression.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/SingleArgumentExpression.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/TimeZoneExpression.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/TripleArgumentExpression.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Addition.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/AllInCollection.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/AnyInCollection.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Division.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/EqCollections.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Equal.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Greater.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/GreaterOrEqual.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/InCollection.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Less.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/LessOrEqual.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/LogicalAnd.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/LogicalNot.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/LogicalOr.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/LogicalXor.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Product.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/StringConstant.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/SubCollection.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/impl/Subtraction.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/BuitInOperationExpressionFactory.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/factory/ExpressionFactory.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/AnchorMethodInvokeAction.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ArrowActionBlock.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ConcurrentActionBlock.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/ExtrinsicMethodInvokeAction.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalAndActionBlock.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/actions/impl/LogicalOrActionBlock.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/DeclarationStatement.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/ImportStatement.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/PolicyDefinition.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/statements/impl/SPLPolicy.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/KeyStringToMapConvertor.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/util/TypeResolver.java
    incubator/imperius/trunk/imperius-splcore/src/test/java/org/apache/imperius/spl/tests/StringExpressionTest.java
    incubator/imperius/trunk/javaspl-samples/src/test/java/org/apache/imperius/javaspl/samples/simplepolicies/TestSimplePolicies.java

Added: incubator/imperius/trunk/.antlr-eclipse
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/.antlr-eclipse?rev=820060&view=auto
==============================================================================
--- incubator/imperius/trunk/.antlr-eclipse (added)
+++ incubator/imperius/trunk/.antlr-eclipse Tue Sep 29 18:29:44 2009
@@ -0,0 +1,6 @@
+<?xml version='1.0' ?> 
+<settings>
+  <resource name='**ANTLR-ECLIPSE-PLUGIN**'>
+    <property name='pluginVersion' value='2.7.6' />
+  </resource>
+</settings>

Modified: incubator/imperius/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/build.xml?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/build.xml (original)
+++ incubator/imperius/trunk/build.xml Tue Sep 29 18:29:44 2009
@@ -113,6 +113,7 @@
 		
 		<!-- the svn ant task didn't work so call it directly 
              an executable svn must be on the system PATH -->
+<!--
 		<exec executable="svn" searchpath="true" dir="." failonerror="true">
 		    <arg line="co http://svn.apache.org/repos/asf/incubator/imperius/trunk/imperius-splcore "/>
 		</exec>
@@ -143,7 +144,7 @@
 		<exec executable="svn" searchpath="true" dir="." failonerror="true">
 			<arg line="co http://svn.apache.org/repos/asf/incubator/imperius/trunk/imperius-cimsplprovider"/>
 		</exec>  
-		
+-->		
 		
      <!--   <exec executable="svn" searchpath="true" dir="." failonerror="true">
             <arg line="co ${IMPERIUS_SVN_SITE_REPOSITORY} ${IMPERIUS_SVN_SITE} -non-interactive"/>

Modified: incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaActuatorImpl.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaActuatorImpl.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaActuatorImpl.java (original)
+++ incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaActuatorImpl.java Tue Sep 29 18:29:44 2009
@@ -28,108 +28,152 @@
 
 package org.apache.imperius.javaspl;
 
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-import java.util.Iterator;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.net.URLClassLoader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 import org.apache.imperius.spl.external.Actuator;
 import org.apache.imperius.spl.external.Argument;
-import org.apache.imperius.spl.parser.exceptions.*;
-import org.apache.imperius.spl.parser.util.*;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.util.TypeInfo;
 
 
 public class JavaActuatorImpl implements Actuator {
 
-    //private static final String sourceClass="JavaActuatorImpl";
-    //private static Logger logger = SPLLogger.getCIMSPLLogger().getLogger();
-
-    private URL[] fUrls = null;
-    
-    public JavaActuatorImpl() {
-        
-    }
-    
-    public JavaActuatorImpl(URL[] urls) {
-        fUrls = urls;
-    }
-    
-    
-    /**
-     * Invokes the given method on the given instance 
-     */
-    public Object invokeMethod(String className, String qualifier,
-            Object instance, String methodName, List arguments) throws SPLException {
-        Class c;
-        Object result = null;
-        try {
-            // Load class
-            
-            //c = Class.forName(instance.getClass().getName());
-            
-            // modified by naidu to enable URL class loading
-            if(fUrls == null) {
-                c = Class.forName(instance.getClass().getName());
-            } else {
-                URLClassLoader uc = new URLClassLoader(fUrls);
-                c = uc.loadClass(instance.getClass().getName());
-            }
-            
-
-            // Get an array of formal parameter class types
-            Class[] arrayOfParameterTypes = _getParameterTypeArray(arguments);
-
-            // Load the method using reflection
-            Method method = c.getMethod(methodName, arrayOfParameterTypes);
-
-            // If No. of formal params > 0
-            if (arguments.size() != 0) {
-                List paramValues = new ArrayList();
-                Iterator it = arguments.iterator();
-                // Iterate over the passed parameters
-                while (it.hasNext()) {
-                    Argument arg = (Argument) it.next();
-                    //Add the values of the passed parameters to a list
-                    paramValues.add(arg.getValue());
-                }
-
-                // Convert list to an array
-                Object[] arrayOfParameters = paramValues.toArray();
-
-                // Invoke the method on the passed object
-                result = method.invoke(instance, arrayOfParameters);
-            } else {
-                Object[] arrayOfParameters = new Object[0];
-                result = method.invoke(instance, arrayOfParameters);
-            }
-        } catch (ClassNotFoundException e) {
-            throw new SPLException(e);
-        } catch (SecurityException e) {
-            throw new SPLException(e);
-        } catch (NoSuchMethodException e) {
-            throw new SPLException(e);
-        } catch (IllegalArgumentException e) {
-            throw new SPLException(e);
-        } catch (IllegalAccessException e) {
-            throw new SPLException(e);
-        } catch (InvocationTargetException e) {
-            throw new SPLException(e);
-        }
-        return result;
-    }
-
-    /**
-     * @param className : fully qualified name of the class whoose instance is to be modified
-     * @param instance : instance to be modified
-     * @param memberMap: A map of the form (String member Name ->  Object value to be set to)
-     * 
-     */
+	//private static final String sourceClass="JavaActuatorImpl";
+	//private static Logger logger = SPLLogger.getCIMSPLLogger().getLogger();
 
+	private URL[] fUrls = null;
+	
+	public JavaActuatorImpl() {
+		
+	}
+	
+	public JavaActuatorImpl(URL[] urls) {
+		fUrls = urls;
+	}
+	
+	
+	/**
+	 * Invokes the given method on the given instance 
+	 */
+	public Object invokeMethod(String className, String qualifier,
+			Object instance, String methodName, List arguments)	throws SPLException {
+		Class c;
+		Object result = null;
+		try {
+			// Load class
+			
+			//c = Class.forName(instance.getClass().getName());
+			
+			// modified by naidu to enable URL class loading
+			if(fUrls == null) {
+				c = Class.forName(instance.getClass().getName());
+			} else {
+				URLClassLoader uc = new URLClassLoader(fUrls);
+				c = uc.loadClass(instance.getClass().getName());
+			}
+			
+
+			// Get an array of formal parameter class types
+			Class[] arrayOfParameterTypes = _getParameterTypeArray(arguments);
+
+			// Load the method using reflection
+
+			Method method = c.getMethod(methodName, arrayOfParameterTypes);
+
+			// If No. of formal params > 0
+			if (arguments.size() != 0) {
+				List paramValues = new ArrayList();
+				Iterator it = arguments.iterator();
+				// Iterate over the passed parameters
+				while (it.hasNext()) {
+					Argument arg = (Argument) it.next();
+					//Add the values of the passed parameters to a list
+					paramValues.add(arg.getValue());
+				}
+
+				// Convert list to an array
+				Object[] arrayOfParameters = paramValues.toArray();
+
+				// Invoke the method on the passed object
+				result = method.invoke(instance, arrayOfParameters);
+			} else {
+				Object[] arrayOfParameters = new Object[0];
+				result = method.invoke(instance, arrayOfParameters);
+			}
+		} catch (ClassNotFoundException e) {
+			throw new SPLException(e.getMessage());
+		} catch (SecurityException e) {
+			throw new SPLException(e.getMessage());
+		} catch (NoSuchMethodException e) {
+			throw new SPLException(e.getMessage());
+		} catch (IllegalArgumentException e) {
+			throw new SPLException(e.getMessage());
+		} catch (IllegalAccessException e) {
+			throw new SPLException(e.getMessage());
+		} catch (InvocationTargetException e) {
+			throw new SPLException(e.getMessage());
+		}
+		return result;
+	}
+
+	/**
+	 * @param className : fully qualified name of the class whoose instance is to be modified
+	 * @param instance : instance to be modified
+	 * @param memberMap: A map of the form (String member Name ->  Object value to be set to)
+	 * 
+	 */
+
+//	public void modifyInstance(String className, String qualifier,
+//			Object instance, Map memberMap) throws SPLException {
+//		Class c;
+//		try {
+//			// Load class
+//			//c = Class.forName(className);
+//			
+//			// modified by naidu to enable URL class loading
+//			if(fUrls == null) {
+//				c = Class.forName(className);
+//			} else {
+//				URLClassLoader uc = new URLClassLoader(fUrls);
+//				c = uc.loadClass(className);
+//			}
+//
+//			// Iterate over the property map for the instance
+//			Iterator keyIt = memberMap.keySet().iterator();
+//			while (keyIt.hasNext()) {
+//				String propName = (String) keyIt.next();
+//				// Retrieve value of the property
+//				Object value = memberMap.get(propName);
+//
+//				// Load field
+//				Field member = c.getField(propName);
+//
+//				// Set the value of the field
+//				member.set(instance, value);
+//
+//			}
+//		} catch (ClassNotFoundException e) {
+//			throw new SPLException(e.getMessage());
+//
+//		} catch (SecurityException e) {
+//			throw new SPLException(e.getMessage());
+//		} catch (NoSuchFieldException e) {
+//			throw new SPLException(e.getMessage());
+//		} catch (IllegalArgumentException e) {
+//			throw new SPLException(e.getMessage());
+//		} catch (IllegalAccessException e) {
+//			throw new SPLException(e.getMessage());
+//		}
+//
+//	}
     public void modifyInstance(String className, String qualifier,
             Object instance, Map memberMap) throws SPLException {
         Class c;
@@ -197,40 +241,41 @@
 
     }
 
-    /**
-     * Iterate over the list of Argument objects to retrieve an
-     * array of the class types
-     * @param inParameterList
-     * @return
-     * @throws SPLException 
-     */
-
-    private Class[] _getParameterTypeArray(List inParameterList)
-            throws SPLException {
-        int listSize = inParameterList.size();
-        int i = 0;
-        Class[] paramTypeArray = new Class[listSize];
-        try {
-            Iterator it = inParameterList.iterator();
-            // Iterate over the arguments
-            while (it.hasNext()) {
-                Argument arg = (Argument) it.next();
-                TypeInfo tp = arg.getType();
-                boolean isArray = arg.getIsArray();
-                String referenceName = arg.getReferenceTypeName();
-
-                // convert internal type to java type
-                Class c = JavaSPLTypeConstants.convertInternalTypeToJavaType(tp.getType(), isArray, referenceName);
+	/**
+	 * Iterate over the list of Argument objects to retrieve an
+	 * array of the class types
+	 * @param inParameterList
+	 * @return
+	 * @throws SPLException 
+	 */
+
+	private Class[] _getParameterTypeArray(List inParameterList)
+			throws SPLException {
+		int listSize = inParameterList.size();
+		int i = 0;
+		Class[] paramTypeArray = new Class[listSize];
+		try {
+			Iterator it = inParameterList.iterator();
+			// Iterate over the arguments
+			while (it.hasNext()) {
+				Argument arg = (Argument) it.next();
+				TypeInfo tp = arg.getType();
+				boolean isArray = arg.getIsArray();
+				String referenceName = arg.getReferenceTypeName();
+
+				// convert internal type to java type
+				Class c = JavaSPLTypeConstants.convertInternalTypeToJavaType(tp.getType(), isArray, referenceName);
+
+				// Add to array
+				paramTypeArray[i++] = c;
+			}
+		} catch (ClassNotFoundException e) {
+			e.printStackTrace();
+			throw new SPLException(e.getMessage());
+		}
+		return paramTypeArray;
+	}
 
-                // Add to array
-                paramTypeArray[i++] = c;
-            }
-        } catch (ClassNotFoundException e) {
-            throw new SPLException(e);
-        }
-        return paramTypeArray;
-    }
-    
     private String getAccessorMethodName(String identifier)
     {
         if(Character.isLetter(identifier.charAt(0)))

Modified: incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaDataCollectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaDataCollectorImpl.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaDataCollectorImpl.java (original)
+++ incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaDataCollectorImpl.java Tue Sep 29 18:29:44 2009
@@ -33,6 +33,7 @@
 import java.util.Hashtable;
 import java.util.List;
 import java.util.Map;
+import java.util.Vector;
 
 import org.apache.imperius.spl.external.Argument;
 import org.apache.imperius.spl.external.DataCollector;
@@ -104,6 +105,8 @@
 						referenceTypeName, isArray, isKey, isPropertyOfClass);
 
 				// insert into map
+				// xiping's test 06/19/09
+				// a Java class field name must be unique
 				symbolMap.put(fieldName, s);
 
 			}
@@ -191,8 +194,20 @@
 				// construct a method symbol 
 				Symbol s = new MethodSymbol(methodName, internalReturnType, isReturnArray, returnReferenceTypeName, argTypeList, null);
 
-				// Insert into map
-				symbolMap.put(methodName, s);
+//				// Insert into map
+//				symbolMap.put(methodName, s);
+
+				// xiping's test 06/19/09
+				// a Java class can have multiple methods that have the same method name
+				Vector v = null;
+				if (symbolMap.containsKey(methodName)) {
+					v = (Vector) symbolMap.get(methodName);
+				} else {
+					v = new Vector();
+				}
+				v.add(s);
+				symbolMap.put(methodName, v);
+//				
 			}
 
 		} catch (Exception e) {

Modified: incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaSPLTypeConstants.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaSPLTypeConstants.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaSPLTypeConstants.java (original)
+++ incubator/imperius/trunk/imperius-javaspl/src/main/java/org/apache/imperius/javaspl/JavaSPLTypeConstants.java Tue Sep 29 18:29:44 2009
@@ -50,6 +50,7 @@
     	return false;
     	
     }
+
     public static Class convertInternalTypeToJavaType(int type, boolean isArray, 
     		String referenceName) throws ClassNotFoundException
     {
@@ -62,7 +63,6 @@
     		}
     		else
     		{
-    			
     			javaType = Byte.TYPE;
     		}
     	}
@@ -176,10 +176,8 @@
     			javaType = Class.forName(referenceName);
     		}
     	}
+
     	return javaType;
-    	
-    		
-    	
     }
     
     public static int convertJavaTypeToInternalType(String type)

Added: incubator/imperius/trunk/imperius-splcore/SPL.log.lck
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/SPL.log.lck?rev=820060&view=auto
==============================================================================
    (empty)

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyDataStore.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyDataStore.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyDataStore.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyDataStore.java Tue Sep 29 18:29:44 2009
@@ -17,6 +17,7 @@
  * under the License.  
  */
 
+
 /**
  * @author Prashant Baliga <prabalig@in.ibm.com>
  *
@@ -24,6 +25,7 @@
 
 package org.apache.imperius.spl.datastore;
 
+
 import java.util.List;
 import java.util.Map;
 
@@ -31,35 +33,39 @@
 import org.apache.imperius.spl.parser.statements.impl.PolicyInfo;
 import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
 
-public interface PolicyDataStore 
-{
-	public String getPolicy(String policyName) throws SPLException;
-
-	public PolicyInfo getPolicyInfo(String policyName) throws SPLException;
-
-	public boolean createPolicy(String policyName, String policyString)
-			throws SPLException;
-
-	public boolean validatePolicyString(String policyString)
-			throws SPLException;
-
-	public SPLPolicy createSPLPolicyObject(String policyName,
-			String policyString) throws SPLException;
-
-	public void updatePolicy(String policyName, String policyString)
-			throws SPLException;
-
-	public void deletePolicy(String policyName) throws SPLException;
-
-	public Map getAllPolicies() throws SPLException;
-
-	public List getAllPolicyNames() throws SPLException;
-
-	public void init() throws SPLException;
-
-	public void shutdown();
-
-	public SPLPolicy getInternalPolicyObject(String PolicyRuleName)
-			throws SPLException;
 
+public interface PolicyDataStore
+{
+    
+    public String getPolicy(String policyName)
+            throws SPLException;
+    
+    public PolicyInfo getPolicyInfo(String policyName)
+    throws SPLException;
+    
+    public boolean createPolicy(String policyName, String policyString) throws SPLException;
+    
+    public boolean validatePolicyString(String policyString) throws SPLException;
+    
+    
+    public SPLPolicy createSPLPolicyObject(String policyName, String policyString) 
+	throws SPLException;
+	
+    public void updatePolicy(String policyName, String policyString) throws SPLException;
+    
+    public void deletePolicy(String policyName)
+            throws SPLException;
+    
+    public Map getAllPolicies() throws SPLException;
+    
+    public List getAllPolicyNames() throws SPLException;
+    
+    public void init() throws SPLException;
+    
+    public void shutdown();
+    
+       
+    public SPLPolicy getInternalPolicyObject(String PolicyRuleName)
+            throws SPLException;
+    
 }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/external/InternalClient.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/external/InternalClient.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/external/InternalClient.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/external/InternalClient.java Tue Sep 29 18:29:44 2009
@@ -159,7 +159,7 @@
                         {
                             logger.severe("POLICY_EVALUATION_SUCCESSFUL "+policyName+" "+instanceObj.toString()+" "+retVal);
                         }
-
+			            if(logger.isLoggable(Level.FINE))
                         logger.fine(Thread.currentThread().getName()+" Internal client return value="+returnValue);
                         objectMap.remove(instanceInfoList);
                     }
@@ -193,7 +193,7 @@
                         String objectName=className;
                         objectMap.put(objectName, copI);
                         Integer retVal=(Integer)pm.evaluatePolicy(policyName,objectMap);
-
+						if (logger.isLoggable(Level.FINE))
                         logger.fine(Thread.currentThread().getName()+" return value is = "+retVal);
                         
                         logger.exiting(sourceClass,Thread.currentThread().getName()+" "+"InvokePolicy"); 
@@ -208,6 +208,7 @@
                             logger.fine("POLICY_EVALUATION_SUCCESSFUL "+policyName+" "+copI.toString()+" "+retVal);
                             
                         }
+			            if(logger.isLoggable(Level.FINE))
                         logger.fine(Thread.currentThread().getName()+" Internal client return value="+returnValue);
                         objectMap.remove(copI);
                     }
@@ -222,7 +223,8 @@
             logger.severe(e.getMessage());
         }
         
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+"InvokePolicy");
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+"InvokeMethod");
+        if(logger.isLoggable(Level.FINE))
         logger.fine(Thread.currentThread().getName()+" Internal client return value is -1");
 
         return -1;

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/impl/PolicyManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/impl/PolicyManagerImpl.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/impl/PolicyManagerImpl.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/impl/PolicyManagerImpl.java Tue Sep 29 18:29:44 2009
@@ -71,7 +71,7 @@
 		logger.entering(sourceClass, Thread.currentThread().getName() + " " + "getAllPolicies");
 		
 		Map allPolicies = _policyDataStore.getAllPolicies();
-		
+		if(auditLogger.isLoggable(Level.FINE))
 		auditLogger.fine(Thread.currentThread().getName() + "getAllPolicies invoked");
 
 		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "getAllPolicies");
@@ -84,9 +84,9 @@
 		logger.entering(sourceClass, Thread.currentThread().getName() + " "	+ "getAllPolicyNames");
 
 		List allPolicyNames = _policyDataStore.getAllPolicyNames();
+		if(auditLogger.isLoggable(Level.FINE))
+			auditLogger.fine(Thread.currentThread().getName()+"getAllPolicyNames invoked");
 		
-		auditLogger.fine(Thread.currentThread().getName() + " getAllPolicyNames method is invoked");
-
 		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "getAllPolicyNames");
 		
 		return allPolicyNames;
@@ -95,21 +95,21 @@
 	public String getPolicy(String policyName) throws SPLException 
 	{
 		logger.entering(sourceClass, Thread.currentThread().getName() + " "	+ "getPolicy");
-
 		String ci = _policyDataStore.getPolicy(policyName);
-		
-		auditLogger.fine(Thread.currentThread().getName() + " getPolicy  method is invoked :" + policyName);
-
-		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "getPolicy");
+		if(auditLogger.isLoggable(Level.FINE))
+			auditLogger.fine(Thread.currentThread().getName()+"getPolicy invoked :"+policyName);
 
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getPolicy");
 		return ci;
+
+
 	}
 
 	public void shutdown() 
 	{
 		logger.entering(sourceClass, Thread.currentThread().getName() + " " + "shutdown");
-
-		auditLogger.fine(Thread.currentThread().getName() + " Policy Manager Shut Down initiated");
+		if(auditLogger.isLoggable(Level.FINE))
+			auditLogger.fine(Thread.currentThread().getName() + " Policy Manager Shut Down initiated");
 
 		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "shutdown");
 	}
@@ -120,8 +120,8 @@
 		logger.entering(sourceClass, Thread.currentThread().getName() + " " + "updatePolicy");
 
 		_policyDataStore.updatePolicy(policyName, policyString);
-		
-		auditLogger.fine(Thread.currentThread().getName() + " updatePolicy method is invoked :" + policyName);
+		if(auditLogger.isLoggable(Level.FINE))
+			auditLogger.fine(Thread.currentThread().getName() + " updatePolicy method is invoked :" + policyName);
 
 		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "updatePolicy");
 	}
@@ -134,8 +134,8 @@
 			logger.entering(sourceClass, Thread.currentThread().getName() + " " + "createPolicy");
 
 			boolean res = _policyDataStore.createPolicy(policyName, policyString);
-
-			auditLogger.fine(Thread.currentThread().getName() + " createPolicy method invoked for policy : " + policyName);
+			if(auditLogger.isLoggable(Level.FINE))
+				auditLogger.fine(Thread.currentThread().getName() + " createPolicy method invoked for policy : " + policyName);
 
 			logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "createPolicy");
 
@@ -155,8 +155,8 @@
 			logger.entering(sourceClass, Thread.currentThread().getName() + " "	+ "deletePolicy");
 
 			_policyDataStore.deletePolicy(policyName);
-			
-			auditLogger.fine(Thread.currentThread().getName() + " deletePolicy method is invoked : " + policyName);
+			if(auditLogger.isLoggable(Level.FINE))
+				auditLogger.fine(Thread.currentThread().getName() + " deletePolicy method is invoked : " + policyName);
 
 			logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "deletePolicy");
 		} 
@@ -202,7 +202,7 @@
 			Object result;
 			SPLPolicy cp = _policyDataStore.createSPLPolicyObject(policyName, policyString);
 			result = _policyEvaluator.evaluatePolicy(cp, instances);
-			
+			if(auditLogger.isLoggable(Level.FINE))
 			auditLogger.fine(Thread.currentThread().getName() + " evaluatePolicyString method is invoked :" + policyName);
 			
 			logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "createPolicy");

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/IdentPrimaryTuple.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/IdentPrimaryTuple.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/IdentPrimaryTuple.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/IdentPrimaryTuple.java Tue Sep 29 18:29:44 2009
@@ -28,10 +28,14 @@
 package org.apache.imperius.spl.parser.compiler;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.Vector;
 
+import org.apache.imperius.spl.external.Argument;
 import org.apache.imperius.spl.external.DataCollector;
 import org.apache.imperius.spl.external.Expression;
 import org.apache.imperius.spl.external.InstanceInfo;
@@ -76,6 +80,171 @@
     {
         _symbolTable = spt;
     }
+
+//    // no input object means that the symbol table already has anchor object
+//    // populated
+//    public Object evaluate() throws SPLException
+//    {
+//    	Object returnValue = null;
+//    	
+//    	if(_isMethod)
+//    	{
+//    		Object instance = _symbolTable.getInstance(_classType);
+//    		String qualifier = _symbolTable.getQualifierForClass(_classType);
+//    		returnValue = AnchorMethodInvokeAction.invokeClassMethod(_symbolTable, 
+//    		_classType, qualifier, _identifier, _paramList,instance);
+//    	}
+//    	else
+//    	{
+//    		// xiping's addition to support Java overloading, 06/19/09
+//    		// start
+//    		Symbol sym = null;
+//    		Object obj = _symbolTable.getSymbol(_classType + "." + _identifier);
+//    		if (obj instanceof Vector) { //MethodSysbol
+//    			Collection c = (Collection) obj;
+//    			for (Iterator it = c.iterator(); it.hasNext();) {
+//        			sym = (Symbol) it.next();
+//        			List aList = ((MethodSymbol)sym).getArgumentList();
+//        		
+//        			if (aList.size() != _paramList.size()) {
+//        				continue;
+//        			}
+//        			
+//        			boolean typeNotEqual = false;
+//        			for (int i = 0; i < aList.size(); i++) {
+//        				Expression exp = (Expression)_paramList.get(i);
+//        				Argument arg = (Argument)aList.get(i);
+//        				TypeInfo expDataType = exp.getType();
+//        				TypeInfo argDataType = arg.getType();
+////        				if (expDataType.getIsArray() != argDataType.getIsArray() ||
+////        						expDataType.getType() != argDataType.getType()) {
+//        				if (expDataType.getType() != argDataType.getType()) {
+//        					typeNotEqual = true;
+//        					break;
+//        				}
+//        			}
+//        			
+//        			if (typeNotEqual) {
+//        				continue;
+//        			}
+//
+//        			break;
+//        		}
+//    		} else { //PropertySymbol
+//    			sym = (Symbol) obj;
+//    		}
+//    		
+//    		for (Iterator it = c.iterator(); it.hasNext();) {
+//    			sym = (Symbol) it.next();
+//    			List aList = ((MethodSymbol)sym).getArgumentList();
+//    		
+//    			if (aList.size() != _paramList.size()) {
+//    				continue;
+//    			}
+//    			
+//    			boolean notEqual = false;
+//    			for (int i = 0; i < aList.size(); i++) {
+//    				Expression exp = (Expression)_paramList.get(i);
+//    				Argument arg = (Argument)aList.get(i);
+//    				TypeInfo expDataType = exp.getType();
+//    				TypeInfo argDataType = arg.getType();
+////    				if (expDataType.getIsArray() != argDataType.getIsArray() ||
+////    						expDataType.getType() != argDataType.getType()) {
+//    				if (expDataType.getType() != argDataType.getType()) {
+//    					notEqual = true;
+//    					break;
+//    				}
+//    			}
+//    			
+//    			if (notEqual) {
+//    				continue;
+//    			}
+//
+//    			break;
+//    		}
+//    		
+//    		if (sym == null) {
+//    			throw new SPLException("evaluate() failed: " + _identifier + "does not exit");
+//    		}
+//    		// end
+//
+//    		returnValue = sym.getValue();
+//    	}
+//    	
+//    	
+//    	return returnValue;
+//    	
+//    }
+    
+//    public Object evaluate(Object parentObject) throws SPLException
+//    {
+//    	Object returnValue = null;
+//    	
+//    	DataCollector dc = DataCollectorFactory.getDataCollector();
+//    	String qualifier = _symbolTable.getQualifierForClass(_classType);
+//		Map symbolsofInstance = dc.getSymbolsForInstance(_classType,
+//				qualifier,
+//				parentObject);
+//		Map instanceMap = new HashMap();
+//		instanceMap.put(_classType, parentObject);
+//		_symbolTable.populateInstanceValuesForInstance(_classType, 
+//				_classType, 
+//				parentObject, 
+//				symbolsofInstance);
+//
+//    	//_symbolTable.setAnchors(mapOfAnchorClassToInstance);
+//    	if(_isMethod)
+//    	{
+//    		returnValue = AnchorMethodInvokeAction.invokeClassMethod(_symbolTable, 
+//    		_classType, qualifier, _identifier, _paramList, parentObject);
+//    	}
+//    	else
+//    	{
+//    		// xiping's addition to support Java overloading, 06/19/09
+//    		// start
+//    		Symbol sym = null;
+//    		Collection c = _symbolTable.getSymbol(_classType + "." + _identifier);
+//    		for (Iterator it = c.iterator(); it.hasNext();) {
+//    			sym = (Symbol) it.next();
+//    			List aList = ((MethodSymbol)sym).getArgumentList();
+//    		
+//    			if (aList.size() != _paramList.size()) {
+//    				continue;
+//    			}
+//    			
+//    			boolean notEqual = false;
+//    			for (int i = 0; i < aList.size(); i++) {
+//    				Expression exp = (Expression)_paramList.get(i);
+//    				Argument arg = (Argument)aList.get(i);
+//    				TypeInfo expDataType = exp.getType();
+//    				TypeInfo argDataType = arg.getType();
+////    				if (expDataType.getIsArray() != argDataType.getIsArray() ||
+////    						expDataType.getType() != argDataType.getType()) {
+//    				if (expDataType.getType() != argDataType.getType()) {
+//    					notEqual = true;
+//    					break;
+//    				}
+//    			}
+//    			
+//    			if (notEqual) {
+//    				continue;
+//    			}
+//
+//    			break;
+//    		}
+//    		
+//    		if (sym == null) {
+//    			throw new SPLException("evaluate(Object) failed: " + _identifier + "does not exit");
+//    		}
+//    		// end
+//
+//    		returnValue = sym.getValue();
+//    		
+//    	}
+//    	
+//    	return returnValue;
+//    }
+
     // no input object means that the symbol table already has anchor object
     // populated
     public Object evaluate() throws SPLException
@@ -83,17 +252,17 @@
         Object returnValue = null;
         Object instance = _symbolTable.getInstance(_classType);
         String qualifier = _symbolTable.getQualifierForClass(_classType);
-        if(_isMethod)
+        if(_isMethod) // MethodSymbol
         {
             returnValue = AnchorMethodInvokeAction.invokeClassMethod(_symbolTable, 
-            _classType, qualifier, _identifier, _paramList,instance);
+            			_classType, qualifier, _identifier, _paramList, instance);
         }
-        else
+        else // PropertySymbol
         {
             Symbol sym = null;
             try
             {
-                sym =  _symbolTable.getSymbol(_classType + "." + _identifier);
+                sym = (Symbol)_symbolTable.getSymbol(_classType + "." + _identifier);
                 returnValue = sym.getValue();
             } 
             catch(SPLException splex) 
@@ -101,14 +270,22 @@
                 String accessorMethodName = getAccessorMethodName(_identifier, "get");
                 try
                 {
-                    sym =  _symbolTable.getSymbol(_classType + "." + accessorMethodName);
+                	// xiping 09/22/2009
+                	// not sure what this line of code is doing
+                	// sym is not referenced
+//                	sym =  (Symbol)_symbolTable.getSymbol(_classType + "." + accessorMethodName);
+                	Object obj = _symbolTable.getSymbol(_classType + "." + accessorMethodName);
                 }
                 catch(SPLException splex1)
                 {
                     accessorMethodName = getAccessorMethodName(_identifier, "is");
                     try
                     {
-                        sym =  _symbolTable.getSymbol(_classType + "." + accessorMethodName);
+                    	// xiping 09/22/2009
+                    	// not sure what this line of code is doing
+                    	// sym is not referenced
+//                    	sym = (Symbol)_symbolTable.getSymbol(_classType + "." + accessorMethodName);
+                    	Object obj = _symbolTable.getSymbol(_classType + "." + accessorMethodName);
                     }
                     catch(SPLException splex2)
                     {
@@ -120,13 +297,12 @@
 														+ _identifier }));
                     }
                 }
-                returnValue = AnchorMethodInvokeAction.invokeClassMethod(
-                        _symbolTable, _classType, qualifier,
-                        accessorMethodName, _paramList, instance);
+                
+                returnValue = AnchorMethodInvokeAction.invokeClassMethod(_symbolTable, _classType, qualifier,
+                        	accessorMethodName, _paramList, instance);
             }       
         }
         
-        
         return returnValue;
         
     }
@@ -142,26 +318,22 @@
         Map instanceMap = new HashMap();
         instanceMap.put(_classType, parentObject);
         _symbolTable.populateInstanceValuesForInstance(_classType, 
-                _classType, 
-                parentObject, 
-                symbolsofInstance);
+                _classType, parentObject, symbolsofInstance);
         
         // Symbol sym = _symbolTable.getSymbol(_classType + "." + _identifier);
         
         //_symbolTable.setAnchors(mapOfAnchorClassToInstance);
-        if(_isMethod)
+        if(_isMethod) //MethodSymbol
         {
-        
             returnValue = AnchorMethodInvokeAction.invokeClassMethod(_symbolTable, 
-            _classType, qualifier, _identifier, _paramList, parentObject);
+            		_classType, qualifier, _identifier, _paramList, parentObject);
         }
-        else
+        else // PropertySymbol
         {
-            
             Symbol sym = null;
             try
             {
-                sym =  _symbolTable.getSymbol(_classType + "." + _identifier);
+                sym = (Symbol)_symbolTable.getSymbol(_classType + "." + _identifier);
                 returnValue = sym.getValue();
             } 
             catch(SPLException splex) 
@@ -169,7 +341,7 @@
                 String accessorMethodName = getAccessorMethodName(_identifier, "get");
                 try
                 {
-                    sym = _symbolTable.getSymbol(_classType + "."
+                    sym = (Symbol)_symbolTable.getSymbol(_classType + "."
                             + accessorMethodName);
                 }
                 catch(SPLException splex1)
@@ -177,7 +349,7 @@
                     accessorMethodName = getAccessorMethodName(_identifier, "is");
                     try
                     {
-                        sym = _symbolTable.getSymbol(_classType + "."
+                        sym = (Symbol)_symbolTable.getSymbol(_classType + "."
                                 + accessorMethodName);
                     }
                     catch(SPLException splex2)
@@ -190,6 +362,7 @@
 														+ _identifier }));
                     }
                 }
+                
                 returnValue = AnchorMethodInvokeAction.invokeClassMethod(
                         _symbolTable, _classType, qualifier,
                         accessorMethodName, _paramList, parentObject);
@@ -198,34 +371,30 @@
         
         return returnValue;
     }
-    
-    public TypeInfo validate(String classTypeOrVariableName) throws SPLException
-    {
-        TypeInfo typeInfo = new TypeInfo();
-        _classType = classTypeOrVariableName;
-        // ensure symbol table is populated
-        _populateSymbolTable(_classType);
-        
-        // Symbol sym = _symbolTable.getSymbol(classTypeOrVariableName + "." + _identifier);
-        
-        Symbol sym = null;
-        try
-        {
-            sym = _symbolTable.getSymbol(classTypeOrVariableName + "." + _identifier);
-        } 
-        catch(SPLException splex) 
-        {
-            try
-            {
-                sym = _symbolTable.getSymbol(classTypeOrVariableName + "."
-                        + getAccessorMethodName(_identifier, "get"));
+
+	public TypeInfo validate(String classTypeOrVariableName) throws SPLException
+	{
+		TypeInfo typeInfo = new TypeInfo();
+		_classType = classTypeOrVariableName;
+		// ensure symbol table is populated
+		_populateSymbolTable(_classType);
+
+		// xiping's addition to support Java overloading, 06/19/09
+		// start
+		Object obj = null;
+		
+		try {
+			obj = _symbolTable.getSymbol(classTypeOrVariableName + "." + _identifier);
+		} catch(SPLException splex) {
+			try
+			{
+                obj = _symbolTable.getSymbol(classTypeOrVariableName + "." + getAccessorMethodName(_identifier, "get"));
             } 
             catch(SPLException splex1)
             {
                 try
                 {
-                    sym = _symbolTable.getSymbol(classTypeOrVariableName + "."
-                            + getAccessorMethodName(_identifier, "is"));
+                    obj = _symbolTable.getSymbol(classTypeOrVariableName + "." + getAccessorMethodName(_identifier, "is"));
                 }
                 catch(SPLException splex2)
                 {
@@ -238,7 +407,42 @@
                 }
             }
         }
-        
+		
+		Symbol sym = null;
+		if (obj instanceof Vector) { // MethodSymbol
+			Collection c = (Collection) obj;
+			for (Iterator it = c.iterator(); it.hasNext();) {
+				sym = (Symbol) it.next();
+				List aList = ((MethodSymbol)sym).getArgumentList();
+			
+				if (aList.size() != _paramList.size()) {
+					continue;
+				}
+				
+				boolean typeNotEqual = false;
+				for (int i = 0; i < aList.size(); i++) {
+					Expression exp = (Expression)_paramList.get(i);
+					Argument arg = (Argument)aList.get(i);
+					TypeInfo expDataType = exp.getType();
+					TypeInfo argDataType = arg.getType();
+//					if (expDataType.getIsArray() != argDataType.getIsArray() ||
+//							expDataType.getType() != argDataType.getType()) {
+					if (expDataType.getType() != argDataType.getType()) {
+						typeNotEqual = true;
+						break;
+					}
+				}
+				
+				if (typeNotEqual) {
+					continue;
+				}
+
+				break;
+			}
+		} else { // PropertySymbol
+			sym = (Symbol) obj;
+		}
+
         if(_isMethod)
         {
             if(sym instanceof MethodSymbol)
@@ -274,13 +478,11 @@
             }
             
         }
-        
-        
-        
-        return typeInfo;
-        
-    }
-    
+		
+		return typeInfo;
+		
+	}
+
     private String getAccessorMethodName(String identifier, String setOrGetOrIs)
     {
         if(Character.isLetter(identifier.charAt(0)))
@@ -291,46 +493,58 @@
         return identifier;
     }
 
-    private TypeInfo _validateActualParameters(Symbol sym, 
-            String classType) throws SPLException
-    {
-        TypeInfo returnTypeInfo = new TypeInfo();
-        String returnClassName = null;
-        AnchorMethodInvokeAction.validateActualParameters(_symbolTable,
-                classType, _identifier, _paramList);
-        TypeInfo returnType = sym.getType();
-        boolean isArray = sym.isArray();
-        if(TypeResolver.isReference(returnType))
-        {
-            returnClassName = sym.getReferenceTypeName();
-            returnTypeInfo.setIsArray(isArray);
-            returnTypeInfo.setReferenceTypeName(returnClassName);
-            returnTypeInfo.setType(returnType.getType());
-            
-        }
-        else
-        {
-            returnTypeInfo.setIsArray(isArray);
-            returnTypeInfo.setType(returnType.getType());
-        }
-        return returnTypeInfo;
-        
-            
-        
-    }
+	private TypeInfo _validateActualParameters(Symbol sym, 
+			String classType) throws SPLException
+	{
+		TypeInfo returnTypeInfo = new TypeInfo();
+		String returnClassName = null;
+		AnchorMethodInvokeAction.validateActualParameters(_symbolTable,
+	    		classType, _identifier, _paramList);
+		TypeInfo returnType = sym.getType();
+		boolean isArray = sym.isArray();
+		if(TypeResolver.isReference(returnType))
+		{
+			returnClassName = sym.getReferenceTypeName();
+			returnTypeInfo.setIsArray(isArray);
+			returnTypeInfo.setReferenceTypeName(returnClassName);
+			returnTypeInfo.setType(returnType.getType());
+			
+		}
+		else
+		{
+			returnTypeInfo.setIsArray(isArray);
+			returnTypeInfo.setType(returnType.getType());
+		}
+		return returnTypeInfo;
+		
+			
+		
+	}
 
-    private void _populateSymbolTable(String classType) throws SPLException 
-    {
-        String qualifierName = null;
-        if(_symbolTable.getAnchorData() == null)
-        {
-            List instanceInfoList = new ArrayList();
-            instanceInfoList.add(new InstanceInfo(classType, new Object()));
-            _symbolTable.addAnchor(classType,qualifierName,instanceInfoList);
-            
-        }
-        
-    }
+	private void _populateSymbolTable(String classType) throws SPLException 
+	{
+		String qualifierName = null;
+		if(_symbolTable.getAnchorData() == null)
+		{
+			List instanceInfoList = new ArrayList(1);
+			instanceInfoList.add(new InstanceInfo(classType, new Object()));
+			_symbolTable.addAnchor(classType,qualifierName,instanceInfoList);
+			
+		}
+		
+	}
     
+//Xiping 05/25/08
+	public List getParamList() {
+		return _paramList;
+	}
+	
+	public String getIdentifier() {
+		return _identifier;
+	}
 
+	public boolean isMethod() {
+		return _isMethod;
+	}
+	//
 }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/SPLSymbolTable.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/SPLSymbolTable.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/SPLSymbolTable.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/SPLSymbolTable.java Tue Sep 29 18:29:44 2009
@@ -26,10 +26,12 @@
 package org.apache.imperius.spl.parser.compiler.symboltable;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Vector;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -245,29 +247,74 @@
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "insertMacroSymbol");
 	}
 	
-	public Symbol getSymbol(String name) throws SPLException
+//	public Symbol getSymbol(String name) throws SPLException
+//	{
+//		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSymbol");
+//		name=name.trim();
+//		//System.out.println("getSymbol "+name);
+//		Symbol retSym = null;
+//		if(_symbolMap.containsKey(name))
+//		{	
+//			//System.out.println("_symbolMap contains "+name);
+//			retSym = (Symbol)_symbolMap.get(name);
+//		}
+//		else
+//		{
+//			//System.out.println("_symbolMap does not contains "+name);
+//			if(_parentTable != null)
+//			{
+//				//System.out.println("trying parent symboltable");
+//				retSym = (Symbol)_parentTable.getSymbol(name);
+//			}
+//		}
+//		if (retSym==null)
+//		{
+//			throw new SPLException("Symbol does not exist " + name);
+//		}
+//		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSymbol");
+//		return retSym;
+//	}
+
+	// xiping's modification to support java overloading, 06/19/09	
+	public Object getSymbol(String name) throws SPLException
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSymbol");
-
 		name = name.trim();
-		Symbol retSym = null;
+		//System.out.println("getSymbol "+name);
+//		Symbol retSym = null;
+		
+		// xiping 09-16-2009
+		// obj can a collection of MethodSymbols that have the same name or
+		// a PropertySymbol
+		Object obj = null;
 		if(_symbolMap.containsKey(name))
 		{	
-			retSym = (Symbol)_symbolMap.get(name);
+			//System.out.println("_symbolMap contains "+name);
+//			retSym = (Symbol)_symbolMap.get(name);
+			obj = _symbolMap.get(name);
 		}
 		else
 		{
+			//System.out.println("_symbolMap does not contains "+name);
 			if(_parentTable != null)
 			{
-				retSym = (Symbol)_parentTable.getSymbol(name);
+				//System.out.println("trying parent symboltable");
+//				retSym = (Symbol)_parentTable.getSymbol(name);
+				obj = _parentTable.getSymbol(name);
 			}
 		}
-		if (retSym==null)
+
+//		if (retSym==null)
+		
+		if (obj == null)
 		{
 			throw new SPLException(Messages.getString("SPL_SYMBOL_DOES_NOT_EXISTS_MSG") + name);
 		}
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSymbol");
-		return retSym;
+	
+//		return retSym;
+		
+		return obj;
 	}
 	
 	public boolean symbolExists(String name, boolean recurse)
@@ -296,8 +343,94 @@
 			List instanceInfoList)
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" " +
-				"_populateAnchorClassSymbols");
+				"populateAnchorElementSymbols");
+		
+		Map sMap = null;
+		try 
+		{
+			//System.out.println("populateAnchorElementSymbols ::
+			//_anchorElement,nameSpace :"+_anchorElement+"  "+nameSpace);
+					
+			if(_dataCollector == null)
+			{
+				_dataCollector = DataCollectorFactory.getDataCollector();
+			}
+				
+			//System.out.println("trying to get class "+className+" "+qualifier);
+			//System.out.println("_dataCollector "+_dataCollector);
+			sMap = _dataCollector.getSymbolsForClass(className,qualifier);
+			//System.out.println("sMap "+sMap);
+			Iterator it = sMap.keySet().iterator();
+
+			// xiping 09-16-2009
+			// at this point we have the methods (MethodSymbol) w/ the same name stored in a vector
+			// which is stored in Map and field members (PropertySymbol) stored directly in Map.
+			while(it.hasNext())
+			{
+				String key = (String)it.next();
+//				Symbol s = (Symbol)sMap.get(key);
+
+				// xiping 06-19-2009
+				Object obj = sMap.get(key);
+				//
+				
+				Iterator instanceInfoListIt = instanceInfoList.iterator();
+				if(instanceInfoList != null && !instanceInfoList.isEmpty())
+				{	
+					while(instanceInfoListIt.hasNext())
+					{	
+						InstanceInfo instanceInfo = (InstanceInfo)instanceInfoListIt.next();
+						String instanceName = instanceInfo.getInstanceName();
+//						_symbolMap.put(instanceName + "." + key,s);
+
+//						_symbolMap.put(instanceName + "." + key, v);
+
+						// xiping's test 06/19/09
+						_symbolMap.put(instanceName + "." + key, obj);
+//
+						//System.out.println("Symbol added to symbolmap : "+instanceName + "." + key);
+					}	
+					
+				}
+				else
+				{
+//					_symbolMap.put(className + "." + key,s);
+
+					// xiping's test 06/19/09
+					_symbolMap.put(className + "." + key, obj);
+					//
+					
+					//System.out.println("Symbol added to symbolmap : "+className + "." + key);
+					
+				}
+			}
+				
+		} 
+		catch (SPLException e) 
+		{
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} 
+		
+		
+	/*	insertVariableSymbol(_anchorElement + ".intprop",TypeConstants.intType,false);
+		insertVariableSymbol(_anchorElement + ".intprop2",TypeConstants.intType,false);
+		insertVariableSymbol(_anchorElement + ".doubleprop",TypeConstants.doubleType,false);
+		insertVariableSymbol(_anchorElement + ".stringprop3",TypeConstants.stringType,false);*/
+		
+		
+		// TODO Auto-generated method stub
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "populateAnchorElementSymbols");
 		
+	}
+	
+
+	/*private void _populateCollectAnchorClassSymbols(String className, 
+			String qualifier, 
+			List instanceInfoList)
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" " +
+				"populateAnchorElementSymbols");
 		Map sMap = null;
 		try 
 		{
@@ -329,11 +462,13 @@
 		} 
 		catch (SPLException e) 
 		{
-			
+			// TODO Auto-generated catch block
+			e.printStackTrace();
 		} 
-
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "_populateAnchorClassSymbols");
-	}
+		
+	logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "populateAnchorElementSymbols");
+		
+	}*/
 	
 	public void populateInstanceValuesForInstance(
 			String className,
@@ -354,12 +489,13 @@
             PropertySymbol sym = (PropertySymbol)getSymbol(qualifiedKey);
 			Object value = (Object)currentInstanceSymbols.get(currentKey);
 			sym.setValue(value);
-
-            logger.fine(Thread.currentThread().getName() + " SPLSymbolTable setting symbol:" +sym.getName()+" from:"+sym.getValue()+" to:"+value);
+			if(logger.isLoggable(Level.FINE))
+            	logger.fine(Thread.currentThread().getName() + " SPLSymbolTable setting symbol:" +sym.getName()+" from:"+sym.getValue()+" to:"+value);
 		}
 		_insertInstanceObject(className, instanceName, instance);
 	
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "populateInstanceValuesForInstance");
+	
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "populateSymbolTableWithInstanceValues");
 	}
 
 	

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/BasicCollectionExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/BasicCollectionExpression.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/BasicCollectionExpression.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/BasicCollectionExpression.java Tue Sep 29 18:29:44 2009
@@ -69,13 +69,15 @@
 		_elements=pList;
 		try
 		{
-			if(!validate())
-			{
-                logger.severe(Thread.currentThread().getName()+" "+
+			if (sTab != null) { // xiping 03/05/09 to support collection analysis. sTab must not be null in normal cases.
+				if(!validate())
+				{
+               	 	logger.severe(Thread.currentThread().getName()+" "+
                 		"No of parameters for Basic collection has to be greater than zero ");
-                throw new IllegalParameterTypeException(Messages
+                	throw new IllegalParameterTypeException(Messages
 						.getString("SPL_EXPRESSION_VALIDATION_FAIL_MSG")
 						+ sourceClass);
+				}
 			}
 		}
 		catch(SPLException e)
@@ -156,6 +158,17 @@
 
 	public TypeInfo getType() 
 	{
+		if (_collectionType == null) {
+           try
+            {
+                validate();	// Sets the collection type.
+            }
+            catch (SPLException e)
+            {
+                logger.severe(Thread.currentThread().getName()+" "+"Exception caught");
+            }
+
+		}
 		return _collectionType;
 	}
 

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/CollectOperation.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/CollectOperation.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/CollectOperation.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/CollectOperation.java Tue Sep 29 18:29:44 2009
@@ -29,9 +29,11 @@
 
 import java.security.InvalidParameterException;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
+import java.util.logging.Level;
 import java.util.logging.Logger;
 
 import org.apache.imperius.spl.external.DataCollector;
@@ -43,8 +45,9 @@
 import org.apache.imperius.spl.parser.exceptions.MissingParameterException;
 import org.apache.imperius.spl.parser.exceptions.NonExistentSymbolException;
 import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.expressions.*;
-import org.apache.imperius.spl.parser.util.*;
+import org.apache.imperius.spl.parser.expressions.ReferenceExpression;
+import org.apache.imperius.spl.parser.util.DataCollectorFactory;
+import org.apache.imperius.spl.parser.util.TypeInfo;
 import org.apache.imperius.util.Messages;
 import org.apache.imperius.util.SPLLogger;
 
@@ -303,7 +306,12 @@
 		}
 		else
 		{
-			Symbol propSymbol = symTab.getSymbol(targetClassName + "." + targetClassPropertyName);
+			// xiping's modification to support Java overloading, 06/21/09
+			Symbol propSymbol = (Symbol)symTab.getSymbol(targetClassName + "." + targetClassPropertyName);
+//			Collection c = symTab.getSymbol(targetClassName + "." + targetClassPropertyName);
+//			Iterator it = c.iterator();
+//			Symbol propSymbol = (Symbol) it.next();
+			
 			this._dataType=new TypeInfo(propSymbol.getType());
 			this._dataType.setIsArray(true);
 			expressionForTarget = (Expression)paramList.get(6); // 6th param is an expression involving properties of the targetclass
@@ -481,16 +489,17 @@
 
 
 		// get instances of the targetclass that satisfy the association conditions
-		logger.fine(Thread.currentThread().getName()+" refExpressionResult evaluateFlavour2 "+referenceStr);
+		if(logger.isLoggable(Level.FINE))
+			logger.fine(Thread.currentThread().getName()+" refExpressionResult evaluateFlavour2 "+referenceStr);
 		//System.out.println("targetClassInstanceReferences to dc :"+refExpressionResult+" "+symTab.getDefaultQualifier()+" "+targetClassName+" "+associationName+" "+sourceRole+" "+targetRole);
 		
 		targetClassInstanceReferences = dc.getAssociatedInstanceReferences(refExpressionResult,symTab.getDefaultQualifier(),targetClassName,associationName,sourceRole,targetRole);
 		//System.out.println("targetClassInstanceReferences "+targetClassInstanceReferences.toString());
-
+		if (logger.isLoggable(Level.FINE))
 		logger.fine(Thread.currentThread().getName()+" got associated references");
 
 //		targetClassInstance = dc.getAssociatedInstanceReferences(refTypeName, symTab.getDefaultQualifier(), targetClassName,associationName,sourceRole,targetRole, refExpressionResult);
-
+		if (logger.isLoggable(Level.FINE))
 		logger.fine(Thread.currentThread().getName()+" got associated instances");
 
 		// filter the List based on the target filter expression
@@ -499,7 +508,8 @@
 		List filteredTargetClassInstanceReferences = filterTargetClassInstanceReferencesWithTargetExpression(targetClassInstanceReferences , this.targetClassName,this.symTab.getDefaultQualifier());
 		//System.out.println("targetClassInstanceReferences "+filteredTargetClassInstanceReferences.toString());
 		
-		logger.fine(Thread.currentThread().getName()+" got filtered references");
+		if (logger.isLoggable(Level.FINE))
+			logger.fine(Thread.currentThread().getName()+" got filtered references");
 
 		ArrayList filteredTargetClassInstances = new ArrayList();
 
@@ -558,20 +568,24 @@
 		List targetClassInstanceReferences = null;
 
 		// traverse association to get an array of target class instances. Each instance is a Map of key=values
-		logger.fine(Thread.currentThread().getName()+" refExpressionResult evaluateFlavour1 "+refExpressionStr);
+		if(logger.isLoggable(Level.FINE))
+			logger.fine(Thread.currentThread().getName()+" refExpressionResult evaluateFlavour1 "+refExpressionStr);
 
 		targetClassInstanceReferences = dc.getAssociatedInstanceReferences((Object)refExpressionResult,symTab.getDefaultQualifier(),targetClassName,associationName,sourceRole,targetRole);
 		//System.out.println("targetClassInstanceReferences size "+targetClassInstanceReferences.size());
-		logger.fine(Thread.currentThread().getName()+" got associated references");
+		if(logger.isLoggable(Level.FINE))
+			logger.fine(Thread.currentThread().getName()+" got associated references");
 
 //		targetClassInstance = dc.getAssociatedInstanceReferences(refTypeName, symTab.getDefaultQualifier(), targetClassName,associationName,sourceRole,targetRole, refExpressionResult);
-		logger.fine(Thread.currentThread().getName()+" got associated instances");
+		if(logger.isLoggable(Level.FINE))
+			logger.fine(Thread.currentThread().getName()+" got associated instances");
 
 		// filter the List based on the target filter expression
 		List filteredTargetClassInstanceReferences = filterTargetClassInstanceReferencesWithTargetExpression(targetClassInstanceReferences , this.targetClassName,this.symTab.getDefaultQualifier());
 		//System.out.println("filteredTargetClassInstanceReferences size "+filteredTargetClassInstanceReferences.size());
 
-		logger.fine(Thread.currentThread().getName()+" got filtered references");
+		if(logger.isLoggable(Level.FINE))
+			logger.fine(Thread.currentThread().getName()+" got filtered references");
 
 		List filteredTargetClassInstances = new ArrayList();
 
@@ -584,7 +598,8 @@
 			filteredTargetClassInstances.add(instanceProperties);
 		}
 
-		logger.fine(Thread.currentThread().getName()+" got filtered instances");
+		if(logger.isLoggable(Level.FINE))
+			logger.fine(Thread.currentThread().getName()+" got filtered instances");
 
 		if(!noPostCollectOperation) // post collect exists
 		{
@@ -716,20 +731,23 @@
 				//System.out.println("result "+result);
 				if(result.booleanValue())
 				{
-					logger.fine(Thread.currentThread().getName()+" cop passed filter "+cop);
+					if(logger.isLoggable(Level.FINE))
+						logger.fine(Thread.currentThread().getName()+" cop passed filter "+cop);
 					//System.out.println("adding cop to list "+cop.toString());
 					
 					filteredTargetClassInstanceReferences.add(cop);
 				}
 				else
 				{
-					logger.fine(Thread.currentThread().getName()+" cop did not pass filter "+cop);
+					if(logger.isLoggable(Level.FINE))
+						logger.fine(Thread.currentThread().getName()+" cop did not pass filter "+cop);
 				}
 			}
 		}
 		else
 		{
-			logger.fine(Thread.currentThread().getName()+" Zero instances passed in hence zero instance references filtered, therefore returning null ");
+			if (logger.isLoggable(Level.FINE))
+				logger.fine(Thread.currentThread().getName()+" Zero instances passed in hence zero instance references filtered, therefore returning null ");
 		}
 
 

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/PostCollectExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/PostCollectExpression.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/PostCollectExpression.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/PostCollectExpression.java Tue Sep 29 18:29:44 2009
@@ -199,12 +199,8 @@
 		logger.entering(sourceClass, Thread.currentThread().getName() + " "
 				+ "validate");
 
-		if (arrExp1 != null
-				&& (arrExp1.getType().getType() == TypeConstants.intType)) // make
-		// sure
-		// [exp]
-		// is
-		// numeric
+		// make sure [exp] is numeric
+		if (arrExp1 != null && (arrExp1.getType().getType() == TypeConstants.intType)) 
 		{
 			targetName = targetClassName;
 
@@ -222,16 +218,17 @@
 				// System.out.println("!methodOrParam.equals()
 				// "+qualifiedPropertyName);
 
-				if (symTab.symbolExists(qualifiedPropertyName, recurse)) // make
-																			// sure
-																			// ID1
-				// exists in the
-				// symbol table
+				// make  sure ID1 exists in the symbol table
+				if (symTab.symbolExists(qualifiedPropertyName, recurse)) 
 				{
 					// System.out.println("symTab.symbolExists(propName,
 					// recurse)");
 
-					Symbol sym = symTab.getSymbol(qualifiedPropertyName);
+					//TODO xiping 06/21/09
+//					Collection c = symTab.getSymbol(qualifiedPropertyName);
+					Symbol sym = null;
+//					
+					
 					_dataType.copy(sym.getType());
 
 					if (sym instanceof MethodSymbol) 
@@ -306,8 +303,10 @@
 							"SPL_SYMBOL_DOES_NOT_EXIST_EXCEPTION_MSG",
 							new Object[] { qualifiedPropertyName }));
 				}
-			} else {
-				// System.out.println("method or param name is null");
+			}
+			else
+			{
+				//System.out.println("method or param name is null");
 				// expression of type [exp]
 				_dataType.setType(TypeConstants.referenceType);
 				_dataType.setIsArray(false);
@@ -316,9 +315,11 @@
 				// target class name in the
 				// collect
 			}
-		} else {
-			logger.severe("arr index should be integer and not "
-					+ arrExp1.getType());
+		}
+		else
+		{
+			logger.severe(
+					"arr index should be integer and not " + arrExp1.getType());
 
 			throw new IllegalExpressionTypeException(Messages.getString(
 					"SPL_POSTCOLLECT_EXP_EXCEPTION1_MSG",

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/PrimaryExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/PrimaryExpression.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/PrimaryExpression.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/PrimaryExpression.java Tue Sep 29 18:29:44 2009
@@ -26,6 +26,7 @@
 
 package org.apache.imperius.spl.parser.expression.primary;
 
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.logging.Logger;
@@ -178,6 +179,8 @@
 	        			ipt.setSymbolTable(_symTab);
 	        		}
 	        		returnType = ipt.validate(referenceTypeName);
+	        	} else {
+	        		identTupleIt.next();	// <--- Added by dawood
 	        	}	
 	        }
 	        _dataType.copy(returnType);
@@ -189,7 +192,14 @@
             boolean symbolExists = _symTab.symbolExists(_classNameOrInstanceVariableName, true);
             if( symbolExists )
             {
-                Symbol sym = _symTab.getSymbol(_classNameOrInstanceVariableName);
+            	Symbol sym = (Symbol)_symTab.getSymbol(_classNameOrInstanceVariableName);
+            	
+//            	// xiping's modification, 06/19/09
+//            	// contains only one local constant
+//            	Collection c = _symTab.getSymbol(_classNameOrInstanceVariableName);
+//            	Iterator it = c.iterator();
+//            	Symbol sym = (Symbol) it.next();
+
                 _dataType.copy(sym.getType());
                 // _isArray = sym.isArray();
                 _referenceTypeName = sym.getReferenceTypeName();
@@ -237,7 +247,12 @@
         {
              if( _symTab.symbolExists(_classNameOrInstanceVariableName,true) )
              {
-                 Symbol sym = _symTab.getSymbol(_classNameOrInstanceVariableName);
+//            	 Symbol sym = _symTab.getSymbol(_classNameOrInstanceVariableName);
+            	 
+            	 // xiping's test 06/19/09
+            	 // return value must be a PropertySymbol
+            	 Symbol sym = (Symbol)_symTab.getSymbol(_classNameOrInstanceVariableName);
+//            	 
                  intermediateObject = sym.getValue();
              }
              else
@@ -321,22 +336,11 @@
 				+ "setSymTab");
     }
     
-    public String toString()
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
 
-        String retStr=" "+this.getPropertyString() +"( ";
-        
-        if(this.evaluationResult!=null)
-        {
-        	retStr+=this.evaluationResult.toString();
-        }
-        
-        retStr+=" )";
-        
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
-       
-        return retStr;
+    
+    // Xiping 10/20/2008
+    public String toString() {
+    	return getSensorName();
     }
 
 	public String getReferenceTypeName() throws SPLException 
@@ -364,4 +368,92 @@
     	return propName;
     }
 	
+	//Xiping 05/25/08
+	public String getSensorName() {
+		String sensorName = _classNameOrInstanceVariableName;
+		
+        if(!_identTupleList.isEmpty()) {
+	        Iterator identTupleIt = _identTupleList.iterator();
+	        while(identTupleIt.hasNext()) {
+	        	IdentPrimaryTuple ipt = (IdentPrimaryTuple)identTupleIt.next();
+	        	boolean isMethod = ipt.isMethod();
+	        	List paramList = ipt.getParamList();
+	        	String identifier = ipt.getIdentifier();
+	        	
+	        	sensorName +="." + identifier;
+	        	if (isMethod) {
+	        		sensorName += "(";
+	        		Iterator ite = paramList.iterator();
+	        		while (ite.hasNext()) {
+	        			Object obj = (Object)ite.next();
+	        			sensorName += obj + ",";
+	        		}
+	        		if (sensorName.endsWith(",")) {
+	        			sensorName = sensorName.substring(0, sensorName.length()-1);
+	        		}
+	        		sensorName += ")";
+	        	}
+	        }
+        }
+        
+        return sensorName;
+	}
+
+//	public String getSensorName() {
+//		String sensorName = _classNameOrInstanceVariableName;
+//		
+//        if(!_identTupleList.isEmpty()) {
+//	        Iterator identTupleIt = _identTupleList.iterator();
+//	        while(identTupleIt.hasNext()) {
+//	        	IdentPrimaryTuple ipt = (IdentPrimaryTuple)identTupleIt.next();
+//	        	boolean isMethod = ipt.isMethod();
+//	        	List paramList = ipt.getParamList();
+//	        	String identifier = ipt.getIdentifier();
+//	        	
+//	        	String param = "";
+//	        	if (isMethod) {
+//	        		Iterator ite = paramList.iterator();
+//	        		while (ite.hasNext()) {
+//	        			Object obj = (Object)ite.next();
+//	        			param += obj + ",";
+//	        		}
+//	        		if (sensorName.endsWith(",")) {
+//	        			param = param.substring(0, param.length()-1);
+//	        		}
+//	        		identifier.replaceAll("()", "("+param+")");
+//	        		sensorName += "." + identifier;
+//	        	}
+//	        }
+//        }
+//        
+//        return sensorName;
+//	}
+
+    //Xiping 06/04/08
+    public boolean equals(Object that) {
+    	
+    	if (!(that instanceof PrimaryExpression)) {
+    		return false;
+    	}
+    	//TODO SPLSymbolTable must overwrite hashCode() and equals()
+//    	boolean classNameOrInstanceVariableName = this._classNameOrInstanceVariableName.equals(((PrimaryExpression)that)._classNameOrInstanceVariableName);
+//    	boolean identTupleList = this._identTupleList.equals(((PrimaryExpression)that)._identTupleList);
+//    	boolean symTab = this._symTab.equals(((PrimaryExpression)that)._symTab);
+//    	if (classNameOrInstanceVariableName && identTupleList) {// && symTab) {
+//    		return true;
+//    	}
+
+    	if (this.getSensorName().equals(((PrimaryExpression)that).getSensorName())) {
+    		return true;
+    	}
+    	
+    	return false;
+    }
+
+    public int hashCode() {
+    	//TODO see equals()
+    	int hash = this.getSensorName().hashCode();
+    	
+    	return hash;
+    }
 }
\ No newline at end of file

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/SelfExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/SelfExpression.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/SelfExpression.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expression/primary/SelfExpression.java Tue Sep 29 18:29:44 2009
@@ -73,37 +73,33 @@
     
     public String getReferenceTypeName()
     {
-    	logger.entering(sourceClass, Thread.currentThread().getName() + " "
-				+ "evaluate");
-
-		String referenceTypeName = null;
-		SPLSymbolTable symbtab = sTab;
-		while (sTab.getParentSymbolTable() != null
-				&& sTab.getParentSymbolTable().getSymbolTableType() == SPLSymbolTable.COLLECT) 
-		{
-			symbtab = sTab.getParentSymbolTable();
-		}
-
-		if (symbtab.getParentSymbolTable() != null
-				&& symbtab.getParentSymbolTable().getSymbolTableType() != SPLSymbolTable.COLLECT) 
-		{
-			SPLSymbolTable parentSymTab = symbtab.getParentSymbolTable();
-			List anchorClassList = parentSymTab.getAnchorClassList();
-			Iterator anchorClassListIt = anchorClassList.iterator();
-
-			referenceTypeName = (String) anchorClassListIt.next();
-
-		} 
-		else 
-		{
-			logger
-					.severe("non collect Parent SymbolTable not found in Self Expression");
-		}
-		
-		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
-				+ "evaluate");
-		
-		return referenceTypeName;
+    	 logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+         //System.out.println("evaluating Self expression");
+    	 String referenceTypeName = null;
+         
+          SPLSymbolTable symbtab=sTab;
+          while(sTab.getParentSymbolTable() != null && sTab.getParentSymbolTable().getSymbolTableType() == SPLSymbolTable.COLLECT){
+          	symbtab=sTab.getParentSymbolTable();
+          }
+          
+          
+          if (symbtab.getParentSymbolTable() != null && symbtab.getParentSymbolTable().getSymbolTableType() != SPLSymbolTable.COLLECT )
+          {	
+              SPLSymbolTable parentSymTab = symbtab.getParentSymbolTable();
+              List anchorClassList = parentSymTab.getAnchorClassList();
+              Iterator anchorClassListIt = anchorClassList.iterator();
+             
+             	referenceTypeName = (String)anchorClassListIt.next();
+             
+             
+          }
+          else{
+//          	throw new SPLException("non collect Parent SymbolTable not found in Self Expression");
+        	  logger.severe("non collect Parent SymbolTable not found in Self Expression");
+        	  
+          }
+          logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
+          return referenceTypeName;
     }
     
     public Object evaluate() throws SPLException

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/DoubleArgumentExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/DoubleArgumentExpression.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/DoubleArgumentExpression.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/DoubleArgumentExpression.java Tue Sep 29 18:29:44 2009
@@ -25,7 +25,9 @@
 
 package org.apache.imperius.spl.parser.expressions;
 
+import java.util.Iterator;
 import java.util.List;
+import java.util.Vector;
 import java.util.logging.Logger;
 
 import org.apache.imperius.spl.external.Expression;
@@ -160,4 +162,33 @@
     {
     	return null;
     }
+
+    //Xiping 05/25/08
+    public Iterator getSubexpressions() {
+    	Vector subexpressions = new Vector();
+    	subexpressions.add(_lhsExp);
+    	subexpressions.add(_rhsExp);
+    	
+    	return subexpressions.iterator();
+    }
+    //
+
+    //Xiping 10/13/08
+    public Expression getLHS() {
+    	return _lhsExp;
+    }
+
+    public Expression getRHS() {
+    	return _rhsExp;
+    }
+    
+    public void replaceLHS(Expression lhs) {
+    	_lhsExp = lhs;
+    }
+    
+    public void replaceRHS(Expression rhs) {
+    	_rhsExp = rhs;
+    }
+    //
+
 }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/MultipleArgumentExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/MultipleArgumentExpression.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/MultipleArgumentExpression.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/MultipleArgumentExpression.java Tue Sep 29 18:29:44 2009
@@ -26,6 +26,7 @@
 package org.apache.imperius.spl.parser.expressions;
 
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.logging.Logger;
 
@@ -176,4 +177,17 @@
     {
     	return null;
     }
+    
+    //xiping 06/13/08
+    public Iterator getSubexpressions() {
+    	return _expressions.iterator();
+    }
+    
+    public List getExpressions() {
+    	return _expressions;
+    }
+    
+    public void replaceExpressions(List list) {
+    	_expressions = list;
+    }
 }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/QuadrupleArgumentExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/QuadrupleArgumentExpression.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/QuadrupleArgumentExpression.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/QuadrupleArgumentExpression.java Tue Sep 29 18:29:44 2009
@@ -24,7 +24,9 @@
  */
 package org.apache.imperius.spl.parser.expressions;
 
+import java.util.Iterator;
 import java.util.List;
+import java.util.Vector;
 import java.util.logging.Logger;
 
 import org.apache.imperius.spl.external.Expression;
@@ -149,5 +151,21 @@
     public String getReferenceTypeName() throws SPLException
     {
     	return null;
+    	//throw new SPLException("ReferenceTypeName not supported");
+    }
+    
+    //Xiping 05/29/2008
+    public Iterator getSubexpressions() {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSubexpressions");
+
+        Vector subexpressions = new Vector();
+    	subexpressions.add(_exp1);
+    	subexpressions.add(_exp2);
+    	subexpressions.add(_exp3);
+    	subexpressions.add(_exp4);
+    	
+    	logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSubexpressions");
+    	
+    	return subexpressions.iterator();
     }
 }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/SingleArgumentExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/SingleArgumentExpression.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/SingleArgumentExpression.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/SingleArgumentExpression.java Tue Sep 29 18:29:44 2009
@@ -25,7 +25,9 @@
 
 package org.apache.imperius.spl.parser.expressions;
 
+import java.util.Iterator;
 import java.util.List;
+import java.util.Vector;
 import java.util.logging.Logger;
 
 import org.apache.imperius.spl.external.Expression;
@@ -125,4 +127,26 @@
     	return null;
     }
     
+    //Xiping 05/29/2008
+    public Iterator getSubexpressions() {
+    	
+    	final String methodName = "getSubexpressions()";
+        logger.entering(sourceClass, Thread.currentThread().getName() + " " + methodName);
+
+    	Vector subexpressions = new Vector();
+    	subexpressions.add(_exp);
+
+        logger.exiting(sourceClass, Thread.currentThread().getName() + " " + methodName);
+
+    	return subexpressions.iterator();
+    }
+    
+    public Expression getExpression() {
+    	return _exp;
+    }
+    
+    public void replaceExpression(Expression exp) {
+    	_exp = exp;
+    }
+    //
 }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/TimeZoneExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/TimeZoneExpression.java?rev=820060&r1=820059&r2=820060&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/TimeZoneExpression.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/expressions/TimeZoneExpression.java Tue Sep 29 18:29:44 2009
@@ -113,7 +113,7 @@
         logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getType");
 
         Expression e = new StringConstant(tzid);
-        List aList = new ArrayList();
+        List aList = new ArrayList(1);	// DAW
         aList.add(e);
         boolean validateExp = true;
         if (sTab.getSymbolTableType() == SPLSymbolTable.COLLECT)



Mime
View raw message