Return-Path: Delivered-To: apmail-incubator-connectors-commits-archive@minotaur.apache.org Received: (qmail 78656 invoked from network); 25 Jun 2010 10:33:07 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 25 Jun 2010 10:33:07 -0000 Received: (qmail 41063 invoked by uid 500); 25 Jun 2010 10:33:06 -0000 Delivered-To: apmail-incubator-connectors-commits-archive@incubator.apache.org Received: (qmail 41011 invoked by uid 500); 25 Jun 2010 10:33:05 -0000 Mailing-List: contact connectors-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: connectors-dev@incubator.apache.org Delivered-To: mailing list connectors-commits@incubator.apache.org Received: (qmail 41002 invoked by uid 99); 25 Jun 2010 10:33:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jun 2010 10:33:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED,WEIRD_QUOTING X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 25 Jun 2010 10:32:56 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id DBECE2388993; Fri, 25 Jun 2010 10:31:59 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r957882 - in /incubator/lcf/branches/CONNECTORS-40/modules/connectors/livelink: connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java crawler-ui/connectors/ Date: Fri, 25 Jun 2010 10:31:59 -0000 To: connectors-commits@incubator.apache.org From: kwright@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20100625103159.DBECE2388993@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: kwright Date: Fri Jun 25 10:31:59 2010 New Revision: 957882 URL: http://svn.apache.org/viewvc?rev=957882&view=rev Log: Move livelink connector UI to methods in the main connector class. Removed: incubator/lcf/branches/CONNECTORS-40/modules/connectors/livelink/crawler-ui/connectors/ Modified: incubator/lcf/branches/CONNECTORS-40/modules/connectors/livelink/connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java Modified: incubator/lcf/branches/CONNECTORS-40/modules/connectors/livelink/connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-40/modules/connectors/livelink/connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java?rev=957882&r1=957881&r2=957882&view=diff ============================================================================== --- incubator/lcf/branches/CONNECTORS-40/modules/connectors/livelink/connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java (original) +++ incubator/lcf/branches/CONNECTORS-40/modules/connectors/livelink/connector/org/apache/lcf/crawler/connectors/livelink/LivelinkConnector.java Fri Jun 25 10:31:59 2010 @@ -1291,6 +1291,2162 @@ public class LivelinkConnector extends o return 6; } + // UI support methods. + // + // These support methods come in two varieties. The first bunch is involved in setting up connection configuration information. The second bunch + // is involved in presenting and editing document specification information for a job. The two kinds of methods are accordingly treated differently, + // in that the first bunch cannot assume that the current connector object is connected, while the second bunch can. That is why the first bunch + // receives a thread context argument for all UI methods, while the second bunch does not need one (since it has already been applied via the connect() + // method, above). + + /** Output the configuration header section. + * This method is called in the head section of the connector's configuration page. Its purpose is to add the required tabs to the list, and to output any + * javascript methods that might be needed by the configuration editing HTML. + *@param threadContext is the local thread context. + *@param out is the output to which any HTML should be sent. + *@param parameters are the configuration parameters, as they currently exist, for this connection being configured. + *@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector. + */ + public void outputConfigurationHeader(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, ArrayList tabsArray) + throws LCFException, IOException + { + tabsArray.add("Server"); + tabsArray.add("Document Access"); + tabsArray.add("Document View"); + out.print( +"\n" + ); + } + + /** Output the configuration body section. + * This method is called in the body section of the connector's configuration page. Its purpose is to present the required form elements for editing. + * The coder can presume that the HTML that is output from this configuration will be within appropriate , , and
tags. The name of the + * form is "editconnection". + *@param threadContext is the local thread context. + *@param out is the output to which any HTML should be sent. + *@param parameters are the configuration parameters, as they currently exist, for this connection being configured. + *@param tabName is the current tab name. + */ + public void outputConfigurationBody(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters, String tabName) + throws LCFException, IOException + { + String ingestProtocol = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ingestProtocol); + if (ingestProtocol == null) + ingestProtocol = "http"; + String ingestPort = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ingestPort); + if (ingestPort == null) + ingestPort = ""; + String ingestCgiPath = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ingestCgiPath); + if (ingestCgiPath == null) + ingestCgiPath = "/livelink/livelink.exe"; + String viewProtocol = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.viewProtocol); + if (viewProtocol == null) + viewProtocol = ""; + String viewServerName = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.viewServerName); + if (viewServerName == null) + viewServerName = ""; + String viewPort = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.viewPort); + if (viewPort == null) + viewPort = ""; + String viewCgiPath = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.viewCgiPath); + if (viewCgiPath == null) + viewCgiPath = ""; + String serverName = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.serverName); + if (serverName == null) + serverName = "localhost"; + String serverPort = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.serverPort); + if (serverPort == null) + serverPort = "2099"; + String serverUserName = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.serverUsername); + if (serverUserName == null) + serverUserName = ""; + String serverPassword = parameters.getObfuscatedParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.serverPassword); + if (serverPassword == null) + serverPassword = ""; + String ntlmUsername = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ntlmUsername); + if (ntlmUsername == null) + ntlmUsername = ""; + String ntlmPassword = parameters.getObfuscatedParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ntlmPassword); + if (ntlmPassword == null) + ntlmPassword = ""; + String ntlmDomain = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ntlmDomain); + if (ntlmDomain == null) + ntlmDomain = ""; + String livelinkKeystore = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.livelinkKeystore); + IKeystoreManager localKeystore; + if (livelinkKeystore == null) + localKeystore = KeystoreManagerFactory.make(""); + else + localKeystore = KeystoreManagerFactory.make("",livelinkKeystore); + out.print( +"\n" + ); + // The "Server" tab + if (tabName.equals("Server")) + { + out.print( +"\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"

Server name:
Server port:
Server user name:
Server password:
\n" + ); + } + else + { + // Hiddens for Server tab + out.print( +"\n"+ +"\n"+ +"\n"+ +"\n" + ); + } + + // The "Document Access" tab + // Always pass the whole keystore as a hidden. + if (livelinkKeystore != null) + { + out.print( +"\n" + ); + } + if (tabName.equals("Document Access")) + { + out.print( +"\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"

Document fetch protocol:\n"+ +" \n"+ +"
Document fetch port:
Document fetch SSL certificate list:\n"+ +" \n"+ +" \n" + ); + // List the individual certificates in the store, with a delete button for each + String[] contents = localKeystore.getContents(); + if (contents.length == 0) + { + out.print( +" \n" + ); + } + else + { + int i = 0; + while (i < contents.length) + { + String alias = contents[i]; + String description = localKeystore.getDescription(alias); + if (description.length() > 128) + description = description.substring(0,125) + "..."; + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + i++; + } + } + out.print( +"
No certificates present
"+org.apache.lcf.ui.util.Encoder.bodyEscape(description)+"
\n"+ +"  \n"+ +" Certificate: \n"+ +"
Document fetch CGI path:
Document fetch NTLM domain:
(set if NTLM auth desired)
\n"+ +" \n"+ +"
Document fetch NTLM user name:
(set if different from server user name)
\n"+ +" \n"+ +"
Document fetch NTLM password:
(set if different from server password)
\n"+ +" \n"+ +"
\n" + ); + } + else + { + // Hiddens for Document Access tab + out.print( +"\n"+ +"\n"+ +"\n"+ +"\n"+ +"\n"+ +"\n" + ); + } + + // Document View tab + if (tabName.equals("Document View")) + { + out.print( +"\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"

Document view protocol:\n"+ +" \n"+ +"
Document view server name:
(blank = same as fetch server)
Document view port:
(blank = same as fetch port)
Document view CGI path:
(blank = same as fetch path)
\n" + ); + } + else + { + // Hiddens for Document View tab + out.print( +"\n"+ +"\n"+ +"\n"+ +"\n" + ); + } + } + + /** Process a configuration post. + * This method is called at the start of the connector's configuration page, whenever there is a possibility that form data for a connection has been + * posted. Its purpose is to gather form information and modify the configuration parameters accordingly. + * The name of the posted form is "editconnection". + *@param threadContext is the local thread context. + *@param variableContext is the set of variables available from the post, including binary file post information. + *@param parameters are the configuration parameters, as they currently exist, for this connection being configured. + *@return null if all is well, or a string error message if there is an error that should prevent saving of the connection (and cause a redirection to an error page). + */ + public String processConfigurationPost(IThreadContext threadContext, IPostParameters variableContext, ConfigParams parameters) + throws LCFException + { + String serverName = variableContext.getParameter("servername"); + if (serverName != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.serverName,serverName); + String serverPort = variableContext.getParameter("serverport"); + if (serverPort != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.serverPort,serverPort); + String ingestProtocol = variableContext.getParameter("ingestprotocol"); + if (ingestProtocol != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ingestProtocol,ingestProtocol); + String ingestPort = variableContext.getParameter("ingestport"); + if (ingestPort != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ingestPort,ingestPort); + String ingestCgiPath = variableContext.getParameter("ingestcgipath"); + if (ingestCgiPath != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ingestCgiPath,ingestCgiPath); + String viewProtocol = variableContext.getParameter("viewprotocol"); + if (viewProtocol != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.viewProtocol,viewProtocol); + String viewServerName = variableContext.getParameter("viewservername"); + if (viewServerName != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.viewServerName,viewServerName); + String viewPort = variableContext.getParameter("viewport"); + if (viewPort != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.viewPort,viewPort); + String viewCgiPath = variableContext.getParameter("viewcgipath"); + if (viewCgiPath != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.viewCgiPath,viewCgiPath); + String serverUserName = variableContext.getParameter("serverusername"); + if (serverUserName != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.serverUsername,serverUserName); + String serverPassword = variableContext.getParameter("serverpassword"); + if (serverPassword != null) + parameters.setObfuscatedParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.serverPassword,serverPassword); + String ntlmDomain = variableContext.getParameter("ntlmdomain"); + if (ntlmDomain != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ntlmDomain,ntlmDomain); + String ntlmUsername = variableContext.getParameter("ntlmusername"); + if (ntlmUsername != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ntlmUsername,ntlmUsername); + String ntlmPassword = variableContext.getParameter("ntlmpassword"); + if (ntlmPassword != null) + parameters.setObfuscatedParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.ntlmPassword,ntlmPassword); + String keystoreValue = variableContext.getParameter("keystoredata"); + if (keystoreValue != null) + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.livelinkKeystore,keystoreValue); + + String configOp = variableContext.getParameter("configop"); + if (configOp != null) + { + if (configOp.equals("Delete")) + { + String alias = variableContext.getParameter("llkeystorealias"); + keystoreValue = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.livelinkKeystore); + IKeystoreManager mgr; + if (keystoreValue != null) + mgr = KeystoreManagerFactory.make("",keystoreValue); + else + mgr = KeystoreManagerFactory.make(""); + mgr.remove(alias); + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.livelinkKeystore,mgr.getString()); + } + else if (configOp.equals("Add")) + { + String alias = IDFactory.make(threadContext); + byte[] certificateValue = variableContext.getBinaryBytes("llcertificate"); + keystoreValue = parameters.getParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.livelinkKeystore); + IKeystoreManager mgr; + if (keystoreValue != null) + mgr = KeystoreManagerFactory.make("",keystoreValue); + else + mgr = KeystoreManagerFactory.make(""); + java.io.InputStream is = new java.io.ByteArrayInputStream(certificateValue); + String certError = null; + try + { + mgr.importCertificate(alias,is); + } + catch (Throwable e) + { + certError = e.getMessage(); + } + finally + { + try + { + is.close(); + } + catch (IOException e) + { + // Eat this exception + } + } + + if (certError != null) + { + return "Illegal certificate: "+certError; + } + parameters.setParameter(org.apache.lcf.crawler.connectors.livelink.LiveLinkParameters.livelinkKeystore,mgr.getString()); + } + } + + return null; + } + + /** View configuration. + * This method is called in the body section of the connector's view configuration page. Its purpose is to present the connection information to the user. + * The coder can presume that the HTML that is output from this configuration will be within appropriate and tags. + *@param threadContext is the local thread context. + *@param out is the output to which any HTML should be sent. + *@param parameters are the configuration parameters, as they currently exist, for this connection being configured. + */ + public void viewConfiguration(IThreadContext threadContext, IHTTPOutput out, ConfigParams parameters) + throws LCFException, IOException + { + out.print( +"\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"
Parameters:\n" + ); + Iterator iter = parameters.listParameters(); + while (iter.hasNext()) + { + String param = (String)iter.next(); + String value = parameters.getParameter(param); + if (param.length() >= "password".length() && param.substring(param.length()-"password".length()).equalsIgnoreCase("password")) + { + out.print( +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(param)+"=********
\n" + ); + } + else if (param.length() >="keystore".length() && param.substring(param.length()-"keystore".length()).equalsIgnoreCase("keystore")) + { + IKeystoreManager kmanager = KeystoreManagerFactory.make("",value); + out.print( +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(param)+"=<"+Integer.toString(kmanager.getContents().length)+" certificate(s)>
\n" + ); + } + else + { + out.print( +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(param)+"="+org.apache.lcf.ui.util.Encoder.bodyEscape(value)+"
\n" + ); + } + } + out.print( +"
\n" + ); + } + + /** Output the specification header section. + * This method is called in the head section of a job page which has selected a repository connection of the current type. Its purpose is to add the required tabs + * to the list, and to output any javascript methods that might be needed by the job editing HTML. + *@param out is the output to which any HTML should be sent. + *@param ds is the current document specification for this job. + *@param tabsArray is an array of tab names. Add to this array any tab names that are specific to the connector. + */ + public void outputSpecificationHeader(IHTTPOutput out, DocumentSpecification ds, ArrayList tabsArray) + throws LCFException, IOException + { + tabsArray.add("Paths"); + tabsArray.add("Filters"); + tabsArray.add("Security"); + tabsArray.add("Metadata"); + out.print( +"\n" + ); + } + + /** Output the specification body section. + * This method is called in the body section of a job page which has selected a repository connection of the current type. Its purpose is to present the required form elements for editing. + * The coder can presume that the HTML that is output from this configuration will be within appropriate , , and tags. The name of the + * form is "editjob". + *@param out is the output to which any HTML should be sent. + *@param ds is the current document specification for this job. + *@param tabName is the current tab name. + */ + public void outputSpecificationBody(IHTTPOutput out, DocumentSpecification ds, String tabName) + throws LCFException, IOException + { + int i; + int k; + + // Paths tab + if (tabName.equals("Paths")) + { + out.print( +"\n"+ +" \n" + ); + // Now, loop through paths + i = 0; + k = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("startpoint")) + { + String pathDescription = "_"+Integer.toString(k); + String pathOpName = "pathop"+pathDescription; + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + k++; + } + } + if (k == 0) + { + out.print( +" \n"+ +" \n"+ +" \n" + ); + } + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"

\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" "+((sn.getAttributeValue("path").length() == 0)?"(root)":org.apache.lcf.ui.util.Encoder.bodyEscape(sn.getAttributeValue("path")))+"\n"+ +"
No starting points defined

\n"+ +" \n" + ); + + String pathSoFar = (String)currentContext.get("specpath"); + if (pathSoFar == null) + pathSoFar = ""; + + // Grab next folder/project list + try + { + String[] childList; + childList = getChildFolderNames(pathSoFar); + if (childList == null) + { + // Illegal path - set it back + pathSoFar = ""; + childList = getChildFolderNames(""); + if (childList == null) + throw new LCFException("Can't find any children for root folder"); + } + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"  \n"+ +" \n"+ +" "+((pathSoFar.length()==0)?"(root)":org.apache.lcf.ui.util.Encoder.bodyEscape(pathSoFar))+"\n" + ); + if (pathSoFar.length() > 0) + { + out.print( +" \n" + ); + } + if (childList.length > 0) + { + out.print( +"  \n"+ +" \n" + ); + } + } + catch (LCFException e) + { + e.printStackTrace(); + out.println(org.apache.lcf.ui.util.Encoder.bodyEscape(e.getMessage())); + } + out.print( +"
\n" + ); + } + else + { + // Now, loop through paths + i = 0; + k = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("startpoint")) + { + String pathDescription = "_"+Integer.toString(k); + out.print( +"\n" + ); + k++; + } + } + out.print( +"\n" + ); + } + + // Filter tab + if (tabName.equals("Filters")) + { + out.print( +"\n"+ +" \n" + ); + // Next, go through include/exclude filespecs + i = 0; + k = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("include") || sn.getType().equals("exclude")) + { + String fileSpecDescription = "_"+Integer.toString(k); + String fileOpName = "fileop"+fileSpecDescription; + String filespec = sn.getAttributeValue("filespec"); + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + k++; + } + } + if (k == 0) + { + out.print( +" \n"+ +" \n"+ +" \n" + ); + } + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"

\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" "+(sn.getType().equals("include")?"Include:":"")+"\n"+ +" "+(sn.getType().equals("exclude")?"Exclude:":"")+"\n"+ +"  \n"+ +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(filespec)+"\n"+ +"
No include/exclude files defined

\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"  \n"+ +" \n"+ +"  \n"+ +" \n"+ +"
\n" + ); + } + else + { + // Next, go through include/exclude filespecs + i = 0; + k = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("include") || sn.getType().equals("exclude")) + { + String fileSpecDescription = "_"+Integer.toString(k); + String filespec = sn.getAttributeValue("filespec"); + out.print( +"\n"+ +"\n" + ); + k++; + } + } + out.print( +"\n" + ); + } + + + // Security tab + // Find whether security is on or off + i = 0; + boolean securityOn = true; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("security")) + { + String securityValue = sn.getAttributeValue("value"); + if (securityValue.equals("off")) + securityOn = false; + else if (securityValue.equals("on")) + securityOn = true; + } + } + + if (tabName.equals("Security")) + { + out.print( +"\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + // Go through forced ACL + i = 0; + k = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("access")) + { + String accessDescription = "_"+Integer.toString(k); + String accessOpName = "accessop"+accessDescription; + String token = sn.getAttributeValue("token"); + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + k++; + } + } + if (k == 0) + { + out.print( +" \n"+ +" \n"+ +" \n" + ); + } + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"

Security:\n"+ +" Enabled \n"+ +" Disabled\n"+ +"

\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"  \n"+ +" \n"+ +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(token)+"\n"+ +"
No access tokens present

\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"  \n"+ +" \n"+ +" \n"+ +"
\n" + ); + } + else + { + out.print( +"\n" + ); + // Finally, go through forced ACL + i = 0; + k = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("access")) + { + String accessDescription = "_"+Integer.toString(k); + String token = sn.getAttributeValue("token"); + out.print( +"\n" + ); + k++; + } + } + out.print( +"\n" + ); + } + + + // Metadata tab + + // Find the path-value metadata attribute name + i = 0; + String pathNameAttribute = ""; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("pathnameattribute")) + { + pathNameAttribute = sn.getAttributeValue("value"); + } + } + + // Find the path-value mapping data + i = 0; + org.apache.lcf.crawler.connectors.livelink.MatchMap matchMap = new org.apache.lcf.crawler.connectors.livelink.MatchMap(); + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("pathmap")) + { + String pathMatch = sn.getAttributeValue("match"); + String pathReplace = sn.getAttributeValue("replace"); + matchMap.appendMatchPair(pathMatch,pathReplace); + } + } + + + i = 0; + String ingestAllMetadata = "false"; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("allmetadata")) + { + ingestAllMetadata = sn.getAttributeValue("all"); + if (ingestAllMetadata == null) + ingestAllMetadata = "false"; + } + } + + if (tabName.equals("Metadata")) + { + out.print( +"\n"+ +"\n"+ +"\n"+ +"\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + // Go through the selected metadata attributes + i = 0; + k = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("metadata")) + { + String accessDescription = "_"+Integer.toString(k); + String accessOpName = "metadataop"+accessDescription; + String categoryPath = sn.getAttributeValue("category"); + String isAll = sn.getAttributeValue("all"); + if (isAll == null) + isAll = "false"; + String attributeName = sn.getAttributeValue("attribute"); + if (attributeName == null) + attributeName = ""; + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + k++; + } + } + if (k == 0) + { + out.print( +" \n"+ +" \n"+ +" \n" + ); + } + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + i = 0; + while (i < matchMap.getMatchCount()) + { + String matchString = matchMap.getMatchString(i); + String replaceString = matchMap.getReplaceString(i); + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + i++; + } + if (i == 0) + { + out.print( +" \n" + ); + } + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"

Ingest ALL metadata?\n"+ +" Yes \n"+ +" No\n"+ +"

\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"  \n"+ +" \n"+ +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(categoryPath)+":"+((isAll!=null&&isAll.equals("true"))?"(All metadata attributes)":org.apache.lcf.ui.util.Encoder.bodyEscape(attributeName))+"\n"+ +"
No metadata specified

\n"+ +" \n"+ +" \n" + ); + String categorySoFar = (String)currentContext.get("speccategory"); + if (categorySoFar == null) + categorySoFar = ""; + // Grab next folder/project list, and the appropriate category list + try + { + String[] childList = null; + String[] workspaceList = null; + String[] categoryList = null; + String[] attributeList = null; + if (categorySoFar.length() == 0) + { + workspaceList = getWorkspaceNames(); + } + else + { + attributeList = getCategoryAttributes(categorySoFar); + if (attributeList == null) + { + childList = getChildFolderNames(categorySoFar); + if (childList == null) + { + // Illegal path - set it back + categorySoFar = ""; + childList = getChildFolderNames(""); + if (childList == null) + throw new LCFException("Can't find any children for root folder"); + } + categoryList = getChildCategoryNames(categorySoFar); + if (categoryList == null) + throw new LCFException("Can't find any categories for root folder folder"); + } + } + out.print( +" \n"+ +" \n" + ); + if (attributeList != null) + { + // We have a valid category! + out.print( +"  \n"+ +" \n"+ +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(categorySoFar)+": \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"
\n"+ +"  All attributes in this category
\n"+ +" \n"+ +"
\n" + ); + } + else if (workspaceList != null) + { + out.print( +"
\n"+ +"  \n"+ +" \n" + ); + } + else + { + out.print( +" \n"+ +" "+((categorySoFar.length()==0)?"(root)":org.apache.lcf.ui.util.Encoder.bodyEscape(categorySoFar))+" \n" + ); + if (categorySoFar.length() > 0) + { + out.print( +"  \n" + ); + } + if (childList.length > 0) + { + out.print( +"  \n"+ +" \n" + ); + } + if (categoryList.length > 0) + { + out.print( +"  \n"+ +" \n" + ); + } + } + } + catch (ServiceInterruption e) + { + e.printStackTrace(); + out.println(org.apache.lcf.ui.util.Encoder.bodyEscape(e.getMessage())); + } + catch (LCFException e) + { + e.printStackTrace(); + out.println(org.apache.lcf.ui.util.Encoder.bodyEscape(e.getMessage())); + } + out.print( +"

Path attribute name:\n"+ +" \n"+ +"

\n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(matchString)+"\n"+ +" ==>\n"+ +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(replaceString)+"\n"+ +"
No mappings specified

\n"+ +" \n"+ +" \n"+ +" \n"+ +" Match regexp: ==>Replace string: 
\n" + ); + } + else + { + out.print( +"\n" + ); + // Go through the selected metadata attributes + i = 0; + k = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("metadata")) + { + String accessDescription = "_"+Integer.toString(k); + String categoryPath = sn.getAttributeValue("category"); + String isAll = sn.getAttributeValue("all"); + if (isAll == null) + isAll = "false"; + String attributeName = sn.getAttributeValue("attribute"); + if (attributeName == null) + attributeName = ""; + out.print( +"\n"+ +"\n"+ +"\n" + ); + k++; + } + } + out.print( +"\n"+ +"\n" + ); + i = 0; + while (i < matchMap.getMatchCount()) + { + String matchString = matchMap.getMatchString(i); + String replaceString = matchMap.getReplaceString(i); + out.print( +"\n"+ +"\n" + ); + i++; + } + } + } + + /** Process a specification post. + * This method is called at the start of job's edit or view page, whenever there is a possibility that form data for a connection has been + * posted. Its purpose is to gather form information and modify the document specification accordingly. + * The name of the posted form is "editjob". + *@param variableContext contains the post data, including binary file-upload information. + *@param ds is the current document specification for this job. + *@return null if all is well, or a string error message if there is an error that should prevent saving of the job (and cause a redirection to an error page). + */ + public String processSpecificationPost(IPostParameters variableContext, DocumentSpecification ds) + throws LCFException + { + String xc = variableContext.getParameter("pathcount"); + if (xc != null) + { + // Delete all path specs first + int i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i); + if (sn.getType().equals("startpoint")) + ds.removeChild(i); + else + i++; + } + + // Find out how many children were sent + int pathCount = Integer.parseInt(xc); + // Gather up these + i = 0; + while (i < pathCount) + { + String pathDescription = "_"+Integer.toString(i); + String pathOpName = "pathop"+pathDescription; + xc = variableContext.getParameter(pathOpName); + if (xc != null && xc.equals("Delete")) + { + // Skip to the next + i++; + continue; + } + // Path inserts won't happen until the very end + String path = variableContext.getParameter("specpath"+pathDescription); + SpecificationNode node = new SpecificationNode("startpoint"); + node.setAttribute("path",path); + ds.addChild(ds.getChildCount(),node); + i++; + } + + // See if there's a global add operation + String op = variableContext.getParameter("pathop"); + if (op != null && op.equals("Add")) + { + String path = variableContext.getParameter("specpath"); + SpecificationNode node = new SpecificationNode("startpoint"); + node.setAttribute("path",path); + ds.addChild(ds.getChildCount(),node); + } + else if (op != null && op.equals("Up")) + { + // Strip off end + String path = variableContext.getParameter("specpath"); + int lastSlash = -1; + int k = 0; + while (k < path.length()) + { + char x = path.charAt(k++); + if (x == '/') + { + lastSlash = k-1; + continue; + } + if (x == '\\') + k++; + } + if (lastSlash == -1) + path = ""; + else + path = path.substring(0,lastSlash); + currentContext.save("specpath",path); + } + else if (op != null && op.equals("AddToPath")) + { + String path = variableContext.getParameter("specpath"); + String addon = variableContext.getParameter("pathaddon"); + if (addon != null && addon.length() > 0) + { + StringBuffer sb = new StringBuffer(); + int k = 0; + while (k < addon.length()) + { + char x = addon.charAt(k++); + if (x == '/' || x == '\\' || x == ':') + sb.append('\\'); + sb.append(x); + } + if (path.length() == 0) + path = sb.toString(); + else + path += "/" + sb.toString(); + } + currentContext.save("specpath",path); + } + } + + xc = variableContext.getParameter("filecount"); + if (xc != null) + { + // Delete all file specs first + int i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i); + if (sn.getType().equals("include") || sn.getType().equals("exclude")) + ds.removeChild(i); + else + i++; + } + + int fileCount = Integer.parseInt(xc); + i = 0; + while (i < fileCount) + { + String fileSpecDescription = "_"+Integer.toString(i); + String fileOpName = "fileop"+fileSpecDescription; + xc = variableContext.getParameter(fileOpName); + if (xc != null && xc.equals("Delete")) + { + // Next row + i++; + continue; + } + // Get the stuff we need + String filespecType = variableContext.getParameter("specfiletype"+fileSpecDescription); + String filespec = variableContext.getParameter("specfile"+fileSpecDescription); + SpecificationNode node = new SpecificationNode(filespecType); + node.setAttribute("filespec",filespec); + ds.addChild(ds.getChildCount(),node); + i++; + } + + String op = variableContext.getParameter("fileop"); + if (op != null && op.equals("Add")) + { + String filespec = variableContext.getParameter("specfile"); + String filespectype = variableContext.getParameter("specfiletype"); + SpecificationNode node = new SpecificationNode(filespectype); + node.setAttribute("filespec",filespec); + ds.addChild(ds.getChildCount(),node); + } + } + + xc = variableContext.getParameter("specsecurity"); + if (xc != null) + { + // Delete all security entries first + int i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i); + if (sn.getType().equals("security")) + ds.removeChild(i); + else + i++; + } + + SpecificationNode node = new SpecificationNode("security"); + node.setAttribute("value",xc); + ds.addChild(ds.getChildCount(),node); + + } + + xc = variableContext.getParameter("tokencount"); + if (xc != null) + { + // Delete all file specs first + int i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i); + if (sn.getType().equals("access")) + ds.removeChild(i); + else + i++; + } + + int accessCount = Integer.parseInt(xc); + i = 0; + while (i < accessCount) + { + String accessDescription = "_"+Integer.toString(i); + String accessOpName = "accessop"+accessDescription; + xc = variableContext.getParameter(accessOpName); + if (xc != null && xc.equals("Delete")) + { + // Next row + i++; + continue; + } + // Get the stuff we need + String accessSpec = variableContext.getParameter("spectoken"+accessDescription); + SpecificationNode node = new SpecificationNode("access"); + node.setAttribute("token",accessSpec); + ds.addChild(ds.getChildCount(),node); + i++; + } + + String op = variableContext.getParameter("accessop"); + if (op != null && op.equals("Add")) + { + String accessspec = variableContext.getParameter("spectoken"); + SpecificationNode node = new SpecificationNode("access"); + node.setAttribute("token",accessspec); + ds.addChild(ds.getChildCount(),node); + } + } + + xc = variableContext.getParameter("specallmetadata"); + if (xc != null) + { + // Look for the 'all metadata' checkbox + int i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i); + if (sn.getType().equals("allmetadata")) + ds.removeChild(i); + else + i++; + } + + if (xc.equals("true")) + { + SpecificationNode newNode = new SpecificationNode("allmetadata"); + newNode.setAttribute("all",xc); + ds.addChild(ds.getChildCount(),newNode); + } + } + + xc = variableContext.getParameter("metadatacount"); + if (xc != null) + { + // Delete all metadata specs first + int i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i); + if (sn.getType().equals("metadata")) + ds.removeChild(i); + else + i++; + } + + // Find out how many children were sent + int metadataCount = Integer.parseInt(xc); + // Gather up these + i = 0; + while (i < metadataCount) + { + String pathDescription = "_"+Integer.toString(i); + String pathOpName = "metadataop"+pathDescription; + xc = variableContext.getParameter(pathOpName); + if (xc != null && xc.equals("Delete")) + { + // Skip to the next + i++; + continue; + } + // Metadata inserts won't happen until the very end + String category = variableContext.getParameter("speccategory"+pathDescription); + String attributeName = variableContext.getParameter("specattribute"+pathDescription); + String isAll = variableContext.getParameter("specattributeall"+pathDescription); + SpecificationNode node = new SpecificationNode("metadata"); + node.setAttribute("category",category); + if (isAll != null && isAll.equals("true")) + node.setAttribute("all","true"); + else + node.setAttribute("attribute",attributeName); + ds.addChild(ds.getChildCount(),node); + i++; + } + + // See if there's a global add operation + String op = variableContext.getParameter("metadataop"); + if (op != null && op.equals("Add")) + { + String category = variableContext.getParameter("speccategory"); + String isAll = variableContext.getParameter("attributeall"); + if (isAll != null && isAll.equals("true")) + { + SpecificationNode node = new SpecificationNode("metadata"); + node.setAttribute("category",category); + node.setAttribute("all","true"); + ds.addChild(ds.getChildCount(),node); + } + else + { + String[] attributes = variableContext.getParameterValues("attributeselect"); + if (attributes != null && attributes.length > 0) + { + int k = 0; + while (k < attributes.length) + { + String attribute = attributes[k++]; + SpecificationNode node = new SpecificationNode("metadata"); + node.setAttribute("category",category); + node.setAttribute("attribute",attribute); + ds.addChild(ds.getChildCount(),node); + } + } + } + } + else if (op != null && op.equals("Up")) + { + // Strip off end + String category = variableContext.getParameter("speccategory"); + int lastSlash = -1; + int firstColon = -1; + int k = 0; + while (k < category.length()) + { + char x = category.charAt(k++); + if (x == '/') + { + lastSlash = k-1; + continue; + } + if (x == ':') + { + firstColon = k; + continue; + } + if (x == '\\') + k++; + } + + if (lastSlash == -1) + { + if (firstColon == -1 || firstColon == category.length()) + category = ""; + else + category = category.substring(0,firstColon); + } + else + category = category.substring(0,lastSlash); + currentContext.save("speccategory",category); + } + else if (op != null && op.equals("AddToPath")) + { + String category = variableContext.getParameter("speccategory"); + String addon = variableContext.getParameter("metadataaddon"); + if (addon != null && addon.length() > 0) + { + StringBuffer sb = new StringBuffer(); + int k = 0; + while (k < addon.length()) + { + char x = addon.charAt(k++); + if (x == '/' || x == '\\' || x == ':') + sb.append('\\'); + sb.append(x); + } + if (category.length() == 0 || category.endsWith(":")) + category += sb.toString(); + else + category += "/" + sb.toString(); + } + currentContext.save("speccategory",category); + } + else if (op != null && op.equals("SetWorkspace")) + { + String addon = variableContext.getParameter("metadataaddon"); + if (addon != null && addon.length() > 0) + { + StringBuffer sb = new StringBuffer(); + int k = 0; + while (k < addon.length()) + { + char x = addon.charAt(k++); + if (x == '/' || x == '\\' || x == ':') + sb.append('\\'); + sb.append(x); + } + + String category = sb.toString() + ":"; + currentContext.save("speccategory",category); + } + } + else if (op != null && op.equals("AddCategory")) + { + String category = variableContext.getParameter("speccategory"); + String addon = variableContext.getParameter("categoryaddon"); + if (addon != null && addon.length() > 0) + { + StringBuffer sb = new StringBuffer(); + int k = 0; + while (k < addon.length()) + { + char x = addon.charAt(k++); + if (x == '/' || x == '\\' || x == ':') + sb.append('\\'); + sb.append(x); + } + if (category.length() == 0 || category.endsWith(":")) + category += sb.toString(); + else + category += "/" + sb.toString(); + } + currentContext.save("speccategory",category); + } + } + + xc = variableContext.getParameter("specpathnameattribute"); + if (xc != null) + { + // Delete old one + int i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i); + if (sn.getType().equals("pathnameattribute")) + ds.removeChild(i); + else + i++; + } + if (xc.length() > 0) + { + SpecificationNode node = new SpecificationNode("pathnameattribute"); + node.setAttribute("value",xc); + ds.addChild(ds.getChildCount(),node); + } + } + + xc = variableContext.getParameter("specmappingcount"); + if (xc != null) + { + // Delete old spec + int i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i); + if (sn.getType().equals("pathmap")) + ds.removeChild(i); + else + i++; + } + + // Now, go through the data and assemble a new list. + int mappingCount = Integer.parseInt(xc); + + // Gather up these + i = 0; + while (i < mappingCount) + { + String pathDescription = "_"+Integer.toString(i); + String pathOpName = "specmappingop"+pathDescription; + xc = variableContext.getParameter(pathOpName); + if (xc != null && xc.equals("Delete")) + { + // Skip to the next + i++; + continue; + } + // Inserts won't happen until the very end + String match = variableContext.getParameter("specmatch"+pathDescription); + String replace = variableContext.getParameter("specreplace"+pathDescription); + SpecificationNode node = new SpecificationNode("pathmap"); + node.setAttribute("match",match); + node.setAttribute("replace",replace); + ds.addChild(ds.getChildCount(),node); + i++; + } + + // Check for add + xc = variableContext.getParameter("specmappingop"); + if (xc != null && xc.equals("Add")) + { + String match = variableContext.getParameter("specmatch"); + String replace = variableContext.getParameter("specreplace"); + SpecificationNode node = new SpecificationNode("pathmap"); + node.setAttribute("match",match); + node.setAttribute("replace",replace); + ds.addChild(ds.getChildCount(),node); + } + } + return null; + } + + /** View specification. + * This method is called in the body section of a job's view page. Its purpose is to present the document specification information to the user. + * The coder can presume that the HTML that is output from this configuration will be within appropriate and tags. + *@param out is the output to which any HTML should be sent. + *@param ds is the current document specification for this job. + */ + public void viewSpecification(IHTTPOutput out, DocumentSpecification ds) + throws LCFException, IOException + { + out.print( +"\n"+ +" \n" + ); + int i = 0; + boolean seenAny = false; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("startpoint")) + { + if (seenAny == false) + { + out.print( +" \n"+ +" \n"+ +" \n" + ); + } + else + { + out.print( +" \n" + ); + } + out.print( +" \n" + ); + + seenAny = false; + // Go through looking for include or exclude file specs + i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("include") || sn.getType().equals("exclude")) + { + if (seenAny == false) + { + out.print( +" \n"+ +" \n"+ +" \n" + ); + } + else + { + out.print( +" \n" + ); + } + out.print( +" \n" + ); + // Find whether security is on or off + i = 0; + boolean securityOn = true; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("security")) + { + String securityValue = sn.getAttributeValue("value"); + if (securityValue.equals("off")) + securityOn = false; + else if (securityValue.equals("on")) + securityOn = true; + } + } + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n"+ +"\n"+ +" \n" + ); + // Go through looking for access tokens + seenAny = false; + i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("access")) + { + if (seenAny == false) + { + out.print( +" \n"+ +" \n"+ +" \n" + ); + } + else + { + out.print( +" \n" + ); + } + out.print( +" \n" + ); + i = 0; + String allMetadata = "Only specified metadata will be ingested"; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("allmetadata")) + { + String value = sn.getAttributeValue("all"); + if (value != null && value.equals("true")) + { + allMetadata="All document metadata will be ingested"; + } + } + } + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + // Go through looking for metadata spec + seenAny = false; + i = 0; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("metadata")) + { + if (seenAny == false) + { + out.print( +" \n"+ +" \n"+ +" \n" + ); + } + else + { + out.print( +" \n" + ); + } + out.print( +" \n" + ); + // Find the path-name metadata attribute name + i = 0; + String pathNameAttribute = ""; + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("pathnameattribute")) + { + pathNameAttribute = sn.getAttributeValue("value"); + } + } + out.print( +" \n" + ); + if (pathNameAttribute.length() > 0) + { + out.print( +" \n"+ +" \n" + ); + } + else + { + out.print( +" \n" + ); + } + out.print( +" \n"+ +"\n"+ +" \n"+ +"\n"+ +" \n" + ); + // Find the path-value mapping data + i = 0; + org.apache.lcf.crawler.connectors.livelink.MatchMap matchMap = new org.apache.lcf.crawler.connectors.livelink.MatchMap(); + while (i < ds.getChildCount()) + { + SpecificationNode sn = ds.getChild(i++); + if (sn.getType().equals("pathmap")) + { + String pathMatch = sn.getAttributeValue("match"); + String pathReplace = sn.getAttributeValue("replace"); + matchMap.appendMatchPair(pathMatch,pathReplace); + } + } + if (matchMap.getMatchCount() > 0) + { + out.print( +" \n"+ +" \n" + ); + } + else + { + out.print( +" \n" + ); + } + out.print( +" \n"+ +"
Roots:\n" + ); + seenAny = true; + } + out.print( +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(sn.getAttributeValue("path"))+"
\n" + ); + } + } + + if (seenAny) + { + out.print( +"
No start points specified

File specs:\n" + ); + seenAny = true; + } + String filespec = sn.getAttributeValue("filespec"); + out.print( +" "+(sn.getType().equals("include")?"Include file:":"")+"\n"+ +" "+(sn.getType().equals("exclude")?"Exclude file:":"")+"\n"+ +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(filespec)+"
\n" + ); + } + } + + if (seenAny) + { + out.print( +"
No file specs specified

Security:"+(securityOn?"Enabled":"Disabled")+"

Access tokens:\n" + ); + seenAny = true; + } + String token = sn.getAttributeValue("token"); + out.print( +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(token)+"
\n" + ); + } + } + + if (seenAny) + { + out.print( +"
No access tokens specified

Metadata specification:"+allMetadata+"

Specific metadata:\n" + ); + seenAny = true; + } + String category = sn.getAttributeValue("category"); + String attribute = sn.getAttributeValue("attribute"); + String isAll = sn.getAttributeValue("all"); + out.print( +" "+org.apache.lcf.ui.util.Encoder.bodyEscape(category)+":"+((isAll!=null&&isAll.equals("true"))?"(All metadata attributes)":org.apache.lcf.ui.util.Encoder.bodyEscape(attribute))+"
\n" + ); + } + } + + if (seenAny) + { + out.print( +"
No metadata specified

Path-name metadata attribute:"+org.apache.lcf.ui.util.Encoder.bodyEscape(pathNameAttribute)+"No path-name metadata attribute specified

Path-value mapping:\n"+ +" \n" + ); + i = 0; + while (i < matchMap.getMatchCount()) + { + String matchString = matchMap.getMatchString(i); + String replaceString = matchMap.getReplaceString(i); + out.print( +" \n"+ +" \n"+ +" \n"+ +" \n"+ +" \n" + ); + i++; + } + out.print( +"
"+org.apache.lcf.ui.util.Encoder.bodyEscape(matchString)+"-->"+org.apache.lcf.ui.util.Encoder.bodyEscape(replaceString)+"
\n"+ +"
No mappings specified
\n" + ); + } + // The following public methods are NOT part of the interface. They are here so that the UI can present information // that will allow users to select what they need.