src/java.base/aix/classes/sun/nio/fs/AixFileSystem.java

Print this page


   1 /*
   2  * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * Copyright 2013 SAP AG. All rights reserved.
   4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   5  *
   6  * This code is free software; you can redistribute it and/or modify it
   7  * under the terms of the GNU General Public License version 2 only, as
   8  * published by the Free Software Foundation.  Oracle designates this
   9  * particular file as subject to the "Classpath" exception as provided
  10  * by Oracle in the LICENSE file that accompanied this code.
  11  *
  12  * This code is distributed in the hope that it will be useful, but WITHOUT
  13  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  15  * version 2 for more details (a copy is included in the LICENSE file that
  16  * accompanied this code).
  17  *
  18  * You should have received a copy of the GNU General Public License version
  19  * 2 along with this work; if not, write to the Free Software Foundation,
  20  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  21  *
  22  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  23  * or visit www.oracle.com if you need additional information or have any
  24  * questions.
  25  */
  26 




  27 package sun.nio.fs;
  28 
  29 import java.nio.file.*;
  30 import java.nio.file.attribute.*;
  31 import java.io.IOException;
  32 import java.util.*;

  33 import static sun.nio.fs.AixNativeDispatcher.*;
  34 
  35 /**
  36  * AIX implementation of FileSystem
  37  */
  38 
  39 class AixFileSystem extends UnixFileSystem {
  40 
  41     AixFileSystem(UnixFileSystemProvider provider, String dir) {
  42         super(provider, dir);
  43     }
  44 
  45     @Override
  46     public WatchService newWatchService()
  47         throws IOException
  48     {
  49         return new PollingWatchService();
  50     }
  51 
  52     // lazy initialization of the list of supported attribute views
  53     private static class SupportedFileFileAttributeViewsHolder {
  54         static final Set<String> supportedFileAttributeViews =
  55             supportedFileAttributeViews();
  56         private static Set<String> supportedFileAttributeViews() {
  57             Set<String> result = new HashSet<String>();
  58             result.addAll(UnixFileSystem.standardFileAttributeViews());



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