manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r955564 - in /incubator/lcf/branches/CONNECTORS-40/modules/framework: crawler-ui/ pull-agent/org/apache/lcf/crawler/connectors/ pull-agent/org/apache/lcf/crawler/interfaces/
Date Thu, 17 Jun 2010 12:02:48 GMT
Author: kwright
Date: Thu Jun 17 12:02:48 2010
New Revision: 955564

URL: http://svn.apache.org/viewvc?rev=955564&view=rev
Log:
Framework infrastructure changes to support removal of repository connector JSPs.  The individual
connectors have not yet been changed as of this commit; that's expected to be an ongoing project.

Modified:
    incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/editconnection.jsp
    incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/editjob.jsp
    incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/execute.jsp
    incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/viewconnection.jsp
    incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/viewjob.jsp
    incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java
    incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java
    incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/RepositoryConnectorFactory.java

Modified: incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/editconnection.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/editconnection.jsp?rev=955564&r1=955563&r2=955564&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/editconnection.jsp (original)
+++ incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/editconnection.jsp Thu
Jun 17 12:02:48 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/branches/CONNECTORS-40/modules/framework/crawler-ui/editjob.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/editjob.jsp?rev=955564&r1=955563&r2=955564&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/editjob.jsp (original)
+++ incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/editjob.jsp Thu Jun
17 12:02:48 2010
@@ -329,18 +329,15 @@
 	String[] relationshipTypes = null;
 	ArrayList tabsArray = new ArrayList();
 	
-	String JSPFolder = null;
+	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)
 	{
@@ -350,9 +347,9 @@
 	}
 
 	// 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");
@@ -412,11 +409,29 @@
 %>
 
 <%
-	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);
+			}
+		}
 	}
 %>
 
@@ -655,11 +670,21 @@
 %>
 
 <%
-	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);
+			}
+		}
 	}
 %>
 
@@ -1370,11 +1395,21 @@
 		}
 	}
 
-	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/branches/CONNECTORS-40/modules/framework/crawler-ui/execute.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/execute.jsp?rev=955564&r1=955563&r2=955564&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/execute.jsp (original)
+++ incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/execute.jsp Thu Jun
17 12:02:48 2010
@@ -217,7 +217,6 @@
 
 					IRepositoryConnection connection = connManager.load(job.getConnectionName());
 					IOutputConnection outputConnection = outputManager.load(job.getOutputConnectionName());
-					String JSPFolder = RepositoryConnectorFactory.getJSPFolder(threadContext,connection.getClassName());
 					String[] relationshipTypes = RepositoryConnectorFactory.getRelationshipTypes(threadContext,connection.getClassName());
 
 					// Gather hopcount filters
@@ -259,15 +258,29 @@
 							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.
@@ -407,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);
 %>

Modified: incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/viewconnection.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/viewconnection.jsp?rev=955564&r1=955563&r2=955564&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/viewconnection.jsp (original)
+++ incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/viewconnection.jsp Thu
Jun 17 12:02:48 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/branches/CONNECTORS-40/modules/framework/crawler-ui/viewjob.jsp
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/viewjob.jsp?rev=955564&r1=955563&r2=955564&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/viewjob.jsp (original)
+++ incubator/lcf/branches/CONNECTORS-40/modules/framework/crawler-ui/viewjob.jsp Thu Jun
17 12:02:48 2010
@@ -120,7 +120,6 @@
 
 		IRepositoryConnection connection = connManager.load(job.getConnectionName());
 		IOutputConnection outputConnection = outputManager.load(job.getOutputConnectionName());
-		String JSPFolder = RepositoryConnectorFactory.getJSPFolder(threadContext,connection.getClassName());
 		int model = RepositoryConnectorFactory.getConnectorModel(threadContext,connection.getClassName());
 		String[] relationshipTypes = RepositoryConnectorFactory.getRelationshipTypes(threadContext,connection.getClassName());
 		Map hopCountFilters = job.getHopCountFilters();
@@ -128,8 +127,8 @@
 
 		//threadContext.save("OutputSpecification",job.getOutputSpecification());
 		//threadContext.save("OutputConnection",outputConnection);
-		threadContext.save("DocumentSpecification",job.getSpecification());
-		threadContext.save("RepositoryConnection",connection);
+		//threadContext.save("DocumentSpecification",job.getSpecification());
+		//threadContext.save("RepositoryConnection",connection);
 %>
 		<table class="displaytable">
 			<tr>
@@ -570,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/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java?rev=955564&r1=955563&r2=955564&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java
(original)
+++ incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/connectors/BaseRepositoryConnector.java
Thu Jun 17 12:02:48 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/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java?rev=955564&r1=955563&r2=955564&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java
(original)
+++ incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/IRepositoryConnector.java
Thu Jun 17 12:02:48 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/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/RepositoryConnectorFactory.java
URL: http://svn.apache.org/viewvc/incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/RepositoryConnectorFactory.java?rev=955564&r1=955563&r2=955564&view=diff
==============================================================================
--- incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/RepositoryConnectorFactory.java
(original)
+++ incubator/lcf/branches/CONNECTORS-40/modules/framework/pull-agent/org/apache/lcf/crawler/interfaces/RepositoryConnectorFactory.java
Thu Jun 17 12:02:48 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.



Mime
View raw message