manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1688628 - in /manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch: MCFAuthorizerRestSearchAction.java MCFConfigurationParameters.java
Date Wed, 01 Jul 2015 11:39:00 GMT
Author: kwright
Date: Wed Jul  1 11:39:00 2015
New Revision: 1688628

URL: http://svn.apache.org/r1688628
Log:
Import configuration code from Bartlomiej Superson.

Modified:
    manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerRestSearchAction.java
    manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFConfigurationParameters.java

Modified: manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerRestSearchAction.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerRestSearchAction.java?rev=1688628&r1=1688627&r2=1688628&view=diff
==============================================================================
--- manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerRestSearchAction.java
(original)
+++ manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFAuthorizerRestSearchAction.java
Wed Jul  1 11:39:00 2015
@@ -54,16 +54,6 @@ import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 
- /*
-    New parseSearchRequestMCF function added in utils to parse RestRequest.
-    There are also problems with security using JavaSearchAPI, because it doesn't implements
setParam function
-    to set username param, but this can be ommited using JavaScriptAPI, which allows to do
that.
-    Security filter can be also applied in this class but there is a problem with proper
extraSource parsing.
-    There is also a possibility to create service, inject RestController into it, register
RestFilter in it, which
-    should be used only if request handled by RestSearchAction and replace query from this
request with
-    the same query wrapped by security filter.
- */
-
 public class MCFAuthorizerRestSearchAction extends RestSearchAction {
 
   protected final MCFAuthorizer authorizer;
@@ -71,9 +61,7 @@ public class MCFAuthorizerRestSearchActi
   @Inject
   public MCFAuthorizerRestSearchAction(Settings settings, final RestController restController,
Client client) {
     super(settings,restController,client);
-    // Set up MCFConfigurationParameters instance from settings
-    final MCFConfigurationParameters conf = new MCFConfigurationParameters();
-    // MHL
+    final MCFConfigurationParameters conf = new MCFConfigurationParameters(settings);
     authorizer = new MCFAuthorizer(conf);
   }
 
@@ -86,7 +74,6 @@ public class MCFAuthorizerRestSearchActi
   
   protected SearchRequest parseSearchRequestMCF(final RestRequest request) throws MCFAuthorizerException
{
     SearchRequest searchRequest;
-    //if(usernameAndDomain[0]==null) throw new MCFAuthorizerException("Username not passed.");
     if(request.param("u")!=null) {
       String[] authenticatedUserNamesAndDomains = request.param("u").split(",");
       String[] indices = Strings.splitStringByCommaToArray(request.param("index"));

Modified: manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFConfigurationParameters.java
URL: http://svn.apache.org/viewvc/manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFConfigurationParameters.java?rev=1688628&r1=1688627&r2=1688628&view=diff
==============================================================================
--- manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFConfigurationParameters.java
(original)
+++ manifoldcf/integration/elasticsearch-1.5/trunk/src/main/java/org/apache/manifoldcf/elasticsearch/MCFConfigurationParameters.java
Wed Jul  1 11:39:00 2015
@@ -1,5 +1,5 @@
 /* $Id$ */
-
+/* Modified 2015-07-01 by Bart Superson */
 /**
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements. See the NOTICE file distributed with
@@ -18,6 +18,8 @@
 */
 package org.apache.manifoldcf.elasticsearch;
 
+import org.elasticsearch.common.settings.Settings;
+
 /** This class represents the configuration information that the QueryModifier
 * needs to perform its job.
 */
@@ -35,11 +37,21 @@ public class MCFConfigurationParameters
   public String denyFieldPrefix = "deny_token_";
   /** Connection pool size, e.g. 50 */
   public int connectionPoolSize = 50;
-  
+
+  public  MCFConfigurationParameters(){};
+
+  public MCFConfigurationParameters(Settings settings) {
+      setBaseURL(settings.get("mcf.authority_service_base_url", authorityServiceBaseURL));
+      setConnectionTimeout(settings.getAsInt("mcf.http.connection_timeout", connectionTimeout));
+      setSocketTimeout(settings.getAsInt("mcf.http.socket_timeout",socketTimeout));
+      setAllowFieldPrefix(settings.get("mcf.allow_field_prefix"));
+      setDenyFieldPrefix(settings.get("mcf.deny_field_prefix"));
+      setConnectionPoolSize(settings.getAsInt("mcf.http.connection_pool_size",connectionPoolSize));
+  }
+
   public MCFConfigurationParameters setBaseURL(String baseURL)
   {
-    this.authorityServiceBaseURL = baseURL;
-    return this;
+    this.authorityServiceBaseURL = baseURL;    return this;
   }
   
   public MCFConfigurationParameters setConnectionTimeout(int timeout)



Mime
View raw message