manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1363252 - /manifoldcf/branches/CONNECTORS-488/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java
Date Thu, 19 Jul 2012 07:34:19 GMT
Author: kwright
Date: Thu Jul 19 07:34:19 2012
New Revision: 1363252

URL: http://svn.apache.org/viewvc?rev=1363252&view=rev
Log:
Add Documentum configurable logic, minus UI piece

Modified:
    manifoldcf/branches/CONNECTORS-488/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java

Modified: manifoldcf/branches/CONNECTORS-488/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-488/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java?rev=1363252&r1=1363251&r2=1363252&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-488/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-488/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java
Thu Jul 19 07:34:19 2012
@@ -40,7 +40,9 @@ public class AuthorityConnector extends 
   public static final String CONFIG_PARAM_DOMAIN = "domain";
   public static final String CONFIG_PARAM_CASEINSENSITIVE = "usernamecaseinsensitive";
   public static final String CONFIG_PARAM_USESYSTEMACLS = "usesystemacls";
-
+  public static final String CONFIG_PARAM_CACHELIFETIME = "cachelifetimesecs";
+  public static final String CONFIG_PARAM_CACHELRUSIZE = "cachelrusize";
+  
   protected String docbaseName = null;
   protected String userName = null;
   protected String password = null;
@@ -66,6 +68,11 @@ public class AuthorityConnector extends 
 
   protected static final long timeToRelease = 300000L;
 
+  private String cacheLifetime = null;
+  private String cacheLRUsize = null;
+  private long responseLifetime = 60000L;
+  private int LRUsize = 1000;
+
   public AuthorityConnector()
   {
     super();
@@ -127,6 +134,16 @@ public class AuthorityConnector extends 
   protected void getSession()
     throws ManifoldCFException
   {
+    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 (session == null)
     {
       // This is the stuff that used to be in connect()
@@ -614,7 +631,7 @@ public class AuthorityConnector extends 
 
     // Construct a cache description object
     ICacheDescription objectDescription = new AuthorizationResponseDescription(strUserNamePassedIn,docbaseName,userName,password,
-      domain,caseInsensitive,useSystemAcls);
+      domain,caseInsensitive,useSystemAcls,responseLifetime,LRUsize);
     
     // Enter the cache
     ICacheHandle ch = cacheManager.enterCache(new ICacheDescription[]{objectDescription},null,null);
@@ -910,6 +927,13 @@ public class AuthorityConnector extends 
     else
       useSystemAcls = false;
 
+    cacheLifetime = configParams.getParameter(CONFIG_PARAM_CACHELIFETIME);
+    if (cacheLifetime == null)
+      cacheLifetime = "1";
+    cacheLRUsize = configParams.getParameter(CONFIG_PARAM_CACHELRUSIZE);
+    if (cacheLRUsize == null)
+      cacheLRUsize = "1000";    
+
   }
 
   /** Disconnect from Documentum.
@@ -1269,8 +1293,6 @@ public class AuthorityConnector extends 
     );
   }
 
-  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
@@ -1288,10 +1310,14 @@ public class AuthorityConnector extends 
     protected boolean useSystemACLs;
     /** The expiration time */
     protected long expirationTime = -1;
+    /** The response lifetime */
+    protected long responseLifetime;
     
     /** Constructor. */
     public AuthorizationResponseDescription(String userName, String docbaseName,
-      String adminUserName, String adminPassword, String domain, boolean caseInsensitive,
boolean useSystemACLs)
+      String adminUserName, String adminPassword, String domain,
+      boolean caseInsensitive, boolean useSystemACLs,
+      long responseLifetime, int LRUsize)
     {
       super("DocumentumDirectoryAuthority",LRUsize);
       this.userName = userName;
@@ -1301,6 +1327,7 @@ public class AuthorityConnector extends 
       this.domain = domain;
       this.caseInsensitive = caseInsensitive;
       this.useSystemACLs = useSystemACLs;
+      this.responseLifetime = responseLifetime;
     }
 
     /** Return the invalidation keys for this object. */



Mime
View raw message