incubator-imperius-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jnee...@apache.org
Subject svn commit: r606479 [10/30] - in /incubator/imperius/trunk/trunk: ./ modules/ modules/imperius-javaspl/ modules/imperius-javaspl/resources/ modules/imperius-javaspl/resources/samples/ modules/imperius-javaspl/resources/samples/computersystem/ modules/i...
Date Sat, 22 Dec 2007 19:34:03 GMT
Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/compiler/symboltable/SPLSymbolTable.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/compiler/symboltable/SPLSymbolTable.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/compiler/symboltable/SPLSymbolTable.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/compiler/symboltable/SPLSymbolTable.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,671 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <prabalig@in.ibm.com>
+ *
+ */
+
+
+
+package org.apache.imperius.spl.parser.compiler.symboltable;
+
+
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+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;
+import org.apache.imperius.spl.external.InstanceInfo;
+import org.apache.imperius.spl.external.TypeConstants;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.exceptions.SymbolAlreadyDefinedException;
+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.SPLLogger;
+
+
+public class SPLSymbolTable 
+{
+	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;
+	
+	private AnchorData _anchorData = null;
+		
+	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+	private static final String sourceClass="SPLSymbolTable";
+	
+	private Map _symbolMap = null;
+	private List _subSymbolTables = null;
+	private SPLSymbolTable _parentTable = null;
+	private int  _symbolTableType = UNDEFINED;
+	private DataCollector _dataCollector = null;
+	
+	private String _defaultQualifier = null;
+	
+	public void addAnchor(String className,
+			String qualifier, 
+			List instanceInfoList) throws SPLException
+	{
+		if(_anchorData == null)
+		{
+			_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);
+		_anchorData.addQualifierForClass(className, qualifier);
+		if(qualifier!=null)
+		{
+			_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;
+	}
+	
+	public void setAnchorData(AnchorData anchorData)
+	{
+		_anchorData = anchorData;
+		
+	}
+	
+	
+	public SPLSymbolTable(SPLSymbolTable pt)
+	{
+		this(pt,DEFAULT);
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "SPLSymbolTable");
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "SPLSymbolTable");
+	}
+	
+	
+	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;
+		
+	}
+	
+		
+	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.entering(sourceClass,Thread.currentThread().getName()+" "+ "insertVariableSymbol");
+	}
+	
+	public void insertVariableSymbol(String name,
+			int type,
+			String referenceTypeName,
+			boolean isArray,
+			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))
+		{	
+			TypeInfo tp = new TypeInfo(type,referenceTypeName,isArray);
+			Symbol cimSym = new PropertySymbol(name,tp,isKey,isClassProp);
+			_symbolMap.put(name, cimSym);
+		}
+		else
+		{
+			logger.severe(Thread.currentThread().getName()+" "+"Symbol: " + name + " already defined");
+			throw new SymbolAlreadyDefinedException("Symbol: " + name + " already defined");
+		}
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "insertVariableSymbol");
+	}
+	public void insertMethodSymbol(String name, 
+			TypeInfo retType, 
+			boolean isReturnArray, 
+			String returnReferenceName, 
+			List argTypeList,
+			SPLSymbolTable argsSymbolTable) throws SymbolAlreadyDefinedException
+	{
+		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.exiting(sourceClass,Thread.currentThread().getName()+" "+ "insertMethodSymbol");
+		
+	}
+	
+	public void insertMacroSymbol(String name, 
+			String retType, 
+			boolean isArray,
+			ArrayList argTypeList,
+			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);
+			_symbolMap.put(name, cimSym);
+		}
+		else
+		{
+			logger.severe(Thread.currentThread().getName()+" "+"Symbol: " + name + " already defined");
+			throw new SymbolAlreadyDefinedException("Symbol: " + name + " already defined");
+		}
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "insertMacroSymbol");
+	}
+	
+	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;
+	}
+	
+	public boolean symbolExists(String name, boolean recurse)
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "symbolExists");
+		boolean res = false;
+		if(_symbolMap.containsKey(name))
+		{	
+			res = true;
+		}
+		else
+		{
+			if(_parentTable != null && recurse)
+			{
+				res = _parentTable.symbolExists(name, recurse);
+			}
+		}
+		//System.out.println("symbol exists ? "+name+" "+res);
+		
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "symbolExists");
+		return res;
+	}
+	
+	
+	private void _populateAnchorClassSymbols(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();
+			}
+				
+			//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);*/
+		
+		
+		// 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();
+				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 void populateInstanceValuesForInstance(
+			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);
+            }    
+                
+			
+		}
+		_insertInstanceObject(className, instanceName, instance);
+	
+	
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "populateSymbolTableWithInstanceValues");
+	}
+	
+	/*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, 
+			Object instance) throws SPLException 
+	{
+		_anchorData.insertInstanceObject(className, instanceName, instance);
+			
+	}
+
+
+	public void resetSymbolValues()
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "resetSymbolValues");
+		//TBD
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "resetSymbolValues");
+	}
+
+	
+	public void setParentSymbolTable(SPLSymbolTable table) {
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setParentSymbolTable");
+		this._parentTable = table;
+		table._subSymbolTables.add(this);
+		
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setParentSymbolTable");
+		
+	}
+	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");
+		
+	}
+	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) {
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "setDataCollector");
+		if(dataCollector == null) {
+			this._dataCollector = DataCollectorFactory.getDataCollector();
+		} else {
+			this._dataCollector = dataCollector;
+		}
+		
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "setDataCollector");
+		
+	}
+	
+	public List getAnchorClassList()
+	{
+		
+		List anchorClassList = _anchorData.getAnchorClassList();
+		return anchorClassList;
+	}
+	
+	public String getQualifierForClass(String className)
+	{
+		String qualifier = _anchorData.getQualifierForClass(className);
+		return qualifier;
+	}
+
+	public List getInstanceInfoList(String className)
+	{
+		List instanceInfoList = _anchorData.getInstanceInfoList(className);
+		return instanceInfoList;
+	}
+
+	public Object getInstance(String instanceName) 
+	{
+		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() 
+	{
+		return _defaultQualifier;
+	}
+
+	public void setDefaultQualifier(String qualifier) {
+		_defaultQualifier = qualifier;
+	}
+	
+
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/compiler/symboltable/Symbol.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/compiler/symboltable/Symbol.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/compiler/symboltable/Symbol.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/compiler/symboltable/Symbol.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+
+
+package org.apache.imperius.spl.parser.compiler.symboltable;
+
+import org.apache.imperius.spl.parser.util.TypeInfo;
+
+
+
+public interface Symbol 
+{
+	TypeInfo getType();
+	String getReferenceTypeName();
+	Object getValue();
+	boolean isArray();
+	boolean isKey();
+	boolean isClassSymbol();
+	
+
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/ClassDoesNotExistException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/ClassDoesNotExistException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/ClassDoesNotExistException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/ClassDoesNotExistException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class ClassDoesNotExistException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public ClassDoesNotExistException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalExpressionTypeException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalExpressionTypeException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalExpressionTypeException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalExpressionTypeException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,37 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class IllegalExpressionTypeException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public IllegalExpressionTypeException(String x)
+    {
+        super(x);
+    }
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalParameterTypeException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalParameterTypeException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalParameterTypeException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalParameterTypeException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class IllegalParameterTypeException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public IllegalParameterTypeException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalSymbolReferenceException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalSymbolReferenceException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalSymbolReferenceException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/IllegalSymbolReferenceException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,36 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class IllegalSymbolReferenceException extends SPLException
+{
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public IllegalSymbolReferenceException(String x)
+    {
+        super(x);
+    }
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InstanceDoesNotExistException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InstanceDoesNotExistException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InstanceDoesNotExistException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InstanceDoesNotExistException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <prabalig@in.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class InstanceDoesNotExistException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public InstanceDoesNotExistException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidAssociationException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidAssociationException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidAssociationException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidAssociationException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <prabalig@in.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class InvalidAssociationException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public InvalidAssociationException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidCIMParameterException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidCIMParameterException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidCIMParameterException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidCIMParameterException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <prabalig@in.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class InvalidCIMParameterException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public InvalidCIMParameterException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidPolicyParameterException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidPolicyParameterException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidPolicyParameterException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/InvalidPolicyParameterException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <prabalig@in.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class InvalidPolicyParameterException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public InvalidPolicyParameterException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/MissingParameterException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/MissingParameterException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/MissingParameterException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/MissingParameterException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,37 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class MissingParameterException extends SPLException
+{
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public MissingParameterException(String s)
+    {
+        super(s);
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/NonExistentSymbolException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/NonExistentSymbolException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/NonExistentSymbolException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/NonExistentSymbolException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,37 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class NonExistentSymbolException extends SPLException
+{
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public NonExistentSymbolException(String x)
+    {
+        super(x);
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/PolicyAlreadyExistsInRepositoryException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/PolicyAlreadyExistsInRepositoryException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/PolicyAlreadyExistsInRepositoryException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/PolicyAlreadyExistsInRepositoryException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <prabalig@in.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class PolicyAlreadyExistsInRepositoryException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public PolicyAlreadyExistsInRepositoryException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/PolicyDoesNotExistException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/PolicyDoesNotExistException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/PolicyDoesNotExistException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/PolicyDoesNotExistException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class PolicyDoesNotExistException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public PolicyDoesNotExistException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/ReferenceDoesNotExistException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/ReferenceDoesNotExistException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/ReferenceDoesNotExistException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/ReferenceDoesNotExistException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <prabalig@in.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class ReferenceDoesNotExistException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public ReferenceDoesNotExistException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/SPLException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/SPLException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/SPLException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/SPLException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,38 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class SPLException extends Exception
+{
+    
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public SPLException(String s)
+    {
+        super(s);
+    }
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/SymbolAlreadyDefinedException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/SymbolAlreadyDefinedException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/SymbolAlreadyDefinedException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/SymbolAlreadyDefinedException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class SymbolAlreadyDefinedException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public SymbolAlreadyDefinedException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/TypeMismatchException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/TypeMismatchException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/TypeMismatchException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/TypeMismatchException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class TypeMismatchException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public TypeMismatchException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/TypesNotAssignableException.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/TypesNotAssignableException.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/TypesNotAssignableException.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/exceptions/TypesNotAssignableException.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,39 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Neeraj Joshi <jneeraj@us.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.parser.exceptions;
+
+
+
+public class TypesNotAssignableException extends SPLException
+{
+    
+    /**
+	 * 
+	 */
+	private static final long serialVersionUID = 1L;
+
+	public TypesNotAssignableException(String s)
+    {
+        super(s);
+        // TODO Auto-generated constructor stub
+    }
+    
+}

Added: incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expression/primary/BasicCollectionExpression.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expression/primary/BasicCollectionExpression.java?rev=606479&view=auto
==============================================================================
--- incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expression/primary/BasicCollectionExpression.java (added)
+++ incubator/imperius/trunk/trunk/modules/imperius-splcore/src/org/apache/imperius/spl/parser/expression/primary/BasicCollectionExpression.java Sat Dec 22 11:33:46 2007
@@ -0,0 +1,260 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <prabalig@in.ibm.com>
+ *
+ */
+
+
+
+package org.apache.imperius.spl.parser.expression.primary;
+
+import java.security.InvalidParameterException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.external.Expression;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+import org.apache.imperius.spl.parser.exceptions.IllegalParameterTypeException;
+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.SPLLogger;
+
+
+public class BasicCollectionExpression  implements Expression 
+{
+	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="";
+	
+
+
+	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 "); 
+		}
+
+		_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");
+			}
+			
+	
+		}
+		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())
+		{
+			Expression expression=(Expression)paramListIterator.next();
+			if(_collectionType == null)
+			{
+				_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;
+	}
+
+	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+=" ]";
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "toString");
+       
+        return str;
+    }
+
+
+
+
+	public String getReferenceTypeName() throws SPLException 
+	{
+	
+		return _referenceTypeName;
+	}
+    
+
+}
\ No newline at end of file



Mime
View raw message