use of org.apache.ignite.internal.util.lang.GridTuple3 in project ignite by apache.
the class GridConfigurationFinder method getConfigFiles.
/**
* Lists paths to all Ignite configuration files located in given directory with their
* last modification timestamps.
*
* @param dir Directory.
* @return Collection of configuration files and their last modification timestamps.
* @throws IOException Thrown in case of any IO error.
*/
private static List<GridTuple3<String, Long, File>> getConfigFiles(File dir) throws IOException {
assert dir != null;
LinkedList<GridTuple3<String, Long, File>> lst = listFiles(dir);
// Sort.
Collections.sort(lst, new Comparator<GridTuple3<String, Long, File>>() {
@Override
public int compare(GridTuple3<String, Long, File> t1, GridTuple3<String, Long, File> t2) {
String s1 = t1.get1();
String s2 = t2.get1();
String q1 = s1.startsWith(Q_PREFIX) ? s1.substring(Q_PREFIX_LEN + 1) : s1;
String q2 = s2.startsWith(Q_PREFIX) ? s2.substring(Q_PREFIX_LEN + 1) : s2;
return q1.compareTo(q2);
}
});
File dflt = new File(U.getIgniteHome() + File.separator + DFLT_CFG);
if (dflt.exists())
lst.addFirst(F.t(DFLT_CFG, dflt.lastModified(), dflt));
return lst;
}
Aggregations