Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private static boolean processProperties(String absPropertiesPath) throws IOException {
- LOGGER.debug("Started with properties " + absPropertiesPath);
- boolean isOk = false;
- Properties prop = new Properties();
- InputStream input = null;
- //maybe some day we need to provide an internal properties file. this is how to do it!
- // processing internal properties file
- // String filename = "feed-adaptor.properties";
- // input =
- // Thread.currentThread().getContextClassLoader().getResourceAsStream(filename);
- // prop.load(input);
- String filename = absPropertiesPath;
- LOGGER.debug("trying to open properties file: " + filename);
- input = new FileInputStream(filename);
- prop.load(input);
- if (prop.isEmpty()) {
- LOGGER.fatal("ATENTION! the properties file " + filename + " is empty. Aborting!");
- return isOk;
- }
- // where are the datacast files? it could come many of them!
- DATACAST_PATH = prop.getProperty("data_cast_path");
- C2D_AGGR_DR_HDFS_PATH = prop.getProperty("c2d_aggr_dr_hdfs_path");
- DISCARDED_HDSF_PATH = prop.getProperty("discarded_hdfs_path");
- CSV_MAPPING = prop.getProperty("csv_mapping");
- DUPLICATE_LAST_COLUMN = prop.getProperty("duplicateLastColumn");
- FILENAME_REGEX = prop.getProperty("filenameregex");
- SERVICE_ID = prop.getProperty("service_id");
- DEFAULTFS = prop.getProperty("fs.defaultFS");
- // true everythings ok
- if ((DATACAST_PATH != null) && (!("").equals(DATACAST_PATH)) && (C2D_AGGR_DR_HDFS_PATH != null)
- && (!("").equals(C2D_AGGR_DR_HDFS_PATH)) && (DISCARDED_HDSF_PATH != null)
- && (!("").equals(DISCARDED_HDSF_PATH)) && (CSV_MAPPING != null) && (!("").equals(CSV_MAPPING))
- && (DUPLICATE_LAST_COLUMN != null) && (!("").equals(DUPLICATE_LAST_COLUMN)) && (FILENAME_REGEX != null)
- && (!("").equals(FILENAME_REGEX)) && (SERVICE_ID != null) && (!("").equals(SERVICE_ID))
- && (DEFAULTFS != null) && (!("").equals(DEFAULTFS))) {
- isOk = true;
- LOGGER.debug("DATACAST_PATH, C2D_AGGR_DR_HDFS_PATH, DISCARDED_HDSF_PATH, CSV_MAPPING, DUPLICATE_LAST_COLUMN, FILENAME_REGEX, SERVICE_ID looks find. "
- + DATACAST_PATH
- + " "
- + C2D_AGGR_DR_HDFS_PATH
- + " "
- + DISCARDED_HDSF_PATH
- + " "
- + CSV_MAPPING
- + " "
- + DUPLICATE_LAST_COLUMN + " " + FILENAME_REGEX + " " + SERVICE_ID + " DEFAULTFS: " + DEFAULTFS);
- }
- if (input != null) {
- input.close();
- }
- return isOk;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement