Author: kwright
Date: Sat Mar 30 08:26:55 2013
New Revision: 1462716

URL: http://svn.apache.org/r1462716
Log:
Separate parameter setup from actual session establishment.  Part of 
CONNECTORS-667.

Modified:
    
manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java
    
manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java

Modified: 
manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java?rev=1462716&r1=1462715&r2=1462716&view=diff
==============================================================================
--- 
manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java
 (original)
+++ 
manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/authorities/DCTM/AuthorityConnector.java
 Sat Mar 30 08:26:55 2013
@@ -62,6 +62,8 @@ public class AuthorityConnector extends 
     /** Cache manager. */
   protected ICacheManager cacheManager = null;
 
+  // Set if we have set up session parameters necessary for caching
+  protected boolean hasSessionParameters = false;
   // This is the DFC session; it may be null, or it may be set.
   protected IDocumentum session = null;
   protected long lastSessionFetch = -1L;
@@ -129,23 +131,23 @@ public class AuthorityConnector extends 
     }
   }
 
-  /** Get a DFC session.  This will be done every time it is needed.
+  /** Get session parameters.
   */
-  protected void getSession()
+  protected void getSessionParameters()
     throws ManifoldCFException
   {
-    try
+    if (!hasSessionParameters)
     {
-      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);
-    }
+      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()
       if (docbaseName == null || docbaseName.length() < 1)
         throw new ManifoldCFException("Parameter "+CONFIG_PARAM_DOCBASE+" 
required but not set");
@@ -182,7 +184,18 @@ public class AuthorityConnector extends 
         Logging.authorityConnectors.debug("DCTM: Use system acls enabled");
       }
 
-
+      hasSessionParameters = true;
+    }
+  }
+  
+  /** Get a DFC session.  This will be done every time it is needed.
+  */
+  protected void getSession()
+    throws ManifoldCFException
+  {
+    getSessionParameters();
+    if (session == null)
+    {
       // This actually sets up the connection
       GetSessionThread t = new GetSessionThread();
       try
@@ -630,7 +643,7 @@ public class AuthorityConnector extends 
       Logging.authorityConnectors.debug("DCTM: Inside 
AuthorityConnector.getAuthorizationResponse for user 
'"+strUserNamePassedIn+"'");
 
     // We need this in order to be able to properly construct an 
AuthorizationResponseDescription.
-    getSession();
+    getSessionParameters();
     
     // Construct a cache description object
     ICacheDescription objectDescription = new 
AuthorizationResponseDescription(strUserNamePassedIn,docbaseName,userName,password,
@@ -945,6 +958,7 @@ public class AuthorityConnector extends 
   public void disconnect()
     throws ManifoldCFException
   {
+    hasSessionParameters = false;
     if (session != null)
     {
       DestroySessionThread t = new DestroySessionThread();

Modified: 
manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java
URL: 
http://svn.apache.org/viewvc/manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java?rev=1462716&r1=1462715&r2=1462716&view=diff
==============================================================================
--- 
manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java
 (original)
+++ 
manifoldcf/trunk/connectors/documentum/connector/src/main/java/org/apache/manifoldcf/crawler/connectors/DCTM/DCTM.java
 Sat Mar 30 08:26:55 2013
@@ -56,6 +56,7 @@ public class DCTM extends org.apache.man
   protected String domain = null;
   protected String webtopBaseURL = null;
 
+  protected boolean hasSessionParameters = false;
   protected IDocumentum session = null;
   protected long lastSessionFetch = -1L;
 
@@ -98,12 +99,12 @@ public class DCTM extends org.apache.man
     }
   }
 
-  /** Get a DFC session.  This will be done every time it is needed.
+  /** Establish session parameters.
   */
-  protected void getSession()
-    throws ManifoldCFException, ServiceInterruption
+  protected void getSessionParameters()
+    throws ManifoldCFException
   {
-    if (session == null)
+    if (!hasSessionParameters)
     {
       // Perform basic parameter checking, and debug output.
       if (docbaseName == null || docbaseName.length() < 1)
@@ -132,6 +133,18 @@ public class DCTM extends org.apache.man
       else
         Logging.connectors.debug("DCTM: Domain = '" + domain + "'");
 
+      hasSessionParameters = true;
+    }
+  }
+  
+  /** Get a DFC session.  This will be done every time it is needed.
+  */
+  protected void getSession()
+    throws ManifoldCFException, ServiceInterruption
+  {
+    getSessionParameters();
+    if (session == null)
+    {
       long currentTime;
       GetSessionThread t = new GetSessionThread();
       try
@@ -646,6 +659,7 @@ public class DCTM extends org.apache.man
   public void disconnect()
     throws ManifoldCFException
   {
+    hasSessionParameters = false;
     if (session != null)
     {
       DestroySessionThread t = new DestroySessionThread();


Reply via email to