SOLR-1120 follow up -- Adding a postTransform hook in EntityProcessor which can be used to add, remove and modify variables added by Transformers

git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@783750 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Shalin Shekhar Mangar 2009-06-11 12:58:27 +00:00
parent 9e81632efa
commit 9306b481e3
3 changed files with 18 additions and 1 deletions

View File

@ -96,6 +96,15 @@ public abstract class EntityProcessor {
*/
public abstract void destroy();
/**
* Invoked after the transformers are invoked. EntityProcessors can add, remove or modify values
* added by Transformers in this method.
*
* @param r The transformed row
*/
public void postTransform(Map<String, Object> r) {
}
/**
* Invoked when the Entity processor is detroyed. towards the end of import.
*/

View File

@ -233,7 +233,10 @@ public class EntityProcessorWrapper extends EntityProcessor {
return null;
} else {
arow = applyTransformer(arow);
if (arow != null) return arow;
if (arow != null) {
delegate.postTransform(arow);
return arow;
}
}
}
}

View File

@ -172,6 +172,11 @@ public class XPathEntityProcessor extends EntityProcessorBase {
}
}
@Override
public void postTransform(Map<String, Object> r) {
readUsefulVars(r);
}
@SuppressWarnings("unchecked")
private Map<String, Object> fetchNextRow() {
Map<String, Object> r = null;