incubator-connectors-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r959078 - in /incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr: HttpPoster.java SolrConfig.java SolrConnector.java
Date Tue, 29 Jun 2010 19:36:42 GMT
Author: kwright
Date: Tue Jun 29 19:36:41 2010
New Revision: 959078

URL: http://svn.apache.org/viewvc?rev=959078&view=rev
Log:
Fix for CONNECTORS-45.  Add a solr core field.

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/SolrConfig.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=959078&r1=959077&r2=959078&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
Tue Jun 29 19:36:41 2010
@@ -123,7 +123,8 @@ public class HttpPoster
   * @param userID is the unencoded user name, or null.
   * @param password is the unencoded password, or null.
   */
-  public HttpPoster(String protocol, String server, int port, String webappName, String updatePath,
String removePath, String statusPath,
+  public HttpPoster(String protocol, String server, int port, String webappName,
+    String updatePath, String removePath, String statusPath,
     String realm, String userID, String password, String allowAttributeName, String denyAttributeName)
     throws LCFException
   {
@@ -153,6 +154,7 @@ public class HttpPoster
 
     if (webappName.length() > 0)
       webappName = "/" + webappName;
+      
     postUpdateAction = webappName + updatePath;
     postRemoveAction = webappName + removePath;
     postStatusAction = webappName + statusPath;

Modified: incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConfig.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConfig.java?rev=959078&r1=959077&r2=959078&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConfig.java
(original)
+++ incubator/lcf/trunk/modules/connectors/solr/connector/org/apache/lcf/agents/output/solr/SolrConfig.java
Tue Jun 29 19:36:41 2010
@@ -35,6 +35,8 @@ public class SolrConfig
   public static final String PARAM_PORT = "Server port";
   /** Webapp */
   public static final String PARAM_WEBAPPNAME = "Server web application";
+  /** Core */
+  public static final String PARAM_CORE = "Solr core name";
   /** Update path */
   public static final String PARAM_UPDATEPATH = "Server update handler";
   /** Remove path */

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=959078&r1=959077&r2=959078&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
Tue Jun 29 19:36:41 2010
@@ -109,6 +109,10 @@ public class SolrConnector extends org.a
       if (webapp == null || webapp.length() == 0)
         webapp = "";
 
+      String core = params.getParameter(org.apache.lcf.agents.output.solr.SolrConfig.PARAM_CORE);
+      if (core != null && core.length() == 0)
+        core = null;
+      
       String updatePath = params.getParameter(org.apache.lcf.agents.output.solr.SolrConfig.PARAM_UPDATEPATH);
       if (updatePath == null || updatePath.length() == 0)
         updatePath = "";
@@ -124,6 +128,14 @@ public class SolrConnector extends org.a
       String userID = params.getParameter(SolrConfig.PARAM_USERID);
       String password = params.getObfuscatedParameter(SolrConfig.PARAM_PASSWORD);
       String realm = params.getParameter(SolrConfig.PARAM_REALM);
+      
+      if (core != null)
+      {
+        if (webapp.length() == 0)
+          throw new LCFException("Webapp must be specified if core is specified.");
+        webapp = webapp + "/" + core;
+      }
+      
       try
       {
         poster = new HttpPoster(protocol,server,Integer.parseInt(port),webapp,updatePath,removePath,statusPath,realm,userID,password,
@@ -331,6 +343,18 @@ public class SolrConnector extends org.a
 "    editconnection.webappname.focus();\n"+
 "    return false;\n"+
 "  }\n"+
+"  if (editconnection.core.value != \"\" && editconnection.core.value.indexOf(\"/\")
!= -1)\n"+
+"  {\n"+
+"    alert(\"Core name cannot have '/' characters\");\n"+
+"    editconnection.core.focus();\n"+
+"    return false;\n"+
+"  }\n"+
+"  if (editconnection.webappname.value == \"\" && editconnection.core.value != \"\")\n"+
+"  {\n"+
+"    alert(\"Web application must be specified if core is specified\");\n"+
+"    editconnection.webappname.focus();\n"+
+"    return false;\n"+
+"  }\n"+
 "  if (editconnection.updatepath.value != \"\" && editconnection.updatepath.value.substring(0,1)
!= \"/\")\n"+
 "  {\n"+
 "    alert(\"Update path must start with a  '/' character\");\n"+
@@ -375,6 +399,20 @@ public class SolrConnector extends org.a
 "    editconnection.webappname.focus();\n"+
 "    return false;\n"+
 "  }\n"+
+"  if (editconnection.core.value != \"\" && editconnection.core.value.indexOf(\"/\")
!= -1)\n"+
+"  {\n"+
+"    alert(\"Core name cannot have '/' characters\");\n"+
+"    SelectTab(\"Server\");\n"+
+"    editconnection.core.focus();\n"+
+"    return false;\n"+
+"  }\n"+
+"  if (editconnection.webappname.value == \"\" && editconnection.core.value != \"\")\n"+
+"  {\n"+
+"    alert(\"Web application must be specified if core is specified\");\n"+
+"    SelectTab(\"Server\");\n"+
+"    editconnection.webappname.focus();\n"+
+"    return false;\n"+
+"  }\n"+
 "  if (editconnection.updatepath.value != \"\" && editconnection.updatepath.value.substring(0,1)
!= \"/\")\n"+
 "  {\n"+
 "    alert(\"Update path must start with a  '/' character\");\n"+
@@ -458,6 +496,10 @@ public class SolrConnector extends org.a
     if (webapp == null)
       webapp = "solr";
 
+    String core = parameters.getParameter(org.apache.lcf.agents.output.solr.SolrConfig.PARAM_CORE);
+    if (core == null)
+      core = "";
+
     String updatePath = parameters.getParameter(org.apache.lcf.agents.output.solr.SolrConfig.PARAM_UPDATEPATH);
     if (updatePath == null)
       updatePath = "/update/extract";
@@ -510,12 +552,18 @@ public class SolrConnector extends org.a
 "  </tr>\n"+
 "  <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n"+
 "  <tr>\n"+
-"    <td class=\"description\"><nobr>Web application  name:</nobr></td>\n"+
+"    <td class=\"description\"><nobr>Web application name:</nobr></td>\n"+
 "    <td class=\"value\">\n"+
 "      <input name=\"webappname\" type=\"text\" size=\"16\" value=\""+org.apache.lcf.ui.util.Encoder.attributeEscape(webapp)+"\"/>\n"+
 "    </td>\n"+
 "  </tr>\n"+
 "  <tr>\n"+
+"    <td class=\"description\"><nobr>Core name:</nobr></td>\n"+
+"    <td class=\"value\">\n"+
+"      <input name=\"core\" type=\"text\" size=\"16\" value=\""+org.apache.lcf.ui.util.Encoder.attributeEscape(core)+"\"/>\n"+
+"    </td>\n"+
+"  </tr>\n"+
+"  <tr>\n"+
 "    <td class=\"description\"><nobr>Update handler:</nobr></td>\n"+
 "    <td class=\"value\">\n"+
 "      <input name=\"updatepath\" type=\"text\" size=\"32\" value=\""+org.apache.lcf.ui.util.Encoder.attributeEscape(updatePath)+"\"/>\n"+
@@ -563,6 +611,7 @@ public class SolrConnector extends org.a
 "<input type=\"hidden\" name=\"servername\" value=\""+org.apache.lcf.ui.util.Encoder.attributeEscape(server)+"\"/>\n"+
 "<input type=\"hidden\" name=\"serverport\" value=\""+org.apache.lcf.ui.util.Encoder.attributeEscape(port)+"\"/>\n"+
 "<input type=\"hidden\" name=\"webappname\" value=\""+org.apache.lcf.ui.util.Encoder.attributeEscape(webapp)+"\"/>\n"+
+"<input type=\"hidden\" name=\"core\" value=\""+org.apache.lcf.ui.util.Encoder.attributeEscape(core)+"\"/>\n"+
 "<input type=\"hidden\" name=\"updatepath\" value=\""+org.apache.lcf.ui.util.Encoder.attributeEscape(updatePath)+"\"/>\n"+
 "<input type=\"hidden\" name=\"removepath\" value=\""+org.apache.lcf.ui.util.Encoder.attributeEscape(removePath)+"\"/>\n"+
 "<input type=\"hidden\" name=\"statuspath\" value=\""+org.apache.lcf.ui.util.Encoder.attributeEscape(statusPath)+"\"/>\n"+
@@ -730,6 +779,10 @@ public class SolrConnector extends org.a
     if (webapp != null)
       parameters.setParameter(org.apache.lcf.agents.output.solr.SolrConfig.PARAM_WEBAPPNAME,webapp);
 
+    String core = variableContext.getParameter("core");
+    if (core != null)
+      parameters.setParameter(org.apache.lcf.agents.output.solr.SolrConfig.PARAM_CORE,core);
+
     String updatePath = variableContext.getParameter("updatepath");
     if (updatePath != null)
       parameters.setParameter(org.apache.lcf.agents.output.solr.SolrConfig.PARAM_UPDATEPATH,updatePath);



Mime
View raw message