Search in sources :

Example 11 with PosixFileAttributes

use of java.nio.file.attribute.PosixFileAttributes in project ignite by apache.

the class IgfsLocalSecondaryFileSystemTestAdapter method properties.

/** {@inheritDoc} */
@Override
public Map<String, String> properties(final String path) throws IOException {
    Path p = path(path);
    PosixFileAttributes attrs = Files.getFileAttributeView(p, PosixFileAttributeView.class).readAttributes();
    Map<String, String> props = new HashMap<>();
    props.put(IgfsUtils.PROP_USER_NAME, attrs.owner().getName());
    props.put(IgfsUtils.PROP_GROUP_NAME, attrs.group().getName());
    props.put(IgfsUtils.PROP_PERMISSION, permissions(path));
    return props;
}
Also used : Path(java.nio.file.Path) HashMap(java.util.HashMap) PosixFileAttributes(java.nio.file.attribute.PosixFileAttributes) PosixFileAttributeView(java.nio.file.attribute.PosixFileAttributeView)

Aggregations

PosixFileAttributes (java.nio.file.attribute.PosixFileAttributes)11 Path (java.nio.file.Path)6 PosixFileAttributeView (java.nio.file.attribute.PosixFileAttributeView)5 PosixFilePermission (java.nio.file.attribute.PosixFilePermission)4 Test (org.junit.Test)4 IOException (java.io.IOException)3 BasicFileAttributes (java.nio.file.attribute.BasicFileAttributes)2 FileSystemOperationException (com.axway.ats.common.filesystem.FileSystemOperationException)1 File (java.io.File)1 InvalidPathException (java.nio.file.InvalidPathException)1 DosFileAttributes (java.nio.file.attribute.DosFileAttributes)1 GroupPrincipal (java.nio.file.attribute.GroupPrincipal)1 UserPrincipal (java.nio.file.attribute.UserPrincipal)1 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)1 HashMap (java.util.HashMap)1 IgfsFile (org.apache.ignite.igfs.IgfsFile)1 LocalFileSystemIgfsFile (org.apache.ignite.internal.processors.igfs.secondary.local.LocalFileSystemIgfsFile)1 UserException (org.elasticsearch.cli.UserException)1 Certificates (org.neo4j.bolt.security.ssl.Certificates)1 FileChecksum (org.syncany.database.FileContent.FileChecksum)1