incubator-imperius-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ke...@apache.org
Subject svn commit: r611261 [4/43] - in /incubator/imperius/trunk: ./ imperius-javaspl/ imperius-javaspl/src/main/java/org/apache/imperius/javaspl/ imperius-splcore/ imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/ imperius-splcore/src/...
Date Fri, 11 Jan 2008 18:57:14 GMT
Propchange: incubator/imperius/trunk/imperius-splcore/src/main/antlr/org/apache/imperius/spl/parser/compiler/cimspl.tree.g
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyDataStore.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyDataStore.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyDataStore.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyDataStore.java Fri Jan 11 10:56:30 2008
@@ -1,66 +1,66 @@
-/*
- * 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.datastore;
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.statements.impl.PolicyInfo;
-import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
-
-
-public interface PolicyDataStore
-{
-    
-    public String getPolicy(String policyName)
-            throws SPLException;
-    
-    public PolicyInfo getPolicyInfo(String policyName)
-    throws SPLException;
-    
-    public boolean createPolicy(String policyName, String policyString) throws SPLException;
-    
-    public boolean validatePolicyString(String policyString) throws SPLException;
-    
-    
-    public SPLPolicy createSPLPolicyObject(String policyName, String policyString) 
-	throws SPLException;
-	
-    public void updatePolicy(String policyName, String policyString) throws SPLException;
-    
-    public void deletePolicy(String policyName)
-            throws SPLException;
-    
-    public Map getAllPolicies() throws SPLException;
-    
-    public List getAllPolicyNames() throws SPLException;
-    
-    public void init() throws SPLException;
-    
-    public void shutdown();
-    
-       
-    public SPLPolicy getInternalPolicyObject(String PolicyRuleName)
-            throws SPLException;
-    
-}
+/*
+ * 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.datastore;
+
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.statements.impl.PolicyInfo;
+import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
+
+
+public interface PolicyDataStore
+{
+    
+    public String getPolicy(String policyName)
+            throws SPLException;
+    
+    public PolicyInfo getPolicyInfo(String policyName)
+    throws SPLException;
+    
+    public boolean createPolicy(String policyName, String policyString) throws SPLException;
+    
+    public boolean validatePolicyString(String policyString) throws SPLException;
+    
+    
+    public SPLPolicy createSPLPolicyObject(String policyName, String policyString) 
+	throws SPLException;
+	
+    public void updatePolicy(String policyName, String policyString) throws SPLException;
+    
+    public void deletePolicy(String policyName)
+            throws SPLException;
+    
+    public Map getAllPolicies() throws SPLException;
+    
+    public List getAllPolicyNames() throws SPLException;
+    
+    public void init() throws SPLException;
+    
+    public void shutdown();
+    
+       
+    public SPLPolicy getInternalPolicyObject(String PolicyRuleName)
+            throws SPLException;
+    
+}

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

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyParser.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyParser.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyParser.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyParser.java Fri Jan 11 10:56:30 2008
@@ -1,41 +1,41 @@
-/*
- * 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.datastore;
-
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
-
-
-public interface PolicyParser
-{
-    
-    public SPLPolicy createInternalPolicyObject(String PolicyRuleName,
-            String PolicyString) throws SPLException;
-    
-    public boolean validate(String PolicyRuleName, String PolicyString);
-    
-    public void init() throws SPLException;
-    
-    public void shutDown();
-    
-    public boolean validatePolicyString(String policyString) throws SPLException;
-    
-}
+/*
+ * 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.datastore;
+
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
+
+
+public interface PolicyParser
+{
+    
+    public SPLPolicy createInternalPolicyObject(String PolicyRuleName,
+            String PolicyString) throws SPLException;
+    
+    public boolean validate(String PolicyRuleName, String PolicyString);
+    
+    public void init() throws SPLException;
+    
+    public void shutDown();
+    
+    public boolean validatePolicyString(String policyString) throws SPLException;
+    
+}

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

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyRepository.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyRepository.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyRepository.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyRepository.java Fri Jan 11 10:56:30 2008
@@ -1,56 +1,56 @@
-/*
- * 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.datastore;
-
-
-
-import java.util.List;
-import java.util.Map;
-
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-
-public interface PolicyRepository
-{
-    
-    public String getPolicyString(String PolicyRuleName) throws SPLException;
-            
-    
-    public boolean insertPolicy(String PolicyRuleName, String PolicyString)
-            throws SPLException;
-    
-    public void updatePolicy(String PolicyRuleName, String PolicyString)
-            throws SPLException;
-    
-    public void deletePolicy(String PolicyRuleName) throws SPLException;
-    
-    public Map getAllPolicies() throws SPLException;
-    
-    public List getAllPolicyNames() throws SPLException;
-    
-    public boolean policyExists(String PolicyRuleName) throws SPLException;
-    
-    public void init() throws SPLException;
-    
-    public void shutdown();
-    
-    
-    
-}
+/*
+ * 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.datastore;
+
+
+
+import java.util.List;
+import java.util.Map;
+
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+
+public interface PolicyRepository
+{
+    
+    public String getPolicyString(String PolicyRuleName) throws SPLException;
+            
+    
+    public boolean insertPolicy(String PolicyRuleName, String PolicyString)
+            throws SPLException;
+    
+    public void updatePolicy(String PolicyRuleName, String PolicyString)
+            throws SPLException;
+    
+    public void deletePolicy(String PolicyRuleName) throws SPLException;
+    
+    public Map getAllPolicies() throws SPLException;
+    
+    public List getAllPolicyNames() throws SPLException;
+    
+    public boolean policyExists(String PolicyRuleName) throws SPLException;
+    
+    public void init() throws SPLException;
+    
+    public void shutdown();
+    
+    
+    
+}

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

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyCache.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyCache.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyCache.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyCache.java Fri Jan 11 10:56:30 2008
@@ -1,106 +1,106 @@
-/*
- * 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.datastore.impl;
-
-import java.util.Map;
-import java.util.Hashtable;
-
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
-
-
-public class PolicyCache 
-{
-	private Map _policyCache = new Hashtable();
-	
-	public boolean policyExists(String policyName)
-	{
-		if (!_policyCache.containsKey(policyName))
-        {
-			return false;
-        }
-		return true;
-		
-		
-	}
-	
-	public boolean insertPolicy(String policyName, SPLPolicy policyObject)
-	{
-		if (!policyExists(policyName))
-        {
-            
-            _policyCache.put(policyName,policyObject);
-            return true;
-            
-        }
-        else
-        {
-        	return false;
-            
-        }
-    	
-	}
-	public boolean updatePolicy(String policyName, SPLPolicy policyObject)
-		throws SPLException
-	{
-		if(policyExists(policyName))
-		{
-			_policyCache.remove(policyName);
-			_policyCache.put(policyName, policyObject);
-			return true;
-		}
-		else
-		{
-			throw new SPLException("policy does not exist in cache");
-		}
-		
-	}
-	public boolean deletePolicy(String policyName) throws SPLException
-	{
-		if(policyExists(policyName))
-		{
-			_policyCache.remove(policyName);
-			return true;
-		}
-		else
-		{
-			return false;
-		}
-		
-		
-	}
-	public SPLPolicy getPolicy(String policyName) throws SPLException
-	{
-		if(policyExists(policyName))
-		{
-			SPLPolicy pol = (SPLPolicy)_policyCache.get(policyName);
-			return pol;
-		}
-		else
-		{
-			throw new SPLException("policy does not exist in cache");
-		}
-		
-	}
-	
-	
-
-}
+/*
+ * 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.datastore.impl;
+
+import java.util.Map;
+import java.util.Hashtable;
+
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
+
+
+public class PolicyCache 
+{
+	private Map _policyCache = new Hashtable();
+	
+	public boolean policyExists(String policyName)
+	{
+		if (!_policyCache.containsKey(policyName))
+        {
+			return false;
+        }
+		return true;
+		
+		
+	}
+	
+	public boolean insertPolicy(String policyName, SPLPolicy policyObject)
+	{
+		if (!policyExists(policyName))
+        {
+            
+            _policyCache.put(policyName,policyObject);
+            return true;
+            
+        }
+        else
+        {
+        	return false;
+            
+        }
+    	
+	}
+	public boolean updatePolicy(String policyName, SPLPolicy policyObject)
+		throws SPLException
+	{
+		if(policyExists(policyName))
+		{
+			_policyCache.remove(policyName);
+			_policyCache.put(policyName, policyObject);
+			return true;
+		}
+		else
+		{
+			throw new SPLException("policy does not exist in cache");
+		}
+		
+	}
+	public boolean deletePolicy(String policyName) throws SPLException
+	{
+		if(policyExists(policyName))
+		{
+			_policyCache.remove(policyName);
+			return true;
+		}
+		else
+		{
+			return false;
+		}
+		
+		
+	}
+	public SPLPolicy getPolicy(String policyName) throws SPLException
+	{
+		if(policyExists(policyName))
+		{
+			SPLPolicy pol = (SPLPolicy)_policyCache.get(policyName);
+			return pol;
+		}
+		else
+		{
+			throw new SPLException("policy does not exist in cache");
+		}
+		
+	}
+	
+	
+
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyCache.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyDataStoreImpl.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyDataStoreImpl.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyDataStoreImpl.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyDataStoreImpl.java Fri Jan 11 10:56:30 2008
@@ -1,497 +1,497 @@
-/*
- * 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.datastore.impl;
-
-
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.datastore.PolicyDataStore;
-import org.apache.imperius.spl.datastore.PolicyParser;
-import org.apache.imperius.spl.datastore.PolicyRepository;
-import org.apache.imperius.spl.parser.exceptions.InvalidCIMParameterException;
-import org.apache.imperius.spl.parser.exceptions.InvalidPolicyParameterException;
-import org.apache.imperius.spl.parser.exceptions.PolicyAlreadyExistsInRepositoryException;
-import org.apache.imperius.spl.parser.exceptions.PolicyDoesNotExistException;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.statements.impl.PolicyInfo;
-import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
-import org.apache.imperius.util.SPLLogger;
-
-
-public class PolicyDataStoreImpl implements PolicyDataStore
-{
-
-
-
-	private PolicyCache _policyCache = null;
-
-	private PolicyParser _policyParser = null;
-
-	private PolicyRepository _policyRepository = null;
-
-
-	private static final String sourceClass = "PolicyDataStoreImpl";
-
-	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
-
-	public PolicyDataStoreImpl()
-	{
-
-		init();
-	}
-
-	public void init()
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "init");
-
-		_policyCache = new PolicyCache();
-		_policyRepository = new PolicyRepositoryImpl();
-		_policyParser = new PolicyParserImpl();
-	
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "init");
-	}
-
-
-	public void shutdown()
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "shutdown");
-		_policyParser.shutDown();
-		_policyRepository.shutdown();
-		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "shutdown");
-	}
-
-	public boolean createPolicy(String policyName, String policyString) 
-	throws SPLException
-	{
-
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createPolicy");
-		// check to see if class name and namespace are valid
-		boolean res = false;
-
-		if ((policyName != null) && (policyString != null))
-		{
-			// check if Policy already exists in Repository
-			if (!_policyRepository.policyExists(policyName))
-			{
-				SPLPolicy internalPolicyObject = 
-					_policyParser.createInternalPolicyObject(policyName,policyString);
-
-				if (internalPolicyObject != null)
-				{
-					if (logger.isLoggable(Level.FINE))
-					{	
-						logger.fine(Thread.currentThread().getName() + 
-								" created internal SPLPolicy");
-					}    
-					// create CIMObjectPath that is to be returned
-					res = _policyRepository.insertPolicy(
-							policyName, policyString);
-					if (logger.isLoggable(Level.FINE))
-					{	
-						logger.fine(Thread.currentThread().getName() + 
-								" inserted Policy into PolicyRepository");
-					}    
-					
-					_policyCache.insertPolicy(policyName,internalPolicyObject);
-					
-
-				}
-
-			}
-			else
-			{
-				logger
-				.severe(Thread.currentThread().getName() +" " +
-						"Cannot create new Policy asPolicy already exists . Try updating.");
-				throw new PolicyAlreadyExistsInRepositoryException(
-				"Cannot create new Policy asPolicy already exists");
-			}
-		}
-		else
-		{
-			logger.severe(Thread.currentThread().getName()+" " + 
-			"Policy Parameter is null");
-			throw new InvalidPolicyParameterException( "Policy Parameter is null");
-		}
-
-
-
-
-		return res;
-	}
-
-	public void deletePolicy(String policyName)
-	throws SPLException
-	{
-		// logger.entry("deletePolicy");
-
-		// check to see if they r null
-		// check if it already exists
-		// put in a utility to check a cim object
-
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "deletePolicy");
-
-		// get name of Policy to be deleted
-
-		if (policyName != null)
-		{
-			//_readSerializedCimPolicyStorage();
-			if (logger.isLoggable(Level.FINE))
-			{	
-				logger.fine(Thread.currentThread().getName() + 
-						" Deleting Policy Object from cache");
-			}    
-			// delete Policy from cache
-			_policyCache.deletePolicy(policyName);
-
-			if (logger.isLoggable(Level.FINE))
-			{	
-				logger.fine(Thread.currentThread().getName() + 
-						" Deleting Policy from policyRepository");
-			}    
-			// delete policy from Repository
-			if (_policyRepository.policyExists(policyName))
-			{
-				_policyRepository.deletePolicy(policyName);
-				logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "deletePolicy");
-			}
-			else
-			{
-				logger.severe(Thread.currentThread().getName()+" " + 
-				"The Policy cannot be deleted as it does not exist in the Repository");
-				throw new PolicyDoesNotExistException(
-				"The Policy cannot be deleted as it does not exist in the Repository");
-			}
-		}
-		else
-		{
-			logger.severe(Thread.currentThread().getName()+" " + 
-			"The Policy cannot be found due to Invalid Policy Parameters");
-			throw new InvalidPolicyParameterException(
-			"The Policy cannot be found due to Invalid Policy Parameters");
-		}
-
-	}
-
-	public Map getAllPolicies()
-	throws SPLException
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getAllPolicies");
-
-		// enumerating Policies from policyRepository
-		if (logger.isLoggable(Level.FINE))
-			logger.fine(Thread.currentThread().getName() + 
-					" enumerating Policies from policyRepository");
-		// USE equalscase instead
-
-		Map policies = _policyRepository.getAllPolicies();
-
-		return policies;
-
-
-
-	}
-
-	public List getAllPolicyNames() throws SPLException
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getAllPolicyNames");
-		List policyNames = _policyRepository.getAllPolicyNames(); 
-
-		return policyNames;
-
-	}
-
-	public SPLPolicy getInternalPolicyObject(String policyRuleName)
-	throws SPLException
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ 
-		"getInternalPolicyObject");
-		if (policyRuleName != null)
-		{
-			//_readSerializedCimPolicyStorage();
-			// get Policy object from Cache
-			if (logger.isLoggable(Level.FINE))
-				logger.fine(Thread.currentThread().getName()+" get Policy object from Cache");
-
-			if (_policyCache.policyExists(policyRuleName))
-			{
-				SPLPolicy policyObject = _policyCache.getPolicy(policyRuleName);
-				logger.exiting(sourceClass,Thread.currentThread().getName()+" " +
-						"getInternalPolicyObject");
-				return policyObject;
-			}
-			// get Policy from Repository,cache it and then return the Policy
-			// Object
-
-			else if (_policyRepository.policyExists(policyRuleName))
-			{
-				if (logger.isLoggable(Level.FINE))
-				{	
-					logger.fine(Thread.currentThread().getName() + 
-							" get Policy from Repository,cache it and then return the Policy Object");
-				}    
-				String PolicyString = _policyRepository.getPolicyString(policyRuleName);
-				SPLPolicy internalPolicyObject = 
-					_policyParser.createInternalPolicyObject(policyRuleName,PolicyString);
-				_policyCache.insertPolicy(policyRuleName, internalPolicyObject);
-				//_serializeCimPolicyStorage();
-				logger.exiting(sourceClass,Thread.currentThread().getName()+" " 
-						+ "getInternalPolicyObject");
-				return internalPolicyObject;
-			}
-			else
-			{
-				logger.severe(Thread.currentThread().getName()+" "+"The Policy does not exist");
-				throw new PolicyDoesNotExistException(
-				"The Policy does not exist");
-			}
-		}
-		else
-		{
-			logger
-			.severe(Thread.currentThread().getName()+" "+"This CIM class is not handled by the Policy Provider");
-			throw new InvalidCIMParameterException(
-			"This CIM class is not handled by the Policy Provider");
-		}
-
-	}
-
-	public String getPolicy(String policyRuleName)
-	throws SPLException
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getPolicy");
-
-
-		if (policyRuleName != null)
-		{
-			// check to see if Policy exists, if so then return it
-			if (_policyRepository.policyExists(policyRuleName))
-			{
-				String policyString = _policyRepository.getPolicyString(policyRuleName);
-				logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getPolicy");
-				return policyString;
-			}
-			else
-			{
-				logger.severe(Thread.currentThread().getName()+" " + 
-				"The Policy does not exist");
-				throw new PolicyDoesNotExistException(
-				"The Policy does not exist");
-			}
-		}
-		else
-		{
-			logger
-			.severe(Thread.currentThread().getName()+" " + 
-					"The Policy cannot be found due to Invalid Policy Parameters");
-			throw new InvalidPolicyParameterException(
-			"The Policy cannot be found due to Invalid Policy Parameters");
-		}
-
-
-	}
-
-
-
-	public void updatePolicy(String policyRuleName, String policyString) throws SPLException
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "updatePolicy");
-
-		if ((policyRuleName != null) && (policyString != null))
-		{
-			//_readSerializedCimPolicyStorage();
-
-			// NEED TO CHECK FOR PRESENCE IN CACHE, DELETE IF ONE EXISTS
-			if (_policyRepository.policyExists(policyRuleName))
-			{
-				if (logger.isLoggable(Level.FINE))
-				{	
-					logger.fine(Thread.currentThread().getName()  + 
-							" Updating Policy in Repository");
-				}    
-				SPLPolicy internalPolicyObject = 
-					_policyParser.createInternalPolicyObject(policyRuleName,policyString);
-				// CALL CREATEINTERNALPOLICYOBJECT validate is for future
-				// use
-				if (internalPolicyObject != null)
-				{
-					_policyRepository.updatePolicy(policyRuleName,
-							policyString);
-					if (_policyCache.policyExists(policyRuleName))
-					{
-						_policyCache.deletePolicy(policyRuleName);
-						//_serializeCimPolicyStorage();
-						if (logger.isLoggable(Level.FINE))
-						{	
-							logger.fine(Thread.currentThread().getName() +
-									" Removing old Policy Object from cache");
-						}    
-					}
-					if (logger.isLoggable(Level.FINE))
-					{	
-						logger.fine(Thread.currentThread().getName() + 
-								" Adding new Policy Object to cache");
-					}    
-					_policyCache.insertPolicy(policyRuleName, internalPolicyObject);
-					//_serializeCimPolicyStorage();
-
-					logger.exiting(sourceClass,Thread.currentThread().getName() + 
-							" "+ "updatePolicy");
-				}
-			}
-			else
-			{
-				logger.severe(Thread.currentThread().getName()+" "+"The Policy does not exist");
-				throw new PolicyDoesNotExistException("The Policy does not exist");
-			}
-		}
-		else
-		{
-			logger
-			.severe(Thread.currentThread().getName()+" "+ 
-					"The Policy cannot be found due to Invalid Policy Parameters");
-			throw new InvalidPolicyParameterException(
-			"The Policy cannot be found due to Invalid Policy Parameters");
-		}
-
-
-
-	}
-
-	public PolicyInfo getPolicyInfo(String policyRuleName) throws SPLException {
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ 
-		"getInternalPolicyObject");
-		
-		if (policyRuleName != null)
-		{
-			
-			if (logger.isLoggable(Level.FINE))
-				logger.fine(Thread.currentThread().getName()+" get Policy object from Cache");
-
-		
-			if (_policyCache.policyExists(policyRuleName))
-			{
-		
-				
-				SPLPolicy policyObject = _policyCache.getPolicy(policyRuleName);
-				List importStmtList=policyObject.getImportStmtList();
-				logger.exiting(sourceClass,Thread.currentThread().getName()+" " +"getInternalPolicyObject");
-				PolicyInfo pi=new PolicyInfo( importStmtList);
-		
-				return pi;
-			}
-			// get Policy from Repository,cache it and then return the Policy
-			// Object
-
-			else if (_policyRepository.policyExists(policyRuleName))
-			{
-			
-				if (logger.isLoggable(Level.FINE))
-				{	
-					logger.fine(Thread.currentThread().getName() + 
-							" get Policy from Repository,cache it and then return the Policy Object");
-				}    
-				String PolicyString = _policyRepository.getPolicyString(policyRuleName);
-				
-				SPLPolicy internalPolicyObject = 
-					_policyParser.createInternalPolicyObject(policyRuleName,PolicyString);
-				
-				_policyCache.insertPolicy(policyRuleName, internalPolicyObject);
-				
-
-				logger.exiting(sourceClass,Thread.currentThread().getName()+" " 
-						+ "getInternalPolicyObject");
-				List importStmtList=internalPolicyObject.getImportStmtList();
-				logger.exiting(sourceClass,Thread.currentThread().getName()+" " +"getInternalPolicyObject");
-				PolicyInfo pi=new PolicyInfo( importStmtList);
-				return pi;
-			}
-			else
-			{
-
-			
-				logger.severe(Thread.currentThread().getName()+" "+"The Policy does not exist");
-				throw new PolicyDoesNotExistException(
-				"The Policy does not exist");
-			}
-		}
-		else
-		{
-
-			logger.severe(Thread.currentThread().getName()+" "+"policy name is null");
-			throw new InvalidCIMParameterException("policy name is null");
-		}
-
-	}
-
-	
-	public SPLPolicy createSPLPolicyObject(String policyName, String policyString) 
-	throws SPLException
-	{
-
-		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createPolicy");
-		// check to see if class name and name space are valid
-		
-		if ((policyName != null) && (policyString != null))
-		{
-			// check if Policy already exists in Repository
-				SPLPolicy internalPolicyObject = 
-					_policyParser.createInternalPolicyObject(policyName,policyString);
-
-				if (internalPolicyObject != null)
-				{
-					if (logger.isLoggable(Level.FINE))
-					{	
-						logger.fine(Thread.currentThread().getName() + 
-								" created internal SPLPolicy");
-					}    
-					// create CIMObjectPath that is to be returned
-					return internalPolicyObject;
-				}
-
-			
-		}
-		else
-		{
-			logger.severe(Thread.currentThread().getName()+" " + 
-			"Policy Parameter is null");
-			throw new InvalidPolicyParameterException( "Policy Parameter is null");
-		}
-
-
-
-
-		return null;
-	}
-
-	public boolean validatePolicyString(String policyString) throws SPLException
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName() + " " + "validatePolicyString");
-		boolean pi=this._policyParser.validatePolicyString(policyString);
-		logger.exiting(sourceClass,Thread.currentThread().getName() + " " + "validatePolicyString");
-
-		return pi;
-	}
-
-}
+/*
+ * 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.datastore.impl;
+
+
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.datastore.PolicyDataStore;
+import org.apache.imperius.spl.datastore.PolicyParser;
+import org.apache.imperius.spl.datastore.PolicyRepository;
+import org.apache.imperius.spl.parser.exceptions.InvalidCIMParameterException;
+import org.apache.imperius.spl.parser.exceptions.InvalidPolicyParameterException;
+import org.apache.imperius.spl.parser.exceptions.PolicyAlreadyExistsInRepositoryException;
+import org.apache.imperius.spl.parser.exceptions.PolicyDoesNotExistException;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.statements.impl.PolicyInfo;
+import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
+import org.apache.imperius.util.SPLLogger;
+
+
+public class PolicyDataStoreImpl implements PolicyDataStore
+{
+
+
+
+	private PolicyCache _policyCache = null;
+
+	private PolicyParser _policyParser = null;
+
+	private PolicyRepository _policyRepository = null;
+
+
+	private static final String sourceClass = "PolicyDataStoreImpl";
+
+	private static Logger logger = SPLLogger.getSPLLogger().getLogger();
+
+	public PolicyDataStoreImpl()
+	{
+
+		init();
+	}
+
+	public void init()
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "init");
+
+		_policyCache = new PolicyCache();
+		_policyRepository = new PolicyRepositoryImpl();
+		_policyParser = new PolicyParserImpl();
+	
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "init");
+	}
+
+
+	public void shutdown()
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "shutdown");
+		_policyParser.shutDown();
+		_policyRepository.shutdown();
+		logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "shutdown");
+	}
+
+	public boolean createPolicy(String policyName, String policyString) 
+	throws SPLException
+	{
+
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createPolicy");
+		// check to see if class name and namespace are valid
+		boolean res = false;
+
+		if ((policyName != null) && (policyString != null))
+		{
+			// check if Policy already exists in Repository
+			if (!_policyRepository.policyExists(policyName))
+			{
+				SPLPolicy internalPolicyObject = 
+					_policyParser.createInternalPolicyObject(policyName,policyString);
+
+				if (internalPolicyObject != null)
+				{
+					if (logger.isLoggable(Level.FINE))
+					{	
+						logger.fine(Thread.currentThread().getName() + 
+								" created internal SPLPolicy");
+					}    
+					// create CIMObjectPath that is to be returned
+					res = _policyRepository.insertPolicy(
+							policyName, policyString);
+					if (logger.isLoggable(Level.FINE))
+					{	
+						logger.fine(Thread.currentThread().getName() + 
+								" inserted Policy into PolicyRepository");
+					}    
+					
+					_policyCache.insertPolicy(policyName,internalPolicyObject);
+					
+
+				}
+
+			}
+			else
+			{
+				logger
+				.severe(Thread.currentThread().getName() +" " +
+						"Cannot create new Policy asPolicy already exists . Try updating.");
+				throw new PolicyAlreadyExistsInRepositoryException(
+				"Cannot create new Policy asPolicy already exists");
+			}
+		}
+		else
+		{
+			logger.severe(Thread.currentThread().getName()+" " + 
+			"Policy Parameter is null");
+			throw new InvalidPolicyParameterException( "Policy Parameter is null");
+		}
+
+
+
+
+		return res;
+	}
+
+	public void deletePolicy(String policyName)
+	throws SPLException
+	{
+		// logger.entry("deletePolicy");
+
+		// check to see if they r null
+		// check if it already exists
+		// put in a utility to check a cim object
+
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "deletePolicy");
+
+		// get name of Policy to be deleted
+
+		if (policyName != null)
+		{
+			//_readSerializedCimPolicyStorage();
+			if (logger.isLoggable(Level.FINE))
+			{	
+				logger.fine(Thread.currentThread().getName() + 
+						" Deleting Policy Object from cache");
+			}    
+			// delete Policy from cache
+			_policyCache.deletePolicy(policyName);
+
+			if (logger.isLoggable(Level.FINE))
+			{	
+				logger.fine(Thread.currentThread().getName() + 
+						" Deleting Policy from policyRepository");
+			}    
+			// delete policy from Repository
+			if (_policyRepository.policyExists(policyName))
+			{
+				_policyRepository.deletePolicy(policyName);
+				logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "deletePolicy");
+			}
+			else
+			{
+				logger.severe(Thread.currentThread().getName()+" " + 
+				"The Policy cannot be deleted as it does not exist in the Repository");
+				throw new PolicyDoesNotExistException(
+				"The Policy cannot be deleted as it does not exist in the Repository");
+			}
+		}
+		else
+		{
+			logger.severe(Thread.currentThread().getName()+" " + 
+			"The Policy cannot be found due to Invalid Policy Parameters");
+			throw new InvalidPolicyParameterException(
+			"The Policy cannot be found due to Invalid Policy Parameters");
+		}
+
+	}
+
+	public Map getAllPolicies()
+	throws SPLException
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getAllPolicies");
+
+		// enumerating Policies from policyRepository
+		if (logger.isLoggable(Level.FINE))
+			logger.fine(Thread.currentThread().getName() + 
+					" enumerating Policies from policyRepository");
+		// USE equalscase instead
+
+		Map policies = _policyRepository.getAllPolicies();
+
+		return policies;
+
+
+
+	}
+
+	public List getAllPolicyNames() throws SPLException
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getAllPolicyNames");
+		List policyNames = _policyRepository.getAllPolicyNames(); 
+
+		return policyNames;
+
+	}
+
+	public SPLPolicy getInternalPolicyObject(String policyRuleName)
+	throws SPLException
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ 
+		"getInternalPolicyObject");
+		if (policyRuleName != null)
+		{
+			//_readSerializedCimPolicyStorage();
+			// get Policy object from Cache
+			if (logger.isLoggable(Level.FINE))
+				logger.fine(Thread.currentThread().getName()+" get Policy object from Cache");
+
+			if (_policyCache.policyExists(policyRuleName))
+			{
+				SPLPolicy policyObject = _policyCache.getPolicy(policyRuleName);
+				logger.exiting(sourceClass,Thread.currentThread().getName()+" " +
+						"getInternalPolicyObject");
+				return policyObject;
+			}
+			// get Policy from Repository,cache it and then return the Policy
+			// Object
+
+			else if (_policyRepository.policyExists(policyRuleName))
+			{
+				if (logger.isLoggable(Level.FINE))
+				{	
+					logger.fine(Thread.currentThread().getName() + 
+							" get Policy from Repository,cache it and then return the Policy Object");
+				}    
+				String PolicyString = _policyRepository.getPolicyString(policyRuleName);
+				SPLPolicy internalPolicyObject = 
+					_policyParser.createInternalPolicyObject(policyRuleName,PolicyString);
+				_policyCache.insertPolicy(policyRuleName, internalPolicyObject);
+				//_serializeCimPolicyStorage();
+				logger.exiting(sourceClass,Thread.currentThread().getName()+" " 
+						+ "getInternalPolicyObject");
+				return internalPolicyObject;
+			}
+			else
+			{
+				logger.severe(Thread.currentThread().getName()+" "+"The Policy does not exist");
+				throw new PolicyDoesNotExistException(
+				"The Policy does not exist");
+			}
+		}
+		else
+		{
+			logger
+			.severe(Thread.currentThread().getName()+" "+"This CIM class is not handled by the Policy Provider");
+			throw new InvalidCIMParameterException(
+			"This CIM class is not handled by the Policy Provider");
+		}
+
+	}
+
+	public String getPolicy(String policyRuleName)
+	throws SPLException
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "getPolicy");
+
+
+		if (policyRuleName != null)
+		{
+			// check to see if Policy exists, if so then return it
+			if (_policyRepository.policyExists(policyRuleName))
+			{
+				String policyString = _policyRepository.getPolicyString(policyRuleName);
+				logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "getPolicy");
+				return policyString;
+			}
+			else
+			{
+				logger.severe(Thread.currentThread().getName()+" " + 
+				"The Policy does not exist");
+				throw new PolicyDoesNotExistException(
+				"The Policy does not exist");
+			}
+		}
+		else
+		{
+			logger
+			.severe(Thread.currentThread().getName()+" " + 
+					"The Policy cannot be found due to Invalid Policy Parameters");
+			throw new InvalidPolicyParameterException(
+			"The Policy cannot be found due to Invalid Policy Parameters");
+		}
+
+
+	}
+
+
+
+	public void updatePolicy(String policyRuleName, String policyString) throws SPLException
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "updatePolicy");
+
+		if ((policyRuleName != null) && (policyString != null))
+		{
+			//_readSerializedCimPolicyStorage();
+
+			// NEED TO CHECK FOR PRESENCE IN CACHE, DELETE IF ONE EXISTS
+			if (_policyRepository.policyExists(policyRuleName))
+			{
+				if (logger.isLoggable(Level.FINE))
+				{	
+					logger.fine(Thread.currentThread().getName()  + 
+							" Updating Policy in Repository");
+				}    
+				SPLPolicy internalPolicyObject = 
+					_policyParser.createInternalPolicyObject(policyRuleName,policyString);
+				// CALL CREATEINTERNALPOLICYOBJECT validate is for future
+				// use
+				if (internalPolicyObject != null)
+				{
+					_policyRepository.updatePolicy(policyRuleName,
+							policyString);
+					if (_policyCache.policyExists(policyRuleName))
+					{
+						_policyCache.deletePolicy(policyRuleName);
+						//_serializeCimPolicyStorage();
+						if (logger.isLoggable(Level.FINE))
+						{	
+							logger.fine(Thread.currentThread().getName() +
+									" Removing old Policy Object from cache");
+						}    
+					}
+					if (logger.isLoggable(Level.FINE))
+					{	
+						logger.fine(Thread.currentThread().getName() + 
+								" Adding new Policy Object to cache");
+					}    
+					_policyCache.insertPolicy(policyRuleName, internalPolicyObject);
+					//_serializeCimPolicyStorage();
+
+					logger.exiting(sourceClass,Thread.currentThread().getName() + 
+							" "+ "updatePolicy");
+				}
+			}
+			else
+			{
+				logger.severe(Thread.currentThread().getName()+" "+"The Policy does not exist");
+				throw new PolicyDoesNotExistException("The Policy does not exist");
+			}
+		}
+		else
+		{
+			logger
+			.severe(Thread.currentThread().getName()+" "+ 
+					"The Policy cannot be found due to Invalid Policy Parameters");
+			throw new InvalidPolicyParameterException(
+			"The Policy cannot be found due to Invalid Policy Parameters");
+		}
+
+
+
+	}
+
+	public PolicyInfo getPolicyInfo(String policyRuleName) throws SPLException {
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ 
+		"getInternalPolicyObject");
+		
+		if (policyRuleName != null)
+		{
+			
+			if (logger.isLoggable(Level.FINE))
+				logger.fine(Thread.currentThread().getName()+" get Policy object from Cache");
+
+		
+			if (_policyCache.policyExists(policyRuleName))
+			{
+		
+				
+				SPLPolicy policyObject = _policyCache.getPolicy(policyRuleName);
+				List importStmtList=policyObject.getImportStmtList();
+				logger.exiting(sourceClass,Thread.currentThread().getName()+" " +"getInternalPolicyObject");
+				PolicyInfo pi=new PolicyInfo( importStmtList);
+		
+				return pi;
+			}
+			// get Policy from Repository,cache it and then return the Policy
+			// Object
+
+			else if (_policyRepository.policyExists(policyRuleName))
+			{
+			
+				if (logger.isLoggable(Level.FINE))
+				{	
+					logger.fine(Thread.currentThread().getName() + 
+							" get Policy from Repository,cache it and then return the Policy Object");
+				}    
+				String PolicyString = _policyRepository.getPolicyString(policyRuleName);
+				
+				SPLPolicy internalPolicyObject = 
+					_policyParser.createInternalPolicyObject(policyRuleName,PolicyString);
+				
+				_policyCache.insertPolicy(policyRuleName, internalPolicyObject);
+				
+
+				logger.exiting(sourceClass,Thread.currentThread().getName()+" " 
+						+ "getInternalPolicyObject");
+				List importStmtList=internalPolicyObject.getImportStmtList();
+				logger.exiting(sourceClass,Thread.currentThread().getName()+" " +"getInternalPolicyObject");
+				PolicyInfo pi=new PolicyInfo( importStmtList);
+				return pi;
+			}
+			else
+			{
+
+			
+				logger.severe(Thread.currentThread().getName()+" "+"The Policy does not exist");
+				throw new PolicyDoesNotExistException(
+				"The Policy does not exist");
+			}
+		}
+		else
+		{
+
+			logger.severe(Thread.currentThread().getName()+" "+"policy name is null");
+			throw new InvalidCIMParameterException("policy name is null");
+		}
+
+	}
+
+	
+	public SPLPolicy createSPLPolicyObject(String policyName, String policyString) 
+	throws SPLException
+	{
+
+		logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "createPolicy");
+		// check to see if class name and name space are valid
+		
+		if ((policyName != null) && (policyString != null))
+		{
+			// check if Policy already exists in Repository
+				SPLPolicy internalPolicyObject = 
+					_policyParser.createInternalPolicyObject(policyName,policyString);
+
+				if (internalPolicyObject != null)
+				{
+					if (logger.isLoggable(Level.FINE))
+					{	
+						logger.fine(Thread.currentThread().getName() + 
+								" created internal SPLPolicy");
+					}    
+					// create CIMObjectPath that is to be returned
+					return internalPolicyObject;
+				}
+
+			
+		}
+		else
+		{
+			logger.severe(Thread.currentThread().getName()+" " + 
+			"Policy Parameter is null");
+			throw new InvalidPolicyParameterException( "Policy Parameter is null");
+		}
+
+
+
+
+		return null;
+	}
+
+	public boolean validatePolicyString(String policyString) throws SPLException
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName() + " " + "validatePolicyString");
+		boolean pi=this._policyParser.validatePolicyString(policyString);
+		logger.exiting(sourceClass,Thread.currentThread().getName() + " " + "validatePolicyString");
+
+		return pi;
+	}
+
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyDataStoreImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyParserImpl.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyParserImpl.java?rev=611261&r1=611260&r2=611261&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyParserImpl.java (original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyParserImpl.java Fri Jan 11 10:56:30 2008
@@ -1,218 +1,218 @@
-/*
- * 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.datastore.impl;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import org.apache.imperius.spl.datastore.PolicyParser;
-import org.apache.imperius.spl.external.DataCollector;
-import org.apache.imperius.spl.parser.compiler.SPLLexer;
-import org.apache.imperius.spl.parser.compiler.SPLParser;
-import org.apache.imperius.spl.parser.compiler.SPLTreeParser;
-import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
-import org.apache.imperius.spl.parser.exceptions.SPLException;
-import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
-import org.apache.imperius.spl.parser.util.DataCollectorFactory;
-import org.apache.imperius.util.SPLLogger;
-
-import antlr.RecognitionException;
-import antlr.collections.AST;
-
-//import com.ibm.ac.javaspl.JavaDataCollectorImpl;
-//import com.ibm.ac.cimspl.CIMDataCollectorImpl;
-
-public class PolicyParserImpl implements PolicyParser
-{
-
-   // private CIMOMHandle handle = null;
-
-    private static final String sourceClass = "PolicyParserImpl";
-
-    private static Logger logger = null; //SPLLogger.getSPLLogger().getLogger();
-
-    static boolean showTree = false;
-
-        
-    public PolicyParserImpl()
-    {
-    	//System.out.println("in policyparserimpl ctor");
-    	logger = SPLLogger.getSPLLogger().getLogger();
-    	init();
-    }
-
-    public void init() 
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "init");
-        
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "init");
-
-    }
-
-    public void shutDown()
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "shutDown");
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "shutDown");
-
-    }
-
-    public SPLPolicy createInternalPolicyObject(String policyRuleName,
-            String policyString) throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "
-        		+ "CreateInternalPolicyObject");
-        try
-        {
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" " 
-            		+ "CreateInternalPolicyObject");
-            StringReader policyStringReader = new StringReader(policyString);
-            SPLPolicy pol =parseFile(policyRuleName, policyStringReader); 
-            return pol;
-
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-            logger.severe(Thread.currentThread().getName()+" " + 
-            		"Error encountered while parsing PolicyString");
-            throw new SPLException("Error encountered while parsing PolicyString");
-
-        }
-
-        // return cimpolicy;
-    }
-
-    public boolean validate(String PolicyRuleName, String PolicyString)
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
-
-        return true;
-    }
-
-    public static SPLPolicy parseFile(String f, Reader r) throws Exception
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "parseFile");
-
-        try
-        {
-            // Create a scanner that reads from the input stream passed to us
-            SPLLexer lexer = new SPLLexer(r);
-            lexer.setFilename(f);
-
-            // Create a parser that reads from the scanner
-            SPLParser parser = new SPLParser(lexer);
-            parser.setASTNodeClass("org.apache.imperius.spl.parser.compiler.ASTWithLineNumber");
-            parser.setFilename(f);
-            if (logger.isLoggable(Level.FINE))
-                logger.fine(Thread.currentThread().getName()+" start parse");
-
-            // start parsing at the compilationUnit rule
-            parser.splpolicy();
-            if (logger.isLoggable(Level.FINE))
-                logger.fine(Thread.currentThread().getName()+" parsing complete");
-            AST t = parser.getAST();
-            if (logger.isLoggable(Level.FINE))
-                logger.fine(Thread.currentThread().getName()+" got AST");
-            if (t != null)
-            {
-                traverseTree(t);
-            }
-            else
-            {
-                logger.severe(Thread.currentThread().getName()+" "+"No tree produced");
-
-            }
-
-            // do something with the tree
-            SPLPolicy pol = doTreeAction(f, parser.getAST(), parser.getTokenNames()); 
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "parseFile");
-            return pol;
-        }
-        catch (Exception e)
-        {
-            logger.severe(e.getMessage());
-            e.printStackTrace(); // so we can get stack trace
-            throw new SPLException(e.getMessage());
-        }
-    }
-
-    public static void traverseTree(AST t)
-    {
-
-    }
-
-    public static SPLPolicy doTreeAction(String f, AST t, String[] tokenNames) throws SPLException
-    {
-        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "doTreeAction");
-  
-        if (t == null)
-        {	
-            return null;
-        }    
-       
-        SPLTreeParser tparse = new SPLTreeParser();
-        tparse.setASTNodeClass("org.apache.imperius.spl.parser.compiler.ASTWithLineNumber");
-        try
-        {
-            DataCollector dc = DataCollectorFactory.getDataCollector();
-            SPLSymbolTable st=new SPLSymbolTable();
-            SPLPolicy cp = tparse.splpolicy(t, dc, st);
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "doTreeAction");
-            return cp;
-        }
-        
-        catch (RecognitionException e)
-        {
-            logger.severe(e.getMessage());
-            e.printStackTrace();
-            throw new SPLException(e.getMessage());
-            //return null;
-        }
-
-    }
-    
-	public boolean validatePolicyString(String policyString) throws SPLException
-	{
-		logger.entering(sourceClass,Thread.currentThread().getName() + " " + "validatePolicyString");
-		try
-        {
-            StringReader policyStringReader = new StringReader(policyString);
-            SPLPolicy pol =parseFile("validate",policyStringReader); 
-            logger.exiting(sourceClass,Thread.currentThread().getName()+" " 
-            		+ "CreateInternalPolicyObject");
-            
-            return true;
-
-        }
-        catch (Exception e)
-        {
-            e.printStackTrace();
-            logger.severe(Thread.currentThread().getName()+" " + 
-            		"Error encountered while parsing PolicyString "+e.getMessage());
-            return false;
-        }
-		
-		
-	}
-}
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+//
+
+/**
+ * @author Prashant Baliga <prabalig@in.ibm.com>
+ *
+ */
+
+package org.apache.imperius.spl.datastore.impl;
+
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import org.apache.imperius.spl.datastore.PolicyParser;
+import org.apache.imperius.spl.external.DataCollector;
+import org.apache.imperius.spl.parser.compiler.SPLLexer;
+import org.apache.imperius.spl.parser.compiler.SPLParser;
+import org.apache.imperius.spl.parser.compiler.SPLTreeParser;
+import org.apache.imperius.spl.parser.compiler.symboltable.SPLSymbolTable;
+import org.apache.imperius.spl.parser.exceptions.SPLException;
+import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
+import org.apache.imperius.spl.parser.util.DataCollectorFactory;
+import org.apache.imperius.util.SPLLogger;
+
+import antlr.RecognitionException;
+import antlr.collections.AST;
+
+//import com.ibm.ac.javaspl.JavaDataCollectorImpl;
+//import com.ibm.ac.cimspl.CIMDataCollectorImpl;
+
+public class PolicyParserImpl implements PolicyParser
+{
+
+   // private CIMOMHandle handle = null;
+
+    private static final String sourceClass = "PolicyParserImpl";
+
+    private static Logger logger = null; //SPLLogger.getSPLLogger().getLogger();
+
+    static boolean showTree = false;
+
+        
+    public PolicyParserImpl()
+    {
+    	//System.out.println("in policyparserimpl ctor");
+    	logger = SPLLogger.getSPLLogger().getLogger();
+    	init();
+    }
+
+    public void init() 
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "init");
+        
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "init");
+
+    }
+
+    public void shutDown()
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "shutDown");
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "shutDown");
+
+    }
+
+    public SPLPolicy createInternalPolicyObject(String policyRuleName,
+            String policyString) throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "
+        		+ "CreateInternalPolicyObject");
+        try
+        {
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" " 
+            		+ "CreateInternalPolicyObject");
+            StringReader policyStringReader = new StringReader(policyString);
+            SPLPolicy pol =parseFile(policyRuleName, policyStringReader); 
+            return pol;
+
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            logger.severe(Thread.currentThread().getName()+" " + 
+            		"Error encountered while parsing PolicyString");
+            throw new SPLException("Error encountered while parsing PolicyString");
+
+        }
+
+        // return cimpolicy;
+    }
+
+    public boolean validate(String PolicyRuleName, String PolicyString)
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+        logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "validate");
+
+        return true;
+    }
+
+    public static SPLPolicy parseFile(String f, Reader r) throws Exception
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "parseFile");
+
+        try
+        {
+            // Create a scanner that reads from the input stream passed to us
+            SPLLexer lexer = new SPLLexer(r);
+            lexer.setFilename(f);
+
+            // Create a parser that reads from the scanner
+            SPLParser parser = new SPLParser(lexer);
+            parser.setASTNodeClass("org.apache.imperius.spl.parser.compiler.ASTWithLineNumber");
+            parser.setFilename(f);
+            if (logger.isLoggable(Level.FINE))
+                logger.fine(Thread.currentThread().getName()+" start parse");
+
+            // start parsing at the compilationUnit rule
+            parser.splpolicy();
+            if (logger.isLoggable(Level.FINE))
+                logger.fine(Thread.currentThread().getName()+" parsing complete");
+            AST t = parser.getAST();
+            if (logger.isLoggable(Level.FINE))
+                logger.fine(Thread.currentThread().getName()+" got AST");
+            if (t != null)
+            {
+                traverseTree(t);
+            }
+            else
+            {
+                logger.severe(Thread.currentThread().getName()+" "+"No tree produced");
+
+            }
+
+            // do something with the tree
+            SPLPolicy pol = doTreeAction(f, parser.getAST(), parser.getTokenNames()); 
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "parseFile");
+            return pol;
+        }
+        catch (Exception e)
+        {
+            logger.severe(e.getMessage());
+            e.printStackTrace(); // so we can get stack trace
+            throw new SPLException(e.getMessage());
+        }
+    }
+
+    public static void traverseTree(AST t)
+    {
+
+    }
+
+    public static SPLPolicy doTreeAction(String f, AST t, String[] tokenNames) throws SPLException
+    {
+        logger.entering(sourceClass,Thread.currentThread().getName()+" "+ "doTreeAction");
+  
+        if (t == null)
+        {	
+            return null;
+        }    
+       
+        SPLTreeParser tparse = new SPLTreeParser();
+        tparse.setASTNodeClass("org.apache.imperius.spl.parser.compiler.ASTWithLineNumber");
+        try
+        {
+            DataCollector dc = DataCollectorFactory.getDataCollector();
+            SPLSymbolTable st=new SPLSymbolTable();
+            SPLPolicy cp = tparse.splpolicy(t, dc, st);
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" "+ "doTreeAction");
+            return cp;
+        }
+        
+        catch (RecognitionException e)
+        {
+            logger.severe(e.getMessage());
+            e.printStackTrace();
+            throw new SPLException(e.getMessage());
+            //return null;
+        }
+
+    }
+    
+	public boolean validatePolicyString(String policyString) throws SPLException
+	{
+		logger.entering(sourceClass,Thread.currentThread().getName() + " " + "validatePolicyString");
+		try
+        {
+            StringReader policyStringReader = new StringReader(policyString);
+            SPLPolicy pol =parseFile("validate",policyStringReader); 
+            logger.exiting(sourceClass,Thread.currentThread().getName()+" " 
+            		+ "CreateInternalPolicyObject");
+            
+            return true;
+
+        }
+        catch (Exception e)
+        {
+            e.printStackTrace();
+            logger.severe(Thread.currentThread().getName()+" " + 
+            		"Error encountered while parsing PolicyString "+e.getMessage());
+            return false;
+        }
+		
+		
+	}
+}

Propchange: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyParserImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message