/** * Load properties from the given path * * @param jobPath The path to load from * @param props The parent properties for loaded properties * @param suffixes The suffixes of files to load */ public static void loadPropsBySuffix(final File jobPath, final Props props, final String... suffixes) { try { if (jobPath.isDirectory()) { final File[] files = jobPath.listFiles(); if (files != null) { for (final File file : files) { loadPropsBySuffix(file, props, suffixes); } } } else if (endsWith(jobPath, suffixes)) { props.putAll(new Props(null, jobPath.getAbsolutePath())); } } catch (final IOException e) { throw new RuntimeException("Error loading schedule properties.", e); } }
/** * Load job schedules from the given directories * * @param parent The parent properties for these properties * @param dir The directory to look in * @param suffixes File suffixes to load * @return The loaded set of schedules */ public static Props loadPropsInDir(final Props parent, final File dir, final String... suffixes) { try { final Props props = new Props(parent); final File[] files = dir.listFiles(); Arrays.sort(files); if (files != null) { for (final File f : files) { if (f.isFile() && endsWith(f, suffixes)) { props.putAll(new Props(null, f.getAbsolutePath())); } } } return props; } catch (final IOException e) { throw new RuntimeException("Error loading properties.", e); } }
/** * Load job schedules from the given directories * * @param parent The parent properties for these properties * @param dir The directory to look in * @param suffixes File suffixes to load * @return The loaded set of schedules */ public static Props loadPropsInDir(final Props parent, final File dir, final String... suffixes) { try { final Props props = new Props(parent); final File[] files = dir.listFiles(); Arrays.sort(files); if (files != null) { for (final File f : files) { if (f.isFile() && endsWith(f, suffixes)) { props.putAll(new Props(null, f.getAbsolutePath())); } } } return props; } catch (final IOException e) { throw new RuntimeException("Error loading properties.", e); } }
/** * Load properties from the given path * * @param jobPath * The path to load from * @param props * The parent properties for loaded properties * @param suffixes * The suffixes of files to load */ public static void loadPropsBySuffix(File jobPath, Props props, String... suffixes) { try { if (jobPath.isDirectory()) { File[] files = jobPath.listFiles(); if (files != null) { for (File file : files) loadPropsBySuffix(file, props, suffixes); } } else if (endsWith(jobPath, suffixes)) { props.putAll(new Props(null, jobPath.getAbsolutePath())); } } catch (IOException e) { throw new RuntimeException("Error loading schedule properties.", e); } }
/** * Load properties from the given path * * @param jobPath The path to load from * @param props The parent properties for loaded properties * @param suffixes The suffixes of files to load */ public static void loadPropsBySuffix(final File jobPath, final Props props, final String... suffixes) { try { if (jobPath.isDirectory()) { final File[] files = jobPath.listFiles(); if (files != null) { for (final File file : files) { loadPropsBySuffix(file, props, suffixes); } } } else if (endsWith(jobPath, suffixes)) { props.putAll(new Props(null, jobPath.getAbsolutePath())); } } catch (final IOException e) { throw new RuntimeException("Error loading schedule properties.", e); } }
/** * Load job schedules from the given directories * * @param parent * The parent properties for these properties * @param dir * The directory to look in * @param suffixes * File suffixes to load * @return The loaded set of schedules */ public static Props loadPropsInDir(Props parent, File dir, String... suffixes) { try { Props props = new Props(parent); File[] files = dir.listFiles(); Arrays.sort(files); if (files != null) { for (File f : files) { if (f.isFile() && endsWith(f, suffixes)) { props.putAll(new Props(null, f.getAbsolutePath())); } } } return props; } catch (IOException e) { throw new RuntimeException("Error loading properties.", e); } }