You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@manifoldcf.apache.org by kw...@apache.org on 2010/06/29 18:00:59 UTC
svn commit: r959015 [16/16] - in /incubator/lcf/trunk/modules: ./
connectors/activedirectory/
connectors/activedirectory/connector/org/apache/lcf/authorities/authorities/activedirectory/
connectors/activedirectory/crawler-ui/authorities/ connectors/doc...
Modified: incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/IOutputConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/IOutputConnector.java?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/IOutputConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/IOutputConnector.java Tue Jun 29 16:00:57 2010
@@ -73,15 +73,6 @@ public interface IOutputConnector
public void deinstall(IThreadContext threadContext)
throws LCFException;
- /** Return the path for the UI interface JSP elements.
- * These JSP's must be provided to allow the connector to be configured, and to
- * permit it to present connector-specific metadata specification information in the UI.
- * This method should return the name of the folder, under the <webapp>/output/
- * area, where the appropriate JSP's can be found. The name should NOT have a slash in it.
- *@return the folder part
- */
- public String getJSPFolder();
-
/** Return a list of activities that this connector generates.
*@return the set of activities.
*/
@@ -186,6 +177,100 @@ public interface IOutputConnector
public void removeDocument(String documentURI, String outputDescription, IOutputRemoveActivity activities)
throws LCFException, ServiceInterruption;
+ // 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 output 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;
+
+ /** 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 <html>, <body>, and <form> 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;
+
+ /** 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;
+
+ /** 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 <html> and <body> 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;
+
+ /** Output the specification header section.
+ * This method is called in the head section of a job page which has selected an output 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 os is the current output 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, OutputSpecification os, ArrayList tabsArray)
+ throws LCFException, IOException;
+
+ /** Output the specification body section.
+ * This method is called in the body section of a job page which has selected an output 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 <html>, <body>, and <form> tags. The name of the
+ * form is "editjob".
+ *@param out is the output to which any HTML should be sent.
+ *@param os is the current output specification for this job.
+ *@param tabName is the current tab name.
+ */
+ public void outputSpecificationBody(IHTTPOutput out, OutputSpecification os, String tabName)
+ throws LCFException, IOException;
+
+ /** 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 output specification accordingly.
+ * The name of the posted form is "editjob".
+ *@param variableContext contains the post data, including binary file-upload information.
+ *@param os is the current output 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, OutputSpecification os)
+ throws LCFException;
+
+ /** View specification.
+ * This method is called in the body section of a job's view page. Its purpose is to present the output specification information to the user.
+ * The coder can presume that the HTML that is output from this configuration will be within appropriate <html> and <body> tags.
+ *@param out is the output to which any HTML should be sent.
+ *@param os is the current output specification for this job.
+ */
+ public void viewSpecification(IHTTPOutput out, OutputSpecification os)
+ throws LCFException, IOException;
+
}
Modified: incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/OutputConnectorFactory.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/OutputConnectorFactory.java?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/OutputConnectorFactory.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/interfaces/OutputConnectorFactory.java Tue Jun 29 16:00:57 2010
@@ -21,6 +21,7 @@ package org.apache.lcf.agents.interfaces
import org.apache.lcf.core.interfaces.*;
import java.util.*;
+import java.io.*;
import java.lang.reflect.*;
/** This is the factory class for IOutputConnector objects.
@@ -74,17 +75,49 @@ public class OutputConnectorFactory
return values;
}
- /** Get the JSP folder for a connector.
- *@param className is the class name.
- *@return the folder string.
+ /** Output the configuration header section.
*/
- public static String getJSPFolder(IThreadContext threadContext, String className)
+ public static void outputConfigurationHeader(IThreadContext threadContext, String className, IHTTPOutput out, ConfigParams parameters, ArrayList tabsArray)
+ throws LCFException, IOException
+ {
+ IOutputConnector connector = getConnector(threadContext, className);
+ if (connector == null)
+ return;
+ connector.outputConfigurationHeader(threadContext,out,parameters,tabsArray);
+ }
+
+ /** Output the configuration body section.
+ */
+ public static void outputConfigurationBody(IThreadContext threadContext, String className, IHTTPOutput out, ConfigParams parameters, String tabName)
+ throws LCFException, IOException
+ {
+ IOutputConnector connector = getConnector(threadContext, className);
+ if (connector == null)
+ return;
+ connector.outputConfigurationBody(threadContext,out,parameters,tabName);
+ }
+
+ /** Process configuration post data for a connector.
+ */
+ public static String processConfigurationPost(IThreadContext threadContext, String className, IPostParameters variableContext, ConfigParams configParams)
throws LCFException
{
IOutputConnector connector = getConnector(threadContext, className);
if (connector == null)
return null;
- return connector.getJSPFolder();
+ return connector.processConfigurationPost(threadContext,variableContext,configParams);
+ }
+
+ /** View connector configuration.
+ */
+ public static void viewConfiguration(IThreadContext threadContext, String className, IHTTPOutput out, ConfigParams configParams)
+ throws LCFException, IOException
+ {
+ IOutputConnector connector = getConnector(threadContext, className);
+ // We want to be able to view connections even if they have unregistered connectors.
+ if (connector == null)
+ return;
+ connector.viewConfiguration(threadContext,out,configParams);
}
/** Get an output connector instance, without checking for installed connector.
Modified: incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/output/BaseOutputConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/output/BaseOutputConnector.java?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/output/BaseOutputConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/agents/org/apache/lcf/agents/output/BaseOutputConnector.java Tue Jun 29 16:00:57 2010
@@ -166,6 +166,118 @@ public abstract class BaseOutputConnecto
return true;
}
+ // 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 output 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
+ {
+ }
+
+ /** 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 <html>, <body>, and <form> 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
+ {
+ }
+
+ /** 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
+ {
+ 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 <html> and <body> 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
+ {
+ }
+
+ /** Output the specification header section.
+ * This method is called in the head section of a job page which has selected an output 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 os is the current output 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, OutputSpecification os, ArrayList tabsArray)
+ throws LCFException, IOException
+ {
+ }
+
+ /** Output the specification body section.
+ * This method is called in the body section of a job page which has selected an output 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 <html>, <body>, and <form> tags. The name of the
+ * form is "editjob".
+ *@param out is the output to which any HTML should be sent.
+ *@param os is the current output specification for this job.
+ *@param tabName is the current tab name.
+ */
+ public void outputSpecificationBody(IHTTPOutput out, OutputSpecification os, String tabName)
+ throws LCFException, IOException
+ {
+ }
+
+ /** 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 output specification accordingly.
+ * The name of the posted form is "editjob".
+ *@param variableContext contains the post data, including binary file-upload information.
+ *@param os is the current output 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, OutputSpecification os)
+ throws LCFException
+ {
+ return null;
+ }
+
+ /** View specification.
+ * This method is called in the body section of a job's view page. Its purpose is to present the output specification information to the user.
+ * The coder can presume that the HTML that is output from this configuration will be within appropriate <html> and <body> tags.
+ *@param out is the output to which any HTML should be sent.
+ *@param os is the current output specification for this job.
+ */
+ public void viewSpecification(IHTTPOutput out, OutputSpecification os)
+ throws LCFException, IOException
+ {
+ }
+
}
Modified: incubator/lcf/trunk/modules/framework/crawler-ui/editauthority.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/crawler-ui/editauthority.jsp?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/crawler-ui/editauthority.jsp (original)
+++ incubator/lcf/trunk/modules/framework/crawler-ui/editauthority.jsp Tue Jun 29 16:00:57 2010
@@ -70,17 +70,8 @@
if (x != null && x.length() > 0)
maxConnections = Integer.parseInt(x);
- String JSPFolder = null;
ArrayList tabsArray = new ArrayList();
- if (className.length() > 0)
- {
- JSPFolder = AuthorityConnectorFactory.getJSPFolder(threadContext,className);
- threadContext.save("Parameters",parameters);
- threadContext.save("Tabs",tabsArray);
- threadContext.save("TabName",tabName);
- }
-
// Set up the predefined tabs
tabsArray.add("Name");
tabsArray.add("Type");
@@ -90,12 +81,19 @@
%>
<%
- if (JSPFolder != null)
+ if (className.length() > 0)
{
+ String error = AuthorityConnectorFactory.processConfigurationPost(threadContext,className,variableContext,parameters);
+ if (error != null)
+ {
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listauthorities.jsp");
%>
- <jsp:include page='<%="/authorities/"+JSPFolder+"/postconfig.jsp"%>' flush="false"/>
+<jsp:forward page="error.jsp"/>
<%
+ }
}
+
%>
<?xml version="1.0" encoding="utf-8"?>
@@ -223,12 +221,7 @@
//-->
</script>
<%
- if (JSPFolder != null)
- {
-%>
- <jsp:include page='<%="/authorities/"+JSPFolder+"/headerconfig.jsp"%>' flush="true"/>
-<%
- }
+ AuthorityConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.lcf.ui.jsp.JspWrapper(out),parameters,tabsArray);
// Get connectors, since this will be needed to determine what to display.
IResultSet set = connectorManager.getConnectors();
@@ -431,13 +424,8 @@
<%
}
-
- if (JSPFolder != null)
- {
-%>
- <jsp:include page='<%="/authorities/"+JSPFolder+"/editconfig.jsp"%>' flush="true"/>
-<%
- }
+ if (className.length() > 0)
+ AuthorityConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.lcf.ui.jsp.JspWrapper(out),parameters,tabName);
%>
<table class="displaytable">
<tr><td class="separator" colspan="4"><hr/></td></tr>
Modified: incubator/lcf/trunk/modules/framework/crawler-ui/editconnection.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/crawler-ui/editconnection.jsp?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/crawler-ui/editconnection.jsp (original)
+++ incubator/lcf/trunk/modules/framework/crawler-ui/editconnection.jsp Tue Jun 29 16:00:57 2010
@@ -159,17 +159,8 @@
}
}
- String JSPFolder = null;
ArrayList tabsArray = new ArrayList();
- if (className.length() > 0)
- {
- JSPFolder = RepositoryConnectorFactory.getJSPFolder(threadContext,className);
- threadContext.save("Parameters",parameters);
- threadContext.save("Tabs",tabsArray);
- threadContext.save("TabName",tabName);
- }
-
// Set up the predefined tabs
tabsArray.add("Name");
tabsArray.add("Type");
@@ -179,11 +170,17 @@
%>
<%
- if (JSPFolder != null)
+ if (className.length() > 0)
{
+ String error = RepositoryConnectorFactory.processConfigurationPost(threadContext,className,variableContext,parameters);
+ if (error != null)
+ {
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listconnections.jsp");
%>
- <jsp:include page='<%="/connectors/"+JSPFolder+"/postconfig.jsp"%>' flush="false"/>
+<jsp:forward page="error.jsp"/>
<%
+ }
}
%>
@@ -338,14 +335,7 @@
//-->
</script>
<%
- if (JSPFolder != null)
- {
-%>
- <jsp:include page='<%="/connectors/"+JSPFolder+"/headerconfig.jsp"%>' flush="true"/>
-<%
- }
-
-
+ RepositoryConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.lcf.ui.jsp.JspWrapper(out),parameters,tabsArray);
%>
</head>
@@ -656,12 +646,8 @@
}
}
- if (JSPFolder != null)
- {
-%>
- <jsp:include page='<%="/connectors/"+JSPFolder+"/editconfig.jsp"%>' flush="true"/>
-<%
- }
+ if (className.length() > 0)
+ RepositoryConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.lcf.ui.jsp.JspWrapper(out),parameters,tabName);
%>
<table class="displaytable">
<tr><td class="separator" colspan="4"><hr/></td></tr>
Modified: incubator/lcf/trunk/modules/framework/crawler-ui/editjob.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/crawler-ui/editjob.jsp?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/crawler-ui/editjob.jsp (original)
+++ incubator/lcf/trunk/modules/framework/crawler-ui/editjob.jsp Tue Jun 29 16:00:57 2010
@@ -325,35 +325,31 @@
// 3) a jobid and a connection name, which indicates that we are editing an existing connection.
// There are similar combinations for output connections.
- String JSPFolder = null;
- String outputJSPFolder = null;
int model = IRepositoryConnector.MODEL_ADD_CHANGE_DELETE;
String[] relationshipTypes = null;
ArrayList tabsArray = new ArrayList();
+
+ IRepositoryConnection connection = null;
+ IOutputConnection outputConnection = null;
if (connectionName.length() > 0)
{
-
- IRepositoryConnection connection = connMgr.load(connectionName);
- JSPFolder = RepositoryConnectorFactory.getJSPFolder(threadContext,connection.getClassName());
+ connection = connMgr.load(connectionName);
model = RepositoryConnectorFactory.getConnectorModel(threadContext,connection.getClassName());
relationshipTypes = RepositoryConnectorFactory.getRelationshipTypes(threadContext,connection.getClassName());
-
- threadContext.save("DocumentSpecification",documentSpecification);
- threadContext.save("RepositoryConnection",connection);
+ //threadContext.save("DocumentSpecification",documentSpecification);
+ //threadContext.save("RepositoryConnection",connection);
}
if (outputName.length() > 0)
{
- IOutputConnection connection = outputMgr.load(outputName);
- outputJSPFolder = OutputConnectorFactory.getJSPFolder(threadContext,connection.getClassName());
-
- threadContext.save("OutputSpecification",outputSpecification);
- threadContext.save("OutputConnection",connection);
+ outputConnection = outputMgr.load(outputName);
+ //threadContext.save("OutputSpecification",outputSpecification);
+ //threadContext.save("OutputConnection",connection);
}
// Assert the following variables regardless of connection choice/non-choice
- threadContext.save("ScheduleCount",Integer.toString(scheduleRecords.size()));
- threadContext.save("Tabs",tabsArray);
- threadContext.save("TabName",tabName);
+ //threadContext.save("ScheduleCount",Integer.toString(scheduleRecords.size()));
+ //threadContext.save("Tabs",tabsArray);
+ //threadContext.save("TabName",tabName);
// Set up the predefined tabs
tabsArray.add("Name");
@@ -386,20 +382,56 @@
%>
<%
- if (outputJSPFolder != null)
+ if (outputConnection != null)
{
+ IOutputConnector outputConnector = OutputConnectorFactory.grab(threadContext,outputConnection.getClassName(),outputConnection.getConfigParams(),
+ outputConnection.getMaxConnections());
+ if (outputConnector != null)
+ {
+ try
+ {
+ String error = outputConnector.processSpecificationPost(variableContext,outputSpecification);
+ if (error != null)
+ {
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listjobs.jsp");
%>
- <jsp:include page='<%="/output/"+outputJSPFolder+"/postspec.jsp"%>' flush="true"/>
+ <jsp:forward page="error.jsp"/>
<%
+ }
+ }
+ finally
+ {
+ OutputConnectorFactory.release(outputConnector);
+ }
+ }
}
%>
<%
- if (JSPFolder != null)
+ if (connection != null)
{
+ IRepositoryConnector repositoryConnector = RepositoryConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),
+ connection.getMaxConnections());
+ if (repositoryConnector != null)
+ {
+ try
+ {
+ String error = repositoryConnector.processSpecificationPost(variableContext,documentSpecification);
+ if (error != null)
+ {
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listjobs.jsp");
%>
- <jsp:include page='<%="/connectors/"+JSPFolder+"/postspec.jsp"%>' flush="true"/>
+ <jsp:forward page="error.jsp"/>
<%
+ }
+ }
+ finally
+ {
+ RepositoryConnectorFactory.release(repositoryConnector);
+ }
+ }
}
%>
@@ -619,20 +651,40 @@
//-->
</script>
<%
- if (outputJSPFolder != null)
+ if (outputConnection != null)
{
-%>
- <jsp:include page='<%="/output/"+outputJSPFolder+"/headerspec.jsp"%>' flush="true"/>
-<%
+ IOutputConnector outputConnector = OutputConnectorFactory.grab(threadContext,outputConnection.getClassName(),outputConnection.getConfigParams(),
+ outputConnection.getMaxConnections());
+ if (outputConnector != null)
+ {
+ try
+ {
+ outputConnector.outputSpecificationHeader(new org.apache.lcf.ui.jsp.JspWrapper(out),outputSpecification,tabsArray);
+ }
+ finally
+ {
+ OutputConnectorFactory.release(outputConnector);
+ }
+ }
}
%>
<%
- if (JSPFolder != null)
+ if (connection != null)
{
-%>
- <jsp:include page='<%="/connectors/"+JSPFolder+"/headerspec.jsp"%>' flush="true"/>
-<%
+ IRepositoryConnector repositoryConnector = RepositoryConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),
+ connection.getMaxConnections());
+ if (repositoryConnector != null)
+ {
+ try
+ {
+ repositoryConnector.outputSpecificationHeader(new org.apache.lcf.ui.jsp.JspWrapper(out),documentSpecification,tabsArray);
+ }
+ finally
+ {
+ RepositoryConnectorFactory.release(repositoryConnector);
+ }
+ }
}
%>
@@ -1326,18 +1378,38 @@
}
}
- if (outputJSPFolder != null)
+ if (outputConnection != null)
{
-%>
- <jsp:include page='<%="/output/"+outputJSPFolder+"/editspec.jsp"%>' flush="true"/>
-<%
+ IOutputConnector outputConnector = OutputConnectorFactory.grab(threadContext,outputConnection.getClassName(),outputConnection.getConfigParams(),
+ outputConnection.getMaxConnections());
+ if (outputConnector != null)
+ {
+ try
+ {
+ outputConnector.outputSpecificationBody(new org.apache.lcf.ui.jsp.JspWrapper(out),outputSpecification,tabName);
+ }
+ finally
+ {
+ OutputConnectorFactory.release(outputConnector);
+ }
+ }
}
- if (JSPFolder != null)
+ if (connection != null)
{
-%>
- <jsp:include page='<%="/connectors/"+JSPFolder+"/editspec.jsp"%>' flush="true"/>
-<%
+ IRepositoryConnector repositoryConnector = RepositoryConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),
+ connection.getMaxConnections());
+ if (repositoryConnector != null)
+ {
+ try
+ {
+ repositoryConnector.outputSpecificationBody(new org.apache.lcf.ui.jsp.JspWrapper(out),documentSpecification,tabName);
+ }
+ finally
+ {
+ RepositoryConnectorFactory.release(repositoryConnector);
+ }
+ }
}
%>
<table class="displaytable">
Modified: incubator/lcf/trunk/modules/framework/crawler-ui/editoutput.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/crawler-ui/editoutput.jsp?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/crawler-ui/editoutput.jsp (original)
+++ incubator/lcf/trunk/modules/framework/crawler-ui/editoutput.jsp Tue Jun 29 16:00:57 2010
@@ -75,17 +75,8 @@
maxConnections = Integer.parseInt(x);
}
- String JSPFolder = null;
ArrayList tabsArray = new ArrayList();
- if (className.length() > 0)
- {
- JSPFolder = OutputConnectorFactory.getJSPFolder(threadContext,className);
- threadContext.save("Parameters",parameters);
- threadContext.save("Tabs",tabsArray);
- threadContext.save("TabName",tabName);
- }
-
// Set up the predefined tabs
tabsArray.add("Name");
tabsArray.add("Type");
@@ -95,11 +86,17 @@
%>
<%
- if (JSPFolder != null)
+ if (className.length() > 0)
{
+ String error = OutputConnectorFactory.processConfigurationPost(threadContext,className,variableContext,parameters);
+ if (error != null)
+ {
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listoutputs.jsp");
%>
- <jsp:include page='<%="/output/"+JSPFolder+"/postconfig.jsp"%>' flush="false"/>
+<jsp:forward page="error.jsp"/>
<%
+ }
}
%>
@@ -229,14 +226,7 @@
//-->
</script>
<%
- if (JSPFolder != null)
- {
-%>
- <jsp:include page='<%="/output/"+JSPFolder+"/headerconfig.jsp"%>' flush="true"/>
-<%
- }
-
-
+ OutputConnectorFactory.outputConfigurationHeader(threadContext,className,new org.apache.lcf.ui.jsp.JspWrapper(out),parameters,tabsArray);
%>
</head>
@@ -435,12 +425,9 @@
<%
}
- if (JSPFolder != null)
- {
-%>
- <jsp:include page='<%="/output/"+JSPFolder+"/editconfig.jsp"%>' flush="true"/>
-<%
- }
+ if (className.length() > 0)
+ OutputConnectorFactory.outputConfigurationBody(threadContext,className,new org.apache.lcf.ui.jsp.JspWrapper(out),parameters,tabName);
+
%>
<table class="displaytable">
<tr><td class="separator" colspan="4"><hr/></td></tr>
Modified: incubator/lcf/trunk/modules/framework/crawler-ui/execute.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/crawler-ui/execute.jsp?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/crawler-ui/execute.jsp (original)
+++ incubator/lcf/trunk/modules/framework/crawler-ui/execute.jsp Tue Jun 29 16:00:57 2010
@@ -217,8 +217,6 @@
IRepositoryConnection connection = connManager.load(job.getConnectionName());
IOutputConnection outputConnection = outputManager.load(job.getOutputConnectionName());
- String JSPFolder = RepositoryConnectorFactory.getJSPFolder(threadContext,connection.getClassName());
- String outputJSPFolder = OutputConnectorFactory.getJSPFolder(threadContext,outputConnection.getClassName());
String[] relationshipTypes = RepositoryConnectorFactory.getRelationshipTypes(threadContext,connection.getClassName());
// Gather hopcount filters
@@ -238,24 +236,51 @@
}
}
}
-
- if (outputJSPFolder != null)
+
+ IOutputConnector outputConnector = OutputConnectorFactory.grab(threadContext,
+ outputConnection.getClassName(),outputConnection.getConfigParams(),outputConnection.getMaxConnections());
+ if (outputConnector != null)
{
- threadContext.save("OutputSpecification",job.getOutputSpecification());
- threadContext.save("OutputConnection",outputConnection);
+ try
+ {
+ String error = outputConnector.processSpecificationPost(variableContext,job.getOutputSpecification());
+ if (error != null)
+ {
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listjobs.jsp");
%>
- <jsp:include page='<%="/output/"+outputJSPFolder+"/postspec.jsp"%>' flush="false"/>
+ <jsp:forward page="error.jsp"/>
<%
+ }
+ }
+ finally
+ {
+ OutputConnectorFactory.release(outputConnector);
+ }
}
- if (JSPFolder != null)
+ IRepositoryConnector repositoryConnector = RepositoryConnectorFactory.grab(threadContext,
+ connection.getClassName(),connection.getConfigParams(),connection.getMaxConnections());
+ if (repositoryConnector != null)
{
- threadContext.save("DocumentSpecification",job.getSpecification());
- threadContext.save("RepositoryConnection",connection);
+ try
+ {
+ String error = repositoryConnector.processSpecificationPost(variableContext,job.getSpecification());
+ if (error != null)
+ {
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listjobs.jsp");
%>
- <jsp:include page='<%="/connectors/"+JSPFolder+"/postspec.jsp"%>' flush="false"/>
+ <jsp:forward page="error.jsp"/>
<%
+ }
+ }
+ finally
+ {
+ RepositoryConnectorFactory.release(repositoryConnector);
+ }
}
+
manager.save(job);
// Reset the job schedule. We may want to make this explicit at some point; having
// this happen all the time seems wrong.
@@ -300,13 +325,14 @@
if (x != null && x.length() > 0)
connection.setMaxConnections(Integer.parseInt(x));
- String JSPFolder = OutputConnectorFactory.getJSPFolder(threadContext,connection.getClassName());
-
- threadContext.save("Parameters",connection.getConfigParams());
- if (JSPFolder != null)
+ String error = OutputConnectorFactory.processConfigurationPost(threadContext,connection.getClassName(),variableContext,connection.getConfigParams());
+
+ if (error != null)
{
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listoutputs.jsp");
%>
- <jsp:include page='<%="/output/"+JSPFolder+"/postconfig.jsp"%>' flush="false"/>
+ <jsp:forward page="error.jsp"/>
<%
}
outputManager.save(connection);
@@ -394,15 +420,17 @@
}
}
- String JSPFolder = RepositoryConnectorFactory.getJSPFolder(threadContext,connection.getClassName());
-
- threadContext.save("Parameters",connection.getConfigParams());
- if (JSPFolder != null)
+ String error = RepositoryConnectorFactory.processConfigurationPost(threadContext,connection.getClassName(),variableContext,connection.getConfigParams());
+
+ if (error != null)
{
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listconnections.jsp");
%>
- <jsp:include page='<%="/connectors/"+JSPFolder+"/postconfig.jsp"%>' flush="false"/>
+ <jsp:forward page="error.jsp"/>
<%
}
+
connManager.save(connection);
variableContext.setParameter("connname",connectionName);
%>
@@ -443,15 +471,17 @@
if (x != null && x.length() > 0)
connection.setMaxConnections(Integer.parseInt(x));
- String JSPFolder = AuthorityConnectorFactory.getJSPFolder(threadContext,connection.getClassName());
-
- threadContext.save("Parameters",connection.getConfigParams());
- if (JSPFolder != null)
+ String error = AuthorityConnectorFactory.processConfigurationPost(threadContext,connection.getClassName(),variableContext,connection.getConfigParams());
+
+ if (error != null)
{
+ variableContext.setParameter("text",error);
+ variableContext.setParameter("target","listauthorities.jsp");
%>
- <jsp:include page='<%="/authorities/"+JSPFolder+"/postconfig.jsp"%>' flush="false"/>
+ <jsp:forward page="error.jsp"/>
<%
}
+
authConnManager.save(connection);
variableContext.setParameter("connname",connectionName);
%>
Modified: incubator/lcf/trunk/modules/framework/crawler-ui/viewauthority.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/crawler-ui/viewauthority.jsp?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/crawler-ui/viewauthority.jsp (original)
+++ incubator/lcf/trunk/modules/framework/crawler-ui/viewauthority.jsp Tue Jun 29 16:00:57 2010
@@ -86,8 +86,8 @@
ConfigParams parameters = connection.getConfigParams();
// Do stuff so we can call out to display the parameters
- String JSPFolder = AuthorityConnectorFactory.getJSPFolder(threadContext,className);
- threadContext.save("Parameters",parameters);
+ //String JSPFolder = AuthorityConnectorFactory.getJSPFolder(threadContext,className);
+ //threadContext.save("Parameters",parameters);
// Now, test the connection.
String connectionStatus;
@@ -136,12 +136,7 @@
<tr>
<td colspan="4">
<%
- if (JSPFolder != null)
- {
-%>
- <jsp:include page='<%="/authorities/"+JSPFolder+"/viewconfig.jsp"%>' flush="true"/>
-<%
- }
+ AuthorityConnectorFactory.viewConfiguration(threadContext,className,new org.apache.lcf.ui.jsp.JspWrapper(out),parameters);
%>
</td>
Modified: incubator/lcf/trunk/modules/framework/crawler-ui/viewconnection.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/crawler-ui/viewconnection.jsp?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/crawler-ui/viewconnection.jsp (original)
+++ incubator/lcf/trunk/modules/framework/crawler-ui/viewconnection.jsp Tue Jun 29 16:00:57 2010
@@ -91,8 +91,8 @@
ConfigParams parameters = connection.getConfigParams();
// Do stuff so we can call out to display the parameters
- String JSPFolder = RepositoryConnectorFactory.getJSPFolder(threadContext,className);
- threadContext.save("Parameters",parameters);
+ //String JSPFolder = RepositoryConnectorFactory.getJSPFolder(threadContext,className);
+ //threadContext.save("Parameters",parameters);
// Now, test the connection.
String connectionStatus;
@@ -191,12 +191,7 @@
<tr>
<td colspan="4">
<%
- if (JSPFolder != null)
- {
-%>
- <jsp:include page='<%="/connectors/"+JSPFolder+"/viewconfig.jsp"%>' flush="true"/>
-<%
- }
+ RepositoryConnectorFactory.viewConfiguration(threadContext,className,new org.apache.lcf.ui.jsp.JspWrapper(out),parameters);
%>
</td>
</tr>
Modified: incubator/lcf/trunk/modules/framework/crawler-ui/viewjob.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/crawler-ui/viewjob.jsp?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/crawler-ui/viewjob.jsp (original)
+++ incubator/lcf/trunk/modules/framework/crawler-ui/viewjob.jsp Tue Jun 29 16:00:57 2010
@@ -120,17 +120,15 @@
IRepositoryConnection connection = connManager.load(job.getConnectionName());
IOutputConnection outputConnection = outputManager.load(job.getOutputConnectionName());
- String JSPFolder = RepositoryConnectorFactory.getJSPFolder(threadContext,connection.getClassName());
- String outputJSPFolder = OutputConnectorFactory.getJSPFolder(threadContext,outputConnection.getClassName());
int model = RepositoryConnectorFactory.getConnectorModel(threadContext,connection.getClassName());
String[] relationshipTypes = RepositoryConnectorFactory.getRelationshipTypes(threadContext,connection.getClassName());
Map hopCountFilters = job.getHopCountFilters();
int hopcountMode = job.getHopcountMode();
- threadContext.save("OutputSpecification",job.getOutputSpecification());
- threadContext.save("OutputConnection",outputConnection);
- threadContext.save("DocumentSpecification",job.getSpecification());
- threadContext.save("RepositoryConnection",connection);
+ //threadContext.save("OutputSpecification",job.getOutputSpecification());
+ //threadContext.save("OutputConnection",outputConnection);
+ //threadContext.save("DocumentSpecification",job.getSpecification());
+ //threadContext.save("RepositoryConnection",connection);
%>
<table class="displaytable">
<tr>
@@ -546,11 +544,21 @@
<tr>
<td colspan="4">
<%
- if (outputJSPFolder != null)
+ if (outputConnection != null)
{
-%>
- <jsp:include page='<%="/output/"+outputJSPFolder+"/viewspec.jsp"%>' flush="true"/>
-<%
+ IOutputConnector outputConnector = OutputConnectorFactory.grab(threadContext,outputConnection.getClassName(),outputConnection.getConfigParams(),
+ outputConnection.getMaxConnections());
+ if (outputConnector != null)
+ {
+ try
+ {
+ outputConnector.viewSpecification(new org.apache.lcf.ui.jsp.JspWrapper(out),job.getOutputSpecification());
+ }
+ finally
+ {
+ OutputConnectorFactory.release(outputConnector);
+ }
+ }
}
%>
</td>
@@ -561,11 +569,21 @@
<tr>
<td colspan="4">
<%
- if (JSPFolder != null)
+ if (connection != null)
{
-%>
- <jsp:include page='<%="/connectors/"+JSPFolder+"/viewspec.jsp"%>' flush="true"/>
-<%
+ IRepositoryConnector repositoryConnector = RepositoryConnectorFactory.grab(threadContext,connection.getClassName(),connection.getConfigParams(),
+ connection.getMaxConnections());
+ if (repositoryConnector != null)
+ {
+ try
+ {
+ repositoryConnector.viewSpecification(new org.apache.lcf.ui.jsp.JspWrapper(out),job.getSpecification());
+ }
+ finally
+ {
+ RepositoryConnectorFactory.release(repositoryConnector);
+ }
+ }
}
%>
</td>
Modified: incubator/lcf/trunk/modules/framework/crawler-ui/viewoutput.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/crawler-ui/viewoutput.jsp?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/crawler-ui/viewoutput.jsp (original)
+++ incubator/lcf/trunk/modules/framework/crawler-ui/viewoutput.jsp Tue Jun 29 16:00:57 2010
@@ -97,8 +97,8 @@
ConfigParams parameters = connection.getConfigParams();
// Do stuff so we can call out to display the parameters
- String JSPFolder = OutputConnectorFactory.getJSPFolder(threadContext,className);
- threadContext.save("Parameters",parameters);
+ //String JSPFolder = OutputConnectorFactory.getJSPFolder(threadContext,className);
+ //threadContext.save("Parameters",parameters);
// Now, test the connection.
String connectionStatus;
@@ -145,12 +145,7 @@
<tr>
<td colspan="4">
<%
- if (JSPFolder != null)
- {
-%>
- <jsp:include page='<%="/output/"+JSPFolder+"/viewconfig.jsp"%>' flush="true"/>
-<%
- }
+ OutputConnectorFactory.viewConfiguration(threadContext,className,new org.apache.lcf.ui.jsp.JspWrapper(out),parameters);
%>
</td>
</tr>
Modified: incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/authorities/BaseAuthorityConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/authorities/BaseAuthorityConnector.java?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/authorities/BaseAuthorityConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/authorities/BaseAuthorityConnector.java Tue Jun 29 16:00:57 2010
@@ -21,6 +21,9 @@ package org.apache.lcf.authorities.autho
import org.apache.lcf.core.interfaces.*;
import org.apache.lcf.authorities.interfaces.*;
+import java.util.*;
+import java.io.*;
+
/** An authority connector supplies an ACL of some kind for a given user. This is necessary so that the search UI
* can find the documents that can be legally seen.
*
@@ -185,4 +188,59 @@ public abstract class BaseAuthorityConne
{
return null;
}
+
+ /** 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
+ {
+ }
+
+ /** Output the configuration body section.
+ * This method is called in the body section of the authority 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 <html>, <body>, and <form> 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
+ {
+ }
+
+ /** Process a configuration post.
+ * This method is called at the start of the authority 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
+ {
+ return null;
+ }
+
+ /** View configuration.
+ * This method is called in the body section of the authority 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 <html> and <body> 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
+ {
+ }
+
}
Modified: incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/interfaces/AuthorityConnectorFactory.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/interfaces/AuthorityConnectorFactory.java?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/interfaces/AuthorityConnectorFactory.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/interfaces/AuthorityConnectorFactory.java Tue Jun 29 16:00:57 2010
@@ -20,6 +20,7 @@ package org.apache.lcf.authorities.inter
import org.apache.lcf.core.interfaces.*;
import java.util.*;
+import java.io.*;
import java.lang.reflect.*;
/** This class manages a pool of authority connectors.
@@ -54,28 +55,60 @@ public class AuthorityConnectorFactory
connector.deinstall(threadContext);
}
- /** Get the JSP folder for a connector.
- *@param className is the class name.
- *@return the folder string.
+ /** Get the default response from a connector. Called if the connection attempt fails.
*/
- public static String getJSPFolder(IThreadContext threadContext, String className)
+ public static AuthorizationResponse getDefaultAuthorizationResponse(IThreadContext threadContext, String className, String userName)
throws LCFException
{
IAuthorityConnector connector = getConnector(threadContext,className);
if (connector == null)
return null;
- return connector.getJSPFolder();
+ return connector.getDefaultAuthorizationResponse(userName);
}
- /** Get the default response from a connector. Called if the connection attempt fails.
+ /** Output the configuration header section.
*/
- public static AuthorizationResponse getDefaultAuthorizationResponse(IThreadContext threadContext, String className, String userName)
+ public static void outputConfigurationHeader(IThreadContext threadContext, String className, IHTTPOutput out, ConfigParams parameters, ArrayList tabsArray)
+ throws LCFException, IOException
+ {
+ IAuthorityConnector connector = getConnector(threadContext, className);
+ if (connector == null)
+ return;
+ connector.outputConfigurationHeader(threadContext,out,parameters,tabsArray);
+ }
+
+ /** Output the configuration body section.
+ */
+ public static void outputConfigurationBody(IThreadContext threadContext, String className, IHTTPOutput out, ConfigParams parameters, String tabName)
+ throws LCFException, IOException
+ {
+ IAuthorityConnector connector = getConnector(threadContext, className);
+ if (connector == null)
+ return;
+ connector.outputConfigurationBody(threadContext,out,parameters,tabName);
+ }
+
+ /** Process configuration post data for a connector.
+ */
+ public static String processConfigurationPost(IThreadContext threadContext, String className, IPostParameters variableContext, ConfigParams configParams)
throws LCFException
{
- IAuthorityConnector connector = getConnector(threadContext,className);
+ IAuthorityConnector connector = getConnector(threadContext, className);
if (connector == null)
return null;
- return connector.getDefaultAuthorizationResponse(userName);
+ return connector.processConfigurationPost(threadContext,variableContext,configParams);
+ }
+
+ /** View connector configuration.
+ */
+ public static void viewConfiguration(IThreadContext threadContext, String className, IHTTPOutput out, ConfigParams configParams)
+ throws LCFException, IOException
+ {
+ IAuthorityConnector connector = getConnector(threadContext, className);
+ // We want to be able to view connections even if they have unregistered connectors.
+ if (connector == null)
+ return;
+ connector.viewConfiguration(threadContext,out,configParams);
}
/** Get a repository connector instance, but do NOT check if class is installed first!
Modified: incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/interfaces/IAuthorityConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/interfaces/IAuthorityConnector.java?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/interfaces/IAuthorityConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/authorities/interfaces/IAuthorityConnector.java Tue Jun 29 16:00:57 2010
@@ -20,6 +20,9 @@ package org.apache.lcf.authorities.inter
import org.apache.lcf.core.interfaces.*;
+import java.util.*;
+import java.io.*;
+
/** An authority connector supplies an ACL of some kind for a given user. This is necessary so that the search UI
* can find the documents that can be legally seen.
*
@@ -45,14 +48,6 @@ public interface IAuthorityConnector
public void deinstall(IThreadContext threadContext)
throws LCFException;
- /** Return the path for the UI interface JSP elements.
- * These JSP's must be provided to allow the connector to be configured.
- * This method should return the name of the folder, under the <webapp>/connectors/
- * area, where the appropriate JSP's can be found. The name should NOT have a slash in it.
- *@return the folder part
- */
- public String getJSPFolder();
-
/** Connect. The configuration parameters are included.
*@param configParams are the configuration parameters for this connection.
*/
@@ -107,4 +102,54 @@ public interface IAuthorityConnector
*/
public AuthorizationResponse getDefaultAuthorizationResponse(String userName);
+ // UI support methods.
+ //
+ // These support methods are involved in setting up authority connection configuration information. The configuration methods cannot assume that the
+ // current authority object is connected. That is why they receive a thread context argument.
+
+ /** 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;
+
+ /** Output the configuration body section.
+ * This method is called in the body section of the authority 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 <html>, <body>, and <form> 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;
+
+ /** Process a configuration post.
+ * This method is called at the start of the authority 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;
+
+ /** View configuration.
+ * This method is called in the body section of the authority 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 <html> and <body> 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;
+
}
Modified: incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java Tue Jun 29 16:00:57 2010
@@ -521,6 +521,118 @@ public abstract class BaseRepositoryConn
// Does nothing; override to make something happen
}
+ // 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
+ {
+ }
+
+ /** 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 <html>, <body>, and <form> 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
+ {
+ }
+
+ /** 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
+ {
+ 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 <html> and <body> 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
+ {
+ }
+
+ /** 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
+ {
+ }
+
+ /** 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 <html>, <body>, and <form> 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
+ {
+ }
+
+ /** 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
+ {
+ 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 <html> and <body> 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
+ {
+ }
+
}
Modified: incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java Tue Jun 29 16:00:57 2010
@@ -263,6 +263,100 @@ public interface IRepositoryConnector
*/
public int getMaxDocumentRequest();
+ // 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;
+
+ /** 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 <html>, <body>, and <form> 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;
+
+ /** 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;
+
+ /** 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 <html> and <body> 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;
+
+ /** 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;
+
+ /** 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 <html>, <body>, and <form> 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;
+
+ /** 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;
+
+ /** 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 <html> and <body> 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;
+
}
Modified: incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/RepositoryConnectorFactory.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/RepositoryConnectorFactory.java?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/RepositoryConnectorFactory.java (original)
+++ incubator/lcf/trunk/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/RepositoryConnectorFactory.java Tue Jun 29 16:00:57 2010
@@ -23,6 +23,7 @@ import org.apache.lcf.agents.interfaces.
import org.apache.lcf.crawler.system.Logging;
import java.util.*;
+import java.io.*;
import java.lang.reflect.*;
/** This is the factory class for IRepositoryConnector objects.
@@ -91,30 +92,62 @@ public class RepositoryConnectorFactory
return values;
}
- /** Get the JSP folder for a connector.
+ /** Get the operating mode for a connector.
*@param className is the class name.
- *@return the folder string.
+ *@return the connector operating model, as specified in IRepositoryConnector.
*/
- public static String getJSPFolder(IThreadContext threadContext, String className)
+ public static int getConnectorModel(IThreadContext threadContext, String className)
throws LCFException
{
IRepositoryConnector connector = getConnector(threadContext, className);
if (connector == null)
- return null;
- return connector.getJSPFolder();
+ return -1;
+ return connector.getConnectorModel();
}
- /** Get the operating mode for a connector.
- *@param className is the class name.
- *@return the connector operating model, as specified in IRepositoryConnector.
+ /** Output the configuration header section.
*/
- public static int getConnectorModel(IThreadContext threadContext, String className)
+ public static void outputConfigurationHeader(IThreadContext threadContext, String className, IHTTPOutput out, ConfigParams parameters, ArrayList tabsArray)
+ throws LCFException, IOException
+ {
+ IRepositoryConnector connector = getConnector(threadContext, className);
+ if (connector == null)
+ return;
+ connector.outputConfigurationHeader(threadContext,out,parameters,tabsArray);
+ }
+
+ /** Output the configuration body section.
+ */
+ public static void outputConfigurationBody(IThreadContext threadContext, String className, IHTTPOutput out, ConfigParams parameters, String tabName)
+ throws LCFException, IOException
+ {
+ IRepositoryConnector connector = getConnector(threadContext, className);
+ if (connector == null)
+ return;
+ connector.outputConfigurationBody(threadContext,out,parameters,tabName);
+ }
+
+ /** Process configuration post data for a connector.
+ */
+ public static String processConfigurationPost(IThreadContext threadContext, String className, IPostParameters variableContext, ConfigParams configParams)
throws LCFException
{
IRepositoryConnector connector = getConnector(threadContext, className);
if (connector == null)
- return -1;
- return connector.getConnectorModel();
+ return null;
+ return connector.processConfigurationPost(threadContext,variableContext,configParams);
+ }
+
+ /** View connector configuration.
+ */
+ public static void viewConfiguration(IThreadContext threadContext, String className, IHTTPOutput out, ConfigParams configParams)
+ throws LCFException, IOException
+ {
+ IRepositoryConnector connector = getConnector(threadContext, className);
+ // We want to be able to view connections even if they have unregistered connectors.
+ if (connector == null)
+ return;
+ connector.viewConfiguration(threadContext,out,configParams);
}
/** Get a repository connector instance, without checking for installed connector.
Modified: incubator/lcf/trunk/modules/framework/ui-core/org/apache/lcf/ui/multipart/MultipartWrapper.java
URL: http://svn.apache.org/viewvc/incubator/lcf/trunk/modules/framework/ui-core/org/apache/lcf/ui/multipart/MultipartWrapper.java?rev=959015&r1=959014&r2=959015&view=diff
==============================================================================
--- incubator/lcf/trunk/modules/framework/ui-core/org/apache/lcf/ui/multipart/MultipartWrapper.java (original)
+++ incubator/lcf/trunk/modules/framework/ui-core/org/apache/lcf/ui/multipart/MultipartWrapper.java Tue Jun 29 16:00:57 2010
@@ -29,7 +29,7 @@ import java.io.*;
* multipart forms. It is styled much like HttpServletRequest, but wraps this interface so
* that code can access either standard post data or multipart data transparently.
*/
-public class MultipartWrapper
+public class MultipartWrapper implements IPostParameters
{
public static final String _rcsid = "@(#)$Id$";
@@ -134,7 +134,6 @@ public class MultipartWrapper
return rval;
}
- /** We need to be able to set a parameter
/** Get single parameter value.
*/
public String getParameter(String name)