incubator-imperius-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jnee...@apache.org
Subject svn commit: r686743 [4/10] - in /incubator/imperius/trunk: imperius-javaspl/src/main/java/org/apache/imperius/javaspl/ imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/ imperius-splcore/src/main/java/org/apache/imperius/spl/datas...
Date Mon, 18 Aug 2008 12:50:42 GMT
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=686743&r1=686742&r2=686743&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 Mon Aug 18 05:50:36 2008
@@ -17,14 +17,11 @@
  * under the License.  
  */
 
-
 /**
  * @author Prashant Baliga <prabalig@in.ibm.com>
  *
  */
 
-
-
 package org.apache.imperius.spl.manager.impl;
 
 import java.util.List;
@@ -44,244 +41,213 @@
 import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
 import org.apache.imperius.spl.parser.util.ActuatorFactory;
 import org.apache.imperius.spl.parser.util.DataCollectorFactory;
+import org.apache.imperius.util.Messages;
 import org.apache.imperius.util.SPLLogger;
 
-
-
 public class PolicyManagerImpl implements PolicyManager 
 {
-
-
-	private  PolicyDataStore _policyDataStore = null;
-	private  PolicyEvaluator _policyEvaluator = null;
-	private static Logger logger =  SPLLogger.getSPLLogger().getLogger(); 
-	private static final String sourceClass="PolicyManagerImpl";
-
+	private PolicyDataStore _policyDataStore = null;
+	private PolicyEvaluator _policyEvaluator = null;
+	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+	private static final String sourceClass = "PolicyManagerImpl";
 	private static Logger auditLogger = SPLLogger.getSPLLogger().getAuditLogger();
 
-
-
-
-	public PolicyManagerImpl(DataCollector dc, Actuator ac)
+	public PolicyManagerImpl(DataCollector dc, Actuator ac) 
 	{
-		init(dc,ac);
+		init(dc, ac);
 	}
-	public void init(DataCollector dc, Actuator ac)
-	{
-
 
+	public void init(DataCollector dc, Actuator ac) 
+	{
 		ActuatorFactory.registerActuator(ac);
 		DataCollectorFactory.registerDataCollector(dc);
-		
-		_policyDataStore = PolicyDataStoreImpl.getInstance();
-        _policyEvaluator = PolicyEvaluatorImpl.getInstance();
 
+		_policyDataStore = PolicyDataStoreImpl.getInstance();
+		_policyEvaluator = PolicyEvaluatorImpl.getInstance();
 	}
 
-
-
-	public Map getAllPolicies() throws SPLException
+	public Map getAllPolicies() throws SPLException 
 	{
-
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getAllPolicies");
+		logger.entering(sourceClass, Thread.currentThread().getName() + " " + "getAllPolicies");
+		
 		Map allPolicies = _policyDataStore.getAllPolicies();
-		if(auditLogger.isLoggable(Level.FINE))
-			auditLogger.fine(Thread.currentThread().getName()+"getAllPolicies invoked");
+		
+		auditLogger.fine(Thread.currentThread().getName() + "getAllPolicies invoked");
 
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getAllPolicies");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "getAllPolicies");
+		
 		return allPolicies;
 	}
 
-	public List getAllPolicyNames()  throws SPLException 
+	public List getAllPolicyNames() throws SPLException 
 	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "	+ "getAllPolicyNames");
 
-		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");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "getAllPolicyNames");
+		
 		return allPolicyNames;
-
 	}
 
-	public String getPolicy(String policyName) throws SPLException  
+	public String getPolicy(String policyName) throws SPLException 
 	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "	+ "getPolicy");
 
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getPolicy");
 		String ci = _policyDataStore.getPolicy(policyName);
-		if(auditLogger.isLoggable(Level.FINE))
-			auditLogger.fine(Thread.currentThread().getName()+"getPolicy invoked :"+policyName);
+		
+		auditLogger.fine(Thread.currentThread().getName() + " getPolicy  method is invoked :" + policyName);
 
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getPolicy");
-		return ci;
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "getPolicy");
 
+		return ci;
 	}
 
-
-
 	public void shutdown() 
 	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "shutdown");
-		if(auditLogger.isLoggable(Level.FINE))
-			auditLogger.fine(Thread.currentThread().getName()+"Policy Manager Shut Down initiated");
-
-		
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "shutdown");
+		logger.entering(sourceClass, Thread.currentThread().getName() + " " + "shutdown");
 
+		auditLogger.fine(Thread.currentThread().getName() + " Policy Manager Shut Down initiated");
 
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "shutdown");
 	}
 
-	public void updatePolicy(String policyName, String policyString) throws SPLException  
+	public void updatePolicy(String policyName, String policyString)
+			throws SPLException 
 	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " " + "updatePolicy");
 
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "updatePolicy");
-		System.out.println("***********"+"UpdatePolicy : "+policyName+"***********");
 		_policyDataStore.updatePolicy(policyName, policyString);
-		if(auditLogger.isLoggable(Level.FINE))
-			auditLogger.fine(Thread.currentThread().getName()+"updatePolicy invoked :"+policyName);
-		System.out.println("***********"+"UpdatePolicy complete"+"***********");
 		
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "updatePolicy");
-
+		auditLogger.fine(Thread.currentThread().getName() + " updatePolicy method is invoked :" + policyName);
 
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "updatePolicy");
 	}
 
-	public boolean createPolicy(String policyName, String policyString) throws SPLException 
+	public boolean createPolicy(String policyName, String policyString)
+			throws SPLException 
 	{
-		try
+		try 
 		{
-			logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createPolicy");
-			System.out.println("***********"+"CreatePolicy : "+policyName+"***********");
-			
-			boolean res = _policyDataStore.createPolicy(policyName,policyString);
-			if(auditLogger.isLoggable(Level.FINE))
-				auditLogger.fine(Thread.currentThread().getName()+"createPolicy invoked :"+policyName);
-			System.out.println("***********"+"CreatePolicy complete"+"***********");
-			
-			
-			logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createPolicy");
+			logger.entering(sourceClass, Thread.currentThread().getName() + " " + "createPolicy");
 
-			return res;
-		}
-		catch (SPLException e){
-			logger.severe(e.getLocalizedMessage());
-			e.printStackTrace();
-			throw new SPLException(e.getLocalizedMessage());
+			boolean res = _policyDataStore.createPolicy(policyName, policyString);
 
-		}
+			auditLogger.fine(Thread.currentThread().getName() + " createPolicy method invoked for policy : " + policyName);
 
+			logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "createPolicy");
 
+			return res;
+		} 
+		catch (SPLException e) 
+		{
+			logger.log(Level.SEVERE, Messages.SPLOF0001E, new Object[]{policyName});
+			throw new SPLException(e.getMessage());
+		}
 	}
 
 	public void deletePolicy(String policyName) throws SPLException 
 	{
-		try
+		try 
 		{
-			logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "deletePolicy");
-			System.out.println("***********"+"DeletePolicy : "+policyName+"***********");
-			
-			_policyDataStore.deletePolicy(policyName);
-			if(auditLogger.isLoggable(Level.FINE))
-				auditLogger.fine(Thread.currentThread().getName()+"deletePolicy invoked :"+policyName);
+			logger.entering(sourceClass, Thread.currentThread().getName() + " "	+ "deletePolicy");
 
-			System.out.println("***********"+"DeletePolicy complete"+"***********");
+			_policyDataStore.deletePolicy(policyName);
 			
-			logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "deletePolicy");
-		}
-		catch (SPLException e)
+			auditLogger.fine(Thread.currentThread().getName() + " deletePolicy method is invoked : " + policyName);
+
+			logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "deletePolicy");
+		} 
+		catch (SPLException e) 
 		{
-			logger.severe(e.getLocalizedMessage());
-			e.printStackTrace();
+			logger.log(Level.SEVERE, Messages.SPLOF0002E, e.getLocalizedMessage());
 			throw new SPLException(e.getLocalizedMessage());
-
 		}
-
 	}
 
-	public Object evaluatePolicy(String policyName, Map instances) throws SPLException 
+	public Object evaluatePolicy(String policyName, Map instances)
+			throws SPLException 
 	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluatePolicy");
+		logger.entering(sourceClass, Thread.currentThread().getName() + " " + "evaluatePolicy");
 
 		SPLPolicy internalPolicyObject = _policyDataStore.getInternalPolicyObject(policyName);
 
+		Object result = _policyEvaluator.evaluatePolicy(internalPolicyObject, instances);
 
-		Object result = _policyEvaluator.evaluatePolicy(internalPolicyObject,instances);
-
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluatePolicy");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "evaluatePolicy");
 
 		return result;
 	}
+
 	public PolicyInfo getPolicyInfo(String policyName) throws SPLException 
 	{
-		logger.entering(sourceClass,Thread.currentThread().getName() + " " + "getPolicyInfo");
-		PolicyInfo pi=this._policyDataStore.getPolicyInfo(policyName);
-		logger.exiting(sourceClass,Thread.currentThread().getName() + " " + "getPolicyInfo");
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "	+ "getPolicyInfo");
+		
+		PolicyInfo pi = this._policyDataStore.getPolicyInfo(policyName);
+		
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "getPolicyInfo");
 
 		return pi;
 	}
 
-
-	public Object evaluatePolicyString(String policyName, String policyString, Map instances) throws SPLException 
+	public Object evaluatePolicyString(String policyName, String policyString,
+			Map instances) throws SPLException 
 	{
-		try
+		try 
 		{
-			logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createPolicy");
-			Object result;
-//			boolean res = _policyDataStore.createPolicy(policyName,policyString);
-//			if(res)
-//			{
-//			SPLPolicy internalPolicyObject = _policyDataStore.getInternalPolicyObject(policyName);
-
-
-//			result = _policyEvaluator.evaluatePolicy(internalPolicyObject,instances);
-			SPLPolicy cp=_policyDataStore.createSPLPolicyObject(policyName, policyString);
-			result=_policyEvaluator.evaluatePolicy(cp, instances);
-			if(auditLogger.isLoggable(Level.FINE))
-				auditLogger.fine(Thread.currentThread().getName()+"evaluatePolicyString invoked :"+policyName);
-
-			logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "createPolicy");
-
-//			}
-//			else
-//			{
-//			result=null;
-//			}
+			logger.entering(sourceClass, Thread.currentThread().getName() + " " + "createPolicy");
 
+			Object result;
+			SPLPolicy cp = _policyDataStore.createSPLPolicyObject(policyName, policyString);
+			result = _policyEvaluator.evaluatePolicy(cp, instances);
+			
+			auditLogger.fine(Thread.currentThread().getName() + " evaluatePolicyString method is invoked :" + policyName);
+			
+			logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "createPolicy");
+			
 			return result;
-		}
-		catch (SPLException e){
-			logger.severe(e.getLocalizedMessage());
-			e.printStackTrace();
+		} 
+		catch (SPLException e) 
+		{
+			logger.log(Level.SEVERE, "Error while evaluating the policy : "+policyName);
 			throw new SPLException(e.getLocalizedMessage());
-
 		}
-
-
 	}
+
 	public void setSPLHome(String location) 
 	{
 		SPLLogger.SPL_HOME = location;
-
 	}
-	public String getSPLHome()
+
+	public String getSPLHome() 
 	{
 		return SPLLogger.SPL_HOME;
 	}
+
 	public void enableLogging(boolean enableOrDisable) 
 	{
-		SPLLogger.ENABLE_SPL_LOGGING = enableOrDisable;
-
+		if (enableOrDisable) 
+		{
+			SPLLogger.getSPLLogger().enableSPLLogger();
+		} 
+		else 
+		{
+			SPLLogger.getSPLLogger().disableSPLLogger();
+		}
 	}
 
-	public boolean validatePolicyString(String policyString) throws SPLException
+	public boolean validatePolicyString(String policyString)
+			throws SPLException 
 	{
-		logger.entering(sourceClass,Thread.currentThread().getName() + " " + "validatePolicyString");
-		boolean pi=this._policyDataStore.validatePolicyString(policyString);
-		logger.exiting(sourceClass,Thread.currentThread().getName() + " " + "validatePolicyString");
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "	+ "validatePolicyString");
+		
+		boolean pi = this._policyDataStore.validatePolicyString(policyString);
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " " + "validatePolicyString");
 
 		return pi;
 	}
-    
 
 }

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=686743&r1=686742&r2=686743&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 Mon Aug 18 05:50:36 2008
@@ -43,6 +43,7 @@
 import org.apache.imperius.spl.parser.util.DataCollectorFactory;
 import org.apache.imperius.spl.parser.util.TypeInfo;
 import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.Messages;
 
 
 public class IdentPrimaryTuple 
@@ -111,10 +112,12 @@
                     }
                     catch(SPLException splex2)
                     {
-                        throw new SPLException("Symbol does not exist "
-                                + _classType + "." + _identifier
-                                + "Or it can be a private variable without"
-                                + "getter and setter methods");
+                        throw new SPLException(
+								Messages
+										.getString(
+												"SPL_SYMBOL_DOES_NOT_EXIST_EXCEPTION_MSG",
+												new Object[] { _classType + "."
+														+ _identifier }));
                     }
                 }
                 returnValue = AnchorMethodInvokeAction.invokeClassMethod(
@@ -179,10 +182,12 @@
                     }
                     catch(SPLException splex2)
                     {
-                        throw new SPLException("Symbol does not exist "
-                                + _classType + "." + _identifier
-                                + "Or it can be a private variable without"
-                                + "getter and setter methods");
+                        throw new SPLException(
+								Messages
+										.getString(
+												"SPL_SYMBOL_DOES_NOT_EXIST_EXCEPTION_MSG",
+												new Object[] { _classType + "."
+														+ _identifier }));
                     }
                 }
                 returnValue = AnchorMethodInvokeAction.invokeClassMethod(
@@ -225,12 +230,11 @@
                 catch(SPLException splex2)
                 {
                     throw new SPLException(
-                            "Symbol does not exist "
-                                    + classTypeOrVariableName
-                                    + "."
-                                    + _identifier
-                                    + "Or it can be a private variable without"
-                                    + "getter and setter methods");
+							Messages
+									.getString(
+											"SPL_SYMBOL_DOES_NOT_EXIST_EXCEPTION_MSG",
+											new Object[] { classTypeOrVariableName + "."
+													+ _identifier }));
                 }
             }
         }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/AnchorData.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/AnchorData.java?rev=686743&r1=686742&r2=686743&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/AnchorData.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/AnchorData.java Mon Aug 18 05:50:36 2008
@@ -29,27 +29,27 @@
 import org.apache.imperius.spl.parser.exceptions.SPLException;
 import org.apache.imperius.util.SPLLogger;
 
-
 public class AnchorData 
 {
 	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-    private static final String sourceClass="AnchorData";
-    
+	private static final String sourceClass = "AnchorData";
 	private Map _classNameToQualifierMap;
 	private Map _classNameToInstanceInfoListMap;
 	
 	public AnchorData()
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "AnchorData");
+		
 		_classNameToQualifierMap = new Hashtable();
 		_classNameToInstanceInfoListMap = new Hashtable();
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "AnchorData");
 		
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "AnchorData");
 	}
 	
 	public List getAnchorClassList()
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getAnchorClassList");
+
 		List anchorClassList = new ArrayList();
 		Iterator anchorKeySetIt = _classNameToInstanceInfoListMap.keySet().iterator();
 		while(anchorKeySetIt.hasNext())
@@ -57,14 +57,15 @@
 			String className = (String)anchorKeySetIt.next();
 			anchorClassList.add(className);
 		}
+		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getAnchorClassList");
 		return anchorClassList;
-		
 	}
 	
 	public Object getInstance(String instanceName) 
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getInstance");
+
 		Object instance = null;
 		Iterator anchorKeySetIt = _classNameToInstanceInfoListMap.keySet().iterator();
 		while(anchorKeySetIt.hasNext())
@@ -79,15 +80,12 @@
 				{
 					instance = ii.getInstance();
 					return instance;
-					
 				}
 			}
 		}	
 		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getInstance");
 		return instance;
-		
-		
 	}
 	
 	public void insertInstanceObject(String className, 
@@ -96,22 +94,16 @@
 	{
 		
 		List instanceInfoList = (List)_classNameToInstanceInfoListMap.get(className);
-		
-
 		boolean instanceFound = false;
 		
 		Iterator instanceInfoListIt = instanceInfoList.iterator();
 		while(instanceInfoListIt.hasNext())
 		{
 			InstanceInfo instanceInfo = (InstanceInfo) instanceInfoListIt.next();
-			//System.out.println(" instanceInfo.getInstanceName() "+instanceInfo.getInstanceName());
-			//System.out.println(" instanceName "+instanceName);
-			
 			if(instanceInfo.getInstanceName() != null)
 			{	
 				if(instanceInfo.getInstanceName().equalsIgnoreCase(instanceName))
 				{
-					//System.out.println(" instanceInfo.getInstanceName() "+instanceInfo.getInstanceName());
 					instanceInfo.setInstance(instance);
 					instanceFound = true;
 					break;
@@ -119,19 +111,12 @@
 			}
 			else 
 			{
-				
-				
-//				break;
 			}
-		
-			
 		}
 		if(!instanceFound)
 		{
 			throw new SPLException("Invalid instance Name " + instanceName);
 		}
-		
-		
 	}
 	
 	public String getQualifierForClass(String className)
@@ -144,15 +129,11 @@
 	{
 		List instanceInfoList = (List)_classNameToInstanceInfoListMap.get(className);
 		return instanceInfoList;
-		
 	}
 	
 	public void addInstanceInfoListForClass(String className, List instanceInfoList)
 	{
-		//System.out.println("className "+className);
-		//System.out.println("instanceInfoList "+instanceInfoList);
 		_classNameToInstanceInfoListMap.put(className, instanceInfoList);
-		
 	}
 	
 	public void addQualifierForClass(String className, String qualifier)
@@ -161,8 +142,6 @@
 		{	
 			_classNameToQualifierMap.put(className, qualifier);
 		}	
-		
 	}
 	
-
 }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/MacroSymbol.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/MacroSymbol.java?rev=686743&r1=686742&r2=686743&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/MacroSymbol.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/parser/compiler/symboltable/MacroSymbol.java Mon Aug 18 05:50:36 2008
@@ -17,14 +17,11 @@
  * under the License.  
  */
 
-
 /**
  * @author Prashant Baliga <prabalig@in.ibm.com>
  *
  */
 
-
-
 package org.apache.imperius.spl.parser.compiler.symboltable;
 
 import java.util.List;
@@ -35,7 +32,6 @@
 import org.apache.imperius.spl.parser.util.TypeInfo;
 import org.apache.imperius.util.SPLLogger;
 
-
 public class MacroSymbol implements Symbol 
 {
 	private String _macroName;
@@ -43,156 +39,173 @@
 	private List _argTypeList;
 	private MacroDefinition _macroDefn;
 	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-	private static final String sourceClass="MacroSymbol";
-    private boolean _isArray=false;
-	
-	public MacroSymbol(String macroName, TypeInfo retType, List argTypes, MacroDefinition md) 
-		throws SPLException
+	private static final String sourceClass = "MacroSymbol";
+	private boolean _isArray = false;
+
+	public MacroSymbol(String macroName, TypeInfo retType, List argTypes,
+			MacroDefinition md) throws SPLException 
 	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "MacroSymbol");
-		
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "MacroSymbol");
+
 		this._macroName = macroName;
 		this._returnType.copy(retType);
 		_returnType.setReferenceTypeName(md.getReferenceTypeName());
 		this._argTypeList = argTypes;
 		this._macroDefn = md;
-        if(md.isArray())
-        {
-            this._isArray=true;
-        }
-       //System.out.println("new MacroSymbol : "+macroName+" "+retType+" "+argTypes);
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "MacroSymbol");
-		
-		
+		if (md.isArray()) 
+		{
+			this._isArray = true;
+		}
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "MacroSymbol");
 	}
-	
-	public TypeInfo getType() {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getType");
-		
-		// TODO Auto-generated method stub
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getType");
-		
+
+	public TypeInfo getType() 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "getType");
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "getType");
+
 		return _returnType;
 	}
 
-	public Object getValue() {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getValue");
-		
-		// TODO Auto-generated method stub
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getValue");
-		
+	public Object getValue() 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "getValue");
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "getValue");
+
 		return null;
 	}
 
-	public List getArgTypeList() {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getArgTypeList");
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getArgTypeList");
-		
-		
+	public List getArgTypeList() 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "getArgTypeList");
+	
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "getArgTypeList");
+
 		return _argTypeList;
 	}
 
-	public void setArgTypeList(List argTypeList) {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setArgTypeList");
-		
+	public void setArgTypeList(List argTypeList) 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "setArgTypeList");
+
 		_argTypeList = argTypeList;
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setArgTypeList");
-		
-		
+	
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "setArgTypeList");
 	}
 
-	public MacroDefinition getMacroDefn() {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getMacroDefn");
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getMacroDefn");
-		
-		
+	public MacroDefinition getMacroDefn() 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "getMacroDefn");
+	
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "getMacroDefn");
+
 		return _macroDefn;
 	}
 
-	public void setMacroDefn(MacroDefinition macroDefn) {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setMacroDefn");
-		
-		
+	public void setMacroDefn(MacroDefinition macroDefn) 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "setMacroDefn");
+
 		_macroDefn = macroDefn;
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setMacroDefn");
-		
+	
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "setMacroDefn");
 	}
 
-	public String getMacroName() {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getMacroName");
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getMacroName");
-		
-		
+	public String getMacroName() 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "getMacroName");
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "getMacroName");
+
 		return _macroName;
 	}
 
-	public void setMacroName(String macroName) {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setMacroName");
+	public void setMacroName(String macroName) 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "setMacroName");
+	
 		_macroName = macroName;
 
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setMacroName");
-		
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "setMacroName");
 	}
 
-	
-	public void setReturnType(TypeInfo returnType) {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setReturnType");
-		
+	public void setReturnType(TypeInfo returnType) 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "setReturnType");
+
 		_returnType.copy(returnType);
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setReturnType");
 		
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "setReturnType");
 	}
 
-	public boolean isArray() {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
-		
-		
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "isArray");
-		
+	public boolean isArray() 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "isArray");
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "isArray");
+
 		return _returnType.getIsArray();
 	}
 
-	public boolean isKey() {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "isKey");
-		
-		// TODO Auto-generated method stub
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "isKey");
-		
+	public boolean isKey() 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "isKey");
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "isKey");
+
 		return false;
 	}
 
-	public boolean isClassSymbol() {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "isClassSymbol");
-		
-		// TODO Auto-generated method stub
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "isClassSymbol");
-		
+	public boolean isClassSymbol() 
+	{
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "isClassSymbol");
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "isClassSymbol");
+
 		return false;
 	}
 
-     public boolean isArray(boolean isArray)
-        {
-            return _returnType.getIsArray();
-        }
-     
-    public void setArray(boolean isArray)
-    {
-        _returnType.setIsArray(isArray);
-    }
+	public boolean isArray(boolean isArray) 
+	{
+		return _returnType.getIsArray();
+	}
+
+	public void setArray(boolean isArray) 
+	{
+		_returnType.setIsArray(isArray);
+	}
 
 	public String getReferenceTypeName() 
 	{
-		//String referenceTypeName;
-		/*try 
-		{
-			referenceTypeName = _macroDefn.getReferenceTypeName();
-		} catch (SPLException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-			referenceTypeName = "";
-		}*/
-		//return referenceTypeName;
 		return _returnType.getReferenceTypeName();
 	}
-
 }

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=686743&r1=686742&r2=686743&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 Mon Aug 18 05:50:36 2008
@@ -23,12 +23,8 @@
  *
  */
 
-
-
 package org.apache.imperius.spl.parser.compiler.symboltable;
 
-
-
 import java.util.ArrayList;
 import java.util.Iterator;
 import java.util.LinkedHashMap;
@@ -45,6 +41,7 @@
 import org.apache.imperius.spl.parser.statements.impl.MacroDefinition;
 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;
 
 
@@ -53,21 +50,18 @@
 	public static final int COLLECT = 1;
 	public static final int MACRO = 2;
 	public static final int DEFAULT = 3;
-	public static final int BASICCOLLECT=4;
-	public static final int POLICYGROUP=5;
-	public static final int UNDEFINED=-1;
-	
+	public static final int BASICCOLLECT = 4;
+	public static final int POLICYGROUP = 5;
+	public static final int UNDEFINED = -1;
 	private AnchorData _anchorData = null;
-		
 	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-	private static final String sourceClass="SPLSymbolTable";
-	
+	private static final String sourceClass = "SPLSymbolTable";
 	private Map _symbolMap = null;
 	private List _subSymbolTables = null;
 	private SPLSymbolTable _parentTable = null;
-	private int  _symbolTableType = UNDEFINED;
+	private int _symbolTableType = UNDEFINED;
 	private DataCollector _dataCollector = null;
-	
+
 	private String _defaultQualifier = null;
 	
 	public void addAnchor(String className,
@@ -78,14 +72,10 @@
 		{
 			_anchorData = new AnchorData();
 		}
-		//System.out.println("SPLSymbolTable addAnchor className "+className);
-		//System.out.println("SPLSymbolTable addAnchor qualifier "+qualifier);
-		//System.out.println("SPLSymbolTable addAnchor instanceInfoList "+instanceInfoList);
+
 		if(instanceInfoList.size()==0)
 		{
 			InstanceInfo iI=new InstanceInfo(className,null);
-           //System.out.println("created new instance info object ");
-            
             instanceInfoList.add(iI);
 		}
 		_anchorData.addInstanceInfoListForClass(className, instanceInfoList);
@@ -95,33 +85,9 @@
 			_defaultQualifier = qualifier;
 			
 		}
-//		_defaultQualifier = qualifier;
-		
 		_populateAnchorClassSymbols(className, qualifier, instanceInfoList);
-		
 	}
 	
-	/*public void addCollectAnchor(String className,
-			String qualifier, 
-			List instanceInfoList,
-			boolean isCollectInstance) throws SPLException
-	{
-		
-		//System.out.println("SPLSymbolTable addAnchor className "+className);
-		//System.out.println("SPLSymbolTable addAnchor qualifier "+qualifier);
-		//System.out.println("SPLSymbolTable addAnchor instanceInfoList "+instanceInfoList);
-		if(instanceInfoList.size()==0)
-		{
-			InstanceInfo iI=new InstanceInfo(className,null,isCollectInstance);
-           //System.out.println("created new instance info object ");
-            
-            instanceInfoList.add(iI);
-		}
-		
-		_populateCollectAnchorClassSymbols(className, qualifier, instanceInfoList);
-		
-	}*/
-	
 	public AnchorData getAnchorData()
 	{
 		return _anchorData;
@@ -130,7 +96,6 @@
 	public void setAnchorData(AnchorData anchorData)
 	{
 		_anchorData = anchorData;
-		
 	}
 	
 	
@@ -138,6 +103,7 @@
 	{
 		this(pt,DEFAULT);
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "SPLSymbolTable");
+
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "SPLSymbolTable");
 	}
 	
@@ -145,68 +111,65 @@
 	public SPLSymbolTable(SPLSymbolTable pt,int type)
 	{
 		this();
-		//System.out.println("creating SPLSymbolTable(SPLSymbolTable pt,int type)");
-		
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "SPLSymbolTable");
 		
-		//System.out.println("Setting Parent" + pt);
 		this._symbolTableType = type;
 		if(_symbolTableType!= COLLECT && _symbolTableType!= POLICYGROUP)
 		{	
 			this._anchorData = pt.getAnchorData();
-			
 		}	
-		
 		this._dataCollector = DataCollectorFactory.getDataCollector();
 		this._defaultQualifier=pt.getDefaultQualifier();
 		this.setParentSymbolTable(pt);
+
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "SPLSymbolTable");
 	}
+	
 	public SPLSymbolTable()
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "SPLSymbolTable");
-		//System.out.println("creating SPLSymbolTable()");
+
 		_subSymbolTables = new ArrayList();
 		_symbolMap = new LinkedHashMap();
+
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "SPLSymbolTable");
 	}
 	
 	public void addChildSymbolTable(SPLSymbolTable c)
 	{
-	//	//System.out.println("Current sym table entries" + _symbolMap);
-	//	//System.out.println("Adding child sym table" + c);
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "addChildSymbolTable");
+
 		_subSymbolTables.add(c);
 		c._parentTable=this;
+		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "addChildSymbolTable");
 	}
 	
 	public SPLSymbolTable getParentSymbolTable()
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getParentSymbolTable");
+		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getParentSymbolTable");
-		return _parentTable;
 		
+		return _parentTable;
 	}
 	
-		
 	public void insertVariableSymbol(String name,
 			TypeInfo type,
 			boolean isKey, 
 			boolean isClassProp) throws SPLException
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "insertVariableSymbol");
-	//	//System.out.println("Inserting Variable: " + name + type + val);
+
 		if(!_symbolMap.containsKey(name))
 		{	
-			
 			Symbol cimSym = new PropertySymbol(name,type,isKey,isClassProp);
 			_symbolMap.put(name, cimSym);
 		}
 		else
 		{
-			logger.severe(Thread.currentThread().getName()+" "+"Symbol: " + name + " already defined");
-			throw new SymbolAlreadyDefinedException("Symbol: " + name + " already defined");
+			logger.log(Level.SEVERE, Messages.SPLOF0009E, new Object[]{name});
+			throw new SymbolAlreadyDefinedException(Messages.getString("SPL_SYMBOL_ALREADY_EXISTS_MSG") + name);
 		}
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "insertVariableSymbol");
 	}
@@ -219,7 +182,7 @@
 			boolean isClassProp) throws SPLException
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "insertVariableSymbol");
-	//	//System.out.println("Inserting Variable: " + name + type + val);
+
 		if(!_symbolMap.containsKey(name))
 		{	
 			TypeInfo tp = new TypeInfo(type,referenceTypeName,isArray);
@@ -228,11 +191,12 @@
 		}
 		else
 		{
-			logger.severe(Thread.currentThread().getName()+" "+"Symbol: " + name + " already defined");
-			throw new SymbolAlreadyDefinedException("Symbol: " + name + " already defined");
+			logger.log(Level.SEVERE, Messages.SPLOF0009E, new Object[]{name});
+			throw new SymbolAlreadyDefinedException(Messages.getString("SPL_SYMBOL_ALREADY_EXISTS_MSG") + name);
 		}
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "insertVariableSymbol");
 	}
+	
 	public void insertMethodSymbol(String name, 
 			TypeInfo retType, 
 			boolean isReturnArray, 
@@ -242,28 +206,20 @@
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "insertMethodSymbol");
 		
-	//	//System.out.println("Inserting Method: " + name + retType + argTypeList);
 		if(!_symbolMap.containsKey(name))
 		{	
-			/* String nName, 
-			int retType, 
-			boolean isReturnArray, 
-			String returnReferenceType, 
-			SPLSymbolTable argsTable)*/
 			Symbol cimSym = new MethodSymbol(name,
 					retType,
 					argTypeList,
 					argsSymbolTable);
 			_symbolMap.put(name, cimSym);
-			//System.out.println("method symbol added to symboltable "+name);
 		}
 		else
 		{
-			logger.severe(Thread.currentThread().getName()+" "+"Symbol: " + name + " already defined");
-			throw new SymbolAlreadyDefinedException("Symbol: " + name + " already defined");
+			logger.log(Level.SEVERE, Messages.SPLOF0009E, new Object[]{name});
+			throw new SymbolAlreadyDefinedException(Messages.getString("SPL_SYMBOL_ALREADY_EXISTS_MSG") + name);
 		}
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "insertMethodSymbol");
-		
 	}
 	
 	public void insertMacroSymbol(String name, 
@@ -273,9 +229,9 @@
 			MacroDefinition macroDef) throws SPLException
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "insertMacroSymbol");
+
 		int type = TypeConstants.getActualType(retType);
 		TypeInfo returnType = new TypeInfo(type,null,isArray);
-		//System.out.println("Inserting Method: " + name + retType + argTypeList);
 		if(!_symbolMap.containsKey(name))
 		{	
 			Symbol cimSym = new MacroSymbol(name,returnType,argTypeList,macroDef);
@@ -283,8 +239,8 @@
 		}
 		else
 		{
-			logger.severe(Thread.currentThread().getName()+" "+"Symbol: " + name + " already defined");
-			throw new SymbolAlreadyDefinedException("Symbol: " + name + " already defined");
+			logger.log(Level.SEVERE, Messages.SPLOF0009E, new Object[]{name});
+			throw new SymbolAlreadyDefinedException(Messages.getString("SPL_SYMBOL_ALREADY_EXISTS_MSG") + name);
 		}
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "insertMacroSymbol");
 	}
@@ -292,26 +248,23 @@
 	public Symbol getSymbol(String name) throws SPLException
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSymbol");
-		name=name.trim();
-		//System.out.println("getSymbol "+name);
+
+		name = name.trim();
 		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);
+			throw new SPLException(Messages.getString("SPL_SYMBOL_DOES_NOT_EXISTS_MSG") + name);
 		}
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSymbol");
 		return retSym;
@@ -320,6 +273,7 @@
 	public boolean symbolExists(String name, boolean recurse)
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "symbolExists");
+
 		boolean res = false;
 		if(_symbolMap.containsKey(name))
 		{	
@@ -332,8 +286,6 @@
 				res = _parentTable.symbolExists(name, recurse);
 			}
 		}
-		//System.out.println("symbol exists ? "+name+" "+res);
-		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "symbolExists");
 		return res;
 	}
@@ -344,88 +296,17 @@
 			List instanceInfoList)
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" " +
-				"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();
-			
-			while(it.hasNext())
-			{
-				String key = (String)it.next();
-				Symbol s = (Symbol)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);
-						//System.out.println("Symbol added to symbolmap : "+instanceName + "." + key);
-					}	
-					
-				}
-				else
-				{
-					_symbolMap.put(className + "." + key,s);
-					//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);*/
+				"_populateAnchorClassSymbols");
 		
-		
-		// 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 
 		{
-			//System.out.println("populateAnchorElementSymbols ::
-			//_anchorElement,nameSpace :"+_anchorElement+"  "+nameSpace);
-					
 			if(_dataCollector == null)
 			{
 				_dataCollector = DataCollectorFactory.getDataCollector();
 			}
-				
 			sMap = _dataCollector.getSymbolsForClass(className,qualifier);
 			Iterator it = sMap.keySet().iterator();
-			
 			while(it.hasNext())
 			{
 				String key = (String)it.next();
@@ -438,30 +319,21 @@
 						InstanceInfo instanceInfo = (InstanceInfo)instanceInfoListIt.next();
 						String instanceName = instanceInfo.getInstanceName();
 						_symbolMap.put(instanceName + "." + key,s);
-						//System.out.println("Symbol added to symbolmap : "+instanceName + "." + key);
 					}	
-					
 				}
 				else
 				{
 					_symbolMap.put(className + "." + key,s);
-					//System.out.println("Symbol added to symbolmap : "+className + "." + key);
-					
 				}
 			}
-				
 		} 
 		catch (SPLException e) 
 		{
-			// TODO Auto-generated catch block
-			e.printStackTrace();
+			
 		} 
-		
-	logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "populateAnchorElementSymbols");
-		
-	}*/
-	
-	
+
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "_populateAnchorClassSymbols");
+	}
 	
 	public void populateInstanceValuesForInstance(
 			String className,
@@ -470,74 +342,26 @@
 			Map currentInstanceSymbols) throws SPLException
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()
-				+" "+ "populateSymbolTableWithInstanceValues");
-		//System.out.println("SPLSymbolTable::populateSymbolTableWithInstanceValues");
+				+" "+ "populateInstanceValuesForInstance");
+
 		resetSymbolValues();
-		
 		Iterator keyIt = currentInstanceSymbols.keySet().iterator();
 		while(keyIt.hasNext())
 		{
-			
 			String currentKey = (String)keyIt.next();
 			String qualifiedKey = currentKey;
 			qualifiedKey = instanceName + "." + currentKey;
-				
-			//System.out.println("currentKey "+currentKey);
             PropertySymbol sym = (PropertySymbol)getSymbol(qualifiedKey);
-			
 			Object value = (Object)currentInstanceSymbols.get(currentKey);
 			sym.setValue(value);
-            if(logger.isLoggable(Level.FINE))
-            {	
-                logger.fine(Thread.currentThread().getName()+
-                		" SPLSymbolTable setting symbol:"
-                		+sym.getName()+" from:"+sym.getValue()+" to:"+value);
-            }    
-                
-			
+
+            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()+" "+ "populateSymbolTableWithInstanceValues");
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "populateInstanceValuesForInstance");
 	}
-	
-	/*public void populateInstanceValuesForCollect(
-			String className,
-			String instanceName,
-			Object instance,
-			Map currentInstanceSymbols) throws SPLException
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName()
-				+" "+ "populateSymbolTableWithInstanceValues");
-		//System.out.println("SPLSymbolTable::populateSymbolTableWithInstanceValues");
-		resetSymbolValues();
-		
-		Iterator keyIt = currentInstanceSymbols.keySet().iterator();
-		while(keyIt.hasNext())
-		{
-			
-			String currentKey = (String)keyIt.next();
-			String qualifiedKey = currentKey;
-			qualifiedKey = instanceName + "." + currentKey;
-				
-			//System.out.println("currentKey "+currentKey);
-            PropertySymbol sym = (PropertySymbol)getSymbol(qualifiedKey);
-			
-			Object value = (Object)currentInstanceSymbols.get(currentKey);
-			sym.setValue(value);
-            if(logger.isLoggable(Level.FINE))
-            {	
-                logger.fine(Thread.currentThread().getName()+
-                		" SPLSymbolTable setting symbol:"
-                		+sym.getName()+" from:"+sym.getValue()+" to:"+value);
-            }    
-                
-			
-		}
-			
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "populateSymbolTableWithInstanceValues");
-	}*/
+
 	
 	private void _insertInstanceObject(String className, 
 			String instanceName, 
@@ -558,6 +382,7 @@
 	
 	public void setParentSymbolTable(SPLSymbolTable table) {
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setParentSymbolTable");
+		
 		this._parentTable = table;
 		table._subSymbolTables.add(this);
 		
@@ -566,64 +391,69 @@
 	}
 	public List getSubSymbolTables() {
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSubSymbolTables");
+		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSubSymbolTables");
 		
 		return _subSymbolTables;
 	}
 	public void setSubSymbolTables(List symbolTables) {
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setSubSymbolTables");
+		
 		_subSymbolTables = symbolTables;
+		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setSubSymbolTables");
 		
 	}
 	public Map getSymbolMap() {
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSymbolMap");
+		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSymbolMap");
 		
 		return _symbolMap;
-		
-		
 	}
+
 	public void setSymbolMap(Map map) {
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setSymbolMap");
+	
 		_symbolMap = map;
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setSymbolMap");
 		
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setSymbolMap");
 	}
+	
 	public int getSymbolTableType() {
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getSymbolTableType");
+		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getSymbolTableType");
 		
 		return _symbolTableType;
 	}
+	
 	public void setSymbolTableType(int tp) {
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setSymbolTableType");
+	
 		this._symbolTableType = tp;
+		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setSymbolTableType");
 	}
 	
-	
-//	public DataCollector getDataCollector() {
-//		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getDataCollector");
-//		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getDataCollector");
-//		
-//		return _dataCollector;
-//	}
-	public void setDataCollector(DataCollector dataCollector) {
+	public void setDataCollector(DataCollector dataCollector) 
+	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setDataCollector");
-		if(dataCollector == null) {
+	
+		if(dataCollector == null) 
+		{
 			this._dataCollector = DataCollectorFactory.getDataCollector();
-		} else {
+		} 
+		else 
+		{
 			this._dataCollector = dataCollector;
 		}
 		
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setDataCollector");
-		
 	}
 	
 	public List getAnchorClassList()
 	{
-		
 		List anchorClassList = _anchorData.getAnchorClassList();
 		return anchorClassList;
 	}
@@ -644,23 +474,7 @@
 	{
 		Object instance = null;
 		instance = _anchorData.getInstance(instanceName);
-//		if(instance ==null){
-////			SPLSymbolTable stab=this;
-////			
-////			while(stab.getParentSymbolTable() != null){
-////				SPLSymbolTable parent=stab.getParentSymbolTable();
-////				instance = parent._anchorData.getInstance(instanceName);
-////				if(instance != null){
-////					break;
-////				}
-////				stab=stab.getParentSymbolTable();
-////			}
-////			logger.severe(Thread.currentThread().getName()+" "+"Did not find instance in Symbol Table: " + instanceName);
-//			
-//		}
-//		
 		return instance;
-				
 	}
 
 	public String getDefaultQualifier() 
@@ -668,9 +482,101 @@
 		return _defaultQualifier;
 	}
 
-	public void setDefaultQualifier(String qualifier) {
+	public void setDefaultQualifier(String qualifier) 
+	{
 		_defaultQualifier = qualifier;
 	}
 	
+/*
+	public void populateInstanceValuesForCollect(String className,
+			String instanceName, Object instance, Map currentInstanceSymbols)
+			throws SPLException {
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "populateSymbolTableWithInstanceValues");
+		// System.out.println("SPLSymbolTable::populateSymbolTableWithInstanceValues");
+		resetSymbolValues();
+
+		Iterator keyIt = currentInstanceSymbols.keySet().iterator();
+		while (keyIt.hasNext()) {
+
+			String currentKey = (String) keyIt.next();
+			String qualifiedKey = currentKey;
+			qualifiedKey = instanceName + "." + currentKey;
+
+			// System.out.println("currentKey "+currentKey);
+			PropertySymbol sym = (PropertySymbol) getSymbol(qualifiedKey);
+
+			Object value = (Object) currentInstanceSymbols.get(currentKey);
+			sym.setValue(value);
+			if (logger.isLoggable(Level.FINE)) {
+				logger.fine(Thread.currentThread().getName()
+						+ " SPLSymbolTable setting symbol:" + sym.getName()
+						+ " from:" + sym.getValue() + " to:" + value);
+			}
+
+		}
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "populateSymbolTableWithInstanceValues");
+	}
+
+	private void _populateCollectAnchorClassSymbols(String className,
+			String qualifier, List instanceInfoList) {
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "populateAnchorElementSymbols");
+		Map sMap = null;
+		try {
+			// System.out.println("populateAnchorElementSymbols ::
+			// _anchorElement,nameSpace :"+_anchorElement+" "+nameSpace);
+
+			if (_dataCollector == null) {
+				_dataCollector = DataCollectorFactory.getDataCollector();
+			}
+
+			sMap = _dataCollector.getSymbolsForClass(className, qualifier);
+			Iterator it = sMap.keySet().iterator();
+
+			while (it.hasNext()) {
+				String key = (String) it.next();
+				Symbol s = (Symbol) 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);
+						// System.out.println("Symbol added to symbolmap :
+						// "+instanceName + "." + key);
+					}
+
+				} else {
+					_symbolMap.put(className + "." + key, s);
+					// System.out.println("Symbol added to symbolmap :
+					// "+className + "." + key);
+
+				}
+			}
+
+		} catch (SPLException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "populateAnchorElementSymbols");
+
+	}
+
+	public DataCollector getDataCollector() {
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "getDataCollector");
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "getDataCollector");
+
+		return _dataCollector;
+
+	}
+*/	
 
 }

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=686743&r1=686742&r2=686743&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 Mon Aug 18 05:50:36 2008
@@ -39,6 +39,7 @@
 import org.apache.imperius.spl.parser.exceptions.SPLException;
 import org.apache.imperius.spl.parser.util.TypeInfo;
 import org.apache.imperius.spl.parser.util.TypeResolver;
+import org.apache.imperius.util.Messages;
 import org.apache.imperius.util.SPLLogger;
 
 
@@ -46,90 +47,65 @@
 {
 	private List _elements = null;
 	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-	private static final String sourceClass="BasicCollectionExpression";
-	
-	private int _size=0;
-	private TypeInfo _collectionType=null;
-	//private int expressionType=TypeConstants.basicCollectionType;
-	
-	private String _referenceTypeName="";
-	
-
+	private static final String sourceClass = "BasicCollectionExpression";
 
+	private int _size = 0;
+	private TypeInfo _collectionType = null;
+	private String _referenceTypeName = "";
+	
 	public BasicCollectionExpression(List pList, SPLSymbolTable sTab) 
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "BasicCollectionExpression");
 		
-		//System.out.println("creating BasicCollectionExpression");
 		if(pList.isEmpty()) 
 		{
-			
             logger.severe(Thread.currentThread().getName()+" "+
             		"No of parameters for Basic collection has to be greater than zero ");
 			
-			throw new InvalidParameterException("No of parameters for Basic collection has to be greater than zero "); 
+			throw new InvalidParameterException(Messages
+					.getString("SPL_EXPRESSION_VALIDATION_FAIL_MSG")
+					+ sourceClass); 
 		}
-
 		_elements=pList;
 		try
 		{
 			if(!validate())
 			{
-
                 logger.severe(Thread.currentThread().getName()+" "+
                 		"No of parameters for Basic collection has to be greater than zero ");
-                throw new IllegalParameterTypeException("Validation of BasicCollectionExpression Failed");
+                throw new IllegalParameterTypeException(Messages
+						.getString("SPL_EXPRESSION_VALIDATION_FAIL_MSG")
+						+ sourceClass);
 			}
-			
-	
 		}
 		catch(SPLException e)
 		{
 			e.printStackTrace();
 		}
-		
 		_size = _elements.size();
-		
-		//System.out.println("size "+this._size+"  isArray"+ this.getType().getIsArray());
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "BasicCollectionExpression");
-		
-
 	}
 
-
-
-
 	public Object evaluate() throws SPLException 
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
 		
-		//System.out.println("evaluate  ");
 		ArrayList resultCollection=new ArrayList();
 		Iterator ExpIt = _elements.iterator();
 		while(ExpIt.hasNext())
 		{
 			Expression exp = (Expression)ExpIt.next();
 			Object resultElement = exp.evaluate();
-			
-			//contained expression is not of type collection, just add it to the result Array
-						
 			resultCollection.add(resultElement);
-			
-			
 		}
-		//System.out.println("returning resultCollection");
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "evaluate");
-		
 		return resultCollection;
 	}
 
-
-
 	public boolean validate() throws SPLException 
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
 		
-		//System.out.println("validate BasicCollectionExpression");
 		Iterator paramListIterator = _elements.iterator();
 		while(paramListIterator.hasNext())
 		{
@@ -138,43 +114,36 @@
 			{
 				_collectionType = new TypeInfo(expression.getType());
 				_collectionType.setIsArray(true);
-				
-				//System.out.println("setting collectionType to "+_collectionType.getType()+" "+_collectionType.getIsArray());
 				if(TypeResolver.isReference(_collectionType))
 				{
 					_collectionType.setReferenceTypeName(expression.getReferenceTypeName());
 					_referenceTypeName = expression.getReferenceTypeName();
 				}
-				
 			}
 			else if (_collectionType.getType() != expression.getType().getType())
 			{
-				
-
 				logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
 				return false;
 			}
 			_collectionType.setIsArray(true);
-			
 		}
-
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
 		return true;
 	}
+
 	public List getCollectionElements() 
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getCollectionElements");
-		
 
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getCollectionElements");
 		
 		return _elements;
 	}
+
 	public int getCollectionSize() 
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getCollectionSize");
 		
-
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getCollectionSize");
 		
 		return _size;
@@ -182,67 +151,28 @@
 
 	public boolean isArray() 
 	{
-				//System.out.println("Basic Collect returning this.getType().getIsArray()"+this.getType().getIsArray());
 		return this.getType().getIsArray();
 	}
 
-	/*public void setElements(List elements) 
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setElements");
-		
-		_elements = elements;
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setElements");
-		
-	}*/
-
-	/*public void setSize(int size) 
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setSize");
-		
-		this.size = size;
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setSize");
-		
-	}*/
-
-	
-
-
 	public TypeInfo getType() 
 	{
-		
-		
 		return _collectionType;
 	}
 
-
-
-
-	/*public void setType(int expressionType) {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setType");
-		
-		this.collectionType = expressionType;
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setType");
-		
-	}*/
-    
     public String toString()
     {
         logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "toString");
         
-        
         String str="[ ";
-        
         Iterator ExpIt = _elements.iterator();
         while(ExpIt.hasNext())
         {
             Expression exp=(Expression)ExpIt.next();
             if(exp!=null)
             {
-                
             	String expstr=exp.toString();
             	str+=expstr + " , ";
             }
-            
         }
         str=str.substring(0, str.length()-3);
         str+=" ]";
@@ -252,14 +182,40 @@
         return str;
     }
 
-
-
-
 	public String getReferenceTypeName() throws SPLException 
 	{
-	
 		return _referenceTypeName;
 	}
-    
+ 
+/*	
+	public void setElements(List elements) {
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "setElements");
+
+		_elements = elements;
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "setElements");
+
+	}
+
+	public void setSize(int size) {
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "setSize");
 
+		this.size = size;
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "setSize");
+
+	}
+
+	public void setType(int expressionType) {
+		logger.entering(sourceClass, Thread.currentThread().getName() + " "
+				+ "setType");
+
+		this.collectionType = expressionType;
+		logger.exiting(sourceClass, Thread.currentThread().getName() + " "
+				+ "setType");
+
+	}
+*/
 }
\ No newline at end of file

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=686743&r1=686742&r2=686743&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 Mon Aug 18 05:50:36 2008
@@ -32,7 +32,6 @@
 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;
@@ -46,10 +45,8 @@
 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.util.Messages;
 import org.apache.imperius.util.SPLLogger;
-//import org.pegasus.jmpi.CIMObjectPath;
-
-//import com.ibm.ac.cimspl.CIMSPLTypeConstants;
 
 public class CollectOperation implements ReferenceExpression {
 
@@ -78,55 +75,44 @@
 
 
 
-//	#(c:COLLECT_OP #(COLLECT_CALL paramList = exprList[collectSymbolTable]) (postExpr = methodPropArrForCollect[symTab,collectSymbolTable])?  )	
+	//	#(c:COLLECT_OP #(COLLECT_CALL paramList = exprList[collectSymbolTable]) (postExpr = methodPropArrForCollect[symTab,collectSymbolTable])?  )	
 	public CollectOperation(ArrayList pList, Expression postCollect, SPLSymbolTable sTab) throws SPLException
 	{
 		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "CollectOperation");
-		//System.out.println("creating collect expression");
-
-
-
-
 
 		this.paramList = pList;
+		
 		// if no of params is 6 then flavour1 collect(refExp, associationname, srcRole, targetRole, targetClass, targetExp)
 		if(pList.size()  == 6) 
 		{	
 			collectType = COLLECT_FLAVOUR1;
-			//System.out.println("COLLECT_FLAVOUR1");
-
 		}	
 		else if(pList.size()  == 7) 
 		{
-//			if no of params is 7 then flavour2 collect(refExp, associationname, srcRole, targetRole, targetClass, <target class param>, targetExp)
+			// if no of params is 7 then flavour2 collect(refExp, associationname, srcRole, targetRole, targetClass, <target class param>, targetExp)
 			collectType = COLLECT_FLAVOUR2;
-			//System.out.println("COLLECT_FLAVOUR2");
-
 		}	
 		else
 		{
 			logger.severe(Thread.currentThread().getName()+" "+"No of parameters for collect has to be 6 or 7");
-			throw new InvalidParameterException("No of parameters for collect has to be 6 or 7");
+			throw new InvalidParameterException(Messages
+					.getString("SPL_EXPRESSION_VALIDATION_FAIL_MSG")
+					+ sourceClass);
 		}
 
 		if(postCollect != null) //  expression following collect e.g. collect(....)[1].param
 		{	
 			postCollectOperation = (PostCollectExpression)postCollect;
 			noPostCollectOperation = false;
-			//System.out.println(" PostCollectOperation exists");
-
 		}
 		else // no expression following collect e.g. collect(...) implies return is an array of targetclass instances (flavour 1) or param values (flavour 2) 
 		{
 			_dataType.setIsArray(true);
 			noPostCollectOperation = true;
-			//System.out.println("no PostCollectOperation");
-
 		}
 
 		this.symTab = sTab;
 
-
 		// validate the expression
 		if (!validate())
 		{
@@ -134,10 +120,7 @@
 			throw new SPLException("validation error:");
 		}
 
-
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "CollectOperation");
-
-
 	}
 
 	public boolean validate() throws SPLException 
@@ -149,27 +132,25 @@
 		{
 			if(collectType == COLLECT_FLAVOUR1)
 			{
-				//System.out.println(" validateCollectFlavour1");
-
 				result = validateCollectFlavour1();
 			}
 			else
 			{
-				//System.out.println(" validateCollectFlavour2");
-
 				result = validateCollectFlavour2();
 			}
 		}
 		else
 		{
 			logger.severe(Thread.currentThread().getName()+" "+"Missing parameters");
-			throw new MissingParameterException("Missing parameters");
+			throw new MissingParameterException(Messages
+					.getString("SPL_MISSING_PARAMETERS_EXCEPTION_MSG"));
 		}
 		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
 		return result;
 
 
 	}
+
 	// The first 4 parameters are common to both Collect flavours
 	private boolean validateCommonParameters() throws SPLException
 	{
@@ -185,7 +166,11 @@
 		if(refExp.getType().getType() != TypeConstants.referenceType) // param 0 is the source class
 		{
 			logger.severe(Thread.currentThread().getName()+" "+"First param to collect needs to be a reference expression");
-			throw new IllegalExpressionTypeException("First param to collect needs to be a reference expression");
+			throw new IllegalExpressionTypeException(
+					"first "
+							+ Messages
+									.getString("SPL_COLLECT_OPERATION_EXP_EXCEPTION1_MSG")
+							+ sourceClass);
 		}
 		if(refExp instanceof ReferenceExpression)
 		{
@@ -205,7 +190,10 @@
 		{
 			logger.severe(Thread.currentThread().getName()+" "+"2nd param to collect needs to be a string expression");
 
-			throw new IllegalExpressionTypeException("2nd param to collect needs to be a string expression");
+			throw new IllegalExpressionTypeException(
+					"second "
+							+ Messages
+									.getString("SPL_COLLECT_OPERATION_EXP_EXCEPTION2_MSG"));
 		}
 		associationName = (String)assocExp.evaluate();
 
@@ -214,7 +202,10 @@
 		{
 			logger.severe(Thread.currentThread().getName()+" "+"3rd param to collect needs to be a string expression");
 
-			throw new IllegalExpressionTypeException("3rd param to collect needs to be a string expression");
+			throw new IllegalExpressionTypeException(
+					"third "
+							+ Messages
+									.getString("SPL_COLLECT_OPERATION_EXP_EXCEPTION2_MSG"));
 		}
 
 		sourceRole = (String)roleExp.evaluate();
@@ -225,7 +216,10 @@
 
 			logger.severe(Thread.currentThread().getName()+" "+"4th param to collect needs to be a string expression");
 
-			throw new IllegalExpressionTypeException("4th param to collect needs to be a string expression");
+			throw new IllegalExpressionTypeException(
+					"fourth "
+							+ Messages
+									.getString("SPL_COLLECT_OPERATION_EXP_EXCEPTION2_MSG"));
 		}
 		targetRole = (String)roleExp.evaluate();
 
@@ -235,7 +229,10 @@
 
 			logger.severe(Thread.currentThread().getName()+" "+"5th param to collect needs to be a string expression");
 
-			throw new IllegalExpressionTypeException("5th param to collect needs to be a string expression");
+			throw new IllegalExpressionTypeException(
+					"fifth "
+							+ Messages
+									.getString("SPL_COLLECT_OPERATION_EXP_EXCEPTION2_MSG"));
 		}
 		targetClassName = (String)targetClassExp.evaluate();
 
@@ -288,7 +285,11 @@
 
 			logger.severe(Thread.currentThread().getName()+" "+"5th param to collect needs to be a string expression");  
 
-			throw new IllegalExpressionTypeException("5th param to collect needs to be a string expression");	
+			throw new IllegalExpressionTypeException(
+					"fifth "
+							+ Messages
+									.getString("SPL_COLLECT_OPERATION_EXP_EXCEPTION2_MSG"));
+	
 		}
 		targetClassPropertyName = (String)propNameExp.evaluate();
 
@@ -297,7 +298,7 @@
 		{
 
 			logger.severe(targetClassName + "." + targetClassPropertyName + " does not exist");
-
+			
 			throw new NonExistentSymbolException(targetClassName + "." + targetClassPropertyName + " does not exist");
 		}
 		else
@@ -313,7 +314,11 @@
 
 					logger.severe(Thread.currentThread().getName()+" "+"6th param to collect needs to be a boolean expression");
 
-					throw new IllegalExpressionTypeException("6th param to collect needs to be a boolean expression");
+					throw new IllegalExpressionTypeException(
+							"sixth "
+									+ Messages
+											.getString("SPL_COLLECT_OPERATION_EXP_EXCEPTION3_MSG"));
+
 				}
 				if(!noPostCollectOperation) // if an expression exists that follows collect
 				{	
@@ -364,7 +369,10 @@
 
 				logger.severe(Thread.currentThread().getName()+" "+"6th param to collect needs to be a boolean expression");
 
-				throw new IllegalExpressionTypeException("6th param to collect needs to be a boolean expression");
+				throw new IllegalExpressionTypeException(
+						"sixth "
+								+ Messages
+										.getString("SPL_COLLECT_OPERATION_EXP_EXCEPTION3_MSG"));
 			}
 			if(!noPostCollectOperation) // post collect exists e.g. collect(...)[exp].prop
 			{																//		 .prop[exp]		
@@ -473,18 +481,17 @@
 
 
 		// get instances of the targetclass that satisfy the association conditions
-		if(logger.isLoggable(Level.FINE))
-			logger.fine(Thread.currentThread().getName()+" refExpressionResult evaluateFlavour2 "+referenceStr);
+		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");
+
+		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");
+
+		logger.fine(Thread.currentThread().getName()+" got associated instances");
 
 		// filter the List based on the target filter expression
 		//System.out.println("filteredTargetClassInstanceReferences to dc :"+targetClassInstanceReferences+" "+symTab.getDefaultQualifier()+" "+this.targetClassName);
@@ -492,8 +499,7 @@
 		List filteredTargetClassInstanceReferences = filterTargetClassInstanceReferencesWithTargetExpression(targetClassInstanceReferences , this.targetClassName,this.symTab.getDefaultQualifier());
 		//System.out.println("targetClassInstanceReferences "+filteredTargetClassInstanceReferences.toString());
 		
-		if (logger.isLoggable(Level.FINE))
-			logger.fine(Thread.currentThread().getName()+" got filtered references");
+		logger.fine(Thread.currentThread().getName()+" got filtered references");
 
 		ArrayList filteredTargetClassInstances = new ArrayList();
 
@@ -552,24 +558,20 @@
 		List targetClassInstanceReferences = null;
 
 		// traverse association to get an array of target class instances. Each instance is a Map of key=values
-		if(logger.isLoggable(Level.FINE))
-			logger.fine(Thread.currentThread().getName()+" refExpressionResult evaluateFlavour1 "+refExpressionStr);
+		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());
-		if (logger.isLoggable(Level.FINE))
-			logger.fine(Thread.currentThread().getName()+" got associated references");
+		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");
+		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());
 
-		if (logger.isLoggable(Level.FINE))
-			logger.fine(Thread.currentThread().getName()+" got filtered references");
+		logger.fine(Thread.currentThread().getName()+" got filtered references");
 
 		List filteredTargetClassInstances = new ArrayList();
 
@@ -582,8 +584,7 @@
 			filteredTargetClassInstances.add(instanceProperties);
 		}
 
-		if (logger.isLoggable(Level.FINE))
-			logger.fine(Thread.currentThread().getName()+" got filtered instances");
+		logger.fine(Thread.currentThread().getName()+" got filtered instances");
 
 		if(!noPostCollectOperation) // post collect exists
 		{
@@ -715,25 +716,20 @@
 				//System.out.println("result "+result);
 				if(result.booleanValue())
 				{
-					if (logger.isLoggable(Level.FINE))
-						logger.fine(Thread.currentThread().getName()+" cop passed filter "+cop);
+					logger.fine(Thread.currentThread().getName()+" cop passed filter "+cop);
 					//System.out.println("adding cop to list "+cop.toString());
 					
 					filteredTargetClassInstanceReferences.add(cop);
 				}
 				else
 				{
-					if (logger.isLoggable(Level.FINE))
-						logger.fine(Thread.currentThread().getName()+" cop did not pass filter "+cop);
-
-
+					logger.fine(Thread.currentThread().getName()+" cop did not pass filter "+cop);
 				}
 			}
 		}
 		else
 		{
-			if (logger.isLoggable(Level.FINE))
-				logger.fine(Thread.currentThread().getName()+" Zero instances passed in hence zero instance references filtered, therefore returning null ");
+			logger.fine(Thread.currentThread().getName()+" Zero instances passed in hence zero instance references filtered, therefore returning null ");
 		}
 
 



Mime
View raw message