Search in sources :

Example 6 with GridTuple3

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;
}
Also used : File(java.io.File) GridTuple3(org.apache.ignite.internal.util.lang.GridTuple3)

Aggregations

GridTuple3 (org.apache.ignite.internal.util.lang.GridTuple3)6 File (java.io.File)3 BufferedReader (java.io.BufferedReader)2 Nullable (org.jetbrains.annotations.Nullable)2 FileReader (java.io.FileReader)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 Date (java.util.Date)1 LinkedList (java.util.LinkedList)1 UUID (java.util.UUID)1 EntryProcessor (javax.cache.processor.EntryProcessor)1 Ignite (org.apache.ignite.Ignite)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteException (org.apache.ignite.IgniteException)1 StorageException (org.apache.ignite.internal.pagemem.wal.StorageException)1 CacheDataRow (org.apache.ignite.internal.processors.cache.persistence.CacheDataRow)1 CacheContinuousQueryListener (org.apache.ignite.internal.processors.cache.query.continuous.CacheContinuousQueryListener)1 GridCacheVersion (org.apache.ignite.internal.processors.cache.version.GridCacheVersion)1 GridRestCommand (org.apache.ignite.internal.processors.rest.GridRestCommand)1 GridClosureException (org.apache.ignite.internal.util.lang.GridClosureException)1