You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2012/07/19 12:24:43 UTC

svn commit: r1363280 - in /manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink: LiveLinkParameters.java LivelinkAuthority.java

Author: kwright
Date: Thu Jul 19 10:24:42 2012
New Revision: 1363280

URL: http://svn.apache.org/viewvc?rev=1363280&view=rev
Log:
Livelink authority cache configuration changes, except for UI

Modified:
    manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LiveLinkParameters.java
    manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java

Modified: manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LiveLinkParameters.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LiveLinkParameters.java?rev=1363280&r1=1363279&r2=1363280&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LiveLinkParameters.java (original)
+++ manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LiveLinkParameters.java Thu Jul 19 10:24:42 2012
@@ -58,7 +58,11 @@ public class LiveLinkParameters
   public final static String livelinkKeystore = "Livelink SSL keystore";
   /** User name mapping description.  This replaces username regexp and username spec below. */
   public final static String userNameMapping = "Livelink user name map";
-
+  /** Cache time in seconds */
+  public final static String cacheLifetime = "Cache lifetime minutes";
+  /** Max LRU size */
+  public final static String cacheLRUSize = "Max cache LRU size";
+  
   // These two are deprecated
   /** Username regexp */
   public final static String userNameRegexp = "User name regexp";

Modified: manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java?rev=1363280&r1=1363279&r2=1363280&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java (original)
+++ manifoldcf/branches/CONNECTORS-488/connectors/livelink/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/livelink/LivelinkAuthority.java Thu Jul 19 10:24:42 2012
@@ -61,6 +61,12 @@ public class LivelinkAuthority extends o
   private LAPI_USERS LLUsers = null;
   private LLSERVER llServer = null;
 
+  // Cache variables
+  private String cacheLifetime = null;
+  private String cacheLRUsize = null;
+  private long responseLifetime = 60000L;
+  private int LRUsize = 1000;
+
   // Match map for username
   private MatchMap matchMap = null;
 
@@ -141,6 +147,12 @@ public class LivelinkAuthority extends o
     else
       serverPort = new Integer(serverPortString).intValue();
 
+    cacheLifetime = configParams.getParameter(LiveLinkParameters.cacheLifetime);
+    if (cacheLifetime == null)
+      cacheLifetime = "1";
+    cacheLRUsize = configParams.getParameter(LiveLinkParameters.cacheLRUSize);
+    if (cacheLRUsize == null)
+      cacheLRUsize = "1000";    
 
 
   }
@@ -148,6 +160,16 @@ public class LivelinkAuthority extends o
   protected void attemptToConnect()
     throws ManifoldCFException, ServiceInterruption
   {
+    try
+    {
+      responseLifetime = Long.parseLong(this.cacheLifetime) * 60L * 1000L;
+      LRUsize = Integer.parseInt(this.cacheLRUsize);
+    }
+    catch (NumberFormatException e)
+    {
+      throw new ManifoldCFException("Cache lifetime or Cache LRU size must be an integer: "+e.getMessage(),e);
+    }
+
     if (LLUsers == null)
     {
 
@@ -239,6 +261,10 @@ public class LivelinkAuthority extends o
     serverPort = -1;
     serverUsername = null;
     serverPassword = null;
+    
+    cacheLifetime = null;
+    cacheLRUsize = null;
+
     super.disconnect();
   }
 
@@ -253,7 +279,7 @@ public class LivelinkAuthority extends o
   {
     // Construct a cache description object
     ICacheDescription objectDescription = new AuthorizationResponseDescription(userName,serverName,serverPort,
-      serverUsername,serverPassword);
+      serverUsername,serverPassword,responseLifetime,LRUsize);
     
     // Enter the cache
     ICacheHandle ch = cacheManager.enterCache(new ICacheDescription[]{objectDescription},null,null);
@@ -801,8 +827,6 @@ public class LivelinkAuthority extends o
 
   }
 
-  protected static long responseLifetime = 60000L;
-  protected static int LRUsize = 1000;
   protected static StringSet emptyStringSet = new StringSet();
   
   /** This is the cache object descriptor for cached access tokens from
@@ -819,12 +843,14 @@ public class LivelinkAuthority extends o
     protected String serverUsername;
     protected String serverPassword;
 
+    protected long responseLifetime;
+    
     /** The expiration time */
     protected long expirationTime = -1;
     
     /** Constructor. */
     public AuthorizationResponseDescription(String userName, String serverName, int serverPort,
-      String serverUsername, String serverPassword)
+      String serverUsername, String serverPassword, long responseLifetime, int LRUsize)
     {
       super("LiveLinkAuthority",LRUsize);
       this.userName = userName;
@@ -832,6 +858,7 @@ public class LivelinkAuthority extends o
       this.serverPort = serverPort;
       this.serverUsername = serverUsername;
       this.serverPassword = serverPassword;
+      this.responseLifetime = responseLifetime;
     }
 
     /** Return the invalidation keys for this object. */