Author: kwright
Date: Tue Jun 3 23:19:38 2014
New Revision: 1599834
URL: http://svn.apache.org/r1599834
Log:
Reset job date when things change -- properly
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/ForcedParamManager.java
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopFilterManager.java
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/ForcedParamManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/ForcedParamManager.java?rev=1599834&r1=1599833&r2=1599834&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/ForcedParamManager.java
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/ForcedParamManager.java
Tue Jun 3 23:19:38 2014
@@ -121,9 +121,10 @@ public class ForcedParamManager extends
public Map<String,Set<String>> readRows(Long id)
throws ManifoldCFException
{
- ArrayList list = new ArrayList();
- list.add(id);
- IResultSet set = performQuery("SELECT
"+paramNameField+","+paramValueField+" FROM "+getTableName()+" WHERE
"+ownerIDField+"=?",list,
+ ArrayList params = new ArrayList();
+ String query = buildConjunctionClause(params,new ClauseDescription[]{
+ new UnitaryClause(ownerIDField,id)});
+ IResultSet set = performQuery("SELECT
"+paramNameField+","+paramValueField+" FROM "+getTableName()+" WHERE
"+query,params,
null,null);
Map<String,Set<String>> rval = new HashMap<String,Set<String>>();
if (set.getRowCount() == 0)
@@ -168,6 +169,34 @@ public class ForcedParamManager extends
}
}
+ /** Compare rows in database against what is in job description.
+ *@param ownerID is the owning identifier.
+ *@param list is the job description to write hopcount filters for.
+ */
+ public boolean compareRows(Long ownerID, IJobDescription list)
+ throws ManifoldCFException
+ {
+ Map<String,Set<String>> map = readRows(ownerID);
+ Map<String,Set<String>> otherMap = list.getForcedMetadata();
+ if (map.size() != otherMap.size())
+ return false;
+ for (String x : map.keySet())
+ {
+ Set<String> xValues = map.get(x);
+ Set<String> otherValues = otherMap.get(x);
+ if (otherValues == null)
+ return false;
+ if (xValues.size() != otherValues.size())
+ return false;
+ for (String y : xValues)
+ {
+ if (!otherValues.contains(y))
+ return false;
+ }
+ }
+ return true;
+ }
+
/** Write a filter list into the database.
*@param ownerID is the owning identifier.
*@param list is the job description to write hopcount filters for.
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopFilterManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopFilterManager.java?rev=1599834&r1=1599833&r2=1599834&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopFilterManager.java
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/HopFilterManager.java
Tue Jun 3 23:19:38 2014
@@ -164,6 +164,30 @@ public class HopFilterManager extends or
}
}
+ /** Compare a filter list against what's in a job description.
+ *@param ownerID is the owning identifier.
+ *@param list is the job description to write hopcount filters for.
+ */
+ public boolean compareRows(Long ownerID, IJobDescription list)
+ throws ManifoldCFException
+ {
+ // Compare hopcount filter criteria.
+ Map filterRows = readRows(ownerID);
+ Map newFilterRows = list.getHopCountFilters();
+ if (filterRows.size() != newFilterRows.size())
+ return false;
+ for (String linkType : (Collection<String>)filterRows.keySet())
+ {
+ Long oldCount = (Long)filterRows.get(linkType);
+ Long newCount = (Long)newFilterRows.get(linkType);
+ if (oldCount == null || newCount == null)
+ return false;
+ if (oldCount.longValue() != newCount.longValue())
+ return false;
+ }
+ return true;
+ }
+
/** Write a filter list into the database.
*@param ownerID is the owning identifier.
*@param list is the job description to write hopcount filters for.
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java?rev=1599834&r1=1599833&r2=1599834&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/Jobs.java
Tue Jun 3 23:19:38 2014
@@ -866,32 +866,14 @@ public class Jobs extends org.apache.man
}
if (isSame)
- {
- // Compare hopcount filter criteria.
- Map filterRows = hopFilterManager.readRows(id);
- Map newFilterRows = jobDescription.getHopCountFilters();
- if (filterRows.size() != newFilterRows.size())
- isSame = false;
- else
- {
- for (String linkType :
(Collection<String>)filterRows.keySet())
- {
- Long oldCount = (Long)filterRows.get(linkType);
- Long newCount = (Long)newFilterRows.get(linkType);
- if (oldCount == null || newCount == null)
- {
- isSame = false;
- break;
- }
- else if (oldCount.longValue() != newCount.longValue())
- {
- isSame = false;
- break;
- }
- }
- }
- }
-
+ isSame = pipelineManager.compareRows(id,jobDescription);
+
+ if (isSame)
+ isSame = hopFilterManager.compareRows(id,jobDescription);
+
+ if (isSame)
+ isSame = forcedParamManager.compareRows(id,jobDescription);
+
if (!isSame)
values.put(lastCheckTimeField,null);
Modified:
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
URL:
http://svn.apache.org/viewvc/manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java?rev=1599834&r1=1599833&r2=1599834&view=diff
==============================================================================
---
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
(original)
+++
manifoldcf/branches/CONNECTORS-946/framework/pull-agent/src/main/java/org/apache/manifoldcf/crawler/jobs/PipelineManager.java
Tue Jun 3 23:19:38 2014
@@ -143,6 +143,35 @@ public class PipelineManager extends org
}
}
+ /** Compare rows in job description with what's currently in the database.
+ *@param ownerID is the owning identifier.
+ *@param job is a job description.
+ */
+ public boolean compareRows(Long ownerID, IJobDescription job)
+ throws ManifoldCFException
+ {
+ ArrayList params = new ArrayList();
+ String query = buildConjunctionClause(params,new ClauseDescription[]{
+ new UnitaryClause(ownerIDField,ownerID)});
+ IResultSet set = performQuery("SELECT * FROM "+getTableName()+" WHERE "+
+ query+" ORDER BY "+ordinalField+" ASC",params,null,null);
+ if (set.getRowCount() != job.countPipelineStages())
+ return false;
+ for (int i = 0; i < set.getRowCount(); i++)
+ {
+ IResultRow row = set.getRow(i);
+ String connectionName = (String)row.getValue(transformationNameField);
+ String spec = (String)row.getValue(transformationSpecField);
+ if (spec == null)
+ spec = "";
+ if (!job.getPipelineStageConnectionName(i).equals(connectionName))
+ return false;
+ if (!job.getPipelineStageSpecification(i).toXML().equals(spec))
+ return false;
+ }
+ return true;
+ }
+
/** Write a pipeline list into the database.
*@param ownerID is the owning identifier.
*@param job is the job description that is the source of the pipeline.