use of org.apache.oozie.coord.input.dependency.CoordPushInputDependency in project oozie by apache.
the class CoordInputLogicEvaluatorUtil method getInputDependencies.
/**
* Get input dependencies.
*
* @param name the name
* @param syncCoordAction the sync coord action
* @return the string
* @throws JDOMException the JDOM exception
*/
public String getInputDependencies(String name, SyncCoordAction syncCoordAction) throws JDOMException {
JexlEngine jexl = new OozieJexlEngine();
CoordinatorActionBean coordAction = new CoordinatorActionBean();
ELEvaluator eval = ELEvaluator.getCurrent();
coordAction.setId(syncCoordAction.getActionId());
Element eJob = XmlUtils.parseXml(eval.getVariable(".actionInputLogic").toString());
String expression = new InputLogicParser().parseWithName(eJob, name);
Expression e = jexl.createExpression(expression);
CoordPullInputDependency pull = (CoordPullInputDependency) syncCoordAction.getPullDependencies();
CoordPushInputDependency push = (CoordPushInputDependency) syncCoordAction.getPushDependencies();
coordAction.setPushInputDependencies(push);
coordAction.setPullInputDependencies(pull);
JexlContext jc = new OozieJexlParser(jexl, new CoordInputLogicBuilder(new CoordInputLogicEvaluatorPhaseThree(coordAction, eval)));
CoordInputLogicEvaluatorResult result = (CoordInputLogicEvaluatorResult) e.evaluate(jc);
if (result == null || !result.isTrue()) {
log.debug("Input logic expression for [{0}] is [{1}] and it is not resolved", name, expression);
return "${coord:dataIn('" + name + "')}";
} else {
log.debug("Input logic expression for [{0}] is [{1}] and evaluate result is [{2}]", name, expression, result.getStatus());
return result.getDataSets();
}
}
Aggregations