public boolean predicate()

in service/src/main/java/org/apache/griffin/core/job/FileExistPredicator.java [48:72]


    public boolean predicate() throws IOException {
        Map<String, Object> config = predicate.getConfigMap();
        String[] paths = null;
        String rootPath = null;
        if (config != null && !StringUtils.isEmpty((String) config.get(PREDICT_PATH))) {
            paths = ((String) config.get(PREDICT_PATH))
                .split(PATH_CONNECTOR_CHARACTER);
            rootPath = (String) config.get(PREDICT_ROOT_PATH);
        }
        if (ArrayUtils.isEmpty(paths) || StringUtils.isEmpty(rootPath)) {
            LOGGER.error("Predicate path is null.Please check predicates " +
                "config root.path and path.");
            throw new NullPointerException();
        }
        for (String path : paths) {
            String hdfsPath = rootPath + path;
            LOGGER.info("Predicate path: {}", hdfsPath);
            if (!FSUtil.isFileExist(hdfsPath)) {
                LOGGER.info("Predicate path: " + hdfsPath + " doesn't exist.");
                return false;
            }
            LOGGER.info("Predicate path: " + hdfsPath + " exists.");
        }
        return true;
    }