jdk/src/aix/classes/sun/nio/fs/AixFileSystem.java
author simonis
Tue, 26 Nov 2013 16:40:31 +0100
changeset 22597 7515a991bb37
permissions -rw-r--r--
8024854: PPC64: Basic changes and files to build the class library on AIX Reviewed-by: alanb, prr, sla, chegar, michaelm, mullan, art Contributed-by: luchsh@linux.vnet.ibm.com, spoole@linux.vnet.ibm.com, thomas.stuefe@sap.com
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22597
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
     1
/*
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
     2
 * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
     3
 * Copyright 2013 SAP AG. All rights reserved.
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
     4
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
     5
 *
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
     6
 * This code is free software; you can redistribute it and/or modify it
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
     7
 * under the terms of the GNU General Public License version 2 only, as
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
     8
 * published by the Free Software Foundation.  Oracle designates this
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
     9
 * particular file as subject to the "Classpath" exception as provided
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    10
 * by Oracle in the LICENSE file that accompanied this code.
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    11
 *
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    12
 * This code is distributed in the hope that it will be useful, but WITHOUT
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    13
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    14
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    15
 * version 2 for more details (a copy is included in the LICENSE file that
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    16
 * accompanied this code).
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    17
 *
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    18
 * You should have received a copy of the GNU General Public License version
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    19
 * 2 along with this work; if not, write to the Free Software Foundation,
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    20
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    21
 *
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    22
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    23
 * or visit www.oracle.com if you need additional information or have any
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    24
 * questions.
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    25
 */
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    26
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    27
package sun.nio.fs;
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    28
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    29
import java.nio.file.*;
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    30
import java.nio.file.attribute.*;
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    31
import java.io.IOException;
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    32
import java.util.*;
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    33
import static sun.nio.fs.AixNativeDispatcher.*;
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    34
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    35
/**
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    36
 * AIX implementation of FileSystem
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    37
 */
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    38
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    39
class AixFileSystem extends UnixFileSystem {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    40
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    41
    AixFileSystem(UnixFileSystemProvider provider, String dir) {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    42
        super(provider, dir);
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    43
    }
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    44
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    45
    @Override
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    46
    public WatchService newWatchService()
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    47
        throws IOException
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    48
    {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    49
        return new PollingWatchService();
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    50
    }
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    51
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    52
    // lazy initialization of the list of supported attribute views
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    53
    private static class SupportedFileFileAttributeViewsHolder {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    54
        static final Set<String> supportedFileAttributeViews =
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    55
            supportedFileAttributeViews();
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    56
        private static Set<String> supportedFileAttributeViews() {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    57
            Set<String> result = new HashSet<String>();
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    58
            result.addAll(UnixFileSystem.standardFileAttributeViews());
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    59
            return Collections.unmodifiableSet(result);
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    60
        }
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    61
    }
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    62
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    63
    @Override
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    64
    public Set<String> supportedFileAttributeViews() {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    65
        return SupportedFileFileAttributeViewsHolder.supportedFileAttributeViews;
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    66
    }
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    67
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    68
    @Override
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    69
    void copyNonPosixAttributes(int ofd, int nfd) {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    70
        // TODO: Implement if needed.
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    71
    }
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    72
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    73
    /**
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    74
     * Returns object to iterate over the mount entries returned by mntctl
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    75
     */
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    76
    @Override
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    77
    Iterable<UnixMountEntry> getMountEntries() {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    78
        UnixMountEntry[] entries = null;
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    79
        try {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    80
            entries = getmntctl();
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    81
        } catch (UnixException x) {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    82
            // nothing we can do
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    83
        }
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    84
        if (entries == null) {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    85
            return Collections.emptyList();
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    86
        }
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    87
        return Arrays.asList(entries);
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    88
    }
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    89
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    90
    @Override
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    91
    FileStore getFileStore(UnixMountEntry entry) throws IOException {
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    92
        return new AixFileStore(this, entry);
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    93
    }
7515a991bb37 8024854: PPC64: Basic changes and files to build the class library on AIX
simonis
parents:
diff changeset
    94
}