Index: src/edu/ucsb/nceas/metacat/DistributionSection.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DistributionSection.java	(revision 5089)
+++ src/edu/ucsb/nceas/metacat/DistributionSection.java	(revision 5090)
@@ -31,6 +31,8 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.accesscontrol.AccessSection;
+
 /**
  * A Class that represents an XML access rule. It include principal and
  * permission
Index: src/edu/ucsb/nceas/metacat/MetaCatServlet.java
===================================================================
--- src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 5089)
+++ src/edu/ucsb/nceas/metacat/MetaCatServlet.java	(revision 5090)
@@ -73,6 +73,9 @@
 import com.oreilly.servlet.multipart.ParamPart;
 import com.oreilly.servlet.multipart.Part;
 
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlForSingleFile;
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlList;
 import edu.ucsb.nceas.metacat.cart.CartManager;
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
@@ -3548,7 +3551,7 @@
         // Make sure the parameter is not null
         if (docList == null || principalList == null || permTypeList == null
                 || permissionList == null) {
-            error = "Please check your parameter list, it should look like: "
+            error = "MetaCatServlet.handleSetAccessAction - Please check your parameter list, it should look like: "
                     + "?action=setaccess&docid=pipeline.1.1&principal=public"
                     + "&permission=read&permType=allow&permOrder=allowFirst";
             errorList.addElement(error);
@@ -3569,13 +3572,13 @@
         	packageSet = 
         		MetacatUtil.getOptionList(PropertyService.getProperty("xml.packagedoctypeset"));
         } catch (PropertyNotFoundException pnfe) {
-        	logMetacat.error("Could not find package doctype set.  Setting to null: " 
+        	logMetacat.error("MetaCatServlet.handleSetAccessAction - Could not find package doctype set.  Setting to null: " 
         			+ pnfe.getMessage());
         }
         //debug
         if (packageSet != null) {
             for (int i = 0; i < packageSet.size(); i++) {
-                logMetacat.debug("doctype in package set: "
+                logMetacat.debug("MetaCatServlet.handleSetAccessAction - doctype in package set: "
                         + packageSet.elementAt(i));
             }
         }
@@ -3601,7 +3604,7 @@
                 owner = getFieldValueForDoc(accessionNumber, "user_owner");
                 publicId = getFieldValueForDoc(accessionNumber, "doctype");
             } catch (Exception e) {
-                logMetacat.error("Error in handleSetAccessAction: "
+                logMetacat.error("MetaCatServlet.handleSetAccessAction - Error in handleSetAccessAction: "
                         + e.getMessage());
                 error = "Error in set access control for document - "
                         + accessionNumber + e.getMessage();
@@ -3643,23 +3646,12 @@
                 try {
                     //insert permission
                     AccessControlForSingleFile accessControl = new AccessControlForSingleFile(
-                            accessionNumber, principal, permission, permType,
-                            permOrder);
-                    if (!accessControl.accessControlExists()) {
-                    	accessControl.insertPermissions();
-	                    success = "Set access control to document "
-	                            + accessionNumber + " successfully";
-                    }
-                    else {
-                    	success = "Access control for document "
-                            + accessionNumber + " already exists";
-                    }
-                    successList.addElement(success);
+                            accessionNumber, principal, permission, permType, permOrder);
+                    accessControl.insertPermissions();
                 } catch (Exception ee) {
-                    logMetacat.error(
-                            "Erorr in handleSetAccessAction2: "
+                    logMetacat.error("MetaCatServlet.handleSetAccessAction - Error inserting permission: "
                             + ee.getMessage());
-                    error = "Faild to set access control for document "
+                    error = "Failed to set access control for document "
                             + accessionNumber + " because " + ee.getMessage();
                     errorList.addElement(error);
                     continue;
@@ -3673,7 +3665,7 @@
             }
             ForceReplicationHandler frh = 
             	new ForceReplicationHandler(accessionNumber, isXml, null);
-            logMetacat.debug("ForceReplicationHandler created: " + frh.toString());
+            logMetacat.debug("MetaCatServlet.handleSetAccessAction - ForceReplicationHandler created: " + frh.toString());
             
         }
         if (params.get("forwardto")  != null) {
Index: src/edu/ucsb/nceas/metacat/PermissionController.java
===================================================================
--- src/edu/ucsb/nceas/metacat/PermissionController.java	(revision 5089)
+++ src/edu/ucsb/nceas/metacat/PermissionController.java	(revision 5090)
@@ -36,6 +36,9 @@
 
 import org.apache.log4j.Logger;
 
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlForSingleFile;
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlList;
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.properties.PropertyService;
Index: src/edu/ucsb/nceas/metacat/DocumentImpl.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 5089)
+++ src/edu/ucsb/nceas/metacat/DocumentImpl.java	(revision 5090)
@@ -53,6 +53,8 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlList;
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.database.DatabaseService;
Index: src/edu/ucsb/nceas/metacat/DBQuery.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 5089)
+++ src/edu/ucsb/nceas/metacat/DBQuery.java	(revision 5090)
@@ -48,6 +48,7 @@
 import org.xml.sax.InputSource;
 import org.w3c.dom.ls.*;
 
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.properties.PropertyService;
Index: src/edu/ucsb/nceas/metacat/DBEntityResolver.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DBEntityResolver.java	(revision 5089)
+++ src/edu/ucsb/nceas/metacat/DBEntityResolver.java	(revision 5090)
@@ -31,6 +31,7 @@
 import org.xml.sax.*;
 import org.xml.sax.helpers.DefaultHandler;
 
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlList;
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.util.SystemUtil;
Index: src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java	(revision 5089)
+++ src/edu/ucsb/nceas/metacat/Eml200SAXHandler.java	(revision 5090)
@@ -48,6 +48,9 @@
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
+import edu.ucsb.nceas.metacat.accesscontrol.AccessRule;
+import edu.ucsb.nceas.metacat.accesscontrol.AccessSection;
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.properties.PropertyService;
Index: src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java	(revision 5089)
+++ src/edu/ucsb/nceas/metacat/Eml210SAXHandler.java	(revision 5090)
@@ -47,6 +47,9 @@
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
+import edu.ucsb.nceas.metacat.accesscontrol.AccessRule;
+import edu.ucsb.nceas.metacat.accesscontrol.AccessSection;
 import edu.ucsb.nceas.metacat.database.DBConnection;
 import edu.ucsb.nceas.metacat.database.DBConnectionPool;
 import edu.ucsb.nceas.metacat.properties.PropertyService;
Index: src/edu/ucsb/nceas/metacat/DocInfoHandler.java
===================================================================
--- src/edu/ucsb/nceas/metacat/DocInfoHandler.java	(revision 5089)
+++ src/edu/ucsb/nceas/metacat/DocInfoHandler.java	(revision 5090)
@@ -33,6 +33,8 @@
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
 
+import edu.ucsb.nceas.metacat.accesscontrol.AccessControlForSingleFile;
+
 /** 
  * A Class implementing callback bethods for the SAX parser to
  * call when processing the XML messages from the replication handler
