manifoldcf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwri...@apache.org
Subject svn commit: r1598156 - in /manifoldcf/branches/CONNECTORS-946/framework: crawler-ui/src/main/webapp/ pull-agent/src/main/java/org/apache/manifoldcf/crawler/connectors/ pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/
Date Wed, 28 May 2014 21:56:18 GMT
Author: kwright
Date: Wed May 28 21:56:17 2014
New Revision: 1598156

URL: http://svn.apache.org/r1598156
Log:
Add sequence numbers to repository connectors

Modified:
    manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/editjob.jsp
    manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/execute.jsp
    manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/viewjob.jsp
    manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/connectors/BaseRepositoryConnector.java
    manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnector.java

Modified: manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/editjob.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/editjob.jsp?rev=1598156&r1=1598155&r2=1598156&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/editjob.jsp (original)
+++ manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/editjob.jsp Wed
May 28 21:56:17 2014
@@ -39,11 +39,23 @@
 	IOutputConnectorPool outputConnectorPool = OutputConnectorPoolFactory.make(threadContext);
 	IRepositoryConnectorPool repositoryConnectorPool = RepositoryConnectorPoolFactory.make(threadContext);
 
-	// Figure out tab name
+	// Figure out tab name and sequence number
 	String tabName = variableContext.getParameter("tabname");
+	String tabSequenceNumber = variableContext.getParameter("sequencenumber");
+	int tabSequenceInt;
 	if (tabName == null || tabName.length() == 0)
+	{
 		tabName = Messages.getString(pageContext.getRequest().getLocale(),"editjob.Name");
-
+		tabSequenceInt = -1;
+	}
+	else
+	{
+		if (tabSequenceNumber == null || tabSequenceNumber.length() == 0)
+			tabSequenceInt = -1;
+		else
+			tabSequenceInt = Integer.parseInt(tabSequenceNumber);
+	}
+	
 	// Get a loaded job object, somehow.
 	String jobID = null;
 	IJobDescription job = (IJobDescription)threadContext.get("JobObject");
@@ -144,6 +156,7 @@
 	int model = IRepositoryConnector.MODEL_ADD_CHANGE_DELETE;
 	String[] relationshipTypes = null;
 	ArrayList tabsArray = new ArrayList();
+	List<Integer> sequenceArray = new ArrayList<Integer>();
 	
 	IRepositoryConnection connection = null;
 	IOutputConnection outputConnection = null;
@@ -160,13 +173,20 @@
 
 	// Set up the predefined tabs
 	tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editjob.Name"));
+	sequenceArray.add(null);
 	tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editjob.Connection"));
+	sequenceArray.add(null);
 	if (connectionName.length() > 0)
 	{
 		tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editjob.Scheduling"));
+		sequenceArray.add(null);
 		if (relationshipTypes != null && relationshipTypes.length > 0)
+		{
 			tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editjob.HopFilters"));
+			sequenceArray.add(null);
+		}
 		tabsArray.add(Messages.getString(pageContext.getRequest().getLocale(),"editjob.ForcedMetadata"));
+		sequenceArray.add(null);
 	}
 
 
@@ -191,6 +211,18 @@
 		if (checkForm())
 		{
 			document.editjob.tabname.value = newtab;
+			document.editjob.sequencenumber.value = "";
+			document.editjob.submit();
+		}
+	}
+
+	// Use this method to repost the form and pick a new tab
+	function SelectTab(newtab, sequencenumber)
+	{
+		if (checkForm())
+		{
+			document.editjob.tabname.value = newtab;
+			document.editjob.sequencenumber.value = sequencenumber;
 			document.editjob.submit();
 		}
 	}
@@ -449,6 +481,11 @@
 				outputConnectorPool.release(outputConnection,outputConnector);
 			}
 		}
+		Integer outputConnectionSequenceNumber = new Integer(1);
+		while (sequenceArray.size() < tabsArray.size())
+		{
+			sequenceArray.add(outputConnectionSequenceNumber);
+		}
 	}
 %>
 
@@ -460,13 +497,18 @@
 		{
 			try
 			{
-				repositoryConnector.outputSpecificationHeader(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),documentSpecification,tabsArray);
+				repositoryConnector.outputSpecificationHeader(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),documentSpecification,0,tabsArray);
 			}
 			finally
 			{
 				repositoryConnectorPool.release(connection,repositoryConnector);
 			}
 		}
+		Integer repositoryConnectionSequenceNumber = new Integer(0);
+		while (sequenceArray.size() < tabsArray.size())
+		{
+			sequenceArray.add(repositoryConnectionSequenceNumber);
+		}
 	}
 %>
 
@@ -501,6 +543,7 @@
 	  <input type="hidden" name="type" value="job"/>
 	  <input type="hidden" name="index" value=""/>
 	  <input type="hidden" name="tabname" value='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(tabName)%>'/>
+	  <input type="hidden" name="sequencenumber" value='<%=((tabSequenceInt==-1)?"":Integer.toString(tabSequenceInt))%>'/>
 <%
 	if (jobID != null)
 	{
@@ -512,11 +555,12 @@
 	    <table class="tabtable">
 	      <tr class="tabrow">
 <%
-	int tabNum = 0;
-	while (tabNum < tabsArray.size())
+	for (int tabNum = 0; tabNum < tabsArray.size(); tabNum++)
 	{
-		String tab = (String)tabsArray.get(tabNum++);
-		if (tab.equals(tabName))
+		String tab = (String)tabsArray.get(tabNum);
+		Integer sequenceNumber = sequenceArray.get(tabNum);
+		int sequenceNumberInt = (sequenceNumber == null)?-1:sequenceNumber.intValue();
+		if (tab.equals(tabName) && (tabSequenceInt == -1 || sequenceNumberInt == tabSequenceInt))
 		{
 %>
 		      <td class="activetab"><nobr><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(tab)%></nobr></td>
@@ -525,7 +569,7 @@
 		else
 		{
 %>
-		      <td class="passivetab"><nobr><a href="javascript:void(0);" alt='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(tab)+"
"+Messages.getAttributeString(pageContext.getRequest().getLocale(),"editjob.tab")%>' onclick='<%="javascript:SelectTab(\""+tab+"\");return
false;"%>'><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(tab)%></a></nobr></td>
+		      <td class="passivetab"><nobr><a href="javascript:void(0);" alt='<%=org.apache.manifoldcf.ui.util.Encoder.attributeEscape(tab)+"
"+Messages.getAttributeString(pageContext.getRequest().getLocale(),"editjob.tab")%>' onclick='<%="javascript:SelectTab(\""+tab+"\","+((sequenceNumber==null)?"":sequenceNumber.toString())+");return
false;"%>'><%=org.apache.manifoldcf.ui.util.Encoder.bodyEscape(tab)%></a></nobr></td>
 <%
 		}
 	}
@@ -553,7 +597,7 @@
 		  <input type="hidden" name="schedulerecords" value='<%=Integer.toString(scheduleRecords.size())%>'/>
 <%
 	// The NAME tab
-	if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.Name")))
+	if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.Name"))
&& tabSequenceInt == -1)
 	{
 %>
 		  <table class="displaytable">
@@ -576,7 +620,7 @@
 	}
 
 	// Forced Metadata tab
-	if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.ForcedMetadata")))
+	if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.ForcedMetadata"))
&& tabSequenceInt == -1)
 	{
 %>
 		  <table class="displaytable">
@@ -685,7 +729,7 @@
 	}
 	
 	// Hop Filters tab
-	if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.HopFilters")))
+	if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.HopFilters"))
&& tabSequenceInt == -1)
 	{
 	    if (relationshipTypes != null)
 	    {
@@ -750,7 +794,7 @@
 	}
 
 	// Connection tab
-	if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.Connection")))
+	if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.Connection"))
&& tabSequenceInt == -1)
 	{
 %>
 		  <table class="displaytable">
@@ -858,7 +902,7 @@
 	}
 
 	// Scheduling tab
-	if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.Scheduling")))
+	if (tabName.equals(Messages.getString(pageContext.getRequest().getLocale(),"editjob.Scheduling"))
&& tabSequenceInt == -1)
 	{
 %>
 		  <table class="displaytable">
@@ -1341,7 +1385,7 @@
 		{
 			try
 			{
-				repositoryConnector.outputSpecificationBody(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),documentSpecification,tabName);
+				repositoryConnector.outputSpecificationBody(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),documentSpecification,0,tabSequenceInt,tabName);
 			}
 			finally
 			{

Modified: manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/execute.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/execute.jsp?rev=1598156&r1=1598155&r2=1598156&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/execute.jsp (original)
+++ manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/execute.jsp Wed
May 28 21:56:17 2014
@@ -1090,7 +1090,7 @@
 						{
 							try
 							{
-								String error = repositoryConnector.processSpecificationPost(variableContext,pageContext.getRequest().getLocale(),job.getSpecification());
+								String error = repositoryConnector.processSpecificationPost(variableContext,pageContext.getRequest().getLocale(),job.getSpecification(),0);
 								if (error != null)
 								{
 									variableContext.setParameter("text",error);

Modified: manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/viewjob.jsp
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/viewjob.jsp?rev=1598156&r1=1598155&r2=1598156&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/viewjob.jsp (original)
+++ manifoldcf/branches/CONNECTORS-946/framework/crawler-ui/src/main/webapp/viewjob.jsp Wed
May 28 21:56:17 2014
@@ -681,7 +681,7 @@
 			{
 				try
 				{
-					repositoryConnector.viewSpecification(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),job.getSpecification());
+					repositoryConnector.viewSpecification(new org.apache.manifoldcf.ui.jsp.JspWrapper(out,adminprofile),pageContext.getRequest().getLocale(),job.getSpecification(),0);
 				}
 				finally
 				{

Modified: manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/connectors/BaseRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/connectors/BaseRepositoryConnector.java?rev=1598156&r1=1598155&r2=1598156&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/connectors/BaseRepositoryConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/connectors/BaseRepositoryConnector.java
Wed May 28 21:56:17 2014
@@ -469,15 +469,34 @@ public abstract class BaseRepositoryConn
   *@param out is the output to which any HTML should be sent.
   *@param locale is the locale the output is preferred to be in.
   *@param ds is the current document specification for this job.
+  *@param connectionSequenceNumber is the unique number of this connection within the job.
   *@param tabsArray is an array of tab names.  Add to this array any tab names that are specific
to the connector.
   */
   @Override
+  public void outputSpecificationHeader(IHTTPOutput out, Locale locale, DocumentSpecification
ds,
+    int connectionSequenceNumber, List<String> tabsArray)
+    throws ManifoldCFException, IOException
+  {
+    outputSpecificationHeader(out,locale,ds,tabsArray);
+  }
+  
+  /** 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.
+  * The connector will be connected before this method can be called.
+  *@param out is the output to which any HTML should be sent.
+  *@param locale is the locale the output is preferred to be in.
+  *@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, Locale locale, DocumentSpecification
ds, List<String> tabsArray)
     throws ManifoldCFException, IOException
   {
     outputSpecificationHeader(out,ds,tabsArray);
   }
 
+
   /** 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.
@@ -511,9 +530,30 @@ public abstract class BaseRepositoryConn
   *@param out is the output to which any HTML should be sent.
   *@param locale is the locale the output is preferred to be in.
   *@param ds is the current document specification for this job.
-  *@param tabName is the current tab name.
+  *@param connectionSequenceNumber is the unique number of this connection within the job.
+  *@param actualSequenceNumber is the connection within the job that has currently been selected.
+  *@param tabName is the current tab name.  (actualSequenceNumber, tabName) form a unique
tuple within
+  *  the job.
   */
   @Override
+  public void outputSpecificationBody(IHTTPOutput out, Locale locale, DocumentSpecification
ds,
+    int connectionSequenceNumber, int actualSequenceNumber, String tabName)
+    throws ManifoldCFException, IOException
+  {
+    outputSpecificationBody(out,locale,ds,tabName);
+  }
+
+  /** 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 always "editjob".
+  * The connector will be connected before this method can be called.
+  *@param out is the output to which any HTML should be sent.
+  *@param locale is the locale the output is preferred to be in.
+  *@param ds is the current document specification for this job.
+  *@param tabName is the current tab name.
+  */
   public void outputSpecificationBody(IHTTPOutput out, Locale locale, DocumentSpecification
ds, String tabName)
     throws ManifoldCFException, IOException
   {
@@ -541,10 +581,29 @@ public abstract class BaseRepositoryConn
   *@param variableContext contains the post data, including binary file-upload information.
   *@param locale is the locale the output is preferred to be in.
   *@param ds is the current document specification for this job.
+  *@param connectionSequenceNumber is the unique number of this connection within the 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).
   */
   @Override
+  public String processSpecificationPost(IPostParameters variableContext, Locale locale,
DocumentSpecification ds,
+    int connectionSequenceNumber)
+    throws ManifoldCFException
+  {
+    return processSpecificationPost(variableContext,locale,ds);
+  }
+
+  /** 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 always "editjob".
+  * The connector will be connected before this method can be called.
+  *@param variableContext contains the post data, including binary file-upload information.
+  *@param locale is the locale the output is preferred to be in.
+  *@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, Locale locale,
DocumentSpecification ds)
     throws ManifoldCFException
   {
@@ -573,8 +632,25 @@ public abstract class BaseRepositoryConn
   *@param out is the output to which any HTML should be sent.
   *@param locale is the locale the output is preferred to be in.
   *@param ds is the current document specification for this job.
+  *@param connectionSequenceNumber is the unique number of this connection within the job.
   */
   @Override
+  public void viewSpecification(IHTTPOutput out, Locale locale, DocumentSpecification ds,
+    int connectionSequenceNumber)
+    throws ManifoldCFException, IOException
+  {
+    viewSpecification(out,locale,ds);
+  }
+
+  /** 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.
+  * The connector will be connected before this method can be called.
+  *@param out is the output to which any HTML should be sent.
+  *@param locale is the locale the output is preferred to be in.
+  *@param ds is the current document specification for this job.
+  */
   public void viewSpecification(IHTTPOutput out, Locale locale, DocumentSpecification ds)
     throws ManifoldCFException, IOException
   {

Modified: manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnector.java
URL: http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnector.java?rev=1598156&r1=1598155&r2=1598156&view=diff
==============================================================================
--- manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnector.java
(original)
+++ manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/interfaces/IRepositoryConnector.java
Wed May 28 21:56:17 2014
@@ -261,9 +261,11 @@ public interface IRepositoryConnector ex
   *@param out is the output to which any HTML should be sent.
   *@param locale is the locale the output is preferred to be in.
   *@param ds is the current document specification for this job.
+  *@param connectionSequenceNumber is the unique number of this connection within the 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, Locale locale, DocumentSpecification
ds, List<String> tabsArray)
+  public void outputSpecificationHeader(IHTTPOutput out, Locale locale, DocumentSpecification
ds,
+    int connectionSequenceNumber, List<String> tabsArray)
     throws ManifoldCFException, IOException;
   
   /** Output the specification body section.
@@ -275,9 +277,13 @@ public interface IRepositoryConnector ex
   *@param out is the output to which any HTML should be sent.
   *@param locale is the locale the output is preferred to be in.
   *@param ds is the current document specification for this job.
-  *@param tabName is the current tab name.
+  *@param connectionSequenceNumber is the unique number of this connection within the job.
+  *@param actualSequenceNumber is the connection within the job that has currently been selected.
+  *@param tabName is the current tab name.  (actualSequenceNumber, tabName) form a unique
tuple within
+  *  the job.
   */
-  public void outputSpecificationBody(IHTTPOutput out, Locale locale, DocumentSpecification
ds, String tabName)
+  public void outputSpecificationBody(IHTTPOutput out, Locale locale, DocumentSpecification
ds,
+    int connectionSequenceNumber, int actualSequenceNumber, String tabName)
     throws ManifoldCFException, IOException;
   
   /** Process a specification post.
@@ -288,10 +294,12 @@ public interface IRepositoryConnector ex
   *@param variableContext contains the post data, including binary file-upload information.
   *@param locale is the locale the output is preferred to be in.
   *@param ds is the current document specification for this job.
+  *@param connectionSequenceNumber is the unique number of this connection within the 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, Locale locale,
DocumentSpecification ds)
+  public String processSpecificationPost(IPostParameters variableContext, Locale locale,
DocumentSpecification ds,
+    int connectionSequenceNumber)
     throws ManifoldCFException;
   
   /** View specification.
@@ -302,8 +310,11 @@ public interface IRepositoryConnector ex
   *@param out is the output to which any HTML should be sent.
   *@param locale is the locale the output is preferred to be in.
   *@param ds is the current document specification for this job.
+  *@param connectionSequenceNumber is the unique number of this connection within the job.
   */
-  public void viewSpecification(IHTTPOutput out, Locale locale, DocumentSpecification ds)
+  public void viewSpecification(IHTTPOutput out, Locale locale, DocumentSpecification ds,
+    int connectionSequenceNumber)
     throws ManifoldCFException, IOException;
 
+
 }



Mime
View raw message