manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1496074 - in /manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system: AuthCheckThread.java AuthRequest.java
Date Mon, 24 Jun 2013 14:59:41 GMT
Author: kwright
Date: Mon Jun 24 14:59:41 2013
New Revision: 1496074

URL: http://svn.apache.org/r1496074
Log:
Handle new method variant in the request/response logic

Modified:
    manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/AuthCheckThread.java
    manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/AuthRequest.java

Modified: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/AuthCheckThread.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/AuthCheckThread.java?rev=1496074&r1=1496073&r2=1496074&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/AuthCheckThread.java
(original)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/AuthCheckThread.java
Mon Jun 24 14:59:41 2013
@@ -33,11 +33,11 @@ public class AuthCheckThread extends Thr
   public static final String _rcsid = "@(#)$Id: AuthCheckThread.java 988245 2010-08-23 18:39:35Z
kwright $";
 
   // Local data
-  protected RequestQueue requestQueue;
+  protected RequestQueue<AuthRequest> requestQueue;
 
   /** Constructor.
   */
-  public AuthCheckThread(String id, RequestQueue requestQueue)
+  public AuthCheckThread(String id, RequestQueue<AuthRequest> requestQueue)
     throws ManifoldCFException
   {
     super();
@@ -89,14 +89,21 @@ public class AuthCheckThread extends Thr
               // Get the acl for the user
               try
               {
-                response = connector.getAuthorizationResponse(theRequest.getUserID());
+                // Either userID or userRecord will be set, never both
+                if (theRequest.getUserID() == null)
+                  response = connector.getAuthorizationResponse(theRequest.getUserRecord());
+                else
+                  response = connector.getAuthorizationResponse(theRequest.getUserID());
               }
               catch (ManifoldCFException e)
               {
                 if (e.getErrorCode() == ManifoldCFException.INTERRUPTED)
                   throw e;
                 Logging.authorityService.warn("Authority error: "+e.getMessage(),e);
-                response = AuthorityConnectorFactory.getDefaultAuthorizationResponse(threadContext,theRequest.getClassName(),theRequest.getUserID());
+                if (theRequest.getUserID() == null)
+                  response = AuthorityConnectorFactory.getDefaultAuthorizationResponse(threadContext,theRequest.getClassName(),theRequest.getUserRecord());
+                else
+                  response = AuthorityConnectorFactory.getDefaultAuthorizationResponse(threadContext,theRequest.getClassName(),theRequest.getUserID());
               }
 
             }
@@ -111,14 +118,20 @@ public class AuthCheckThread extends Thr
           if (e.getErrorCode() == ManifoldCFException.INTERRUPTED)
             throw e;
           Logging.authorityService.warn("Authority connection exception: "+e.getMessage(),e);
-          response = AuthorityConnectorFactory.getDefaultAuthorizationResponse(threadContext,theRequest.getClassName(),theRequest.getUserID());
+          if (theRequest.getUserID() == null)
+            response = AuthorityConnectorFactory.getDefaultAuthorizationResponse(threadContext,theRequest.getClassName(),theRequest.getUserRecord());
+          else
+            response = AuthorityConnectorFactory.getDefaultAuthorizationResponse(threadContext,theRequest.getClassName(),theRequest.getUserID());
           if (response == null)
             exception = e;
         }
         catch (Throwable e)
         {
           Logging.authorityService.warn("Authority connection error: "+e.getMessage(),e);
-          response = AuthorityConnectorFactory.getDefaultAuthorizationResponse(threadContext,theRequest.getClassName(),theRequest.getUserID());
+          if (theRequest.getUserID() == null)
+            response = AuthorityConnectorFactory.getDefaultAuthorizationResponse(threadContext,theRequest.getClassName(),theRequest.getUserRecord());
+          else
+            response = AuthorityConnectorFactory.getDefaultAuthorizationResponse(threadContext,theRequest.getClassName(),theRequest.getUserID());
           if (response == null)
             exception = e;
         }

Modified: manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/AuthRequest.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/AuthRequest.java?rev=1496074&r1=1496073&r2=1496074&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/AuthRequest.java
(original)
+++ manifoldcf/branches/CONNECTORS-703/framework/pull-agent/src/main/java/org/apache/manifoldcf/authorities/system/AuthRequest.java
Mon Jun 24 14:59:41 2013
@@ -31,11 +31,12 @@ public class AuthRequest
   public static final String _rcsid = "@(#)$Id: AuthRequest.java 988245 2010-08-23 18:39:35Z
kwright $";
 
   // This is where the request data actually lives
-  protected String userID;
-  protected String className;
-  protected String identifyingString;
-  protected ConfigParams configParameters;
-  protected int maxConnections;
+  protected final String userID;
+  protected final UserRecord userRecord;
+  protected final String className;
+  protected final String identifyingString;
+  protected final ConfigParams configParameters;
+  protected final int maxConnections;
 
   // These are the possible results of the request
   protected boolean answerComplete = false;
@@ -47,6 +48,19 @@ public class AuthRequest
   public AuthRequest(String userID, String className, String identifyingString, ConfigParams
configParameters, int maxConnections)
   {
     this.userID = userID;
+    this.userRecord = null;
+    this.className = className;
+    this.identifyingString = identifyingString;
+    this.configParameters = configParameters;
+    this.maxConnections = maxConnections;
+  }
+
+  /** Construct the request, and record the question.
+  */
+  public AuthRequest(UserRecord userRecord, String className, String identifyingString, ConfigParams
configParameters, int maxConnections)
+  {
+    this.userID = null;
+    this.userRecord = userRecord;
     this.className = className;
     this.identifyingString = identifyingString;
     this.configParameters = configParameters;
@@ -59,6 +73,12 @@ public class AuthRequest
     return userID;
   }
 
+  /** Get the user record */
+  public UserRecord getUserRecord()
+  {
+    return userRecord;
+  }
+  
   /** Get the class name */
   public String getClassName()
   {



Mime
View raw message