manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iori...@apache.org
Subject svn commit: r1591628 - in /manifoldcf/integration/solr-4.x/trunk: ./ src/main/java/org/apache/solr/mcf/ src/test/java/org/apache/solr/mcf/
Date Thu, 01 May 2014 12:03:11 GMT
Author: iorixxx
Date: Thu May  1 12:03:11 2014
New Revision: 1591628

URL: http://svn.apache.org/r1591628
Log:
CONNECTORS-934 : Check if log level is enabled before constructing log message.

Modified:
    manifoldcf/integration/solr-4.x/trunk/CHANGES.txt
    manifoldcf/integration/solr-4.x/trunk/src/main/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
    manifoldcf/integration/solr-4.x/trunk/src/main/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
    manifoldcf/integration/solr-4.x/trunk/src/test/java/org/apache/solr/mcf/ManifoldCFSCLoadTest.java

Modified: manifoldcf/integration/solr-4.x/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/CHANGES.txt?rev=1591628&r1=1591627&r2=1591628&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/CHANGES.txt (original)
+++ manifoldcf/integration/solr-4.x/trunk/CHANGES.txt Thu May  1 12:03:11 2014
@@ -6,6 +6,9 @@ $Id$
 CONNECTORS-914: Go to a Maven build system.
 (Ahmet Arslan)
 
+CONNECTORS-934 : Check if log level is enabled before constructing log message.
+(Ahmet Arslan)
+
 ======================= Release 2.0 =====================
 
 CONNECTORS-886: Provide [allow|deny]_token_parent fields.

Modified: manifoldcf/integration/solr-4.x/trunk/src/main/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/src/main/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java?rev=1591628&r1=1591627&r2=1591628&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/src/main/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
(original)
+++ manifoldcf/integration/solr-4.x/trunk/src/main/java/org/apache/solr/mcf/ManifoldCFQParserPlugin.java
Thu May  1 12:03:11 2014
@@ -45,8 +45,6 @@ import java.net.*;
 */
 public class ManifoldCFQParserPlugin extends QParserPlugin
 {
-  /** The component name */
-  static final public String COMPONENT_NAME = "mcf";
   /** The parameter that is supposed to contain the authenticated user name, possibly including
the AD domain */
   static final public String AUTHENTICATED_USER_NAME = "AuthenticatedUserName";
   /** The parameter that is supposed to contain the MCF authorization domain, if any */
@@ -63,10 +61,7 @@ public class ManifoldCFQParserPlugin ext
   
   /** Special token for null security fields */
   static final public String NOSECURITY_TOKEN = "__nosecurity__";
-  
-  /** The queries that we will not attempt to interfere with */
-  static final private String[] globalAllowed = { "solrpingquery" };
-  
+
   /** A logger we can use */
   private static final Logger LOG = LoggerFactory.getLogger(ManifoldCFQParserPlugin.class);
 
@@ -207,26 +202,25 @@ public class ManifoldCFQParserPlugin ext
         {
           // Only return 'public' documents (those with no security tokens at all)
           LOG.info("Group tokens received from caller");
-          for (String passedToken : passedTokens)
-          {
-            userAccessTokens.add(passedToken);
-          }
+          userAccessTokens.addAll(Arrays.asList(passedTokens));
         }
       }
       else
       {
-        StringBuilder sb = new StringBuilder("[");
-        boolean first = true;
-        for (String domain : domainMap.keySet())
-        {
-          if (!first)
-            sb.append(",");
-          else
-            first = false;
-          sb.append(domain).append(":").append(domainMap.get(domain));
+        if(LOG.isInfoEnabled()){
+          StringBuilder sb = new StringBuilder("[");
+          boolean first = true;
+          for (String domain : domainMap.keySet())
+          {
+            if (!first)
+              sb.append(",");
+            else
+              first = false;
+            sb.append(domain).append(":").append(domainMap.get(domain));
+          }
+          sb.append("]");
+          LOG.info("Trying to match docs for user '"+sb.toString()+"'");
         }
-        sb.append("]");
-        LOG.info("Trying to match docs for user '"+sb.toString()+"'");
         // Valid authenticated user name.  Look up access tokens for the user.
         // Check the configuration arguments for validity
         if (authorityBaseURL == null)

Modified: manifoldcf/integration/solr-4.x/trunk/src/main/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/src/main/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java?rev=1591628&r1=1591627&r2=1591628&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/src/main/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
(original)
+++ manifoldcf/integration/solr-4.x/trunk/src/main/java/org/apache/solr/mcf/ManifoldCFSearchComponent.java
Thu May  1 12:03:11 2014
@@ -99,7 +99,7 @@ public class ManifoldCFSearchComponent e
     authorityBaseURL = (String)args.get("AuthorityServiceBaseURL");
     if (authorityBaseURL == null)
     {
-      System.out.println("USING DEFAULT BASE URL!!");
+      LOG.info("USING DEFAULT BASE URL!!");
       authorityBaseURL = "http://localhost:8345/mcf-authority-service";
     }
     Integer cTimeOut = (Integer)args.get("ConnectionTimeOut");
@@ -203,26 +203,25 @@ public class ManifoldCFSearchComponent e
       {
         // Only return 'public' documents (those with no security tokens at all)
         LOG.info("Group tokens received from caller");
-        for (String passedToken : passedTokens)
-        {
-          userAccessTokens.add(passedToken);
-        }
+        userAccessTokens.addAll(Arrays.asList(passedTokens));
       }
     }
     else
     {
-      StringBuilder sb = new StringBuilder("[");
-      boolean first = true;
-      for (String domain : domainMap.keySet())
-      {
-        if (!first)
-          sb.append(",");
-        else
-          first = false;
-        sb.append(domain).append(":").append(domainMap.get(domain));
+      if(LOG.isInfoEnabled()){
+        StringBuilder sb = new StringBuilder("[");
+        boolean first = true;
+        for (String domain : domainMap.keySet())
+        {
+          if (!first)
+            sb.append(",");
+          else
+            first = false;
+          sb.append(domain).append(":").append(domainMap.get(domain));
+        }
+        sb.append("]");
+        LOG.info("Trying to match docs for user '"+sb.toString()+"'");
       }
-      sb.append("]");
-      LOG.info("Trying to match docs for user '"+sb.toString()+"'");
       // Valid authenticated user name.  Look up access tokens for the user.
       // Check the configuration arguments for validity
       if (authorityBaseURL == null)
@@ -450,7 +449,6 @@ public class ManifoldCFSearchComponent e
       if (httpConnectionManager != null)
       {
         httpConnectionManager.shutdown();
-	System.out.println("Just shutdown httpConnectionmanager");
         httpConnectionManager = null;
         client = null;
       }

Modified: manifoldcf/integration/solr-4.x/trunk/src/test/java/org/apache/solr/mcf/ManifoldCFSCLoadTest.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/solr-4.x/trunk/src/test/java/org/apache/solr/mcf/ManifoldCFSCLoadTest.java?rev=1591628&r1=1591627&r2=1591628&view=diff
==============================================================================
--- manifoldcf/integration/solr-4.x/trunk/src/test/java/org/apache/solr/mcf/ManifoldCFSCLoadTest.java
(original)
+++ manifoldcf/integration/solr-4.x/trunk/src/test/java/org/apache/solr/mcf/ManifoldCFSCLoadTest.java
Thu May  1 12:03:11 2014
@@ -18,6 +18,7 @@
 package org.apache.solr.mcf;
 
 import java.io.IOException;
+import java.util.concurrent.TimeUnit;
 
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
@@ -80,7 +81,7 @@ public class ManifoldCFSCLoadTest extend
   @Test
   public void testTimeQueries() throws Exception {
     int i = 0;
-    long startTime = System.currentTimeMillis();
+    long startTime = System.nanoTime();
     while (i < 1000)
     {
       assertQ(req("qt", "/mcf", "q", "*:*", "fl", "id", "AuthenticatedUserName", "user1"),
@@ -94,7 +95,7 @@ public class ManifoldCFSCLoadTest extend
       
       i++;
     }
-    System.out.println("Query time = "+new Long(System.currentTimeMillis()-startTime));
+    System.out.println("Query time (milliseconds) = " +  TimeUnit.NANOSECONDS.toMillis(System.nanoTime()-startTime));
   }
 
   static class MockMCFAuthorityService {



Mime
View raw message