in connectors/solr/connector/src/main/java/org/apache/manifoldcf/agents/output/solr/SolrConnector.java [676:1102]
public void outputConfigurationBody(final IThreadContext threadContext, final IHTTPOutput out, final Locale locale, final ConfigParams parameters, final String tabName) throws ManifoldCFException, IOException {
String type = parameters.getParameter(SolrConfig.PARAM_SOLR_TYPE);
if (type == null)
type = SolrConfig.SOLR_TYPE_STANDARD;
String protocol = parameters.getParameter(SolrConfig.PARAM_PROTOCOL);
if (protocol == null)
protocol = SolrConfig.PROTOCOL_TYPE_HTTP;
String server = parameters.getParameter(SolrConfig.PARAM_SERVER);
if (server == null)
server = "localhost";
String port = parameters.getParameter(SolrConfig.PARAM_PORT);
if (port == null)
port = "8983";
String webapp = parameters.getParameter(SolrConfig.PARAM_WEBAPPNAME);
if (webapp == null)
webapp = "solr";
String core = parameters.getParameter(SolrConfig.PARAM_CORE);
if (core == null)
core = "collection1";
String znodePath = parameters.getParameter(SolrConfig.PARAM_ZOOKEEPER_ZNODE_PATH);
if (znodePath == null)
znodePath = "";
String collection = parameters.getParameter(SolrConfig.PARAM_COLLECTION);
if (collection == null)
collection = "collection1";
String connectionTimeout = parameters.getParameter(SolrConfig.PARAM_CONNECTION_TIMEOUT);
if (connectionTimeout == null)
connectionTimeout = "60";
String socketTimeout = parameters.getParameter(SolrConfig.PARAM_SOCKET_TIMEOUT);
if (socketTimeout == null)
socketTimeout = "900";
String zkSocketTimeout = parameters.getParameter(SolrConfig.PARAM_ZOOKEEPER_SOCKET_TIMEOUT);
if (zkSocketTimeout == null)
zkSocketTimeout = "60";
String zkConnectionTimeout = parameters.getParameter(SolrConfig.PARAM_ZOOKEEPER_CONNECTION_TIMEOUT);
if (zkConnectionTimeout == null)
zkConnectionTimeout = "60";
String updatePath = parameters.getParameter(SolrConfig.PARAM_UPDATEPATH);
if (updatePath == null)
updatePath = "/update/extract";
String removePath = parameters.getParameter(SolrConfig.PARAM_REMOVEPATH);
if (removePath == null)
removePath = "/update";
String statusPath = parameters.getParameter(SolrConfig.PARAM_STATUSPATH);
if (statusPath == null)
statusPath = "/admin/ping";
String idField = parameters.getParameter(SolrConfig.PARAM_IDFIELD);
if (idField == null)
idField = "id";
String originalSizeField = parameters.getParameter(SolrConfig.PARAM_ORIGINALSIZEFIELD);
if (originalSizeField == null)
originalSizeField = "";
String modifiedDateField = parameters.getParameter(SolrConfig.PARAM_MODIFIEDDATEFIELD);
if (modifiedDateField == null)
modifiedDateField = "";
String createdDateField = parameters.getParameter(SolrConfig.PARAM_CREATEDDATEFIELD);
if (createdDateField == null)
createdDateField = "";
String indexedDateField = parameters.getParameter(SolrConfig.PARAM_INDEXEDDATEFIELD);
if (indexedDateField == null)
indexedDateField = "";
String fileNameField = parameters.getParameter(SolrConfig.PARAM_FILENAMEFIELD);
if (fileNameField == null)
fileNameField = "";
String mimeTypeField = parameters.getParameter(SolrConfig.PARAM_MIMETYPEFIELD);
if (mimeTypeField == null)
mimeTypeField = "";
String contentField = parameters.getParameter(SolrConfig.PARAM_CONTENTFIELD);
if (contentField == null)
contentField = "";
String useExtractUpdate = parameters.getParameter(SolrConfig.PARAM_EXTRACTUPDATE);
if (useExtractUpdate == null || useExtractUpdate.length() == 0)
useExtractUpdate = "true";
String realm = parameters.getParameter(SolrConfig.PARAM_REALM);
if (realm == null)
realm = "";
String userID = parameters.getParameter(SolrConfig.PARAM_USERID);
if (userID == null)
userID = "";
String password = parameters.getObfuscatedParameter(SolrConfig.PARAM_PASSWORD);
if (password == null)
password = "";
else
password = out.mapPasswordToKey(password);
String commits = parameters.getParameter(SolrConfig.PARAM_COMMITS);
if (commits == null)
commits = "true";
String commitWithin = parameters.getParameter(SolrConfig.PARAM_COMMITWITHIN);
if (commitWithin == null)
commitWithin = "";
final String solrKeystore = parameters.getParameter(SolrConfig.PARAM_KEYSTORE);
IKeystoreManager localKeystore;
if (solrKeystore == null)
localKeystore = KeystoreManagerFactory.make("");
else
localKeystore = KeystoreManagerFactory.make("", solrKeystore);
String maxLength = parameters.getParameter(SolrConfig.PARAM_MAXLENGTH);
if (maxLength == null)
maxLength = "";
String includedMimeTypes = parameters.getParameter(SolrConfig.PARAM_INCLUDEDMIMETYPES);
if (includedMimeTypes == null)
includedMimeTypes = "";
String excludedMimeTypes = parameters.getParameter(SolrConfig.PARAM_EXCLUDEDMIMETYPES);
if (excludedMimeTypes == null)
excludedMimeTypes = "";
// "SOLR type" tab
if (tabName.equals(Messages.getString(locale, "SolrConnector.SolrType"))) {
out.print("<table class=\"displaytable\">\n" + " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.SolrType2") + "</nobr></td>\n"
+ " <td class=\"value\">\n" + " <select name=\"solrtype\">\n" + " <option value=\"" + SolrConfig.SOLR_TYPE_STANDARD + "\"" + (type.equals(SolrConfig.SOLR_TYPE_STANDARD) ? " selected=\"true\"" : "") + ">"
+ Messages.getBodyString(locale, "SolrConnector.SingleServer") + "</option>\n" + " <option value=\"" + SolrConfig.SOLR_TYPE_SOLRCLOUD + "\"" + (type.equals(SolrConfig.SOLR_TYPE_SOLRCLOUD) ? " selected=\"true\"" : "") + ">"
+ Messages.getBodyString(locale, "SolrConnector.SolrCloud") + "</option>\n" + " </select>\n" + " </td>\n" + " </tr>\n" + "</table>\n");
} else {
// Type tab hiddens
out.print("<input type=\"hidden\" name=\"solrtype\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(type) + "\"/>\n");
}
// "Server" tab
// Always pass the whole keystore as a hidden.
if (solrKeystore != null) {
out.print("<input type=\"hidden\" name=\"keystoredata\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(solrKeystore) + "\"/>\n");
}
out.print("<input name=\"configop\" type=\"hidden\" value=\"Continue\"/>\n");
if (tabName.equals(Messages.getString(locale, "SolrConnector.Server"))) {
out.print("<table class=\"displaytable\">\n" + " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.Protocol") + "</nobr></td>\n"
+ " <td class=\"value\">\n" + " <select name=\"serverprotocol\">\n" + " <option value=\"" + SolrConfig.PROTOCOL_TYPE_HTTP + "\"" + (protocol.equals(SolrConfig.PROTOCOL_TYPE_HTTP) ? " selected=\"true\"" : "")
+ ">http</option>\n" + " <option value=\"" + SolrConfig.PROTOCOL_TYPE_HTTPS + "\"" + (protocol.equals(SolrConfig.PROTOCOL_TYPE_HTTPS) ? " selected=\"true\"" : "") + ">https</option>\n" + " </select>\n" + " </td>\n"
+ " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.ServerName") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <input name=\"servername\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(server) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>"
+ Messages.getBodyString(locale, "SolrConnector.Port") + "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"serverport\" type=\"text\" size=\"5\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(port)
+ "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.WebApplicationName")
+ "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"webappname\" type=\"text\" size=\"16\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(webapp) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n"
+ " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.CoreName") + "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"core\" type=\"text\" size=\"16\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(core) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>"
+ Messages.getBodyString(locale, "SolrConnector.ConnectionTimeout") + "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"connectiontimeout\" type=\"text\" size=\"5\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(connectionTimeout) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.SocketTimeout")
+ "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"sockettimeout\" type=\"text\" size=\"5\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(socketTimeout) + "\"/>\n" + " </td>\n" + " </tr>\n"
+ " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.Realm") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <input name=\"realm\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(realm) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>"
+ Messages.getBodyString(locale, "SolrConnector.UserID") + "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"userid\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(userID)
+ "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.Password") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <input type=\"password\" size=\"32\" name=\"password\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(password) + "\"/>\n" + " </td>\n" + " </tr>\n"
+ " <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.SSLTrustCertificateList") + "</nobr></td>\n"
+ " <td class=\"value\">\n" + " <input type=\"hidden\" name=\"solrkeystorealias\" value=\"\"/>\n" + " <table class=\"displaytable\">\n");
// List the individual certificates in the store, with a delete button for each
final String[] contents = localKeystore.getContents();
if (contents.length == 0) {
out.print(" <tr><td class=\"message\" colspan=\"2\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.NoCertificatesPresent") + "</nobr></td></tr>\n");
} else {
int i = 0;
while (i < contents.length) {
final String alias = contents[i];
String description = localKeystore.getDescription(alias);
if (description.length() > 128)
description = description.substring(0, 125) + "...";
out.print(" <tr>\n" + " <td class=\"value\"><input type=\"button\" onclick='Javascript:SolrDeleteCertificate(\"" + org.apache.manifoldcf.ui.util.Encoder.attributeJavascriptEscape(alias) + "\")' alt=\""
+ Messages.getAttributeString(locale, "SolrConnector.DeleteCert") + " " + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(alias) + "\" value=\"Delete\"/></td>\n" + " <td>"
+ org.apache.manifoldcf.ui.util.Encoder.bodyEscape(description) + "</td>\n" + " </tr>\n");
i++;
}
}
out.print(
" </table>\n" + " <input type=\"button\" onclick='Javascript:SolrAddCertificate()' alt=\"" + Messages.getAttributeString(locale, "SolrConnector.AddCert") + "\" value=\"" + Messages.getAttributeString(locale, "SolrConnector.Add")
+ "\"/> \n" + " " + Messages.getBodyString(locale, "SolrConnector.Certificate") + " <input name=\"solrcertificate\" size=\"50\" type=\"file\"/>\n" + " </td>\n" + " </tr>\n" + "</table>\n");
} else {
// Server tab hiddens
out.print("<input type=\"hidden\" name=\"serverprotocol\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(protocol) + "\"/>\n" + "<input type=\"hidden\" name=\"servername\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(server) + "\"/>\n" + "<input type=\"hidden\" name=\"serverport\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(port) + "\"/>\n"
+ "<input type=\"hidden\" name=\"webappname\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(webapp) + "\"/>\n" + "<input type=\"hidden\" name=\"core\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(core) + "\"/>\n" + "<input type=\"hidden\" name=\"connectiontimeout\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(connectionTimeout) + "\"/>\n"
+ "<input type=\"hidden\" name=\"sockettimeout\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(socketTimeout) + "\"/>\n" + "<input type=\"hidden\" name=\"realm\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(realm) + "\"/>\n" + "<input type=\"hidden\" name=\"userid\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(userID) + "\"/>\n"
+ "<input type=\"hidden\" name=\"password\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(password) + "\"/>\n");
}
// "Zookeeper" tab
if (tabName.equals(Messages.getString(locale, "SolrConnector.Zookeeper"))) {
out.print("<table class=\"displaytable\">\n" + " <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.ZookeeperHosts")
+ "</nobr></td>\n" + " <td class=\"boxcell\">\n" + " <table class=\"formtable\">\n" + " <tr class=\"formheaderrow\">\n" + " <td class=\"formcolumnheader\"></td>\n" + " <td class=\"formcolumnheader\"><nobr>"
+ Messages.getBodyString(locale, "SolrConnector.Host") + "</nobr></td>\n" + " <td class=\"formcolumnheader\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.Port") + "</nobr></td>\n" + " </tr>\n");
// Loop through the existing zookeeper nodes
int k = 0;
for (int i = 0; i < parameters.getChildCount(); i++) {
final ConfigurationNode cn = parameters.getChild(i);
if (cn.getType().equals(SolrConfig.NODE_ZOOKEEPER)) {
final String host = cn.getAttributeValue(SolrConfig.ATTR_HOST);
final String zkport = cn.getAttributeValue(SolrConfig.ATTR_PORT);
final String postfix = "zookeeper_" + k;
out.print(" <tr class=\"" + (((k % 2) == 0) ? "evenformrow" : "oddformrow") + "\">\n" + " <td class=\"formcolumncell\">\n" + " <a name=\"" + postfix + "\">\n" + " <input type=\"button\" value=\""
+ Messages.getAttributeString(locale, "SolrConnector.Delete") + "\" alt=\"" + Messages.getAttributeString(locale, "SolrConnector.DeleteZookeeperHost") + Integer.toString(k + 1) + "\" onclick='javascript:deleteZookeeperHost("
+ Integer.toString(k) + ");'/>\n" + " <input type=\"hidden\" name=\"" + "op_" + postfix + "\" value=\"Continue\"/>\n" + " <input type=\"hidden\" name=\"" + "host_" + postfix + "\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(host) + "\"/>\n" + " <input type=\"hidden\" name=\"" + "port_" + postfix + "\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(zkport) + "\"/>\n"
+ " </a>\n" + " </td>\n" + " <td class=\"formcolumncell\">\n" + " <nobr>" + org.apache.manifoldcf.ui.util.Encoder.bodyEscape(host) + "</nobr>\n" + " </td>\n"
+ " <td class=\"formcolumncell\">\n" + " <nobr>" + org.apache.manifoldcf.ui.util.Encoder.bodyEscape(zkport) + "</nobr>\n" + " </td>\n" + " </tr>\n");
k++;
}
}
// If this looks like the first time through for this connection, add a default zookeeper setup.
// Only works because after the first post, parameters always will have children.
if (parameters.getChildCount() == 0) {
final String postfix = "zookeeper_" + k;
out.print(" <tr class=\"" + (((k % 2) == 0) ? "evenformrow" : "oddformrow") + "\">\n" + " <td class=\"formcolumncell\">\n" + " <a name=\"" + postfix + "\">\n" + " <input type=\"button\" value=\""
+ Messages.getAttributeString(locale, "SolrConnector.Delete") + "\" alt=\"" + Messages.getAttributeString(locale, "SolrConnector.DeleteZookeeperHost") + Integer.toString(k + 1) + "\" onclick='javascript:deleteZookeeperHost("
+ Integer.toString(k) + ");'/>\n" + " <input type=\"hidden\" name=\"" + "op_" + postfix + "\" value=\"Continue\"/>\n" + " <input type=\"hidden\" name=\"" + "host_" + postfix + "\" value=\"localhost\"/>\n"
+ " <input type=\"hidden\" name=\"" + "port_" + postfix + "\" value=\"2181\"/>\n" + " </a>\n" + " </td>\n" + " <td class=\"formcolumncell\">\n" + " <nobr>localhost</nobr>\n"
+ " </td>\n" + " <td class=\"formcolumncell\">\n" + " <nobr>2181</nobr>\n" + " </td>\n" + " </tr>\n");
k++;
}
if (k == 0) {
out.print(" <tr class=\"formrow\"><td class=\"formmessage\" colspan=\"3\">" + Messages.getBodyString(locale, "SolrConnector.NoZookeeperHostsSpecified") + "</td></tr>\n");
}
out.print(" <tr class=\"formrow\"><td class=\"formseparator\" colspan=\"3\"><hr/></td></tr>\n" + " <tr class=\"formrow\">\n" + " <td class=\"formcolumncell\">\n" + " <a name=\"zookeeper\">\n"
+ " <input type=\"button\" value=\"" + Messages.getAttributeString(locale, "SolrConnector.Add") + "\" alt=\"" + Messages.getAttributeString(locale, "SolrConnector.AddZookeeperHost")
+ "\" onclick=\"javascript:addZookeeperHost();\"/>\n" + " </a>\n" + " <input type=\"hidden\" name=\"count_zookeeper\" value=\"" + k + "\"/>\n"
+ " <input type=\"hidden\" name=\"op_zookeeper\" value=\"Continue\"/>\n" + " </td>\n" + " <td class=\"formcolumncell\">\n"
+ " <nobr><input type=\"text\" size=\"30\" name=\"host_zookeeper\" value=\"\"/></nobr>\n" + " </td>\n" + " <td class=\"formcolumncell\">\n"
+ " <nobr><input type=\"text\" size=\"5\" name=\"port_zookeeper\" value=\"\"/></nobr>\n" + " </td>\n" + " </tr>\n" + " </table>\n" + " </td>\n" + " </tr>\n"
+ " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.ZnodePath") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <input name=\"znodepath\" type=\"text\" size=\"16\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(znodePath) + "\"/>\n" + " </td>\n" + " </tr>\n"
+ " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.CollectionName") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <input name=\"collection\" type=\"text\" size=\"16\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(collection) + "\"/>\n" + " </td>\n" + " </tr>\n"
+ " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.ZookeeperSocketTimeout") + "</nobr></td>\n"
+ " <td class=\"value\">\n" + " <input name=\"zkclienttimeout\" type=\"text\" size=\"5\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(zkSocketTimeout) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n"
+ " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.ZookeeperConnectionTimeout") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <input name=\"zkconnecttimeout\" type=\"text\" size=\"5\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(zkConnectionTimeout) + "\"/>\n" + " </td>\n" + " </tr>\n" + "</table>\n");
} else {
// Hiddens for Zookeeper tab
int k = 0;
for (int i = 0; i < parameters.getChildCount(); i++) {
final ConfigurationNode cn = parameters.getChild(i);
if (cn.getType().equals(SolrConfig.NODE_ZOOKEEPER)) {
final String host = cn.getAttributeValue(SolrConfig.ATTR_HOST);
final String zkport = cn.getAttributeValue(SolrConfig.ATTR_PORT);
final String postfix = "zookeeper_" + k;
out.print("<input type=\"hidden\" name=\"host_" + postfix + "\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(host) + "\"/>\n" + "<input type=\"hidden\" name=\"port_" + postfix + "\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(zkport) + "\"/>\n");
k++;
}
}
if (parameters.getChildCount() == 0) {
final String postfix = "zookeeper_" + k;
out.print("<input type=\"hidden\" name=\"host_" + postfix + "\" value=\"localhost\"/>\n" + "<input type=\"hidden\" name=\"port_" + postfix + "\" value=\"2181\"/>\n");
k++;
}
out.print("<input type=\"hidden\" name=\"count_zookeeper\" value=\"" + k + "\"/>\n" + "<input type=\"hidden\" name=\"znodepath\" value=\"" + znodePath + "\"/>\n" + "<input type=\"hidden\" name=\"collection\" value=\"" + collection + "\"/>\n"
+ "<input type=\"hidden\" name=\"zkclienttimeout\" value=\"" + zkSocketTimeout + "\"/>\n" + "<input type=\"hidden\" name=\"zkconnecttimeout\" value=\"" + zkConnectionTimeout + "\"/>\n");
}
// "Paths" tab
if (tabName.equals(Messages.getString(locale, "SolrConnector.Paths"))) {
out.print("<table class=\"displaytable\">\n" + " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.UpdateHandler")
+ "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"updatepath\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(updatePath) + "\"/>\n" + " </td>\n" + " </tr>\n"
+ " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.RemoveHandler") + "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"removepath\" type=\"text\" size=\"32\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(removePath) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.StatusHandler")
+ "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"statuspath\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(statusPath) + "\"/>\n" + " </td>\n" + " </tr>\n"
+ "</table>\n");
} else {
// Paths tab hiddens
out.print("<input type=\"hidden\" name=\"updatepath\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(updatePath) + "\"/>\n" + "<input type=\"hidden\" name=\"removepath\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(removePath) + "\"/>\n" + "<input type=\"hidden\" name=\"statuspath\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(statusPath) + "\"/>\n");
}
// "Schema" tab
if (tabName.equals(Messages.getString(locale, "SolrConnector.Schema"))) {
out.print("<table class=\"displaytable\">\n" + " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.IDFieldName")
+ "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"idfield\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(idField) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n"
+ " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.OriginalSizeFieldName") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <input name=\"originalsizefield\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(originalSizeField) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n"
+ " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.ModifiedDateFieldName") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <input name=\"modifieddatefield\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(modifiedDateField) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n"
+ " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.CreatedDateFieldName") + "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"createddatefield\" type=\"text\" size=\"32\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(createdDateField) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.IndexedDateFieldName")
+ "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"indexeddatefield\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(indexedDateField) + "\"/>\n" + " </td>\n"
+ " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.FileNameFieldName") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <input name=\"filenamefield\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(fileNameField) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>"
+ Messages.getBodyString(locale, "SolrConnector.MimeTypeFieldName") + "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"mimetypefield\" type=\"text\" size=\"32\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(mimeTypeField) + "\"/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.UseExtractUpdateHandler")
+ "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"extractupdatecheckbox\" type=\"hidden\" value=\"true\"/>\n" + " <input name=\"extractupdatepresent\" type=\"hidden\" value=\"true\"/>\n");
if (!useExtractUpdate.equals("false")) {
out.print(" <input name=\"extractupdate\" type=\"checkbox\" value=\"true\" checked=\"true\"/>\n");
} else {
out.print(" <input name=\"extractupdate\" type=\"checkbox\" value=\"true\"/>\n");
}
out.print(" </td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.ContentFieldName") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <input name=\"contentfield\" type=\"text\" size=\"32\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(contentField) + "\"/>\n" + " </td>\n" + " </tr>\n" + "</table>\n");
} else {
out.print("<input type=\"hidden\" name=\"idfield\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(idField) + "\"/>\n" + "<input type=\"hidden\" name=\"originalsizefield\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(originalSizeField) + "\"/>\n" + "<input type=\"hidden\" name=\"modifieddatefield\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(modifiedDateField) + "\"/>\n"
+ "<input type=\"hidden\" name=\"createddatefield\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(createdDateField) + "\"/>\n" + "<input type=\"hidden\" name=\"indexeddatefield\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(indexedDateField) + "\"/>\n" + "<input type=\"hidden\" name=\"filenamefield\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(fileNameField) + "\"/>\n"
+ "<input type=\"hidden\" name=\"mimetypefield\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(mimeTypeField) + "\"/>\n" + "<input type=\"hidden\" name=\"contentfield\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(contentField) + "\"/>\n" + "<input name=\"extractupdatecheckbox\" type=\"hidden\" value=\"false\"/>\n" + "<input type=\"hidden\" name=\"extractupdate\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(useExtractUpdate) + "\"/>\n" + "<input name=\"extractupdatepresent\" type=\"hidden\" value=\"true\"/>\n");
}
// "Documents" tab
if (tabName.equals(Messages.getString(locale, "SolrConnector.Documents"))) {
out.print("<table class=\"displaytable\">\n" + " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.MaximumDocumentLength")
+ "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"maxdocumentlength\" type=\"text\" size=\"16\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(maxLength) + "\"/>\n" + " </td>\n" + " </tr>\n"
+ " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.IncludedMimeTypes") + "</nobr></td>\n" + " <td class=\"value\">\n"
+ " <textarea rows=\"10\" cols=\"20\" name=\"includedmimetypes\">" + org.apache.manifoldcf.ui.util.Encoder.bodyEscape(includedMimeTypes) + "</textarea>\n" + " </td>\n" + " </tr>\n" + " <tr>\n"
+ " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.ExcludedMimeTypes") + "</nobr></td>\n" + " <td class=\"value\">\n" + " <textarea rows=\"10\" cols=\"20\" name=\"excludedmimetypes\">"
+ org.apache.manifoldcf.ui.util.Encoder.bodyEscape(excludedMimeTypes) + "</textarea>\n" + " </td>\n" + " </tr>\n" + "</table>\n");
} else {
out.print("<input type=\"hidden\" name=\"maxdocumentlength\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(maxLength) + "\"/>\n" + "<input type=\"hidden\" name=\"includedmimetypes\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(includedMimeTypes) + "\"/>\n" + "<input type=\"hidden\" name=\"excludedmimetypes\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(excludedMimeTypes) + "\"/>\n");
}
// "Commits" tab
if (tabName.equals(Messages.getString(locale, "SolrConnector.Commits"))) {
out.print("<table class=\"displaytable\">\n" + " <tr><td colspan=\"2\" class=\"separator\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.CommitAtEndOfEveryJob")
+ "</nobr></td>\n" + " <td class=\"value\">\n" + " <input name=\"commits_present\" type=\"hidden\" value=\"true\"/>\n" + " <input name=\"commits\" type=\"checkbox\" value=\"true\""
+ (commits.equals("true") ? " checked=\"yes\"" : "") + "/>\n" + " </td>\n" + " </tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.CommitEachDocumentWithin") + "</nobr></td>\n"
+ " <td class=\"value\">\n" + " <input name=\"commitwithin\" type=\"text\" size=\"16\" value=\"" + commitWithin + "\"/>\n" + " </td>\n" + " </tr>\n" + "</table>\n");
} else {
out.print("<input type=\"hidden\" name=\"commits_present\" value=\"true\"/>\n" + "<input name=\"commits\" type=\"hidden\" value=\"" + commits + "\"/>\n" + "<input name=\"commitwithin\" type=\"hidden\" value=\"" + commitWithin + "\"/>\n");
}
// Prepare for the argument tab
final Map argumentMap = new HashMap();
int i = 0;
while (i < parameters.getChildCount()) {
final ConfigNode sn = parameters.getChild(i++);
if (sn.getType().equals(SolrConfig.NODE_ARGUMENT)) {
final String name = sn.getAttributeValue(SolrConfig.ATTRIBUTE_NAME);
final String value = sn.getAttributeValue(SolrConfig.ATTRIBUTE_VALUE);
ArrayList values = (ArrayList) argumentMap.get(name);
if (values == null) {
values = new ArrayList();
argumentMap.put(name, values);
}
values.add(value);
}
}
// "Arguments" tab
if (tabName.equals(Messages.getString(locale, "SolrConnector.Arguments"))) {
// For the display, sort the arguments into alphabetic order
final String[] sortArray = new String[argumentMap.size()];
i = 0;
final Iterator iter = argumentMap.keySet().iterator();
while (iter.hasNext()) {
sortArray[i++] = (String) iter.next();
}
java.util.Arrays.sort(sortArray);
out.print("<table class=\"displaytable\">\n" + " <tr><td class=\"separator\" colspan=\"2\"><hr/></td></tr>\n" + " <tr>\n" + " <td class=\"description\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.Arguments2") + "</nobr></td>\n"
+ " <td class=\"boxcell\">\n" + " <table class=\"formtable\">\n" + " <tr class=\"formheaderrow\">\n" + " <td class=\"formcolumnheader\"></td>\n" + " <td class=\"formcolumnheader\"><nobr>"
+ Messages.getBodyString(locale, "SolrConnector.Name") + "</nobr></td>\n" + " <td class=\"formcolumnheader\"><nobr>" + Messages.getBodyString(locale, "SolrConnector.Value") + "</nobr></td>\n" + " </tr>\n");
i = 0;
int k = 0;
while (k < sortArray.length) {
final String name = sortArray[k++];
final ArrayList values = (ArrayList) argumentMap.get(name);
int j = 0;
while (j < values.size()) {
final String value = (String) values.get(j++);
// Its prefix will be...
final String prefix = "argument_" + Integer.toString(i);
out.print(" <tr class=\"" + (((i % 2) == 0) ? "evenformrow" : "oddformrow") + "\">\n" + " <td class=\"formcolumncell\">\n" + " <a name=\"" + prefix + "\"><input type=\"button\" value=\"Delete\" alt=\""
+ Messages.getAttributeString(locale, "SolrConnector.DeleteArgument") + " " + Integer.toString(i + 1) + "\" onclick=\"javascript:deleteArgument(" + Integer.toString(i) + ");" + "\"/>\n" + " <input type=\"hidden\" name=\""
+ prefix + "_op" + "\" value=\"Continue\"/>\n" + " <input type=\"hidden\" name=\"" + prefix + "_name" + "\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(name) + "\"/>\n" + " </a>\n"
+ " </td>\n" + " <td class=\"formcolumncell\">\n" + " <nobr>" + org.apache.manifoldcf.ui.util.Encoder.bodyEscape(name) + "</nobr>\n" + " </td>\n" + " <td class=\"formcolumncell\">\n"
+ " <nobr><input type=\"text\" size=\"30\" name=\"" + prefix + "_value" + "\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(value) + "\"</nobr>\n" + " </td>\n" + " </tr>\n");
i++;
}
}
if (i == 0) {
out.print(" <tr class=\"formrow\"><td class=\"formmessage\" colspan=\"3\">" + Messages.getBodyString(locale, "SolrConnector.NoArgumentsSpecified") + "</td></tr>\n");
}
out.print(" <tr class=\"formrow\"><td class=\"formseparator\" colspan=\"3\"><hr/></td></tr>\n" + " <tr class=\"formrow\">\n" + " <td class=\"formcolumncell\">\n"
+ " <a name=\"argument\"><input type=\"button\" value=\"Add\" alt=\"Add argument\" onclick=\"javascript:addArgument();\"/>\n" + " <input type=\"hidden\" name=\"argument_count\" value=\"" + Integer.toString(i)
+ "\"/>\n" + " <input type=\"hidden\" name=\"argument_op\" value=\"Continue\"/>\n" + " </a>\n" + " </td>\n" + " <td class=\"formcolumncell\">\n"
+ " <nobr><input type=\"text\" size=\"30\" name=\"argument_name\" value=\"\"/></nobr>\n" + " </td>\n" + " <td class=\"formcolumncell\">\n"
+ " <nobr><input type=\"text\" size=\"30\" name=\"argument_value\" value=\"\"/></nobr>\n" + " </td>\n" + " </tr>\n" + " </table>\n" + " </td>\n" + " </tr>\n" + "</table>\n");
} else {
// Emit hiddens for argument tab
i = 0;
final Iterator iter = argumentMap.keySet().iterator();
while (iter.hasNext()) {
final String name = (String) iter.next();
final ArrayList values = (ArrayList) argumentMap.get(name);
int j = 0;
while (j < values.size()) {
final String value = (String) values.get(j++);
// It's prefix will be...
final String prefix = "argument_" + Integer.toString(i++);
out.print("<input type=\"hidden\" name=\"" + prefix + "_name\" value=\"" + org.apache.manifoldcf.ui.util.Encoder.attributeEscape(name) + "\"/>\n" + "<input type=\"hidden\" name=\"" + prefix + "_value\" value=\""
+ org.apache.manifoldcf.ui.util.Encoder.attributeEscape(value) + "\"/>\n");
}
}
out.print("<input type=\"hidden\" name=\"argument_count\" value=\"" + Integer.toString(i) + "\"/>\n");
}
}