Search in sources :

Example 1 with LocalFileSystemIgfsFile

use of org.apache.ignite.internal.processors.igfs.secondary.local.LocalFileSystemIgfsFile in project ignite by apache.

the class LocalIgfsSecondaryFileSystem method info.

/**
 * {@inheritDoc}
 */
@Override
public IgfsFile info(final IgfsPath path) {
    File file = fileForPath(path);
    if (!file.exists())
        return null;
    boolean isDir = file.isDirectory();
    PosixFileAttributes attrs = LocalFileSystemUtils.posixAttributes(file);
    Map<String, String> props = LocalFileSystemUtils.posixAttributesToMap(attrs);
    BasicFileAttributes basicAttrs = LocalFileSystemUtils.basicAttributes(file);
    if (isDir) {
        return new LocalFileSystemIgfsFile(path, false, true, 0, basicAttrs.lastAccessTime().toMillis(), basicAttrs.lastModifiedTime().toMillis(), 0, props);
    } else {
        return new LocalFileSystemIgfsFile(path, file.isFile(), false, 0, basicAttrs.lastAccessTime().toMillis(), basicAttrs.lastModifiedTime().toMillis(), file.length(), props);
    }
}
Also used : LocalFileSystemIgfsFile(org.apache.ignite.internal.processors.igfs.secondary.local.LocalFileSystemIgfsFile) PosixFileAttributes(java.nio.file.attribute.PosixFileAttributes) IgfsFile(org.apache.ignite.igfs.IgfsFile) LocalFileSystemIgfsFile(org.apache.ignite.internal.processors.igfs.secondary.local.LocalFileSystemIgfsFile) File(java.io.File) BasicFileAttributes(java.nio.file.attribute.BasicFileAttributes)

Aggregations

File (java.io.File)1 BasicFileAttributes (java.nio.file.attribute.BasicFileAttributes)1 PosixFileAttributes (java.nio.file.attribute.PosixFileAttributes)1 IgfsFile (org.apache.ignite.igfs.IgfsFile)1 LocalFileSystemIgfsFile (org.apache.ignite.internal.processors.igfs.secondary.local.LocalFileSystemIgfsFile)1