incubator-imperius-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From daw...@apache.org
Subject svn commit: r823677 - in /incubator/imperius/trunk: ./ imperius-splcore/src/main/java/org/apache/imperius/ imperius-splcore/src/main/java/org/apache/imperius/spl/ imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/ imperius-splcore/src/ma...
Date Fri, 09 Oct 2009 20:21:21 GMT
Author: dawood
Date: Fri Oct  9 20:21:21 2009
New Revision: 823677

URL: http://svn.apache.org/viewvc?rev=823677&view=rev
Log: (empty)

Added:
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/package.html
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/package.html
Removed:
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLogger2.java
Modified:
    incubator/imperius/trunk/build.xml
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/PolicyDataStore.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyDataStoreImpl.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyParser.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyRepository.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/PolicyManager.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/impl/PolicyManagerImpl.java
    incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLogger.java

Modified: incubator/imperius/trunk/build.xml
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/build.xml?rev=823677&r1=823676&r2=823677&view=diff
==============================================================================
--- incubator/imperius/trunk/build.xml (original)
+++ incubator/imperius/trunk/build.xml Fri Oct  9 20:21:21 2009
@@ -413,7 +413,7 @@
 
 	<target name="javadoc" >	<!-- can't be called directly (yet) -->
 		<javadoc destdir="${IMPERIUS_JAVADOC_DIR}" useexternalfile="yes" failonerror="true"
-			access="protected"	use="false"	windowtitle="Apache Imperius"	>
+			access="protected"	use="false" Author="false"	windowtitle="Apache Imperius"	>
 			
 		  	<group title="Core" packages="org.apache.imperius.spl*" />
 			<group title="Java Binding" packages="org.apache.imperius.javaspl*" />

Added: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/package.html
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/package.html?rev=823677&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/package.html
(added)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/package.html
Fri Oct  9 20:21:21 2009
@@ -0,0 +1,6 @@
+<html>
+<body>
+Provides a framework creating, parsing and evaluating CIM-SPL policies.  A key interface
to
+begin understanding the framework is the PolicyManager and it's implementation.
+</body>
+</html>
\ No newline at end of file

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=823677&r1=823676&r2=823677&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 Oct  9 20:21:21 2009
@@ -27,39 +27,113 @@
 import java.util.List;
 import java.util.Map;
 
+import org.apache.imperius.spl.core.Actuator;
+import org.apache.imperius.spl.core.DataCollector;
 import org.apache.imperius.spl.core.PolicyInfo;
 import org.apache.imperius.spl.parser.exceptions.SPLException;
 import org.apache.imperius.spl.parser.statements.impl.SPLPolicy;
 
+/**
+ * Provides the ability manage the storage of policies.
+ * Before using the container, it must be initialized
+ * through a call to {@link #init(DataCollector, Actuator)}.  When the 
+ * container is no longer needed, a call to {@link #shutdown()} should be made
+ * to clear up any resources.  Policies are stored in the container with
+ * a unique name.  
+ *  
+ * @author dawood@us.ibm.com
+ *
+ */
 public interface PolicyDataStore {
 
+	/**
+	 * Get the policy with the given name.
+	 * @param policyName
+	 * @return a policy string, never null.
+	 * @throws SPLException 
+	 */
 	public String getPolicy(String policyName) throws SPLException;
 
+	/**
+	 * Parse the given policy with the given name and provide the information about the policy.
+	 * @param policyName
+	 * @return
+	 * @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;
-
+	/**
+	 * Store the given policy and give it the given name.
+	 * @param policyName
+	 * @param policyString
+	 * @return true if stored successfully.
+	 * @throws SPLException
+	 */
+	public boolean createPolicy(String policyName, String policyString)	throws SPLException;
+
+    /**
+     * Determine if the given policy string is properly formatted and parsable.
+     * @param policyString the SPL policy.
+     * @return true if the the string is parsable, false otherwise.
+     * @throws SPLException // TODO: why do we need to throw an exception here?
+     */
+	public boolean validatePolicyString(String policyString) throws SPLException;
+
+	/**
+	 * Store the policy using the given name and create the Java object representing 
+	 * a parsed policy.
+	 * @param policyName
+	 * @param policyString
+	 * @return
+	 * @throws SPLException
+	 */
 	public SPLPolicy createSPLPolicyObject(String policyName,
 			String policyString) throws SPLException;
 
-	public void updatePolicy(String policyName, String policyString)
-			throws SPLException;
-
+	/**
+	 * Replace the definition of the policy with the given name.
+	 * @param policyName
+	 * @param policyString new policy definition.
+	 * @throws SPLException
+	 */
+	public void updatePolicy(String policyName, String policyString) throws SPLException;
+
+	/**
+	 * Remove the named policy from the repository.
+	 * @param policyName name of the policy.
+	 * @throws SPLException if the named policy does not exist.
+	 */
 	public void deletePolicy(String policyName) throws SPLException;
 
+	/**
+	 * Get a map of all policies mapped from the name of the policy to the policy string.
+	 * @return
+	 * @throws SPLException
+	 */
 	public Map getAllPolicies() throws SPLException;
 
 	public List getAllPolicyNames() throws SPLException;
 
+	/**
+	 * Initialize the storage.
+	 * Calls to access/add policies before this may throw exceptions or otherwise fail.
+	 * @throws SPLException
+	 */
 	public void init() throws SPLException;
 
+	/**
+	 * Signal that the storage is no longer needed.
+	 * Calls to access/add policies after this call and before a call
+	 * to {@link #init()} may fail.
+	 */
 	public void shutdown();
 
-	public SPLPolicy getInternalPolicyObject(String PolicyRuleName)
-			throws SPLException;
+	/**
+	 * Get the java object representation of the parsed policy associated with the given name.
+	 * @param PolicyRuleName
+	 * @return
+	 * @throws SPLException
+	 */
+	public SPLPolicy getInternalPolicyObject(String PolicyRuleName)	throws SPLException;
 
 }

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=823677&r1=823676&r2=823677&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 Oct  9 20:21:21 2009
@@ -39,6 +39,13 @@
 import org.apache.imperius.util.Messages;
 import org.apache.imperius.util.SPLLogger;
 
+/**
+ * Implementation of PolicyDataStore that stores policies using serialization to 
+ * the file PolicyStorage.DAT in the SPLLogger's home directory.
+ * 
+ * @author dawood@us.ibm.com
+ *
+ */
 public class PolicyDataStoreImpl implements PolicyDataStore 
 {
 	private PolicyCache _policyCache = null;

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyParser.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyParser.java?rev=823677&r1=823676&r2=823677&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyParser.java
(original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyParser.java
Fri Oct  9 20:21:21 2009
@@ -41,6 +41,12 @@
     
     public void shutDown();
     
+    /**
+     * Determine if the given policy string is properly formatted and parsable.
+     * @param policyString the SPL policy.
+     * @return true if the the string is parsable, false otherwise.
+     * @throws SPLException // TODO: why do we need to throw an exception here?
+     */
     public boolean validatePolicyString(String policyString) throws SPLException;
     
 }

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyRepository.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyRepository.java?rev=823677&r1=823676&r2=823677&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyRepository.java
(original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/datastore/impl/PolicyRepository.java
Fri Oct  9 20:21:21 2009
@@ -47,6 +47,11 @@
     
     public void deletePolicy(String PolicyRuleName) throws SPLException;
     
+    /**
+     * Get a map of that maps from policy names to the policy strings.
+     * @return
+     * @throws SPLException
+     */
     public Map getAllPolicies() throws SPLException;
     
     public List getAllPolicyNames() throws SPLException;

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/PolicyManager.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/PolicyManager.java?rev=823677&r1=823676&r2=823677&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/PolicyManager.java
(original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/PolicyManager.java
Fri Oct  9 20:21:21 2009
@@ -36,7 +36,17 @@
 import org.apache.imperius.spl.core.PolicyInfo;
 import org.apache.imperius.spl.parser.exceptions.SPLException;
 
-
+/**
+ * Provides the ability manage the storage of policies and to evaluate policies
+ * contained in the container.  Before using the container, it must be initialized
+ * through a call to {@link #init(DataCollector, Actuator)}.  When the 
+ * container is no longer needed, a call to {@link #shutdown()} should be made
+ * to clear up any resources.  Policies are stored in the container with
+ * a unique name.  Once stored, policies may be evaluated by name.
+ *  
+ * @author dawood@us.ibm.com
+ *
+ */
 public interface PolicyManager
 {
     /**
@@ -45,7 +55,6 @@
      * @return
      * @throws SPLException
      */
-    
     public String getPolicy(String name)
     	throws SPLException;
     
@@ -56,7 +65,6 @@
      * @return
      * @throws SPLException
      */
-    
     public PolicyInfo getPolicyInfo(String policyName)
     	throws SPLException;
     
@@ -67,12 +75,11 @@
      * @return
      * @throws SPLException
      */
-    
     public boolean createPolicy(String policyName, String policyString) 
     	throws SPLException;
     
     /**
-     * Updates the policy with the given name with the provided string
+     * Updates the policy with the given name with the provided string.
      * @param policyName
      * @param policyString
      * @throws SPLException
@@ -120,30 +127,50 @@
     	throws SPLException;
     
     /**
-     * Initializes the SPL Engine, Inputs are instances of DataCollector and Actuator
+     * Initializes the instance wit the given DataCollector and Actuator
      * @param dc
      * @param ac
      * @throws SPLException
      * @throws IOException
      */
-    public void init(DataCollector dc, Actuator ac) 
-    	throws SPLException, IOException;
+    public void init(DataCollector dc, Actuator ac) 	throws SPLException, IOException;
     
-    public void setSPLHome(String location);
-    
-    public String getSPLHome();
+//    public void setSPLHome(String location);
+//    
+//    public String getSPLHome();
     
+    /**
+     * Place the given policy into the container and then evaluate it against the 
+     * given instance data.
+     * @param policyName name to be assigned in the container
+     * @param policyString SPL policy 
+     * @param instances the instance data to be applied to the policy.
+     * @return TODO
+     * @throws SPLException
+     */
     public Object evaluatePolicyString(String policyName, String policyString, Map instances)
throws SPLException; 
 	
-    
+    /**
+     * Set the whether logging should be on or off.
+     * 
+     * @param enableOrDisable
+     */
     public void enableLogging(boolean enableOrDisable);
     
     /**
-     * Shutsdown the SPL Engine
+     * Shutdown  this instance.
+     * Evaluation requests made after this call and before another call to {@link #init(DataCollector,
Actuator)}
+     * may cause exceptions.
      *
      */
     public void shutdown();
     
+    /**
+     * Determine if the given policy string is properly formatted and parsable.
+     * @param policyString the SPL policy.
+     * @return true if the the string is parsable, false otherwise.
+     * @throws SPLException // TODO: why do we need to throw an exception here?
+     */
     public boolean validatePolicyString(String policyString) throws SPLException;
     
  

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/impl/PolicyManagerImpl.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/impl/PolicyManagerImpl.java?rev=823677&r1=823676&r2=823677&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/impl/PolicyManagerImpl.java
(original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/manager/impl/PolicyManagerImpl.java
Fri Oct  9 20:21:21 2009
@@ -216,15 +216,15 @@
 		}
 	}
 
-	public void setSPLHome(String location) 
-	{
-		SPLLogger.SPL_HOME = location;
-	}
-
-	public String getSPLHome() 
-	{
-		return SPLLogger.SPL_HOME;
-	}
+//	public void setSPLHome(String location) 
+//	{
+//		SPLLogger.SPL_HOME = location;
+//	}
+//
+//	public String getSPLHome() 
+//	{
+//		return SPLLogger.SPL_HOME;
+//	}
 
 	public void enableLogging(boolean enableOrDisable) 
 	{

Added: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/package.html
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/package.html?rev=823677&view=auto
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/package.html
(added)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/spl/package.html
Fri Oct  9 20:21:21 2009
@@ -0,0 +1,6 @@
+<html>
+<body>
+Provides a framework creating, parsing and evaluating CIM-SPL policies.  A key interface
to
+begin understanding the framework is the PolicyManager and it's implementation.
+</body>
+</html>
\ No newline at end of file

Modified: incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLogger.java
URL: http://svn.apache.org/viewvc/incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLogger.java?rev=823677&r1=823676&r2=823677&view=diff
==============================================================================
--- incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLogger.java
(original)
+++ incubator/imperius/trunk/imperius-splcore/src/main/java/org/apache/imperius/util/SPLLogger.java
Fri Oct  9 20:21:21 2009
@@ -36,6 +36,11 @@
 	private static boolean ENABLE_SPL_LOGGING = true;
 	
 	public static final String fileSeparator = System.getProperty("file.separator");
+	
+	/**
+	 * Location of log files. 
+	 * Initialized to the current directory (i.e. user.dir property)
+	 */
 	public static String SPL_HOME = System.getProperty("user.dir");
 	
 	// SPL Log Handler



Mime
View raw message