Class NfsFileBase<N extends Nfs<F>, F extends NfsFile<N,F>>

java.lang.Object
com.emc.ecs.nfsclient.nfs.io.NfsFileBase<N,F>
All Implemented Interfaces:
NfsFile<N,F>, Comparable<F>
Direct Known Subclasses:
Nfs3File

public abstract class NfsFileBase<N extends Nfs<F>, F extends NfsFile<N,F>> extends Object implements NfsFile<N,F>
Basic implementation of NfsFile. Subclasses need only implement constructors and newChildFile().
  • Constructor Details

    • NfsFileBase

      public NfsFileBase(N nfs, String path, LinkTracker<N,F> linkTracker) throws IOException
      The basic constructor.
      Parameters:
      nfs - The supporting NFS client.
      path - The full path of the file, starting with the mount point.
      linkTracker - The tracker to use. This must be passed so that monitoring is continued until the link resolves to a file that is not a symbolic link.
      Throws:
      IOException
    • NfsFileBase

      public NfsFileBase(F parentFile, String childName) throws IOException
      The most efficient constructor if the parent file already exists.
      Parameters:
      parentFile - The parent file, stored to reduce lookup overhead
      childName - The short name of the file, starting from the parent path.
      Throws:
      IOException
  • Method Details

    • makeParentPath

      public static String makeParentPath(String path)
      Returns everything up to and including the first separator character before the final name.
    • makeName

      public static String makeName(String path)
      Returns everything after the last separator character.
    • makeChildPath

      public static String makeChildPath(String parent, String child)
      Returns the full child path.
    • canDelete

      public boolean canDelete() throws IOException
      Tests whether this client can delete an existing directory entry. Specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Specified by:
      canDelete in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if it can, false if it cannot
      Throws:
      IOException - if it does not exist or permissions cannot be read.
    • canExecute

      public boolean canExecute() throws IOException
      Tests whether this client can execute this file (no meaning for a directory). Specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Specified by:
      canExecute in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if it can, false if it cannot
      Throws:
      IOException - if it does not exist or permissions cannot be read.
    • canExtend

      public boolean canExtend() throws IOException
      Tests whether this client can write new data or add directory entries. Specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Specified by:
      canExtend in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if it can, false if it cannot
      Throws:
      IOException - if it does not exist or permissions cannot be read.
    • canLookup

      public boolean canLookup() throws IOException
      Tests whether this client can look up a name in a directory (no meaning for non-directory objects). Specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Specified by:
      canLookup in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if it can, false if it cannot
      Throws:
      IOException - if it does not exist or permissions cannot be read.
    • canModify

      public boolean canModify() throws IOException
      Tests whether this client can rewrite existing file data or modify existing directory entries. Specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Specified by:
      canModify in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if it can, false if it cannot
      Throws:
      IOException - if it does not exist or permissions cannot be read.
    • canRead

      public boolean canRead() throws IOException
      Tests whether this client can read data from file or read a directory. Specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Specified by:
      canRead in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if it can, false if it cannot
      Throws:
      IOException - if it does not exist or permissions cannot be read.
    • compareTo

      public final int compareTo(F o)
      Specified by:
      compareTo in interface Comparable<N extends Nfs<F>>
    • createNewFile

      public boolean createNewFile() throws IOException
      Atomically creates a new, empty file named by path if and only if a file with this name does not yet exist. The test for the existence of the file and the creation of the file if it does not exist are a single operation that is atomic with respect to all other filesystem activities that might affect the file.
      Specified by:
      createNewFile in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if the named file did not exist and was successfully created; false if the named file already existed.
      Throws:
      IOException - If an I/O error occurred
    • delete

      public void delete() throws IOException
      Deletes this file/directory.
      Specified by:
      delete in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Throws:
      IOException
    • equals

      public final boolean equals(Object obj)
      Overrides:
      equals in class Object
    • exists

      public boolean exists() throws IOException
      Tests whether this file exists on the NFS server.
      Specified by:
      exists in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if the file exists on the NFS server
      Throws:
      IOException
    • followLinks

      public F followLinks() throws IOException
      Resolves symbolic links while tracking link traversal.
      Specified by:
      followLinks in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      The backing file obtained by following all symbolic links in the path, if any.
      Throws:
      IOException
    • followLinks

      public F followLinks(LinkTracker<N,F> linkTracker) throws IOException
      Resolves symbolic links while tracking link traversal.
      Specified by:
      followLinks in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      linkTracker - The tracker to use. This must be passed so that monitoring is continued until the link resolves to a file that is not a symbolic link.
      Returns:
      The backing file obtained by following all symbolic links in the path, if any.
      Throws:
      IOException
    • getAbsolutePath

      public final String getAbsolutePath()
      Returns the fully qualified path to the file in this network, including the server name and the exported folders, using the usual form: server:exported_folders/path_from_exported_filesystem_root.
      Specified by:
      getAbsolutePath in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
    • getAccess

      public long getAccess(long accessToCheck) throws IOException
      Tests whether this client has the specified access permissions for this file. The bits for the request and reply are as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813):
      ACCESS3_READ    = 0x0001 - Read data from file or read a directory.
      ACCESS3_LOOKUP  = 0x0002 - Look up a name in a directory (no meaning for non-directory objects).
      ACCESS3_MODIFY  = 0x0004 - Rewrite existing file data or modify existing directory entries.
      ACCESS3_EXTEND  = 0x0008 - Write new data or add directory entries.
      ACCESS3_DELETE  = 0x0010 - Delete an existing directory entry.
      ACCESS3_EXECUTE = 0x0020 - Execute file (no meaning for a directory).
      
      In general, it is not sufficient for the client to attempt to deduce access permissions by inspecting the uid, gid, and mode fields in the file attributes, since the server may perform uid or gid mapping or enforce additional access control restrictions. It is also possible that the NFS version 3 protocol server may not be in the same ID space as the NFS version 3 protocol client. In these cases (and perhaps others), the NFS version 3 protocol client can not reliably perform an access check with only current file attributes.

      In the NFS version 2 protocol, the only reliable way to determine whether an operation was allowed was to try it and see if it succeeded or failed. Using the ACCESS procedure in the NFS version 3 protocol, the client can ask the server to indicate whether or not one or more classes of operations are permitted. The ACCESS operation is provided to allow clients to check before doing a series of operations. This is useful in operating systems (such as UNIX) where permission checking is done only when a file or directory is opened. This procedure is also invoked by NFS client access procedure (called possibly through access(2)). The intent is to make the behavior of opening a remote file more consistent with the behavior of opening a local file.

      Specified by:
      getAccess in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      accessToCheck - A bit mask of access permissions to check, as specified below.
      ACCESS3_READ    = 0x0001 - Read data from file or read a directory.
      ACCESS3_LOOKUP  = 0x0002 - Look up a name in a directory (no meaning for non-directory objects).
      ACCESS3_MODIFY  = 0x0004 - Rewrite existing file data or modify existing directory entries.
      ACCESS3_EXTEND  = 0x0008 - Write new data or add directory entries.
      ACCESS3_DELETE  = 0x0010 - Delete an existing directory entry.
      ACCESS3_EXECUTE = 0x0020 - Execute file (no meaning for a directory).
                 
      Returns:
      The access bitmap, as specified below.
      ACCESS3_READ    = 0x0001 - Read data from file or read a directory.
      ACCESS3_LOOKUP  = 0x0002 - Look up a name in a directory (no meaning for non-directory objects).
      ACCESS3_MODIFY  = 0x0004 - Rewrite existing file data or modify existing directory entries.
      ACCESS3_EXTEND  = 0x0008 - Write new data or add directory entries.
      ACCESS3_DELETE  = 0x0010 - Delete an existing directory entry.
      ACCESS3_EXECUTE = 0x0020 - Execute file (no meaning for a directory).
              
      Throws:
      IOException - if it does not exist or permissions cannot be read.
    • getAttributes

      public NfsGetAttributes getAttributes() throws IOException
      Returns the NFS attributes, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Specified by:
      getAttributes in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      The NFS attributes, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Throws:
      IOException
    • getChildFile

      public F getChildFile(String childName) throws IOException
      Returns the child file.
      Specified by:
      getChildFile in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      The child file.
      Throws:
      IOException
    • getFileHandle

      public byte[] getFileHandle() throws IOException
      Returns the NFS file handle, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Specified by:
      getFileHandle in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      The NFS file handle, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Throws:
      IOException
    • getFreeSpace

      public long getFreeSpace() throws IOException
      Returns the number of unallocated bytes in the partition named by this abstract path name.
      Specified by:
      getFreeSpace in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      The number of unallocated bytes in the partition named by this abstract path name.
      Throws:
      IOException
    • getMode

      public long getMode() throws IOException
      Convenience method to access the protection mode bits, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813):
      • 0x00800 - Set user ID on execution.
      • 0x00400 - Set group ID on execution.
      • 0x00200 - Save swapped text (not defined in POSIX).
      • 0x00100 - Read permission for owner.
      • 0x00080 - Write permission for owner.
      • 0x00040 - Execute permission for owner on a file. Or lookup (search) permission for owner in directory.
      • 0x00020 - Read permission for group.
      • 0x00010 - Write permission for group.
      • 0x00008 - Execute permission for group on a file. Or lookup (search) permission for group in directory.
      • 0x00004 - Read permission for others.
      • 0x00002 - Write permission for others.
      • 0x00001 - Execute permission for others on a file. Or lookup (search) permission for others in directory.
      Specified by:
      getMode in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      The protection mode bits for the file.
      Throws:
      IOException
    • getName

      public final String getName()
      Returns the name.
      Specified by:
      getName in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
    • getNfs

      public final N getNfs()
      Returns the low-level NFS client supporting this NfsFile instance.
      Specified by:
      getNfs in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
    • getParent

      public final String getParent()
      Returns the path of the parent folder, or null if there is none.
      Specified by:
      getParent in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
    • getParentFile

      public F getParentFile()
      Returns the NfsFile of the parent folder, or null if there is none.
      Specified by:
      getParentFile in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
    • getPath

      public final String getPath()
      Returns the absolute path, from the root of the exported folders. Synonymous with getAbsolutePath().
      Specified by:
      getPath in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
    • getTotalSpace

      public long getTotalSpace() throws IOException
      Returns the size of the partition named by this abstract pathname.
      Specified by:
      getTotalSpace in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      The size of the partition named by this abstract pathname.
      Throws:
      IOException
    • getUsableSpace

      public long getUsableSpace() throws IOException
      Returns the number of free bytes available to this client on the partition named by this abstract pathname.
      Specified by:
      getUsableSpace in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      The number of free bytes available to this client on the partition named by this abstract pathname.
      Throws:
      IOException
    • hashCode

      public final int hashCode()
      Overrides:
      hashCode in class Object
    • isDirectory

      public boolean isDirectory() throws IOException
      Returns true if it is, false if it is not.
      Specified by:
      isDirectory in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if it is, false if it is not
      Throws:
      IOException
    • isFile

      public boolean isFile() throws IOException
      Returns true if it is a normal file, false if it is not.
      Specified by:
      isFile in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if it is a normal file, false if it is not
      Throws:
      IOException
    • isRootFile

      public boolean isRootFile() throws IOException
      Returns true if it is the root file of the mount, false if it is not.
      Specified by:
      isRootFile in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      true if it is the root file of the mount, false if it is not
      Throws:
      IOException
    • lastModified

      public long lastModified() throws IOException
      Returns time of last modification.
      Specified by:
      lastModified in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      time of last modification
      Throws:
      IOException
    • length

      public long length()
      Returns the length in bytes, or 0 if the file does not exist or the attributes cannot be read.
      Specified by:
      length in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
    • lengthEx

      public long lengthEx() throws IOException
      Returns the length in bytes.
      Specified by:
      lengthEx in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the length in bytes
      Throws:
      IOException - if the file does not exist or the attributes cannot be read.
    • list

      public List<String> list() throws IOException
      Lists all files in this directory.

      Preserves the server's entry order across READDIR responses, excluding . and ... The client does not request sorting or sort the results. NFSv3 does not guarantee alphabetical order or the same order across listings or servers. Sort the complete returned list if a specific order is required. A listing is not a snapshot of a changing directory.

      Specified by:
      list in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the names of all files in the directory
      Throws:
      IOException
    • list

      public List<String> list(NfsFilenameFilter filter) throws IOException
      Lists all files matching the filter in this directory.

      Preserves the relative server order of accepted entries. The ordering and consistency considerations described in NfsFile.list() apply.

      Specified by:
      list in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the names of all files matching the filter in the directory
      Throws:
      IOException
    • listFiles

      public List<F> listFiles() throws IOException
      Lists all files in this directory.

      Returns file objects in the order produced by NfsFile.list(), without sorting. The ordering and consistency considerations described there apply.

      Specified by:
      listFiles in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      NfsFile objects for all files in the directory
      Throws:
      IOException
    • listFiles

      public List<F> listFiles(NfsFilenameFilter filter) throws IOException
      Lists all files matching the filter in this directory.

      Preserves the relative server order of accepted entries. The ordering and consistency considerations described in NfsFile.list() apply.

      Specified by:
      listFiles in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      NfsFile objects for all files matching the filter in the directory
      Throws:
      IOException
    • listFiles

      public List<F> listFiles(NfsFileFilter filter) throws IOException
      Lists all files matching the filter in this directory.

      Preserves the relative server order of accepted entries. The ordering and consistency considerations described in NfsFile.list() apply.

      Specified by:
      listFiles in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      NfsFile objects for all files matching the filter in the directory
      Throws:
      IOException
    • mkdir

      public void mkdir() throws IOException
      Creates the directory if it does not exist.
      Specified by:
      mkdir in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Throws:
      IOException - if the parent directories do not exist or it cannot be created
    • mkdirs

      public void mkdirs() throws IOException
      Creates the directory and all parent directories if they do not already exist.
      Specified by:
      mkdirs in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Throws:
      IOException - if it cannot create one of the directories.
    • renameTo

      public boolean renameTo(F destination) throws IOException
      Renames the file denoted by this abstract pathname.

      Many aspects of the behavior of this method are inherently platform-dependent: The rename operation might not be able to move a file from one filesystem to another, it might not be atomic, and it might not succeed if a file with the destination abstract pathname already exists. The return value should always be checked to make sure that the rename operation was successful.

      Specified by:
      renameTo in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Throws:
      IOException
    • setLastModified

      public void setLastModified(long millis) throws IOException
      Sets the last-modified time of the file or directory named by this abstract pathname.

      All platforms support file-modification times to the nearest second, but some provide more precision. The argument will be truncated to fit the supported precision. If the operation succeeds and no intervening operations on the file take place, then the next invocation of the lastModified() method will return the (possibly truncated) time argument that was passed to this method.

      Specified by:
      setLastModified in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      millis - - The new last-modified time, measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970)
      Throws:
      IOException
    • toString

      public final String toString()
      Overrides:
      toString in class Object
    • setAttributes

      public void setAttributes(NfsSetAttributes nfsSetAttr) throws IOException
      Sets NFS file attributes, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).
      Specified by:
      setAttributes in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Throws:
      IOException
    • setMode

      public void setMode(long mode) throws IOException
      Sets the protection mode bits, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This replaces the java.io.File methods setExecutable, setReadable, and setWritable. The protection mode bits are defined as follows:
      • 0x00800 - Set user ID on execution.
      • 0x00400 - Set group ID on execution.
      • 0x00200 - Save swapped text (not defined in POSIX).
      • 0x00100 - Read permission for owner.
      • 0x00080 - Write permission for owner.
      • 0x00040 - Execute permission for owner on a file. Or lookup (search) permission for owner in directory.
      • 0x00020 - Read permission for group.
      • 0x00010 - Write permission for group.
      • 0x00008 - Execute permission for group on a file. Or lookup (search) permission for group in directory.
      • 0x00004 - Read permission for others.
      • 0x00002 - Write permission for others.
      • 0x00001 - Execute permission for others on a file. Or lookup (search) permission for others in directory.
      Specified by:
      setMode in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      mode - the protection mode bits
      Throws:
      IOException
    • getattr

      public NfsGetAttrResponse getattr() throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure GETATTR retrieves the attributes for a specified file system object. The object is identified by the file handle that the server returned as part of the response from a LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD, or READDIRPLUS procedure (or from the MOUNT service, described elsewhere).

      Specified by:
      getattr in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the response
      Throws:
      IOException
    • makeGetAttrRequest

      public NfsGetAttrRequest makeGetAttrRequest() throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure GETATTR retrieves the attributes for a specified file system object. The object is identified by the file handle that the server returned as part of the response from a LOOKUP, CREATE, MKDIR, SYMLINK, MKNOD, or READDIRPLUS procedure (or from the MOUNT service, described elsewhere).

      Specified by:
      makeGetAttrRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the request
      Throws:
      IOException
    • setattr

      public NfsSetAttrResponse setattr(NfsSetAttributes attributes, NfsTime guardTime) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure SETATTR changes one or more of the attributes of a file system object on the server.

      Specified by:
      setattr in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      attributes - The attributes to set.
      guardTime - If guardTime is not null, the server must compare the value of guardTime to the current ctime of the object. If the values are different, the server must preserve the object attributes and must return a status of NFS3ERR_NOT_SYNC.
      Returns:
      the response
      Throws:
      IOException
    • makeSetAttrRequest

      public NfsSetAttrRequest makeSetAttrRequest(NfsSetAttributes attributes, NfsTime guardTime) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure SETATTR changes one or more of the attributes of a file system object on the server.

      Specified by:
      makeSetAttrRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      attributes - The attributes to set.
      guardTime - If guardTime is not null, the server must compare the value of guardTime to the current ctime of the object. If the values are different, the server must preserve the object attributes and must return a status of NFS3ERR_NOT_SYNC.
      Returns:
      the request
      Throws:
      IOException
    • lookup

      public NfsLookupResponse lookup() throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure LOOKUP searches a directory for a specific name and returns the file handle for the corresponding file system object.

      Specified by:
      lookup in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the response
      Throws:
      IOException
    • makeLookupRequest

      public NfsLookupRequest makeLookupRequest() throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure LOOKUP searches a directory for a specific name and returns the file handle for the corresponding file system object.

      Specified by:
      makeLookupRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the request
      Throws:
      IOException
    • access

      public NfsAccessResponse access(long accessToCheck) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure ACCESS determines the access rights that a user, as identified by the credentials in the request, has with respect to a file system object. The client encodes the set of permissions that are to be checked in a bit mask. The server checks the permissions encoded in the bit mask. A status of NFS3_OK is returned along with a bit mask encoded with the permissions that the client is allowed.

      The results of this procedure are necessarily advisory in nature. That is, a return status of NFS3_OK and the appropriate bit set in the bit mask does not imply that such access will be allowed to the file system object in the future, as access rights can be revoked by the server at any time.

      Specified by:
      access in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      accessToCheck - A bit mask of access permissions to check, as specified below.
      ACCESS3_READ    = 0x0001 - Read data from file or read a directory.
      ACCESS3_LOOKUP  = 0x0002 - Look up a name in a directory (no meaning for non-directory objects).
      ACCESS3_MODIFY  = 0x0004 - Rewrite existing file data or modify existing directory entries.
      ACCESS3_EXTEND  = 0x0008 - Write new data or add directory entries.
      ACCESS3_DELETE  = 0x0010 - Delete an existing directory entry.
      ACCESS3_EXECUTE = 0x0020 - Execute file (no meaning for a directory).
                 
      Returns:
      the response
      Throws:
      IOException
    • makeAccessRequest

      public NfsAccessRequest makeAccessRequest(long accessToCheck) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure ACCESS determines the access rights that a user, as identified by the credentials in the request, has with respect to a file system object. The client encodes the set of permissions that are to be checked in a bit mask. The server checks the permissions encoded in the bit mask. A status of NFS3_OK is returned along with a bit mask encoded with the permissions that the client is allowed.

      The results of this procedure are necessarily advisory in nature. That is, a return status of NFS3_OK and the appropriate bit set in the bit mask does not imply that such access will be allowed to the file system object in the future, as access rights can be revoked by the server at any time.

      Specified by:
      makeAccessRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      accessToCheck - A bit mask of access permissions to check, as specified below.
      ACCESS3_READ    = 0x0001 - Read data from file or read a directory.
      ACCESS3_LOOKUP  = 0x0002 - Look up a name in a directory (no meaning for non-directory objects).
      ACCESS3_MODIFY  = 0x0004 - Rewrite existing file data or modify existing directory entries.
      ACCESS3_EXTEND  = 0x0008 - Write new data or add directory entries.
      ACCESS3_DELETE  = 0x0010 - Delete an existing directory entry.
      ACCESS3_EXECUTE = 0x0020 - Execute file (no meaning for a directory).
                 
      Returns:
      the request
      Throws:
      IOException
    • readlink

      public NfsReadlinkResponse readlink() throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      This method reads the data associated with a symbolic link. The data is an ASCII string that is opaque to the server. That is, whether created by the NFS version 3 protocol software from a client or created locally on the server, the data in a symbolic link is not interpreted when created, but is simply stored.

      A symbolic link is nominally a pointer to another file. The data is not necessarily interpreted by the server, just stored in the file. It is possible for a client implementation to store a path name that is not meaningful to the server operating system in a symbolic link. A READLINK operation returns the data to the client for interpretation. If different implementations want to share access to symbolic links, then they must agree on the interpretation of the data in the symbolic link.

      Specified by:
      readlink in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the response
      Throws:
      IOException
    • makeReadlinkRequest

      public NfsReadlinkRequest makeReadlinkRequest() throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      This method reads the data associated with a symbolic link. The data is an ASCII string that is opaque to the server. That is, whether created by the NFS version 3 protocol software from a client or created locally on the server, the data in a symbolic link is not interpreted when created, but is simply stored.

      A symbolic link is nominally a pointer to another file. The data is not necessarily interpreted by the server, just stored in the file. It is possible for a client implementation to store a path name that is not meaningful to the server operating system in a symbolic link. A READLINK operation returns the data to the client for interpretation. If different implementations want to share access to symbolic links, then they must agree on the interpretation of the data in the symbolic link.

      Specified by:
      makeReadlinkRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the request
      Throws:
      IOException
    • read

      public NfsReadResponse read(long offset, int size, byte[] bytes, int position) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure READ reads data from a file.

      Specified by:
      read in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      offset - The position within the file at which the read is to begin. An offset of 0 means to read data starting at the beginning of the file. If offset is greater than or equal to the size of the file, the status, NFS3_OK, is returned with size set to 0 and eof set to true, subject to access permissions checking.
      size - The number of bytes of data that are to be read. If size is 0, the READ will succeed and return 0 bytes of data, subject to access permissions checking. size must be less than or equal to the value of the rtmax field in the FSINFO reply structure for the file system that contains file. If greater, the server may return only rtmax bytes, resulting in a short read.
      bytes - optional externally provided buffer - if not provided, the method will create a new, empty buffer for receiving the data.
      position - position to start writing, defaults to 0 if buffer is null
      Returns:
      the response
      Throws:
      IOException
    • makeReadRequest

      public NfsReadRequest makeReadRequest(long offset, int size) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure READ reads data from a file.

      Specified by:
      makeReadRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      offset - The position within the file at which the read is to begin. An offset of 0 means to read data starting at the beginning of the file. If offset is greater than or equal to the size of the file, the status, NFS3_OK, is returned with size set to 0 and eof set to true, subject to access permissions checking.
      size - The number of bytes of data that are to be read. If size is 0, the READ will succeed and return 0 bytes of data, subject to access permissions checking. size must be less than or equal to the value of the rtmax field in the FSINFO reply structure for the file system that contains file. If greater, the server may return only rtmax bytes, resulting in a short read.
      Returns:
      the request
      Throws:
      IOException
    • write

      public NfsWriteResponse write(long offset, List<ByteBuffer> payload, int syncType) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure WRITE writes data to a file.

      Specified by:
      write in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      offset - The position within the file at which the write is to begin. An offset of 0 means to write data starting at the beginning of the file.
      payload - The data to be written to the file.
      syncType - One of the values below.
      UNSTABLE  = 0 - Best effort, no promises.
      DATA_SYNC = 1 - Commit all data to stable storage, plus enough metadata for retrieval, before returning.
      FILE_SYNC = 2 - Commit all data and metadata to stable storage before returning.
                 
      Returns:
      the response
      Throws:
      IOException
    • write

      public NfsWriteResponse write(long offset, List<ByteBuffer> payload, int syncType, Long verifier) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure WRITE writes data to a file.

      Specified by:
      write in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      offset - The position within the file at which the write is to begin. An offset of 0 means to write data starting at the beginning of the file.
      payload - The data to be written to the file.
      syncType - One of the values below.
      • UNSTABLE = 0 - Best effort, no promises.
      • DATA_SYNC = 1 - Commit all data to stable storage, plus enough metadata for retrieval, before returning.
      • FILE_SYNC = 2 - Commit all data and metadata to stable storage before returning.
      verifier - This is a cookie, previously returned from the server, that the client can use to determine whether the server has changed state between a call to WRITE and a subsequent call to either WRITE or COMMIT.
      Returns:
      the response
      Throws:
      IOException
    • makeWriteRequest

      public NfsWriteRequest makeWriteRequest(long offset, List<ByteBuffer> payload, int syncType) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure WRITE writes data to a file.

      Specified by:
      makeWriteRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      offset - The position within the file at which the write is to begin. An offset of 0 means to write data starting at the beginning of the file.
      payload - The data to be written to the file.
      syncType - One of the values below.
      • UNSTABLE = 0 - Best effort, no promises.
      • DATA_SYNC = 1 - Commit all data to stable storage, plus enough metadata for retrieval, before returning.
      • FILE_SYNC = 2 - Commit all data and metadata to stable storage before returning.
      Returns:
      the request
      Throws:
      IOException
    • create

      public NfsCreateResponse create(NfsCreateMode createMode, NfsSetAttributes attributes, byte[] verifier) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure CREATE creates a regular file.

      Specified by:
      create in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      createMode - The instance describing how the file is to be created. UNCHECKED means that the file should be created without checking for the existence of a duplicate file in the same directory. In this case, how.obj_attributes is a sattr3 describing the initial attributes for the file. GUARDED specifies that the server should check for the presence of a duplicate file before performing the create and should fail the request with NFS3ERR_EXIST if a duplicate file exists. If the file does not exist, the request is performed as described for UNCHECKED. EXCLUSIVE specifies that the server is to follow exclusive creation semantics, using the verifier to ensure exclusive creation of the target. No attributes may be provided in this case, since the server may use the target file metadata to store the createverf3 verifier.
      attributes - The initial attributes for the new file.
      verifier - A unique identifier to ensure exclusive creation of the new file. If no value is provided for exclusive creation, this is generated.
      Returns:
      the response
      Throws:
      IOException
    • makeCreateRequest

      public NfsCreateRequest makeCreateRequest(NfsCreateMode createMode, NfsSetAttributes attributes, byte[] verifier) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure CREATE creates a regular file.

      Specified by:
      makeCreateRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      createMode - The instance describing how the file is to be created. UNCHECKED means that the file should be created without checking for the existence of a duplicate file in the same directory. In this case, how.obj_attributes is a sattr3 describing the initial attributes for the file. GUARDED specifies that the server should check for the presence of a duplicate file before performing the create and should fail the request with NFS3ERR_EXIST if a duplicate file exists. If the file does not exist, the request is performed as described for UNCHECKED. EXCLUSIVE specifies that the server is to follow exclusive creation semantics, using the verifier to ensure exclusive creation of the target. No attributes may be provided in this case, since the server may use the target file metadata to store the createverf3 verifier.
      attributes - The initial attributes for the new file.
      verifier - A unique identifier to ensure exclusive creation of the new file. If no value is provided for exclusive creation, this is generated.
      Returns:
      the request
      Throws:
      IOException
    • mkdir

      public NfsMkdirResponse mkdir(NfsSetAttributes attributes) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure MKDIR creates a new subdirectory.

      Specified by:
      mkdir in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      attributes - The initial attributes for the subdirectory.
      Returns:
      the response
      Throws:
      IOException
    • makeMkdirRequest

      public NfsMkdirRequest makeMkdirRequest(NfsSetAttributes attributes) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure MKDIR creates a new subdirectory.

      Specified by:
      makeMkdirRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      attributes - The initial attributes for the subdirectory.
      Returns:
      the request
      Throws:
      IOException
    • symlink

      public NfsSymlinkResponse symlink(String symbolicLinkData, NfsSetAttributes attributes) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure SYMLINK creates a new symbolic link.

      Specified by:
      symlink in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      symbolicLinkData - The string containing the symbolic link data.
      attributes - The initial attributes for the symbolic link.
      Returns:
      the response
      Throws:
      IOException
    • makeSymlinkRequest

      public NfsSymlinkRequest makeSymlinkRequest(String symbolicLinkData, NfsSetAttributes attributes) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure SYMLINK creates a new symbolic link.

      Specified by:
      makeSymlinkRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      symbolicLinkData - The string containing the symbolic link data.
      attributes - The initial attributes for the symbolic link.
      Returns:
      the request
      Throws:
      IOException
    • mknod

      public NfsMknodResponse mknod(NfsType type, NfsSetAttributes attributes, long[] rdev) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure MKNOD creates a new special file of the type, type . Special files can be device files or named pipes.

      Specified by:
      mknod in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      type - The type of the object to be created.
      attributes - The initial attributes for the special file.
      rdev - When creating a character special file (type is NF3CHR) or a block special file ( type is NF3BLK), rdev[0] is the major number and rdev[1] is the minor number.
      Returns:
      the response
      Throws:
      IOException
    • makeMknodRequest

      public NfsMknodRequest makeMknodRequest(NfsType type, NfsSetAttributes attributes, long[] rdev) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure MKNOD creates a new special file of the type, type . Special files can be device files or named pipes.

      Specified by:
      makeMknodRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      type - The type of the object to be created.
      attributes - The initial attributes for the special file.
      rdev - When creating a character special file (type is NF3CHR) or a block special file ( type is NF3BLK), rdev[0] is the major number and rdev[1] is the minor number.
      Returns:
      the request
      Throws:
      IOException
    • remove

      public NfsRemoveResponse remove() throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure REMOVE removes (deletes) an entry from a directory. If the entry in the directory was the last reference to the corresponding file system object, the object may be destroyed.

      Specified by:
      remove in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the response
      Throws:
      IOException
    • makeRemoveRequest

      public NfsRemoveRequest makeRemoveRequest() throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure REMOVE removes (deletes) an entry from a directory. If the entry in the directory was the last reference to the corresponding file system object, the object may be destroyed.

      Specified by:
      makeRemoveRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the request
      Throws:
      IOException
    • rmdir

      public NfsRmdirResponse rmdir() throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure RMDIR removes (deletes) a subdirectory from a directory. If the directory entry of the subdirectory is the last reference to the subdirectory, the subdirectory may be destroyed.

      Specified by:
      rmdir in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the response
      Throws:
      IOException
    • makeRmdirRequest

      public NfsRmdirRequest makeRmdirRequest() throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure RMDIR removes (deletes) a subdirectory from a directory. If the directory entry of the subdirectory is the last reference to the subdirectory, the subdirectory may be destroyed.

      Specified by:
      makeRmdirRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the request
      Throws:
      IOException
    • rename

      public NfsRenameResponse rename(F toFile) throws IOException
      Makes the RPC call for these files, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure RENAME changes the path of this file to the path specified by toFile. The operation is required to be atomic to the client. This file and toFile must reside on the same file system and server.

      Specified by:
      rename in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      toFile - A file object with the new path for this object.
      Returns:
      the response
      Throws:
      IOException
    • makeRenameRequest

      public NfsRenameRequest makeRenameRequest(F toFile) throws IOException
      Convenience method for creating the request for these files, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure RENAME changes the path of this file to the path specified by toFile. The operation is required to be atomic to the client. This file and toFile must reside on the same file system and server.

      Specified by:
      makeRenameRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      toFile - A file object with the new path for this object.
      Returns:
      the request
      Throws:
      IOException
    • link

      public NfsLinkResponse link(F source) throws IOException
      Makes the RPC call for these files, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure LINK creates a hard link from source to this file. This file and source must reside on the same file system and server.

      Specified by:
      link in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      source - The existing file system object to which this file should be linked.
      Returns:
      the response
      Throws:
      IOException
    • makeLinkRequest

      public NfsLinkRequest makeLinkRequest(F source) throws IOException
      Convenience method for creating the request for these files, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure LINK creates a hard link from source to this file. This file and source must reside on the same file system and server.

      Specified by:
      makeLinkRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      source - The existing file system object to which this file should be linked.
      Returns:
      the request
      Throws:
      IOException
    • readdir

      public NfsReaddirResponse readdir(long cookie, long cookieverf, int count) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure READDIR retrieves a variable number of entries, in sequence, from a directory and returns the name and file identifier for each, with information to allow the client to request additional directory entries in a subsequent READDIR request.

      Specified by:
      readdir in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      cookie - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookie as returned by the server.
      cookieverf - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookieverf as returned by the server. The cookieverf must match that returned by the READDIR in which the cookie was acquired.
      count - The maximum size of the READDIR3resok structure, in bytes. The size must include all XDR overhead. The server is free to return less than count bytes of data.
      Returns:
      the response
      Throws:
      IOException
    • readdir

      public NfsReaddirResponse readdir(long cookie, long cookieverf, int count, List<NfsDirectoryEntry> entries) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure READDIR retrieves a variable number of entries, in sequence, from a directory and returns the name and file identifier for each, with information to allow the client to request additional directory entries in a subsequent READDIR request.

      Specified by:
      readdir in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      cookie - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookie as returned by the server.
      cookieverf - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookieverf as returned by the server. The cookieverf must match that returned by the READDIR in which the cookie was acquired.
      count - The maximum size of the READDIR3resok structure, in bytes. The size must include all XDR overhead. The server is free to return less than count bytes of data.
      entries - A list to which the incoming data should be appended.
      Returns:
      the response
      Throws:
      IOException
    • makeReaddirRequest

      public NfsReaddirRequest makeReaddirRequest(long cookie, long cookieverf, int count) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure READDIR retrieves a variable number of entries, in sequence, from a directory and returns the name and file identifier for each, with information to allow the client to request additional directory entries in a subsequent READDIR request.

      Specified by:
      makeReaddirRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      cookie - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookie as returned by the server.
      cookieverf - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookieverf as returned by the server. The cookieverf must match that returned by the READDIR in which the cookie was acquired.
      count - The maximum size of the READDIR3resok structure, in bytes. The size must include all XDR overhead. The server is free to return less than count bytes of data.
      Returns:
      the request
      Throws:
      IOException
    • readdirplus

      public NfsReaddirplusResponse readdirplus(long cookie, long cookieverf, int dircount, int maxcount) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure READDIRPLUS retrieves a variable number of entries from a file system directory and returns complete information about each along with information to allow the client to request additional directory entries in a subsequent READDIRPLUS. READDIRPLUS differs from READDIR only in the amount of information returned for each entry. In READDIR, each entry returns the filename and the fileid. In READDIRPLUS, each entry returns the name, the fileid, attributes (including the fileid), and file handle.

      Specified by:
      readdirplus in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      cookie - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookie as returned by the server.
      cookieverf - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookieverf as returned by the server. The cookieverf must match that returned by the READDIRPLUS in which the cookie was acquired.
      dircount - The maximum number of bytes of directory information returned. This number should not include the size of the attributes and file handle portions of the result.
      maxcount - The maximum size of the READDIRPLUS3resok structure, in bytes. The size must include all XDR overhead. The server is free to return less than maxcount bytes of data.
      Returns:
      the response
      Throws:
      IOException
    • readdirplus

      public NfsReaddirplusResponse readdirplus(long cookie, long cookieverf, int dircount, int maxcount, List<NfsDirectoryPlusEntry> entries) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure READDIRPLUS retrieves a variable number of entries from a file system directory and returns complete information about each along with information to allow the client to request additional directory entries in a subsequent READDIRPLUS. READDIRPLUS differs from READDIR only in the amount of information returned for each entry. In READDIR, each entry returns the filename and the fileid. In READDIRPLUS, each entry returns the name, the fileid, attributes (including the fileid), and file handle.

      Specified by:
      readdirplus in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      cookie - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookie as returned by the server.
      cookieverf - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookieverf as returned by the server. The cookieverf must match that returned by the READDIRPLUS in which the cookie was acquired.
      dircount - The maximum number of bytes of directory information returned. This number should not include the size of the attributes and file handle portions of the result.
      maxcount - The maximum size of the READDIRPLUS3resok structure, in bytes. The size must include all XDR overhead. The server is free to return less than maxcount bytes of data.
      entries - A list to which the incoming data should be appended.
      Returns:
      the response
      Throws:
      IOException
    • makeReaddirplusRequest

      public NfsReaddirplusRequest makeReaddirplusRequest(long cookie, long cookieverf, int dircount, int maxcount) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure READDIRPLUS retrieves a variable number of entries from a file system directory and returns complete information about each along with information to allow the client to request additional directory entries in a subsequent READDIRPLUS. READDIRPLUS differs from READDIR only in the amount of information returned for each entry. In READDIR, each entry returns the filename and the fileid. In READDIRPLUS, each entry returns the name, the fileid, attributes (including the fileid), and file handle.

      Specified by:
      makeReaddirplusRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      cookie - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookie as returned by the server.
      cookieverf - This should be set to 0 in the first request to read the directory. On subsequent requests, it should be a cookieverf as returned by the server. The cookieverf must match that returned by the READDIRPLUS in which the cookie was acquired.
      dircount - The maximum number of bytes of directory information returned. This number should not include the size of the attributes and file handle portions of the result.
      maxcount - The maximum size of the READDIRPLUS3resok structure, in bytes. The size must include all XDR overhead. The server is free to return less than maxcount bytes of data.
      Returns:
      the request
      Throws:
      IOException
    • fsstat

      public NfsFsStatResponse fsstat() throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure FSSTAT retrieves volatile file system state information.

      Specified by:
      fsstat in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the response
      Throws:
      IOException
    • makeFsStatRequest

      public NfsFsStatRequest makeFsStatRequest() throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure FSSTAT retrieves volatile file system state information.

      Specified by:
      makeFsStatRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the request
      Throws:
      IOException
    • fsinfo

      public NfsFsInfoResponse fsinfo() throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure FSINFO retrieves nonvolatile file system state information and general information about the NFS version 3 protocol server implementation.

      Specified by:
      fsinfo in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the response
      Throws:
      IOException
    • makeFsInfoRequest

      public NfsFsInfoRequest makeFsInfoRequest() throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure FSINFO retrieves nonvolatile file system state information and general information about the NFS version 3 protocol server implementation.

      Specified by:
      makeFsInfoRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the request
      Throws:
      IOException
    • pathconf

      public NfsPathconfResponse pathconf() throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure PATHCONF retrieves the pathconf information for a file or directory. If the FSF_HOMOGENEOUS bit is set in FSFINFO3resok.properties, the pathconf information will be the same for all files and directories in the exported file system in which this file or directory resides.

      Specified by:
      pathconf in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the response
      Throws:
      IOException
    • makePathconfRequest

      public NfsPathconfRequest makePathconfRequest() throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure PATHCONF retrieves the pathconf information for a file or directory. If the FSF_HOMOGENEOUS bit is set in FSFINFO3resok.properties, the pathconf information will be the same for all files and directories in the exported file system in which this file or directory resides.

      Specified by:
      makePathconfRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Returns:
      the request
      Throws:
      IOException
    • commit

      public NfsCommitResponse commit(long offsetToCommit, int dataSizeToCommit) throws IOException
      Makes the RPC call for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813). This call is wrapped as provided by the Nfs client to include repeated attempts, error checking, and logging.

      Procedure COMMIT forces or flushes data to stable storage that was previously written with a WRITE procedure call with the stable field set to UNSTABLE.

      Specified by:
      commit in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      offsetToCommit - The position within the file at which the flush is to begin. An offset of 0 means to flush data starting at the beginning of the file.
      dataSizeToCommit - The number of bytes of data to flush. If count is 0, a flush from offset to the end of file is done.
      Returns:
      the response
      Throws:
      IOException
    • makeCommitRequest

      public NfsCommitRequest makeCommitRequest(long offsetToCommit, int dataSizeToCommit) throws IOException
      Convenience method for creating the request for this file, as specified by RFC 1813 (https://tools.ietf.org/html/rfc1813).

      Procedure COMMIT forces or flushes data to stable storage that was previously written with a WRITE procedure call with the stable field set to UNSTABLE.

      Specified by:
      makeCommitRequest in interface NfsFile<N extends Nfs<F>, F extends NfsFile<N,F>>
      Parameters:
      offsetToCommit - The position within the file at which the flush is to begin. An offset of 0 means to flush data starting at the beginning of the file.
      dataSizeToCommit - The number of bytes of data to flush. If count is 0, a flush from offset to the end of file is done.
      Returns:
      the request
      Throws:
      IOException
    • getChildFiles

      protected List<F> getChildFiles(List<String> childNames) throws IOException
      Conversion method.
      Parameters:
      childNames - A list of child names.
      Returns:
      The list of child files, one for each name.
      Throws:
      IOException
    • setFileHandle

      protected final void setFileHandle(byte[] fileHandle)
      Sets the current NFS file handle.
    • newFile

      protected final F newFile(String path) throws IOException
      This creates a new file with arbitrary path.
      Parameters:
      path - the absolute path from the mount point.
      Returns:
      the new nfs file.
      Throws:
      IOException
    • newFile

      protected abstract F newFile(String path, LinkTracker<N,F> linkTracker) throws IOException
      This creates a new file with arbitrary path, using the given LinkTracker.
      Parameters:
      path - the absolute path from the mount point.
      linkTracker - The tracker to use. This must be passed so that monitoring is continued until the link resolves to a file that is not a symbolic link.
      Returns:
      A new file corresponding to the path, created using the linkTracker
      Throws:
      IOException
    • setPathFields

      protected final void setPathFields(F toFile)
      Copies the path fields from another file.