incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r939022 - in /incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr: HttpPoster.java SolrConnector.java
Date Wed, 28 Apr 2010 17:40:39 GMT
Author: kwright
Date: Wed Apr 28 17:40:39 2010
New Revision: 939022

URL: http://svn.apache.org/viewvc?rev=939022&view=rev
Log:
Debug the authorization tokens, also change the name to be more 'solr like', and in the future
configurable.

Modified:
    incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java
    incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConnector.java

Modified: incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java?rev=939022&r1=939021&r2=939022&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java
(original)
+++ incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/HttpPoster.java
Wed Apr 28 17:40:39 2010
@@ -52,7 +52,10 @@ public class HttpPoster
   private String postUpdateAction;
   private String postRemoveAction;
   private String postStatusAction;
+  private String allowAttributeName;
+  private String denyAttributeName;
 
+  private static final String LITERAL = "literal.";
 
   private int buffersize = 32768;  // default buffer size
   double sizeCoefficient = 0.0005;    // 20 ms additional timeout per 2000 bytes, pulled
out of my butt
@@ -108,9 +111,12 @@ public class HttpPoster
   * @param password is the unencoded password, or null.
   */
   public HttpPoster(String protocol, String server, int port, String webappName, String updatePath,
String removePath, String statusPath,
-    String realm, String userID, String password)
+    String realm, String userID, String password, String allowAttributeName, String denyAttributeName)
     throws LCFException
   {
+    this.allowAttributeName = allowAttributeName;
+    this.denyAttributeName = denyAttributeName;
+      
     this.host = server;
     this.port = port;
     this.protocol = protocol;
@@ -753,17 +759,17 @@ public class HttpPoster
   }
 
   /** Count the size of an acl level */
-  protected static int lengthACLs(String aclType, String[] acl, String[] denyAcl)
+  protected int lengthACLs(String aclType, String[] acl, String[] denyAcl)
     throws IOException
   {
     int totalLength = 0;
-    String metadataACLName = "__ALLOW_TOKEN__" + aclType;
+    String metadataACLName = LITERAL + allowAttributeName + aclType;
     int i = 0;
     while (i < acl.length)
     {
       totalLength += lengthField(metadataACLName,acl[i++]);
     }
-    String metadataDenyACLName = "__DENY_TOKEN__" + aclType;
+    String metadataDenyACLName = LITERAL + denyAttributeName + aclType;
     i = 0;
     while (i < denyAcl.length)
     {
@@ -816,16 +822,16 @@ public class HttpPoster
 
   
   /** Output an acl level */
-  protected static void writeACLs(OutputStream out, String aclType, String[] acl, String[]
denyAcl)
+  protected void writeACLs(OutputStream out, String aclType, String[] acl, String[] denyAcl)
     throws IOException
   {
-    String metadataACLName = "__ALLOW_TOKEN__" + aclType;
+    String metadataACLName = LITERAL + allowAttributeName + aclType;
     int i = 0;
     while (i < acl.length)
     {
       writeField(out,metadataACLName,acl[i++]);
     }
-    String metadataDenyACLName = "__DENY_TOKEN__" + aclType;
+    String metadataDenyACLName = LITERAL + denyAttributeName + aclType;
     i = 0;
     while (i < denyAcl.length)
     {

Modified: incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConnector.java?rev=939022&r1=939021&r2=939022&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConnector.java
(original)
+++ incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConnector.java
Wed Apr 28 17:40:39 2010
@@ -38,7 +38,11 @@ public class SolrConnector extends org.a
 
   /** Local data */
   protected HttpPoster poster = null;
-
+  /** The allow attribute name */
+  protected String allowAttributeName = "allow_token_";
+  /** The deny attribute name */
+  protected String denyAttributeName = "deny_token_";
+  
   /** Constructor.
   */
   public SolrConnector()
@@ -121,7 +125,8 @@ public class SolrConnector extends org.a
       String realm = params.getParameter(SolrConfig.PARAM_REALM);
       try
       {
-        poster = new HttpPoster(protocol,server,Integer.parseInt(port),webapp,updatePath,removePath,statusPath,realm,userID,password);
+        poster = new HttpPoster(protocol,server,Integer.parseInt(port),webapp,updatePath,removePath,statusPath,realm,userID,password,
+          allowAttributeName,denyAttributeName);
       }
       catch (NumberFormatException e)
       {



Mime
View raw message