manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1535983 [1/2] - in /manifoldcf/trunk: ./ connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/ framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/ framework/crawler-ui/src/main...
Date Sat, 26 Oct 2013 12:46:19 GMT
Author: kwright
Date: Sat Oct 26 12:46:18 2013
New Revision: 1535983

URL: http://svn.apache.org/r1535983
Log:
CONNECTORS-792: Add authority groups, authorization domains, etc.  WARNING: Schema change!! Upgrade code has been added too, but not yet tested.

Added:
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editgroup.jsp
      - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/editgroup.jsp
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/listgroups.jsp
      - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/listgroups.jsp
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewgroup.jsp
      - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/crawler-ui/src/main/webapp/viewgroup.jsp
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authdomains/
      - copied from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authdomains/
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authgroups/
      - copied from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authgroups/
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java
      - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorityGroupManagerFactory.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorizationDomainManagerFactory.java
      - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/AuthorizationDomainManagerFactory.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroup.java
      - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroup.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroupManager.java
      - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityGroupManager.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorizationDomainManager.java
      - copied unchanged from r1535981, manifoldcf/branches/CONNECTORS-792/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorizationDomainManager.java
Modified:
    manifoldcf/trunk/   (props changed)
    manifoldcf/trunk/CHANGES.txt
    manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSSession.java
    manifoldcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/UserACLServlet.java
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editauthority.jsp
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editconnection.jsp
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/execute.jsp
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/listconnections.jsp
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/navigation.jsp
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewauthority.jsp
    manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewconnection.jsp
    manifoldcf/trunk/framework/example-common/connectors.xml
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnection.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/CacheKeyFactory.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnection.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnectionManager.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnectionManager.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java
    manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/system/ManifoldCF.java
    manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_en_US.properties
    manifoldcf/trunk/framework/ui-core/src/main/native2ascii/org/apache/manifoldcf/ui/i18n/common_ja_JP.properties
    manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/concepts.xml
    manifoldcf/trunk/site/src/documentation/content/xdocs/en_US/programmatic-operation.xml
    manifoldcf/trunk/site/src/documentation/content/xdocs/ja_JP/programmatic-operation.xml
    manifoldcf/trunk/tests/activedirectory/src/test/java/org/apache/manifoldcf/activedirectory_tests/NavigationDerbyUI.java
    manifoldcf/trunk/tests/cmis/src/test/java/org/apache/manifoldcf/cmis_tests/NavigationDerbyUI.java
    manifoldcf/trunk/tests/jdbc/src/test/java/org/apache/manifoldcf/jdbc_tests/NavigationDerbyUI.java
    manifoldcf/trunk/tests/ldap/src/test/java/org/apache/manifoldcf/ldap_tests/NavigationDerbyUI.java

Propchange: manifoldcf/trunk/
------------------------------------------------------------------------------
  Merged /manifoldcf/branches/CONNECTORS-792:r1534965-1535981

Modified: manifoldcf/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/CHANGES.txt?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/CHANGES.txt (original)
+++ manifoldcf/trunk/CHANGES.txt Sat Oct 26 12:46:18 2013
@@ -3,6 +3,14 @@ $Id$
 
 ======================= 1.5-dev =====================
 
+CONNECTORS-792: Introduce concepts of authorization domain
+and authority group, and appropriate UI, API, etc. changes.  This
+is to support federated authorization models such as what SharePoint
+Claim Space fundamentally does, where there are multiple authorities
+per repository.
+WARNING: Schema change!
+(Karl Wright)
+
 ======================= Release 1.4 =====================
 
 CONNECTORS-791: Broken WHERE clause in job status query.

Modified: manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSSession.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSSession.java?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSSession.java (original)
+++ manifoldcf/trunk/connectors/hdfs/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/hdfs/HDFSSession.java Sat Oct 26 12:46:18 2013
@@ -61,11 +61,12 @@ public class HDFSSession {
     info.put("Name Node", nameNode);
     info.put("Config", config.toString());
     info.put("User", user);
+    // Commented much of this out because each timeout is too long if there's no connection
     info.put("Canonical Service Name", fileSystem.getCanonicalServiceName());
-    info.put("Default Block Size", Long.toString(fileSystem.getDefaultBlockSize()));
-    info.put("Default Replication", Short.toString(fileSystem.getDefaultReplication()));
-    info.put("Home Directory", fileSystem.getHomeDirectory().toUri().toString());
-    info.put("Working Directory", fileSystem.getWorkingDirectory().toUri().toString());
+    //info.put("Default Block Size", Long.toString(fileSystem.getDefaultBlockSize()));
+    //info.put("Default Replication", Short.toString(fileSystem.getDefaultReplication()));
+    //info.put("Home Directory", fileSystem.getHomeDirectory().toUri().toString());
+    //info.put("Working Directory", fileSystem.getWorkingDirectory().toUri().toString());
     return info;
   }
 

Modified: manifoldcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/UserACLServlet.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/UserACLServlet.java?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/UserACLServlet.java (original)
+++ manifoldcf/trunk/framework/authority-servlet/src/main/java/org/apache/manifoldcf/authorityservlet/UserACLServlet.java Sat Oct 26 12:46:18 2013
@@ -106,13 +106,37 @@ public class UserACLServlet extends Http
 
       Logging.authorityService.debug("Received request");
 
+      Map<String,String> domainMap = new HashMap<String,String>();
+
+      // Legacy mode: single user name with optional domain
       String userID = request.getParameter("username");
-      if (userID == null)
+      if (userID != null)
+      {
+        String domain = request.getParameter("domain");
+        if (domain == null)
+          domain = "";
+        domainMap.put(domain,userID);
+      }
+      
+      // Now, go through enumerated username/domain pairs
+      int q = 0;
+      while (true)
+      {
+        String enumUserName = request.getParameter("username_"+q);
+        if (enumUserName == null)
+          break;
+        String enumDomain = request.getParameter("domain_"+q);
+        if (enumDomain == null)
+          enumDomain = "";
+        domainMap.put(enumDomain,enumUserName);
+      }
+      
+      if (domainMap.size() == 0)
       {
         response.sendError(response.SC_BAD_REQUEST);
         return;
       }
-
+      
       boolean idneeded = false;
       boolean aclneeded = true;
 
@@ -135,7 +159,18 @@ public class UserACLServlet extends Http
 
       if (Logging.authorityService.isDebugEnabled())
       {
-        Logging.authorityService.debug("Received authority request for user '"+userID+"'");
+        StringBuilder sb2 = new StringBuilder("[");
+        boolean first = true;
+        for (String domain : domainMap.keySet())
+        {
+          if (first)
+            first = false;
+          else
+            sb2.append(",");
+          sb2.append("'").append(domain).append("':'").append(domainMap.get(domain)).append("'");
+        }
+        sb2.append("]");
+        Logging.authorityService.debug("Received authority request for domain:user set "+sb2.toString());
       }
 
       RequestQueue<MappingRequest> mappingQueue = ManifoldCF.getMappingRequestQueue();
@@ -158,15 +193,15 @@ public class UserACLServlet extends Http
       IMappingConnectionManager mappingConnManager = MappingConnectionManagerFactory.make(itc);
       IAuthorityConnectionManager authConnManager = AuthorityConnectionManagerFactory.make(itc);
 
+      // Get all mapping connections; we may not need them all but we do need to be able to look them all up
       IMappingConnection[] mappingConnections = mappingConnManager.getAllConnections();
-      IAuthorityConnection[] connections = authConnManager.getAllConnections();
       
       // One thread per connection, which is responsible for starting the mapping process when it is ready.
       List<MappingOrderThread> mappingThreads = new ArrayList<MappingOrderThread>();
       // One thread per authority, which is responsible for starting the auth request when it is ready.
       List<AuthOrderThread> authThreads = new ArrayList<AuthOrderThread>();
 
-      Map<String,MappingRequest> mappingRequests = new HashMap<String,MappingRequest>();
+      Map<MapperDescription,MappingRequest> mappingRequests = new HashMap<MapperDescription,MappingRequest>();
       Map<String,AuthRequest> authRequests = new HashMap<String,AuthRequest>();
 
       Map<String,IMappingConnection> mappingConnMap = new HashMap<String,IMappingConnection>();
@@ -178,46 +213,56 @@ public class UserACLServlet extends Http
       }
 
       // Set of connections we need to fire off
-      Set<String> activeConnections = new HashSet<String>();
+      Set<MapperDescription> activeConnections = new HashSet<MapperDescription>();
 
       // We do the minimal set of mapping requests and authorities.  Since it is the authority tokens we are
       // looking for, we start there, and build authority requests first, then mapping requests that support them,
       // etc.
       // Create auth requests
-      for (int i = 0; i < connections.length; i++)
+      for (String authDomain : domainMap.keySet())
       {
-        IAuthorityConnection thisConnection = connections[i];
-        String identifyingString = thisConnection.getDescription();
-        if (identifyingString == null || identifyingString.length() == 0)
-          identifyingString = thisConnection.getName();
-        
-        // Create a request
-        AuthRequest ar = new AuthRequest(
-          thisConnection.getClassName(),identifyingString,thisConnection.getConfigParams(),thisConnection.getMaxConnections());
-        authRequests.put(thisConnection.getName(), ar);
-        
-        // We create an auth thread if there are prerequisites to meet.
-        // Otherwise, we just fire off the request
-        if (thisConnection.getPrerequisiteMapping() == null)
-        {
-          ar.setUserID(userID);
-          queue.addRequest(ar);
-        }
-        else
+        IAuthorityConnection[] connections = authConnManager.getDomainConnections(authDomain);
+        for (int i = 0; i < connections.length; i++)
         {
-          AuthOrderThread thread = new AuthOrderThread(identifyingString,
-            ar, thisConnection.getPrerequisiteMapping(),
-            queue, mappingRequests);
-          authThreads.add(thread);
-          activeConnections.add(thisConnection.getPrerequisiteMapping());
+          IAuthorityConnection thisConnection = connections[i];
+          String identifyingString = thisConnection.getDescription();
+          if (identifyingString == null || identifyingString.length() == 0)
+            identifyingString = thisConnection.getName();
+          
+          // Create a request
+          AuthRequest ar = new AuthRequest(
+            thisConnection.getClassName(),identifyingString,thisConnection.getConfigParams(),thisConnection.getMaxConnections());
+          authRequests.put(thisConnection.getName(), ar);
+          
+          // We create an auth thread if there are prerequisites to meet.
+          // Otherwise, we just fire off the request
+          String domainUserID = domainMap.get(authDomain);
+          if (thisConnection.getPrerequisiteMapping() == null)
+          {
+            ar.setUserID(domainUserID);
+            queue.addRequest(ar);
+          }
+          else
+          {
+            MapperDescription md = new MapperDescription(thisConnection.getPrerequisiteMapping(),authDomain);
+            AuthOrderThread thread = new AuthOrderThread(identifyingString,
+              ar, md,
+              queue, mappingRequests);
+            authThreads.add(thread);
+            // The same mapper can be used for multiple domains, although this is likely to be uncommon.  Nevertheless,
+            // mapper invocations need to be segregated to prevent trouble
+            activeConnections.add(md);
+          }
         }
       }
 
       // Create mapping requests
       while (!activeConnections.isEmpty())
       {
-        Iterator<String> connectionIter = activeConnections.iterator();
-        String connectionName = connectionIter.next();
+        Iterator<MapperDescription> connectionIter = activeConnections.iterator();
+        MapperDescription mapperDesc = connectionIter.next();
+        String connectionName = mapperDesc.mapperName;
+        String authDomain = mapperDesc.authDomain;
         IMappingConnection thisConnection = mappingConnMap.get(connectionName);
         String identifyingString = thisConnection.getDescription();
         if (identifyingString == null || identifyingString.length() == 0)
@@ -226,25 +271,25 @@ public class UserACLServlet extends Http
         // Create a request
         MappingRequest mr = new MappingRequest(
           thisConnection.getClassName(),identifyingString,thisConnection.getConfigParams(),thisConnection.getMaxConnections());
-        mappingRequests.put(connectionName, mr);
+        mappingRequests.put(mapperDesc, mr);
 
         // Either start up a thread, or just fire it off immediately.
         if (thisConnection.getPrerequisiteMapping() == null)
         {
-          mr.setUserID(userID);
+          mr.setUserID(domainMap.get(authDomain));
           mappingQueue.addRequest(mr);
         }
         else
         {
           //System.out.println("Mapper: prerequisite found: '"+thisConnection.getPrerequisiteMapping()+"'");
+          MapperDescription p = new MapperDescription(thisConnection.getPrerequisiteMapping(),authDomain);
           MappingOrderThread thread = new MappingOrderThread(identifyingString,
-            mr, thisConnection.getPrerequisiteMapping(), mappingQueue, mappingRequests);
+            mr, p, mappingQueue, mappingRequests);
           mappingThreads.add(thread);
-          String p = thisConnection.getPrerequisiteMapping();
           if (mappingRequests.get(p) == null)
             activeConnections.add(p);
         }
-        activeConnections.remove(connectionName);
+        activeConnections.remove(mapperDesc);
       }
       
       // Start threads.  We have to wait until all the requests have been
@@ -287,25 +332,24 @@ public class UserACLServlet extends Http
       
       // Now, work through the returning answers.
 
-      // Ask all the registered authorities for their ACLs, and merge the final list together.
+      // Ask all the interrogated authorities for their ACLs, and merge the final list together.
       StringBuilder sb = new StringBuilder();
       // Set response mime type
       response.setContentType("text/plain; charset=ISO8859-1");
       ServletOutputStream out = response.getOutputStream();
       try
       {
-        for (int i = 0; i < connections.length; i++)
+        for (String connectionName : authRequests.keySet())
         {
-          IAuthorityConnection ac = connections[i];
-          AuthRequest ar = authRequests.get(ac.getName());
+          AuthRequest ar = authRequests.get(connectionName);
 
           if (Logging.authorityService.isDebugEnabled())
-            Logging.authorityService.debug("Waiting for answer from connector class '"+ac.getClassName()+"' for user '"+userID+"'");
+            Logging.authorityService.debug("Waiting for answer from authority connection "+ar.getIdentifyingString()+" for user '"+ar.getUserID()+"'");
 
           ar.waitForComplete();
 
           if (Logging.authorityService.isDebugEnabled())
-            Logging.authorityService.debug("Received answer from connector class '"+ac.getClassName()+"' for user '"+userID+"'");
+            Logging.authorityService.debug("Received answer from authority connection "+ar.getIdentifyingString()+" for user '"+ar.getUserID()+"'");
 
           Throwable exception = ar.getAnswerException();
           AuthorizationResponse reply = ar.getAnswerResponse();
@@ -324,24 +368,24 @@ public class UserACLServlet extends Http
           if (reply == null)
           {
             if (Logging.authorityService.isDebugEnabled())
-              Logging.authorityService.debug("User '"+userID+"' mapping failed for authority '"+ar.getIdentifyingString()+"'");
+              Logging.authorityService.debug("User '"+ar.getUserID()+"' mapping failed for authority '"+ar.getIdentifyingString()+"'");
             sb.append(USERNOTFOUND_VALUE).append(java.net.URLEncoder.encode(ar.getIdentifyingString(),"UTF-8")).append("\n");
           }
           else if (reply.getResponseStatus() == AuthorizationResponse.RESPONSE_UNREACHABLE)
           {
-            Logging.authorityService.warn("Authority '"+ar.getIdentifyingString()+"' is unreachable for user '"+userID+"'");
+            Logging.authorityService.warn("Authority '"+ar.getIdentifyingString()+"' is unreachable for user '"+ar.getUserID()+"'");
             sb.append(UNREACHABLE_VALUE).append(java.net.URLEncoder.encode(ar.getIdentifyingString(),"UTF-8")).append("\n");
           }
           else if (reply.getResponseStatus() == AuthorizationResponse.RESPONSE_USERUNAUTHORIZED)
           {
             if (Logging.authorityService.isDebugEnabled())
-              Logging.authorityService.debug("Authority '"+ar.getIdentifyingString()+"' does not authorize user '"+userID+"'");
+              Logging.authorityService.debug("Authority '"+ar.getIdentifyingString()+"' does not authorize user '"+ar.getUserID()+"'");
             sb.append(UNAUTHORIZED_VALUE).append(java.net.URLEncoder.encode(ar.getIdentifyingString(),"UTF-8")).append("\n");
           }
           else if (reply.getResponseStatus() == AuthorizationResponse.RESPONSE_USERNOTFOUND)
           {
             if (Logging.authorityService.isDebugEnabled())
-              Logging.authorityService.debug("User '"+userID+"' unknown to authority '"+ar.getIdentifyingString()+"'");
+              Logging.authorityService.debug("User '"+ar.getUserID()+"' unknown to authority '"+ar.getIdentifyingString()+"'");
             sb.append(USERNOTFOUND_VALUE).append(java.net.URLEncoder.encode(ar.getIdentifyingString(),"UTF-8")).append("\n");
           }
           else
@@ -356,14 +400,15 @@ public class UserACLServlet extends Http
               while (j < acl.length)
               {
                 if (Logging.authorityService.isDebugEnabled())
-                  Logging.authorityService.debug("  User '"+userID+"' has Acl = '"+acl[j]+"' from authority '"+ar.getIdentifyingString()+"'");
-                sb.append(TOKEN_PREFIX).append(java.net.URLEncoder.encode(ac.getName(),"UTF-8")).append(":").append(java.net.URLEncoder.encode(acl[j++],"UTF-8")).append("\n");
+                  Logging.authorityService.debug("  User '"+ar.getUserID()+"' has Acl = '"+acl[j]+"' from authority '"+ar.getIdentifyingString()+"'");
+                sb.append(TOKEN_PREFIX).append(java.net.URLEncoder.encode(connectionName,"UTF-8")).append(":").append(java.net.URLEncoder.encode(acl[j++],"UTF-8")).append("\n");
               }
             }
           }
         }
 
-        if (idneeded)
+        // Maintained for backwards compatibility only; no practical use that I can determine here
+        if (idneeded && userID != null)
           sb.append(ID_PREFIX).append(java.net.URLEncoder.encode(userID,"UTF-8")).append("\n");
 
         byte[] responseValue = sb.toString().getBytes("ISO8859-1");
@@ -378,7 +423,20 @@ public class UserACLServlet extends Http
       }
 
       if (Logging.authorityService.isDebugEnabled())
-        Logging.authorityService.debug("Done with request for '"+userID+"'");
+      {
+        StringBuilder sb2 = new StringBuilder("[");
+        boolean first = true;
+        for (String domain : domainMap.keySet())
+        {
+          if (first)
+            first = false;
+          else
+            sb2.append(",");
+          sb2.append("'").append(domain).append("':'").append(domainMap.get(domain)).append("'");
+        }
+        sb2.append("]");
+        Logging.authorityService.debug("Done with request for domain:user set "+sb2.toString());
+      }
     }
     catch (InterruptedException e)
     {
@@ -396,6 +454,34 @@ public class UserACLServlet extends Http
     }
   }
 
+  /** This class represents a tuple of (mapper_name, auth_domain).
+  */
+  protected static class MapperDescription
+  {
+    public final String mapperName;
+    public final String authDomain;
+    
+    public MapperDescription(String mapperName, String authDomain)
+    {
+      this.mapperName = mapperName;
+      this.authDomain = authDomain;
+    }
+    
+    public int hashCode()
+    {
+      return mapperName.hashCode() + authDomain.hashCode();
+    }
+    
+    public boolean equals(Object o)
+    {
+      if (!(o instanceof MapperDescription))
+        return false;
+      MapperDescription other = (MapperDescription)o;
+      return this.mapperName.equals(other.mapperName) &&
+        this.authDomain.equals(other.authDomain);
+    }
+  }
+  
   /** This thread is responsible for making sure that the constraints for a given mapping connection
   * are met, and then when they are, firing off a MappingRequest.  One of these threads is spun up
   * for every IMappingConnection being handled.
@@ -406,8 +492,8 @@ public class UserACLServlet extends Http
   protected static class MappingOrderThread extends Thread
   {
     protected final MappingRequest request;
-    protected final String prerequisite;
-    protected final Map<String,MappingRequest> requests;
+    protected final MapperDescription prerequisite;
+    protected final Map<MapperDescription,MappingRequest> requests;
     protected final RequestQueue<MappingRequest> mappingRequestQueue;
 
     protected Throwable exception = null;
@@ -415,9 +501,9 @@ public class UserACLServlet extends Http
     public MappingOrderThread(
       String identifyingString,
       MappingRequest request,
-      String prerequisite,
+      MapperDescription prerequisite,
       RequestQueue<MappingRequest> mappingRequestQueue,
-      Map<String, MappingRequest> requests)
+      Map<MapperDescription, MappingRequest> requests)
     {
       super();
       this.request = request;
@@ -469,8 +555,8 @@ public class UserACLServlet extends Http
   protected static class AuthOrderThread extends Thread
   {
     protected final AuthRequest request;
-    protected final String prerequisite;
-    protected final Map<String,MappingRequest> mappingRequests;
+    protected final MapperDescription prerequisite;
+    protected final Map<MapperDescription,MappingRequest> mappingRequests;
     protected final RequestQueue<AuthRequest> authRequestQueue;
     
     protected Throwable exception = null;
@@ -478,9 +564,9 @@ public class UserACLServlet extends Http
     public AuthOrderThread(
       String identifyingString,
       AuthRequest request,
-      String prerequisite,
+      MapperDescription prerequisite,
       RequestQueue<AuthRequest> authRequestQueue,
-      Map<String, MappingRequest> mappingRequests)
+      Map<MapperDescription, MappingRequest> mappingRequests)
     {
       super();
       this.request = request;

Modified: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editauthority.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editauthority.jsp?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editauthority.jsp (original)
+++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editauthority.jsp Sat Oct 26 12:46:18 2013
@@ -28,13 +28,17 @@
     // the connection object being edited will be placed in the thread context under the name "ConnectionObject".
     try
     {
+	// Get the domain manager handle
+	IAuthorizationDomainManager domainMgr = AuthorizationDomainManagerFactory.make(threadContext);
 	// Get the connection manager handle
 	IAuthorityConnectionManager connMgr = AuthorityConnectionManagerFactory.make(threadContext);
 	// Also get the list of available connectors
 	IAuthorityConnectorManager connectorManager = AuthorityConnectorManagerFactory.make(threadContext);
 	// Get the mapping connection manager
 	IMappingConnectionManager mappingConnMgr = MappingConnectionManagerFactory.make(threadContext);
-
+	// Get the group manager
+	IAuthorityGroupManager authGroupManager = AuthorityGroupManagerFactory.make(threadContext);
+	
 	// Figure out what the current tab name is.
 	String tabName = variableContext.getParameter("tabname");
 	if (tabName == null || tabName.length() == 0)
@@ -61,7 +65,9 @@
 	int maxConnections = 10;
 	ConfigParams parameters = new ConfigParams();
 	String prereq = null;
-
+	String authDomain = "";
+	String groupName = "";
+	
 	if (connection != null)
 	{
 		// Set up values
@@ -72,6 +78,12 @@
 		parameters = connection.getConfigParams();
 		maxConnections = connection.getMaxConnections();
 		prereq = connection.getPrerequisiteMapping();
+		authDomain = connection.getAuthDomain();
+		if (authDomain == null)
+			authDomain = "";
+		groupName = connection.getAuthGroup();
+		if (groupName == null)
+			groupName = "";
 	}
 	else
 		connectionName = null;
@@ -152,6 +164,13 @@
 				document.editconnection.connname.focus();
 				return;
 			}
+			if (editconnection.authoritygroup.value == "")
+			{
+				alert("<%=Messages.getBodyJavascriptString(pageContext.getRequest().getLocale(),"editauthority.ConnectionMustHaveAGroup")%>");
+				SelectTab("<%=Messages.getBodyJavascriptString(pageContext.getRequest().getLocale(),"editauthority.Type")%>");
+				document.editconnection.authoritygroup.focus();
+				return;
+			}
 			if (window.checkConfigForSave)
 			{
 				if (!checkConfigForSave())
@@ -222,6 +241,8 @@
 
 	// Get connectors, since this will be needed to determine what to display.
 	IResultSet set = connectorManager.getConnectors();
+	// Same for authority groups
+	IAuthorityGroup[] set2 = authGroupManager.getAllGroups();
 
 %>
 
@@ -233,10 +254,15 @@
       <tr><td colspan="2" class="banner"><jsp:include page="banner.jsp" flush="true"/></td></tr>
       <tr><td class="navigation"><jsp:include page="navigation.jsp" flush="true"/></td>
        <td class="darkwindow">
-
-
 <%
-	if (set.getRowCount() == 0)
+	if (set2.length == 0)
+	{
+%>
+	<p class="windowtitle"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.EditAuthorityConnection")%></p>
+	<table class="displaytable"><tr><td class="message"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.NoAuthorityGroupsDefinedCreateOneFirst")%></td></tr></table>
+<%
+	}
+	else if (set.getRowCount() == 0)
 	{
 %>
 	<p class="windowtitle"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.EditAuthorityConnection")%></p>
@@ -341,6 +367,7 @@
 	  // "Type" tab
 	  if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editauthority.Type")))
 	  {
+	    IResultSet domainSet = domainMgr.getDomains();
 %>
 		    <table class="displaytable">
 			<tr><td class="separator" colspan="5"><hr/></td></tr>
@@ -390,6 +417,49 @@
 %>
 				</td>
 			</tr>
+			<tr><td class="separator" colspan="5"><hr/></td></tr>
+			<tr>
+				<td class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.AuthorityGroupColon")%></nobr></td>
+				<td class="value" colspan="1">
+					<select name="authoritygroup" size="1">
+						<option value=""><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.SelectAGroup")%></option>
+<%
+	    for (int i = 0; i < set2.length; i++)
+	    {
+		IAuthorityGroup row = set2[i];
+		String thisAuthorityName = row.getName();
+		String thisDescription = row.getDescription();
+		if (thisDescription == null || thisDescription.length() == 0)
+			thisDescription = thisAuthorityName;
+%>
+						<option value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(thisAuthorityName)%>'
+							<%=(groupName.equals(thisAuthorityName))?"selected=\"selected\"":""%>><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(thisDescription)%></option>
+<%
+	    }
+%>
+					</select>
+				</td>
+				<td class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.AuthorizationDomainColon")%></nobr></td>
+				<td class="value" colspan="1">
+					<select name="authdomain" size="1">
+						<option value="" <%=(authDomain == null || authDomain.length() == 0)?"selected=\"selected\"":""%>><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editauthority.DefaultDomainNone")%></option>
+<%
+	    for (int i = 0; i < domainSet.getRowCount(); i++)
+	    {
+		IResultRow row = domainSet.getRow(i);
+		String domainName = (String)row.getValue("domainname");
+		String thisDescription = (String)row.getValue("description");
+		if (thisDescription == null || thisDescription.length() == 0)
+			thisDescription = domainName;
+%>
+						<option value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(domainName)%>'
+							<%=(authDomain!=null && domainName.equals(authDomain))?"selected=\"selected\"":""%>><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(thisDescription)%></option>
+<%
+	    }
+%>
+					</select>
+				</td>
+			</tr>
 		    </table>
 <%
 	  }
@@ -398,6 +468,8 @@
 		// Hiddens for the "Type" tab
 %>
 		    <input type="hidden" name="classname" value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(className)%>'/>
+		    <input type="hidden" name="authdomain" value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(authDomain)%>'/>
+		    <input type="hidden" name="authoritygroup" value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(groupName)%>'/>
 <%
 	  }
 

Modified: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editconnection.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editconnection.jsp?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editconnection.jsp (original)
+++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/editconnection.jsp Sat Oct 26 12:46:18 2013
@@ -32,7 +32,7 @@
 	IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(threadContext);
 	// Also get the list of available connectors
 	IConnectorManager connectorManager = ConnectorManagerFactory.make(threadContext);
-	IAuthorityConnectionManager authConnectionManager = AuthorityConnectionManagerFactory.make(threadContext);
+	IAuthorityGroupManager authGroupManager = AuthorityGroupManagerFactory.make(threadContext);
 
 	// Figure out what the current tab name is.
 	String tabName = variableContext.getParameter("tabname");
@@ -422,10 +422,10 @@
 				</td>
 			</tr>
 			<tr>
-				<td class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editconnection.AuthorityColon")%></nobr></td>
+				<td class="description"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"editconnection.AuthorityGroupColon")%></nobr></td>
 				<td class="value" colspan="4">
 <%
-	    IAuthorityConnection[] set2 = authConnectionManager.getAllConnections();
+	    IAuthorityGroup[] set2 = authGroupManager.getAllGroups();
 	    int i = 0;
 %>
 					<select name="authorityname" size="1">
@@ -433,7 +433,7 @@
 <%
 	    while (i < set2.length)
 	    {
-		IAuthorityConnection row = set2[i++];
+		IAuthorityGroup row = set2[i++];
 		String thisAuthorityName = row.getName();
 		String thisDescription = row.getDescription();
 		if (thisDescription == null || thisDescription.length() == 0)

Modified: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/execute.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/execute.jsp?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/execute.jsp (original)
+++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/execute.jsp Sat Oct 26 12:46:18 2013
@@ -45,6 +45,7 @@
 		// Make a few things we will need
 		// Get the job manager handle
 		IJobManager manager = JobManagerFactory.make(threadContext);
+		IAuthorityGroupManager authGroupManager = AuthorityGroupManagerFactory.make(threadContext);
 		IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(threadContext);
 		IAuthorityConnectionManager authConnManager = AuthorityConnectionManagerFactory.make(threadContext);
 		IMappingConnectionManager mappingConnManager = MappingConnectionManagerFactory.make(threadContext);
@@ -212,6 +213,105 @@
 <%
 			}
 		}
+		else if (type != null && op != null && type.equals("group"))
+		{
+			// -- Group editing operations --
+			if (op.equals("Save") || op.equals("Continue"))
+			{
+				try
+				{
+					// Set up a connection object that is a merge of an existing connection object plus what was posted.
+					IAuthorityGroup group = null;
+					boolean isNew = true;
+					String x = variableContext.getParameter("isnewconnection");
+					if (x != null)
+						isNew = x.equals("true");
+
+					String groupName = variableContext.getParameter("groupname");
+					// If the groupname is not null, load the group and prepopulate everything with what comes from it.
+					if (groupName != null && groupName.length() > 0 && !isNew)
+					{
+						group = authGroupManager.load(groupName);
+					}
+					
+					if (group == null)
+					{
+						group = authGroupManager.create();
+						if (groupName != null && groupName.length() > 0)
+							group.setName(groupName);
+					}
+
+					// Gather all the data from the form.
+					group.setIsNew(isNew);
+					x = variableContext.getParameter("description");
+					if (x != null)
+						group.setDescription(x);
+
+					if (op.equals("Continue"))
+					{
+						threadContext.save("GroupObject",group);
+%>
+						<jsp:forward page="editgroup.jsp"/>
+<%
+					}
+					else if (op.equals("Save"))
+					{
+						authGroupManager.save(group);
+						variableContext.setParameter("groupname",groupName);
+%>
+						<jsp:forward page="viewgroup.jsp"/>
+<%
+					}
+				}
+				catch (ManifoldCFException e)
+				{
+					e.printStackTrace();
+					variableContext.setParameter("text",e.getMessage());
+					variableContext.setParameter("target","listgroups.jsp");
+%>
+					<jsp:forward page="error.jsp"/>
+<%
+				}
+			}
+			else if (op.equals("Delete"))
+			{
+				try
+				{
+					String groupName = variableContext.getParameter("groupname");
+					if (groupName == null)
+						throw new ManifoldCFException("Missing group name parameter");
+					authGroupManager.delete(groupName);
+%>
+					<jsp:forward page="listgroups.jsp"/>
+<%
+				}
+				catch (ManifoldCFException e)
+				{
+					e.printStackTrace();
+					variableContext.setParameter("text",e.getMessage());
+					variableContext.setParameter("target","listgroups.jsp");
+%>
+					<jsp:forward page="error.jsp"/>
+<%
+				}
+			}
+			else if (op.equals("Cancel"))
+			{
+%>
+				<jsp:forward page="listgroups.jsp"/>
+<%
+			}
+			else
+			{
+				// Error
+				variableContext.setParameter("text","Illegal parameter to authority group execution page");
+				variableContext.setParameter("target","listgroups.jsp");
+%>
+				<jsp:forward page="error.jsp"/>
+<%
+			}
+
+		}
 		else if (type != null && op != null && type.equals("authority"))
 		{
 			// -- Authority editing operations --
@@ -249,7 +349,7 @@
 					if (x != null)
 						connection.setClassName(x);
 					x = variableContext.getParameter("maxconnections");
-					if (x != null && x.length() > 0)
+					if (x != null)
 						connection.setMaxConnections(Integer.parseInt(x));
 					x = variableContext.getParameter("prerequisites_present");
 					if (x != null && x.equals("true"))
@@ -259,7 +359,13 @@
 							y = null;
 						connection.setPrerequisiteMapping(y);
 					}
-					
+					x = variableContext.getParameter("authdomain");
+					if (x != null)
+						connection.setAuthDomain(x);
+					x = variableContext.getParameter("authoritygroup");
+					if (x != null)
+						connection.setAuthGroup(x);
+
 					String error = AuthorityConnectorFactory.processConfigurationPost(threadContext,connection.getClassName(),variableContext,pageContext.getRequest().getLocale(),connection.getConfigParams());
 					
 					if (error != null)

Modified: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/listconnections.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/listconnections.jsp?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/listconnections.jsp (original)
+++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/listconnections.jsp Sat Oct 26 12:46:18 2013
@@ -75,7 +75,11 @@
 				<td class="separator" colspan="6"><hr/></td>
 			</tr>
 			<tr class="headerrow">
-				<td class="columnheader"></td><td class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Name")%></td><td class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Description")%></td><td class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.ConnectionType")%></td><td class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Authority")%></td>
+				<td class="columnheader"></td>
+				<td class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Name")%></td>
+				<td class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Description")%></td>
+				<td class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.ConnectionType")%></td>
+				<td class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.AuthorityGroup")%></td>
 				<td class="columnheader"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"listconnections.Max")%></td>
 			</tr>
 <%

Modified: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/navigation.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/navigation.jsp?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/navigation.jsp (original)
+++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/navigation.jsp Sat Oct 26 12:46:18 2013
@@ -34,15 +34,11 @@
 		<nobr><a class="menulink" href="listoutputs.jsp" alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"navigation.Listoutputconnections")%>"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"navigation.ListOutputConnections")%></a></nobr>
 	</li>
 </ul>
-<p class="menumain"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"navigation.UserMappings")%></nobr></p>
-<ul class="menusecond">
-	<li class="menuitem">
-		<nobr><a class="menulink" href="listmappers.jsp" alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"navigation.Listusermappings")%>"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"navigation.ListUserMappings")%></a></nobr>
-	</li>
-</ul>
 <p class="menumain"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"navigation.Authorities")%></nobr></p>
 <ul class="menusecond">
 	<li class="menuitem">
+		<nobr><a class="menulink" href="listmappers.jsp" alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"navigation.Listusermappings")%>"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"navigation.ListUserMappings")%></a></nobr>
+		<nobr><a class="menulink" href="listgroups.jsp" alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"navigation.Listauthoritygroups")%>"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"navigation.ListAuthorityGroups")%></a></nobr>
 		<nobr><a class="menulink" href="listauthorities.jsp" alt="<%=Messages.getAttributeString(pageContext.getRequest().getLocale(),"navigation.Listauthorities")%>"><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"navigation.ListAuthorityConnections")%></a></nobr>
 	</li>
 </ul>

Modified: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewauthority.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewauthority.jsp?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewauthority.jsp (original)
+++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewauthority.jsp Sat Oct 26 12:46:18 2013
@@ -84,7 +84,13 @@
 			connectorName = className + Messages.getString(pageContext.getRequest().getLocale(),"viewauthority.uninstalled");
 		int maxCount = connection.getMaxConnections();
 		String prereq = connection.getPrerequisiteMapping();
-		
+		String authDomain = connection.getAuthDomain();
+		if (authDomain == null)
+			authDomain = "";
+		String groupName = connection.getAuthGroup();
+		if (groupName == null)
+			groupName = "";
+
 		ConfigParams parameters = connection.getConfigParams();
 
 		// Do stuff so we can call out to display the parameters
@@ -140,6 +146,15 @@
 				<td class="separator" colspan="4"><hr/></td>
 			</tr>
 			<tr>
+				<td class="description" colspan="1"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewauthority.AuthorityGroupColon")%></nobr></td>
+				<td class="value" colspan="1"><nobr><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(groupName)%></nobr></td>
+				<td class="description" colspan="1"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewauthority.AuthorizationDomainColon")%></nobr></td>
+				<td class="value" colspan="1"><nobr><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(authDomain)%></nobr></td>
+			</tr>
+			<tr>
+				<td class="separator" colspan="4"><hr/></td>
+			</tr>
+			<tr>
 				<td class="description" colspan="1"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewauthority.PrerequisiteUserMappingColon")%></nobr></td>
 				<td class="value" colspan="3">
 <%

Modified: manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewconnection.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewconnection.jsp?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewconnection.jsp (original)
+++ manifoldcf/trunk/framework/crawler-ui/src/main/webapp/viewconnection.jsp Sat Oct 26 12:46:18 2013
@@ -134,7 +134,10 @@
 				<td class="description" colspan="1"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewconnection.MaxConnectionsColon")%></nobr></td><td class="value" colspan="1"><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(Integer.toString(maxCount))%></td>
 			</tr>
 			<tr>
-				<td class="description" colspan="1"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewconnection.AuthorityColon")%></nobr></td><td class="value" colspan="3"><nobr><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(authorityName)%></nobr></td>
+				<td class="separator" colspan="4"><hr/></td>
+			</tr>
+			<tr>
+				<td class="description" colspan="1"><nobr><%=Messages.getBodyString(pageContext.getRequest().getLocale(),"viewconnection.AuthorityGroupColon")%></nobr></td><td class="value" colspan="3"><nobr><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(authorityName)%></nobr></td>
 			</tr>
 			<tr>
 				<td class="separator" colspan="4"><hr/></td>

Modified: manifoldcf/trunk/framework/example-common/connectors.xml
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/example-common/connectors.xml?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/example-common/connectors.xml (original)
+++ manifoldcf/trunk/framework/example-common/connectors.xml Sat Oct 26 12:46:18 2013
@@ -16,14 +16,23 @@
  limitations under the License.
 -->
 
-<!-- The connectors registry file permits registration of connectors upon the
-      startup of the jetty-based LCF example.  In a real installation, this registration
+<!-- The connectors registry file permits registration of domains and connectors upon the
+      startup of the jetty-based ManifoldCF example.  In a real installation, this registration
       step would be done ideally just once, but in the example the connectors
       are all reregistered on every startup.
 -->
 <connectors>
+    <!-- Add any authorization domains here -->
+    <!-- authorizationdomain domain="AD" name="ActiveDirectory"/-->
+    <!-- authorizationdomain domain="SHP" name="SharePoint"/-->
+    <!-- authorizationdomain domain="FB" name="FaceBook"/-->
+
     <!-- Add your output connectors here -->
+    
     <!-- Add your mapping connectors here -->
+    
     <!-- Add your authority connectors here -->
+    
     <!-- Add your repository connectors here -->
+    
 </connectors>

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnection.java?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnection.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnection.java Sat Oct 26 12:46:18 2013
@@ -37,6 +37,8 @@ public class AuthorityConnection impleme
   protected ConfigParams configParams = new ConfigParams();
   protected int maxCount = 100;
   protected String prerequisiteMapping = null;
+  protected String authDomain = null;
+  protected String authGroup = null;
 
   /** Constructor.
   */
@@ -57,6 +59,8 @@ public class AuthorityConnection impleme
     rval.maxCount = maxCount;
     rval.configParams = configParams.duplicate();
     rval.prerequisiteMapping = prerequisiteMapping;
+    rval.authDomain = authDomain;
+    rval.authGroup = authGroup;
     return rval;
   }
 
@@ -165,4 +169,36 @@ public class AuthorityConnection impleme
     return prerequisiteMapping;
   }
 
+  /** Set the authorization domain.
+  *@param domain is the authorization domain.
+  */
+  public void setAuthDomain(String domain)
+  {
+    authDomain = domain;
+  }
+  
+  /** Get the authorization domain.
+  *@return the authorization domain.
+  */
+  public String getAuthDomain()
+  {
+    return authDomain;
+  }
+
+  /** Set authorization group.
+  *@param groupName is the name of the group.
+  */
+  public void setAuthGroup(String groupName)
+  {
+    authGroup = groupName;
+  }
+  
+  /** Get the authorization group.
+  *@return the group.
+  */
+  public String getAuthGroup()
+  {
+    return authGroup;
+  }
+
 }

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/authority/AuthorityConnectionManager.java Sat Oct 26 12:46:18 2013
@@ -40,6 +40,7 @@ import org.apache.manifoldcf.crawler.int
  * <tr><td>maxcount</td><td>BIGINT</td><td></td></tr>
  * <tr><td>configxml</td><td>LONGTEXT</td><td></td></tr>
  * <tr><td>mappingname</td><td>VARCHAR(32)</td><td></td></tr>
+ * <tr><td>authdomainname</td><td>VARCHAR(32)</td><td></td></tr>
  * </table>
  * <br><br>
  * 
@@ -57,7 +58,9 @@ public class AuthorityConnectionManager 
   protected final static String maxCountField = "maxcount";
   protected final static String configField = "configxml";
   protected final static String mappingField = "mappingname";
-
+  protected final static String authDomainField = "authdomainname";
+  protected final static String groupNameField = "groupname";
+  
   // Cache manager
   ICacheManager cacheManager;
   // Thread context
@@ -81,6 +84,9 @@ public class AuthorityConnectionManager 
   public void install()
     throws ManifoldCFException
   {
+    // First, get the authority manager table name and name column
+    IAuthorityGroupManager authMgr = AuthorityGroupManagerFactory.make(threadContext);
+
     // Always do a loop, in case upgrade needs it.
     while (true)
     {
@@ -95,6 +101,9 @@ public class AuthorityConnectionManager 
         map.put(maxCountField,new ColumnDescription("BIGINT",false,false,null,null,false));
         map.put(configField,new ColumnDescription("LONGTEXT",false,true,null,null,false));
         map.put(mappingField,new ColumnDescription("VARCHAR(32)",false,true,null,null,false));
+        map.put(authDomainField,new ColumnDescription("VARCHAR(255)",false,true,null,null,false));
+        map.put(groupNameField,new ColumnDescription("VARCHAR(32)",false,false,
+          authMgr.getTableName(),authMgr.getGroupNameColumn(),false));
         performCreate(map,null);
       }
       else
@@ -107,10 +116,88 @@ public class AuthorityConnectionManager 
           addMap.put(mappingField,new ColumnDescription("VARCHAR(32)",false,true,null,null,false));
           performAlter(addMap,null,null,null);
         }
+        // Add the authDomainField column
+        cd = (ColumnDescription)existing.get(authDomainField);
+        if (cd == null)
+        {
+          Map addMap = new HashMap();
+          addMap.put(authDomainField,new ColumnDescription("VARCHAR(255)",false,true,null,null,false));
+          performAlter(addMap,null,null,null);
+        }
+        cd = (ColumnDescription)existing.get(groupNameField);
+        if (cd == null)
+        {
+          Map addMap = new HashMap();
+          addMap.put(groupNameField,new ColumnDescription("VARCHAR(32)",false,true,
+            authMgr.getTableName(),authMgr.getGroupNameColumn(),false));
+          performAlter(addMap,null,null,null);
+          try
+          {
+            ArrayList params = new ArrayList();
+            IResultSet set = performQuery("SELECT "+nameField+","+descriptionField+" FROM "+getTableName(),null,null,null);
+            for (int i = 0 ; i < set.getRowCount() ; i++)
+            {
+              IResultRow row = set.getRow(i);
+              String authName = (String)row.getValue(nameField);
+              String authDescription = (String)row.getValue(descriptionField);
+              IAuthorityGroup gp = authMgr.load(authName);
+              if (gp == null)
+              {
+                // Create an authority group with this name
+                gp = authMgr.create();
+                gp.setName(authName);
+                if (authDescription != null)
+                  gp.setDescription(authDescription);
+                authMgr.save(gp);
+              }
+              Map<String,String> map = new HashMap<String,String>();
+              map.put(groupNameField,authName);
+              params.clear();
+              String query = buildConjunctionClause(params,new ClauseDescription[]{
+                new UnitaryClause(nameField,authName)});
+              performUpdate(map," WHERE "+query,params,null);
+            }
+            Map modifyMap = new HashMap();
+            modifyMap.put(groupNameField,new ColumnDescription("VARCHAR(32)",false,false,
+              authMgr.getTableName(),authMgr.getGroupNameColumn(),false));
+            performAlter(null,modifyMap,null,null);
+          }
+          finally
+          {
+            // Upgrade failed; back out our changes
+            List<String> deleteList = new ArrayList<String>();
+            deleteList.add(groupNameField);
+            performAlter(null,null,deleteList,null);
+          }
+        }
       }
 
       // Index management goes here
+      IndexDescription authDomainIndex = new IndexDescription(false,new String[]{authDomainField});
+      IndexDescription authorityIndex = new IndexDescription(false,new String[]{groupNameField});
 
+      // Get rid of indexes that shouldn't be there
+      Map indexes = getTableIndexes(null,null);
+      Iterator iter = indexes.keySet().iterator();
+      while (iter.hasNext())
+      {
+        String indexName = (String)iter.next();
+        IndexDescription id = (IndexDescription)indexes.get(indexName);
+
+        if (authDomainIndex != null && id.equals(authDomainIndex))
+          authDomainIndex = null;
+        if (authorityIndex != null && id.equals(authorityIndex))
+          authorityIndex = null;
+        else if (indexName.indexOf("_pkey") == -1)
+          // This index shouldn't be here; drop it
+          performRemoveIndex(indexName);
+      }
+
+      // Add the ones we didn't find
+      if (authDomainIndex != null)
+        performAddIndex(null,authDomainIndex);
+      if (authorityIndex != null)
+        performAddIndex(null,authorityIndex);
       break;
     }
   }
@@ -130,7 +217,7 @@ public class AuthorityConnectionManager 
     throws java.io.IOException, ManifoldCFException
   {
     // Write a version indicator
-    ManifoldCF.writeDword(os,2);
+    ManifoldCF.writeDword(os,3);
     // Get the authority list
     IAuthorityConnection[] list = getAllConnections();
     // Write the number of authorities
@@ -146,6 +233,8 @@ public class AuthorityConnectionManager 
       ManifoldCF.writeString(os,conn.getConfigParams().toXML());
       ManifoldCF.writeDword(os,conn.getMaxConnections());
       ManifoldCF.writeString(os,conn.getPrerequisiteMapping());
+      ManifoldCF.writeString(os,conn.getAuthDomain());
+      ManifoldCF.writeString(os,conn.getAuthGroup());
     }
   }
 
@@ -154,6 +243,7 @@ public class AuthorityConnectionManager 
   public void importConfiguration(java.io.InputStream is)
     throws java.io.IOException, ManifoldCFException
   {
+    IAuthorityGroupManager authMgr = AuthorityGroupManagerFactory.make(threadContext);
     int version = ManifoldCF.readDword(is);
     if (version < 1 || version > 2)
       throw new java.io.IOException("Unknown authority configuration version: "+Integer.toString(version));
@@ -162,22 +252,109 @@ public class AuthorityConnectionManager 
     while (i < count)
     {
       IAuthorityConnection conn = create();
-      conn.setName(ManifoldCF.readString(is));
-      conn.setDescription(ManifoldCF.readString(is));
+      String name = ManifoldCF.readString(is);
+      String description = ManifoldCF.readString(is);
+      conn.setName(name);
+      conn.setDescription(description);
       conn.setClassName(ManifoldCF.readString(is));
       conn.getConfigParams().fromXML(ManifoldCF.readString(is));
       conn.setMaxConnections(ManifoldCF.readDword(is));
       if (version >= 2)
       {
         conn.setPrerequisiteMapping(ManifoldCF.readString(is));
+        if (version >= 3)
+        {
+          conn.setAuthDomain(ManifoldCF.readString(is));
+          conn.setAuthGroup(ManifoldCF.readString(is));
+        }
+      }
+      // For importing older than MCF 1.5 import files...
+      if (conn.getAuthGroup() == null || conn.getAuthGroup().length() == 0)
+      {
+        // Create a matching auth group.
+        IAuthorityGroup grp = authMgr.load(name);
+        if (grp == null)
+        {
+          grp = authMgr.create();
+          grp.setName(name);
+          grp.setDescription(description);
+          authMgr.save(grp);
+        }
+        conn.setAuthGroup(name);
       }
+      
       // Attempt to save this connection
       save(conn);
       i++;
     }
   }
 
-  /** Obtain a list of the repository connections, ordered by name.
+  /** Return true if the specified authority group name is referenced.
+  *@param groupName is the authority group name.
+  *@return true if referenced, false otherwise.
+  */
+  @Override
+  public boolean isGroupReferenced(String groupName)
+    throws ManifoldCFException
+  {
+    StringSetBuffer ssb = new StringSetBuffer();
+    ssb.add(getAuthorityConnectionsKey());
+    StringSet localCacheKeys = new StringSet(ssb);
+    ArrayList params = new ArrayList();
+    String query = buildConjunctionClause(params,new ClauseDescription[]{
+      new UnitaryClause(groupNameField,groupName)});
+    IResultSet set = performQuery("SELECT "+nameField+" FROM "+getTableName()+" WHERE "+query,params,
+      localCacheKeys,null);
+    return set.getRowCount() > 0;
+  }
+
+  /** Obtain a list of the authority connections which correspond to an auth domain.
+  *@param authDomain is the domain to get connections for.
+  *@return an array of connection objects.
+  */
+  @Override
+  public IAuthorityConnection[] getDomainConnections(String authDomain)
+    throws ManifoldCFException
+  {
+    beginTransaction();
+    try
+    {
+      // Read the connections for the domain
+      StringSetBuffer ssb = new StringSetBuffer();
+      ssb.add(getAuthorityConnectionsKey());
+      StringSet localCacheKeys = new StringSet(ssb);
+      StringBuilder sb = new StringBuilder("SELECT ");
+      ArrayList list = new ArrayList();
+      sb.append(nameField).append(" FROM ").append(getTableName()).append(" WHERE ");
+      sb.append(buildConjunctionClause(list,new ClauseDescription[]{new UnitaryClause(authDomainField,authDomain)}));
+      IResultSet set = performQuery(sb.toString(),list,localCacheKeys,null);
+      String[] names = new String[set.getRowCount()];
+      int i = 0;
+      while (i < names.length)
+      {
+        IResultRow row = set.getRow(i);
+        names[i] = row.getValue(nameField).toString();
+        i++;
+      }
+      return loadMultiple(names);
+    }
+    catch (ManifoldCFException e)
+    {
+      signalRollback();
+      throw e;
+    }
+    catch (Error e)
+    {
+      signalRollback();
+      throw e;
+    }
+    finally
+    {
+      endTransaction();
+    }
+  }
+  
+  /** Obtain a list of the authority connections, ordered by name.
   *@return an array of connection objects.
   */
   @Override
@@ -304,6 +481,8 @@ public class AuthorityConnectionManager 
             values.put(maxCountField,new Long((long)object.getMaxConnections()));
             values.put(configField,object.getConfigParams().toXML());
             values.put(mappingField,object.getPrerequisiteMapping());
+            values.put(authDomainField,object.getAuthDomain());
+            values.put(groupNameField,object.getAuthGroup());
 
             boolean isCreated;
             
@@ -376,8 +555,6 @@ public class AuthorityConnectionManager 
   public void delete(String name)
     throws ManifoldCFException
   {
-    // Grab repository connection manager handle, to check on legality of deletion.
-    IRepositoryConnectionManager repoManager = RepositoryConnectionManagerFactory.make(threadContext);
 
     StringSetBuffer ssb = new StringSetBuffer();
     ssb.add(getAuthorityConnectionsKey());
@@ -389,9 +566,6 @@ public class AuthorityConnectionManager 
       beginTransaction();
       try
       {
-        // Check if anything refers to this connection name
-        if (repoManager.isReferenced(name))
-          throw new ManifoldCFException("Can't delete authority connection '"+name+"': existing repository connections refer to it");
         ManifoldCF.noteConfigurationChange();
         ArrayList params = new ArrayList();
         String query = buildConjunctionClause(params,new ClauseDescription[]{
@@ -559,6 +733,8 @@ public class AuthorityConnectionManager 
       rc.setClassName((String)row.getValue(classNameField));
       rc.setMaxConnections((int)((Long)row.getValue(maxCountField)).longValue());
       rc.setPrerequisiteMapping((String)row.getValue(mappingField));
+      rc.setAuthDomain((String)row.getValue(authDomainField));
+      rc.setAuthGroup((String)row.getValue(groupNameField));
       String xml = (String)row.getValue(configField);
       if (xml != null && xml.length() > 0)
         rc.getConfigParams().fromXML(xml);

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/CacheKeyFactory.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/CacheKeyFactory.java?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/CacheKeyFactory.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/CacheKeyFactory.java Sat Oct 26 12:46:18 2013
@@ -28,6 +28,23 @@ public class CacheKeyFactory extends org
   {
   }
 
+  /** Construct a key which represents the general list of authority groups.
+  *@return the cache key.
+  */
+  public static String makeAuthorityGroupsKey()
+  {
+    return "AUTHORITYGROUPS";
+  }
+
+  /** Construct a key which represents an individual authority group.
+  *@param groupName is the name of the group.
+  *@return the cache key.
+  */
+  public static String makeAuthorityGroupKey(String groupName)
+  {
+    return "AUTHORITYGROUP_"+groupName;
+  }
+
   /** Construct a key which represents the general list of authority connectors.
   *@return the cache key.
   */

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnection.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnection.java?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnection.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnection.java Sat Oct 26 12:46:18 2013
@@ -91,4 +91,24 @@ public interface IAuthorityConnection
   */
   public String getPrerequisiteMapping();
 
+  /** Set the authorization domain.
+  *@param domain is the authorization domain.
+  */
+  public void setAuthDomain(String domain);
+  
+  /** Get the authorization domain.
+  *@return the authorization domain.
+  */
+  public String getAuthDomain();
+  
+  /** Set authorization group.
+  *@param groupName is the name of the group.
+  */
+  public void setAuthGroup(String groupName);
+  
+  /** Get the authorization group.
+  *@return the group.
+  */
+  public String getAuthGroup();
+  
 }

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnectionManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnectionManager.java?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnectionManager.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/interfaces/IAuthorityConnectionManager.java Sat Oct 26 12:46:18 2013
@@ -45,12 +45,26 @@ public interface IAuthorityConnectionMan
   public void importConfiguration(java.io.InputStream is)
     throws java.io.IOException, ManifoldCFException;
 
+  /** Return true if the specified authority group name is referenced.
+  *@param authorityGroup is the authority group name.
+  *@return true if referenced, false otherwise.
+  */
+  public boolean isGroupReferenced(String authorityGroup)
+    throws ManifoldCFException;
+
   /** Obtain a list of the authority connections, ordered by name.
   *@return an array of connection objects.
   */
   public IAuthorityConnection[] getAllConnections()
     throws ManifoldCFException;
 
+  /** Obtain a list of the authority connections which correspond to an auth domain.
+  *@param authDomain is the domain to get connections for.
+  *@return an array of connection objects.
+  */
+  public IAuthorityConnection[] getDomainConnections(String authDomain)
+    throws ManifoldCFException;
+
   /** Load a authority connection by name.
   *@param name is the name of the authority connection.
   *@return the loaded connection object, or null if not found.

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/ManifoldCF.java Sat Oct 26 12:46:18 2013
@@ -96,6 +96,8 @@ public class ManifoldCF extends org.apac
       ManifoldCF.getMasterDatabaseUsername(),
       ManifoldCF.getMasterDatabasePassword());
 
+    IAuthorizationDomainManager domainMgr = AuthorizationDomainManagerFactory.make(threadcontext);
+    IAuthorityGroupManager groupMgr = AuthorityGroupManagerFactory.make(threadcontext);
     IAuthorityConnectorManager connMgr = AuthorityConnectorManagerFactory.make(threadcontext);
     IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(threadcontext);
     IMappingConnectorManager mappingConnectorMgr = MappingConnectorManagerFactory.make(threadcontext);
@@ -104,9 +106,11 @@ public class ManifoldCF extends org.apac
     mainDatabase.beginTransaction();
     try
     {
+      domainMgr.install();
       connMgr.install();
-      authConnMgr.install();
       mappingConnectorMgr.install();
+      groupMgr.install();
+      authConnMgr.install();
       mappingConnectionMgr.install();
     }
     catch (ManifoldCFException e)
@@ -139,7 +143,9 @@ public class ManifoldCF extends org.apac
 
     ManifoldCFException se = null;
 
+    IAuthorizationDomainManager domainMgr = AuthorizationDomainManagerFactory.make(threadcontext);
     IAuthorityConnectorManager connMgr = AuthorityConnectorManagerFactory.make(threadcontext);
+    IAuthorityGroupManager groupMgr = AuthorityGroupManagerFactory.make(threadcontext);
     IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(threadcontext);
     IMappingConnectorManager mappingConnectorMgr = MappingConnectorManagerFactory.make(threadcontext);
     IMappingConnectionManager mappingConnectionMgr = MappingConnectionManagerFactory.make(threadcontext);
@@ -148,9 +154,11 @@ public class ManifoldCF extends org.apac
     try
     {
       mappingConnectionMgr.deinstall();
-      mappingConnectorMgr.deinstall();
       authConnMgr.deinstall();
+      groupMgr.deinstall();
+      mappingConnectorMgr.deinstall();
       connMgr.deinstall();
+      domainMgr.deinstall();
     }
     catch (ManifoldCFException e)
     {

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnectionManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnectionManager.java?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnectionManager.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnectionManager.java Sat Oct 26 12:46:18 2013
@@ -85,11 +85,11 @@ public interface IRepositoryConnectionMa
   public void delete(String name)
     throws ManifoldCFException;
 
-  /** Return true if the specified authority name is referenced.
-  *@param authorityName is the authority name.
+  /** Return true if the specified authority group name is referenced.
+  *@param authorityGroup is the authority group name.
   *@return true if referenced, false otherwise.
   */
-  public boolean isReferenced(String authorityName)
+  public boolean isGroupReferenced(String authorityGroup)
     throws ManifoldCFException;
 
   /** Get a list of repository connections that share the same connector.

Modified: manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java
URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java?rev=1535983&r1=1535982&r2=1535983&view=diff
==============================================================================
--- manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java (original)
+++ manifoldcf/trunk/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/repository/RepositoryConnectionManager.java Sat Oct 26 12:46:18 2013
@@ -57,9 +57,12 @@ public class RepositoryConnectionManager
   protected final static String nameField = "connectionname";     // Changed this to work around constraint bug in postgresql
   protected final static String descriptionField = "description";
   protected final static String classNameField = "classname";
-  protected final static String authorityNameField = "authorityname";
   protected final static String maxCountField = "maxcount";
   protected final static String configField = "configxml";
+  protected final static String groupNameField = "groupname";
+
+  // Discontinued fields
+  protected final static String authorityNameField = "authorityname";
 
   protected static Random random = new Random();
 
@@ -93,7 +96,7 @@ public class RepositoryConnectionManager
     throws ManifoldCFException
   {
     // First, get the authority manager table name and name column
-    IAuthorityConnectionManager authMgr = AuthorityConnectionManagerFactory.make(threadContext);
+    IAuthorityGroupManager authMgr = AuthorityGroupManagerFactory.make(threadContext);
 
     // Always use a loop, and no transaction, as we may need to retry due to upgrade
     while (true)
@@ -106,15 +109,57 @@ public class RepositoryConnectionManager
         map.put(nameField,new ColumnDescription("VARCHAR(32)",true,false,null,null,false));
         map.put(descriptionField,new ColumnDescription("VARCHAR(255)",false,true,null,null,false));
         map.put(classNameField,new ColumnDescription("VARCHAR(255)",false,false,null,null,false));
-        map.put(authorityNameField,new ColumnDescription("VARCHAR(32)",false,true,
-          authMgr.getTableName(),authMgr.getAuthorityNameColumn(),false));
+        map.put(groupNameField,new ColumnDescription("VARCHAR(32)",false,true,
+          authMgr.getTableName(),authMgr.getGroupNameColumn(),false));
         map.put(maxCountField,new ColumnDescription("BIGINT",false,false,null,null,false));
         map.put(configField,new ColumnDescription("LONGTEXT",false,true,null,null,false));
         performCreate(map,null);
       }
       else
       {
-        // Upgrade code would go here, if needed.
+        // Upgrade code
+        ColumnDescription cd = (ColumnDescription)existing.get(groupNameField);
+        if (cd == null)
+        {
+          Map addMap = new HashMap();
+          addMap.put(groupNameField,new ColumnDescription("VARCHAR(32)",false,true,
+            authMgr.getTableName(),authMgr.getGroupNameColumn(),false));
+          performAlter(addMap,null,null,null);
+        }
+        // Get rid of the authorityName field.  When we do this we need to copy into the group name
+        // field, adding groups if they don't yet exist first
+        cd = (ColumnDescription)existing.get(authorityNameField);
+        if (cd != null)
+        {
+          ArrayList params = new ArrayList();
+          IResultSet set = performQuery("SELECT "+nameField+","+authorityNameField+" FROM "+getTableName(),null,null,null);
+          for (int i = 0 ; i < set.getRowCount() ; i++)
+          {
+            IResultRow row = set.getRow(i);
+            String repoName = (String)row.getValue(nameField);
+            String authName = (String)row.getValue(authorityNameField);
+            if (authName != null && authName.length() > 0)
+            {
+              IAuthorityGroup gp = authMgr.load(authName);
+              if (gp == null)
+              {
+                // Create an authority group with this name
+                gp = authMgr.create();
+                gp.setName(authName);
+                authMgr.save(gp);
+              }
+              Map<String,String> map = new HashMap<String,String>();
+              map.put(groupNameField,authName);
+              params.clear();
+              String query = buildConjunctionClause(params,new ClauseDescription[]{
+                new UnitaryClause(nameField,repoName)});
+              performUpdate(map," WHERE "+query,params,null);
+            }
+          }
+          List<String> deleteList = new ArrayList<String>();
+          deleteList.add(authorityNameField);
+          performAlter(null,null,deleteList,null);
+        }
       }
 
       // Install dependent tables.
@@ -122,7 +167,7 @@ public class RepositoryConnectionManager
       throttleSpecManager.install(getTableName(),nameField);
 
       // Index management
-      IndexDescription authorityIndex = new IndexDescription(false,new String[]{authorityNameField});
+      IndexDescription authorityIndex = new IndexDescription(false,new String[]{groupNameField});
       IndexDescription classIndex = new IndexDescription(false,new String[]{classNameField});
       
       // Get rid of indexes that shouldn't be there
@@ -368,7 +413,7 @@ public class RepositoryConnectionManager
             HashMap values = new HashMap();
             values.put(descriptionField,object.getDescription());
             values.put(classNameField,object.getClassName());
-            values.put(authorityNameField,object.getACLAuthority());
+            values.put(groupNameField,object.getACLAuthority());
             values.put(maxCountField,new Long((long)object.getMaxConnections()));
             String configXML = object.getConfigParams().toXML();
             values.put(configField,configXML);
@@ -507,10 +552,11 @@ public class RepositoryConnectionManager
   }
 
   /** Return true if the specified authority name is referenced.
-  *@param authorityName is the authority name.
+  *@param groupName is the group name.
   *@return true if referenced, false otherwise.
   */
-  public boolean isReferenced(String authorityName)
+  @Override
+  public boolean isGroupReferenced(String groupName)
     throws ManifoldCFException
   {
     StringSetBuffer ssb = new StringSetBuffer();
@@ -518,7 +564,7 @@ public class RepositoryConnectionManager
     StringSet localCacheKeys = new StringSet(ssb);
     ArrayList params = new ArrayList();
     String query = buildConjunctionClause(params,new ClauseDescription[]{
-      new UnitaryClause(authorityNameField,authorityName)});
+      new UnitaryClause(groupNameField,groupName)});
     IResultSet set = performQuery("SELECT "+nameField+" FROM "+getTableName()+" WHERE "+query,params,
       localCacheKeys,null);
     return set.getRowCount() > 0;
@@ -867,7 +913,7 @@ public class RepositoryConnectionManager
       rc.setName(name);
       rc.setDescription((String)row.getValue(descriptionField));
       rc.setClassName((String)row.getValue(classNameField));
-      rc.setACLAuthority((String)row.getValue(authorityNameField));
+      rc.setACLAuthority((String)row.getValue(groupNameField));
       rc.setMaxConnections((int)((Long)row.getValue(maxCountField)).longValue());
       String xml = (String)row.getValue(configField);
       if (xml != null && xml.length() > 0)



Mime
View raw message