use of org.apache.oozie.util.ELEvaluator in project oozie by apache.
the class CoordELFunctions method getUriEvaluator.
/**
* @param tm
* @return a new Evaluator to be used for URI-template evaluation
*/
private static ELEvaluator getUriEvaluator(Calendar tm) {
tm.setTimeZone(DateUtils.getOozieProcessingTimeZone());
ELEvaluator retEval = new ELEvaluator();
retEval.setVariable("YEAR", tm.get(Calendar.YEAR));
retEval.setVariable("MONTH", (tm.get(Calendar.MONTH) + 1) < 10 ? "0" + (tm.get(Calendar.MONTH) + 1) : (tm.get(Calendar.MONTH) + 1));
retEval.setVariable("DAY", tm.get(Calendar.DAY_OF_MONTH) < 10 ? "0" + tm.get(Calendar.DAY_OF_MONTH) : tm.get(Calendar.DAY_OF_MONTH));
retEval.setVariable("HOUR", tm.get(Calendar.HOUR_OF_DAY) < 10 ? "0" + tm.get(Calendar.HOUR_OF_DAY) : tm.get(Calendar.HOUR_OF_DAY));
retEval.setVariable("MINUTE", tm.get(Calendar.MINUTE) < 10 ? "0" + tm.get(Calendar.MINUTE) : tm.get(Calendar.MINUTE));
return retEval;
}
use of org.apache.oozie.util.ELEvaluator in project oozie by apache.
the class CoordELFunctions method ph1_coord_endOfDays.
/**
* Used in defining the frequency in 'day' unit and specify the "end of day" property. <p> Every instance will
* start at 00:00 hour of each day. <p> domain: <code> val > 0</code> and should be integer.
*
* @param val frequency in number of days.
* @return number of days and also set the frequency timeunit to "day" and end_of_duration flag to "day"
*/
public static int ph1_coord_endOfDays(int val) {
val = ParamChecker.checkGTZero(val, "n");
ELEvaluator eval = ELEvaluator.getCurrent();
eval.setVariable("timeunit", TimeUnit.DAY);
eval.setVariable("endOfDuration", TimeUnit.END_OF_DAY);
return val;
}
use of org.apache.oozie.util.ELEvaluator in project oozie by apache.
the class CoordELFunctions method ph1_coord_endOfWeeks.
/**
* Used in defining the frequency in 'week' unit and specify the "end of
* week" property.
* <p>
* Every instance will start at 00:00 hour of start of week
* <p>
* domain: <code> val > 0</code> and should be integer.
*
* @param val frequency in number of weeks.
* @return number of weeks and also set the frequency timeunit to week of
* the year and end_of_duration flag to week of the year
*/
public static int ph1_coord_endOfWeeks(int val) {
val = ParamChecker.checkGTZero(val, "n");
ELEvaluator eval = ELEvaluator.getCurrent();
eval.setVariable("timeunit", TimeUnit.WEEK);
eval.setVariable("endOfDuration", TimeUnit.END_OF_WEEK);
return val;
}
use of org.apache.oozie.util.ELEvaluator in project oozie by apache.
the class CoordELFunctions method ph3_coord_dataOut.
/**
* Used to specify a list of URI's that are output dir of the workflow job. <p> Look for one evaluator-level
* variable <p> dataout.<DATAOUT_NAME> <p> It defines the current list of URI. <p> otherwise it sends the uris.
*
* @param dataOutName : Dataout name
* @return the list of URI's separated by INSTANCE_SEPARATOR
*/
public static String ph3_coord_dataOut(String dataOutName) {
String uris = "";
ELEvaluator eval = ELEvaluator.getCurrent();
uris = (String) eval.getVariable(".dataout." + dataOutName);
return uris;
}
use of org.apache.oozie.util.ELEvaluator in project oozie by apache.
the class CoordELFunctions method ph2_coord_name.
/**
* Return Job Name. <p>
*
* @return coordinator name
*/
public static String ph2_coord_name() throws Exception {
ELEvaluator eval = ELEvaluator.getCurrent();
SyncCoordAction action = ParamChecker.notNull((SyncCoordAction) eval.getVariable(COORD_ACTION), "Coordinator Action");
return action.getName();
}
Aggregations