--- old/src/java.base/aix/classes/sun/nio/fs/AixFileSystemProvider.java 2014-12-01 15:47:14.815992798 +0800 +++ new/src/java.base/aix/classes/sun/nio/fs/AixFileSystemProvider.java 2014-12-01 15:47:14.615992794 +0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved. * Copyright 2013 SAP AG. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -24,9 +24,20 @@ * questions. */ +/* + * Portions Copyright (c) 2014 IBM Corporation + */ + package sun.nio.fs; import java.io.IOException; +import java.nio.file.LinkOption; +import java.nio.file.Path; +import java.nio.file.attribute.BasicFileAttributes; +import java.nio.file.attribute.DosFileAttributeView; +import java.nio.file.attribute.DosFileAttributes; +import java.nio.file.attribute.FileAttributeView; +import java.nio.file.attribute.UserDefinedFileAttributeView; /** * AIX implementation of FileSystemProvider @@ -49,4 +60,53 @@ AixFileStore getFileStore(UnixPath path) throws IOException { return new AixFileStore(path); } + + @Override + @SuppressWarnings("unchecked") + public V getFileAttributeView(Path obj, + Class type, + LinkOption... options) + { + if (type == DosFileAttributeView.class) { + return (V) new AixDosFileAttributeView(UnixPath.toUnixPath(obj), + Util.followLinks(options)); + } + if (type == UserDefinedFileAttributeView.class) { + return (V) new AixUserDefinedFileAttributeView(UnixPath.toUnixPath(obj), + Util.followLinks(options)); + } + return super.getFileAttributeView(obj, type, options); + } + + @Override + public DynamicFileAttributeView getFileAttributeView(Path obj, + String name, + LinkOption... options) + { + if (name.equals("dos")) { + return new AixDosFileAttributeView(UnixPath.toUnixPath(obj), + Util.followLinks(options)); + } + if (name.equals("user")) { + return new AixUserDefinedFileAttributeView(UnixPath.toUnixPath(obj), + Util.followLinks(options)); + } + return super.getFileAttributeView(obj, name, options); + } + + @Override + @SuppressWarnings("unchecked") + public A readAttributes(Path file, + Class type, + LinkOption... options) + throws IOException + { + if (type == DosFileAttributes.class) { + DosFileAttributeView view = + getFileAttributeView(file, DosFileAttributeView.class, options); + return (A) view.readAttributes(); + } else { + return super.readAttributes(file, type, options); + } + } }