Package org.apache.oozie.util

Examples of org.apache.oozie.util.ELEvaluator$Context


            throw new UnsupportedOperationException("Asynchronous Dataset is not supported yet");
        }
    }

    private static String coord_future_sync(int n, int instance) throws Exception {
        ELEvaluator eval = ELEvaluator.getCurrent();
        String retVal = "";
        int datasetFrequency = (int) getDSFrequency();// in minutes
        TimeUnit dsTimeUnit = getDSTimeUnit();
        int[] instCount = new int[1];
        Calendar nominalInstanceCal = getCurrentInstance(getActionCreationtime(), instCount);
        if (nominalInstanceCal != null) {
            Calendar initInstance = getInitialInstanceCal();
            nominalInstanceCal = (Calendar) initInstance.clone();
            nominalInstanceCal.add(dsTimeUnit.getCalendarUnit(), instCount[0] * datasetFrequency);

            SyncCoordDataset ds = (SyncCoordDataset) eval.getVariable(DATASET);
            if (ds == null) {
                throw new RuntimeException("Associated Dataset should be defined with key " + DATASET);
            }
            String uriTemplate = ds.getUriTemplate();
            Configuration conf = (Configuration) eval.getVariable(CONFIGURATION);
            if (conf == null) {
                throw new RuntimeException("Associated Configuration should be defined with key " + CONFIGURATION);
            }
            int available = 0, checkedInstance = 0;
            boolean resolved = false;
            String user = ParamChecker
                    .notEmpty((String) eval.getVariable(OozieClient.USER_NAME), OozieClient.USER_NAME);
            String doneFlag = ds.getDoneFlag();
            while (instance >= checkedInstance) {
                ELEvaluator uriEval = getUriEvaluator(nominalInstanceCal);
                String uriPath = uriEval.evaluate(uriTemplate, String.class);
                String pathWithDoneFlag = uriPath;
                if (doneFlag.length() > 0) {
                    pathWithDoneFlag += "/" + doneFlag;
                }
                if (isPathAvailable(pathWithDoneFlag, user, null, conf)) {
View Full Code Here


     *
     * @return coordinator action creation or materialization date time
     * @throws Exception if unable to format the Date object to String
     */
    public static String ph2_coord_nominalTime() throws Exception {
        ELEvaluator eval = ELEvaluator.getCurrent();
        SyncCoordAction action = ParamChecker.notNull((SyncCoordAction) eval.getVariable(COORD_ACTION),
                "Coordinator Action");
        return DateUtils.formatDateUTC(action.getNominalTime());
    }
View Full Code Here

     * Return Action Id. <p/>
     *
     * @return coordinator action Id
     */
    public static String ph2_coord_actionId() throws Exception {
        ELEvaluator eval = ELEvaluator.getCurrent();
        SyncCoordAction action = ParamChecker.notNull((SyncCoordAction) eval.getVariable(COORD_ACTION),
                "Coordinator Action");
        return action.getActionId();
    }
View Full Code Here

     * 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();
    }
View Full Code Here

    public static String ph1_dataIn_echo(String dataInName, String part) {
        return "dataIn('" + dataInName + "', '" + part + "')";
    }

    public static String ph3_dataIn(String dataInName, String part) {
        ELEvaluator eval = ELEvaluator.getCurrent();
        String uristr = (String) eval.getVariable(".datain." + dataInName);

        //optional input
        if (uristr == null) {
            Element dsEle = getDSElement(eval, dataInName);
            Configuration conf = new Configuration();
            SyncCoordAction appInst = (SyncCoordAction) eval.getVariable(CoordELFunctions.COORD_ACTION);
            try {
                ELEvaluator instEval = CoordELEvaluator.createInstancesELEvaluator(dsEle, appInst, conf);
                StringBuilder instances = new StringBuilder();
                CoordCommandUtils.resolveInstanceRange(dsEle, instances , appInst, conf, instEval);
                uristr = CoordCommandUtils.createEarlyURIs(dsEle, instances.toString(),
                        new StringBuilder(), new StringBuilder());
                uristr = uristr.replace(CoordELFunctions.INSTANCE_SEPARATOR, ",");
View Full Code Here

        return ele;
    }

    public static String ph1_now_echo(int hr, int min) {
        ELEvaluator eval = ELEvaluator.getCurrent();
        eval.setVariable(".wrap", "true");
        return "now(" + hr + "," + min + ")"; // Unresolved
    }
View Full Code Here

        eval.setVariable(".wrap", "true");
        return "now(" + hr + "," + min + ")"; // Unresolved
    }

    public static String ph1_today_echo(int hr, int min) {
        ELEvaluator eval = ELEvaluator.getCurrent();
        eval.setVariable(".wrap", "true");
        return "today(" + hr + ", " + min + ")"; // Unresolved
    }
View Full Code Here

        eval.setVariable(".wrap", "true");
        return "today(" + hr + ", " + min + ")"; // Unresolved
    }

    public static String ph1_yesterday_echo(int hr, int min) {
        ELEvaluator eval = ELEvaluator.getCurrent();
        eval.setVariable(".wrap", "true");
        return "yesterday(" + hr + ", " + min + ")"; // Unresolved
    }
View Full Code Here

        eval.setVariable(".wrap", "true");
        return "yesterday(" + hr + ", " + min + ")"; // Unresolved
    }

    public static String ph1_currentMonth_echo(int day, int hr, int min) {
        ELEvaluator eval = ELEvaluator.getCurrent();
        eval.setVariable(".wrap", "true");
        return "currentMonth(" + day + ", " + hr + ", " + min + ")"; // Unresolved
    }
View Full Code Here

        eval.setVariable(".wrap", "true");
        return "currentMonth(" + day + ", " + hr + ", " + min + ")"; // Unresolved
    }

    public static String ph1_lastMonth_echo(int day, int hr, int min) {
        ELEvaluator eval = ELEvaluator.getCurrent();
        eval.setVariable(".wrap", "true");
        return "lastMonth(" + day + ", " + hr + ", " + min + ")"; // Unresolved
    }
View Full Code Here

TOP

Related Classes of org.apache.oozie.util.ELEvaluator$Context

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.