public abstract class NfsFileBase<N extends Nfs<F>,F extends NfsFile<N,F>> extends java.lang.Object implements NfsFile<N,F>
groupExecuteModeBit, groupReadModeBit, groupWriteModeBit, othersExecuteModeBit, othersReadModeBit, othersWriteModeBit, ownerExecuteModeBit, ownerReadModeBit, ownerWriteModeBit, saveSwappedTextModeBit, separator, separatorChar, setGroupIdOnExecuteModeBit, setUserIdOnExecuteModeBit| Constructor and Description |
|---|
NfsFileBase(F parentFile,
java.lang.String childName)
The most efficient constructor if the parent file already exists.
|
NfsFileBase(N nfs,
java.lang.String path,
LinkTracker<N,F> linkTracker)
The basic constructor.
|
| Modifier and Type | Method and Description |
|---|---|
NfsAccessResponse |
access(long accessToCheck)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
boolean |
canDelete()
Tests whether this client can delete an existing directory entry.
|
boolean |
canExecute()
Tests whether this client can execute this file (no meaning for a
directory).
|
boolean |
canExtend()
Tests whether this client can write new data or add directory entries.
|
boolean |
canLookup()
Tests whether this client can look up a name in a directory (no meaning
for non-directory objects).
|
boolean |
canModify()
Tests whether this client can rewrite existing file data or modify
existing directory entries.
|
boolean |
canRead()
Tests whether this client can read data from file or read a directory.
|
NfsCommitResponse |
commit(long offsetToCommit,
int dataSizeToCommit)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
int |
compareTo(F o) |
NfsCreateResponse |
create(NfsCreateMode createMode,
NfsSetAttributes attributes,
byte[] verifier)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
boolean |
createNewFile()
Atomically creates a new, empty file named by path if and only if a file
with this name does not yet exist.
|
void |
delete()
Deletes this file/directory.
|
boolean |
equals(java.lang.Object obj) |
boolean |
exists()
Tests whether this file exists on the NFS server.
|
F |
followLinks() |
F |
followLinks(LinkTracker<N,F> linkTracker) |
NfsFsInfoResponse |
fsinfo()
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsFsStatResponse |
fsstat()
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
java.lang.String |
getAbsolutePath() |
long |
getAccess(long accessToCheck)
Tests whether this client has the specified access permissions for this
file.
|
NfsGetAttrResponse |
getattr()
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsGetAttributes |
getAttributes() |
F |
getChildFile(java.lang.String childName) |
protected java.util.List<F> |
getChildFiles(java.util.List<java.lang.String> childNames)
Conversion method.
|
byte[] |
getFileHandle() |
long |
getFreeSpace() |
long |
getMode()
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).
|
java.lang.String |
getName() |
N |
getNfs() |
java.lang.String |
getParent() |
F |
getParentFile() |
java.lang.String |
getPath() |
long |
getTotalSpace() |
long |
getUsableSpace() |
int |
hashCode() |
boolean |
isDirectory() |
boolean |
isFile() |
boolean |
isRootFile() |
long |
lastModified() |
long |
length() |
long |
lengthEx() |
NfsLinkResponse |
link(F source)
Makes the RPC call for these files, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
java.util.List<java.lang.String> |
list()
Lists all files in this directory.
|
java.util.List<java.lang.String> |
list(NfsFilenameFilter filter)
Lists all files matching the filter in this directory.
|
java.util.List<F> |
listFiles()
Lists all files in this directory.
|
java.util.List<F> |
listFiles(NfsFileFilter filter)
Lists all files matching the filter in this directory.
|
java.util.List<F> |
listFiles(NfsFilenameFilter filter)
Lists all files matching the filter in this directory.
|
NfsLookupResponse |
lookup()
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsAccessRequest |
makeAccessRequest(long accessToCheck)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
static java.lang.String |
makeChildPath(java.lang.String parent,
java.lang.String child) |
NfsCommitRequest |
makeCommitRequest(long offsetToCommit,
int dataSizeToCommit)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsCreateRequest |
makeCreateRequest(NfsCreateMode createMode,
NfsSetAttributes attributes,
byte[] verifier)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsFsInfoRequest |
makeFsInfoRequest()
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsFsStatRequest |
makeFsStatRequest()
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsGetAttrRequest |
makeGetAttrRequest()
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsLinkRequest |
makeLinkRequest(F source)
Convenience method for creating the request for these files, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsLookupRequest |
makeLookupRequest()
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsMkdirRequest |
makeMkdirRequest(NfsSetAttributes attributes)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsMknodRequest |
makeMknodRequest(NfsType type,
NfsSetAttributes attributes,
long[] rdev)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
static java.lang.String |
makeName(java.lang.String path) |
static java.lang.String |
makeParentPath(java.lang.String path) |
NfsPathconfRequest |
makePathconfRequest()
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsReaddirplusRequest |
makeReaddirplusRequest(long cookie,
long cookieverf,
int dircount,
int maxcount)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsReaddirRequest |
makeReaddirRequest(long cookie,
long cookieverf,
int count)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsReadlinkRequest |
makeReadlinkRequest()
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsReadRequest |
makeReadRequest(long offset,
int size)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsRemoveRequest |
makeRemoveRequest()
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsRenameRequest |
makeRenameRequest(F toFile)
Convenience method for creating the request for these files, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsRmdirRequest |
makeRmdirRequest()
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsSetAttrRequest |
makeSetAttrRequest(NfsSetAttributes attributes,
NfsTime guardTime)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsSymlinkRequest |
makeSymlinkRequest(java.lang.String symbolicLinkData,
NfsSetAttributes attributes)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
NfsWriteRequest |
makeWriteRequest(long offset,
java.util.List<java.nio.ByteBuffer> payload,
int syncType)
Convenience method for creating the request for this file, as specified
by RFC 1813 (https://tools.ietf.org/html/rfc1813).
|
void |
mkdir()
Creates the directory if it does not exist.
|
NfsMkdirResponse |
mkdir(NfsSetAttributes attributes)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
void |
mkdirs()
Creates the directory and all parent directories if they do not already
exist.
|
NfsMknodResponse |
mknod(NfsType type,
NfsSetAttributes attributes,
long[] rdev)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
protected F |
newFile(java.lang.String path)
This creates a new file with arbitrary path.
|
protected abstract F |
newFile(java.lang.String path,
LinkTracker<N,F> linkTracker)
This creates a new file with arbitrary path, using the given LinkTracker.
|
NfsPathconfResponse |
pathconf()
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsReadResponse |
read(long offset,
int size,
byte[] bytes,
int position)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsReaddirResponse |
readdir(long cookie,
long cookieverf,
int count)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsReaddirResponse |
readdir(long cookie,
long cookieverf,
int count,
java.util.List<NfsDirectoryEntry> entries)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsReaddirplusResponse |
readdirplus(long cookie,
long cookieverf,
int dircount,
int maxcount)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsReaddirplusResponse |
readdirplus(long cookie,
long cookieverf,
int dircount,
int maxcount,
java.util.List<NfsDirectoryPlusEntry> entries)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsReadlinkResponse |
readlink()
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsRemoveResponse |
remove()
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsRenameResponse |
rename(F toFile)
Makes the RPC call for these files, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
boolean |
renameTo(F destination)
Renames the file denoted by this abstract pathname.
|
NfsRmdirResponse |
rmdir()
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsSetAttrResponse |
setattr(NfsSetAttributes attributes,
NfsTime guardTime)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
void |
setAttributes(NfsSetAttributes nfsSetAttr)
Sets NFS file attributes, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
protected void |
setFileHandle(byte[] fileHandle) |
void |
setLastModified(long millis)
Sets the last-modified time of the file or directory named by this
abstract pathname.
|
void |
setMode(long mode)
Sets the protection mode bits, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
protected void |
setPathFields(F toFile) |
NfsSymlinkResponse |
symlink(java.lang.String symbolicLinkData,
NfsSetAttributes attributes)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
java.lang.String |
toString() |
NfsWriteResponse |
write(long offset,
java.util.List<java.nio.ByteBuffer> payload,
int syncType)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
NfsWriteResponse |
write(long offset,
java.util.List<java.nio.ByteBuffer> payload,
int syncType,
java.lang.Long verifier)
Makes the RPC call for this file, as specified by RFC 1813
(https://tools.ietf.org/html/rfc1813).
|
clone, finalize, getClass, notify, notifyAll, wait, wait, waitnewChildFilepublic NfsFileBase(N nfs, java.lang.String path, LinkTracker<N,F> linkTracker) throws java.io.IOException
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.java.io.IOExceptionpublic NfsFileBase(F parentFile, java.lang.String childName) throws java.io.IOException
parentFile - The parent file, stored to reduce lookup overheadchildName - The short name of the file, starting from the parent path.java.io.IOExceptionpublic static java.lang.String makeParentPath(java.lang.String path)
path - public static java.lang.String makeName(java.lang.String path)
path - public static java.lang.String makeChildPath(java.lang.String parent,
java.lang.String child)
parent - child - public boolean canDelete()
throws java.io.IOException
NfsFilepublic boolean canExecute()
throws java.io.IOException
NfsFilepublic boolean canExtend()
throws java.io.IOException
NfsFilepublic boolean canLookup()
throws java.io.IOException
NfsFilepublic boolean canModify()
throws java.io.IOException
NfsFilepublic boolean canRead()
throws java.io.IOException
NfsFilepublic final int compareTo(F o)
public boolean createNewFile()
throws java.io.IOException
NfsFilepublic void delete()
throws java.io.IOException
NfsFilepublic final boolean equals(java.lang.Object obj)
equals in class java.lang.Objectpublic boolean exists()
throws java.io.IOException
NfsFilepublic F followLinks() throws java.io.IOException
public F followLinks(LinkTracker<N,F> linkTracker) throws java.io.IOException
followLinks in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic final java.lang.String getAbsolutePath()
public long getAccess(long accessToCheck)
throws java.io.IOException
NfsFile
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.getAccess in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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).
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).
java.io.IOException - if it does not exist or permissions cannot be read.public NfsGetAttributes getAttributes() throws java.io.IOException
public F getChildFile(java.lang.String childName) throws java.io.IOException
public byte[] getFileHandle()
throws java.io.IOException
public long getFreeSpace()
throws java.io.IOException
public long getMode()
throws java.io.IOException
NfsFilepublic final java.lang.String getName()
public final N getNfs()
public final java.lang.String getParent()
public F getParentFile()
public final java.lang.String getPath()
public long getTotalSpace()
throws java.io.IOException
public long getUsableSpace()
throws java.io.IOException
public final int hashCode()
hashCode in class java.lang.Objectpublic boolean isDirectory()
throws java.io.IOException
public boolean isFile()
throws java.io.IOException
public boolean isRootFile()
throws java.io.IOException
public long lastModified()
throws java.io.IOException
public long length()
public long lengthEx()
throws java.io.IOException
public java.util.List<java.lang.String> list()
throws java.io.IOException
NfsFilepublic java.util.List<java.lang.String> list(NfsFilenameFilter filter) throws java.io.IOException
NfsFilepublic java.util.List<F> listFiles() throws java.io.IOException
NfsFilepublic java.util.List<F> listFiles(NfsFilenameFilter filter) throws java.io.IOException
NfsFilepublic java.util.List<F> listFiles(NfsFileFilter filter) throws java.io.IOException
NfsFilepublic void mkdir()
throws java.io.IOException
NfsFilepublic void mkdirs()
throws java.io.IOException
NfsFilepublic boolean renameTo(F destination) throws java.io.IOException
NfsFileMany 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.
public void setLastModified(long millis)
throws java.io.IOException
NfsFileAll 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.
public final java.lang.String toString()
toString in class java.lang.Objectpublic void setAttributes(NfsSetAttributes nfsSetAttr) throws java.io.IOException
NfsFilepublic void setMode(long mode)
throws java.io.IOException
NfsFilejava.io.File methods setExecutable,
setReadable, and setWritable. The protection
mode bits are defined as follows:
public NfsGetAttrResponse getattr() throws java.io.IOException
NfsFileProcedure 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).
public NfsGetAttrRequest makeGetAttrRequest() throws java.io.IOException
NfsFileProcedure 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).
public NfsSetAttrResponse setattr(NfsSetAttributes attributes, NfsTime guardTime) throws java.io.IOException
NfsFileProcedure SETATTR changes one or more of the attributes of a file system object on the server.
setattr in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsSetAttrRequest makeSetAttrRequest(NfsSetAttributes attributes, NfsTime guardTime) throws java.io.IOException
NfsFileProcedure SETATTR changes one or more of the attributes of a file system object on the server.
makeSetAttrRequest in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsLookupResponse lookup() throws java.io.IOException
NfsFileProcedure LOOKUP searches a directory for a specific name and returns the file handle for the corresponding file system object.
public NfsLookupRequest makeLookupRequest() throws java.io.IOException
NfsFileProcedure LOOKUP searches a directory for a specific name and returns the file handle for the corresponding file system object.
public NfsAccessResponse access(long accessToCheck) throws java.io.IOException
NfsFileProcedure 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.
access in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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).
java.io.IOExceptionpublic NfsAccessRequest makeAccessRequest(long accessToCheck) throws java.io.IOException
NfsFileProcedure 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.
makeAccessRequest in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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).
java.io.IOExceptionpublic NfsReadlinkResponse readlink() throws java.io.IOException
NfsFileThis 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.
public NfsReadlinkRequest makeReadlinkRequest() throws java.io.IOException
NfsFileThis 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.
public NfsReadResponse read(long offset, int size, byte[] bytes, int position) throws java.io.IOException
NfsFileProcedure READ reads data from a file.
read in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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 nulljava.io.IOExceptionpublic NfsReadRequest makeReadRequest(long offset, int size) throws java.io.IOException
NfsFileProcedure READ reads data from a file.
makeReadRequest in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsWriteResponse write(long offset, java.util.List<java.nio.ByteBuffer> payload, int syncType) throws java.io.IOException
NfsFileProcedure WRITE writes data to a file.
write in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.
java.io.IOExceptionpublic NfsWriteResponse write(long offset, java.util.List<java.nio.ByteBuffer> payload, int syncType, java.lang.Long verifier) throws java.io.IOException
NfsFileProcedure WRITE writes data to a file.
write in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.
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.java.io.IOExceptionpublic NfsWriteRequest makeWriteRequest(long offset, java.util.List<java.nio.ByteBuffer> payload, int syncType) throws java.io.IOException
NfsFileProcedure WRITE writes data to a file.
makeWriteRequest in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.
java.io.IOExceptionpublic NfsCreateResponse create(NfsCreateMode createMode, NfsSetAttributes attributes, byte[] verifier) throws java.io.IOException
NfsFileProcedure CREATE creates a regular file.
create in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsCreateRequest makeCreateRequest(NfsCreateMode createMode, NfsSetAttributes attributes, byte[] verifier) throws java.io.IOException
NfsFileProcedure CREATE creates a regular file.
makeCreateRequest in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsMkdirResponse mkdir(NfsSetAttributes attributes) throws java.io.IOException
NfsFileProcedure MKDIR creates a new subdirectory.
public NfsMkdirRequest makeMkdirRequest(NfsSetAttributes attributes) throws java.io.IOException
NfsFileProcedure MKDIR creates a new subdirectory.
public NfsSymlinkResponse symlink(java.lang.String symbolicLinkData, NfsSetAttributes attributes) throws java.io.IOException
NfsFileProcedure SYMLINK creates a new symbolic link.
public NfsSymlinkRequest makeSymlinkRequest(java.lang.String symbolicLinkData, NfsSetAttributes attributes) throws java.io.IOException
NfsFileProcedure SYMLINK creates a new symbolic link.
public NfsMknodResponse mknod(NfsType type, NfsSetAttributes attributes, long[] rdev) throws java.io.IOException
NfsFile
Procedure MKNOD creates a new special file of the type, type
. Special files can be device files or named pipes.
mknod in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsMknodRequest makeMknodRequest(NfsType type, NfsSetAttributes attributes, long[] rdev) throws java.io.IOException
NfsFile
Procedure MKNOD creates a new special file of the type, type
. Special files can be device files or named pipes.
makeMknodRequest in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsRemoveResponse remove() throws java.io.IOException
NfsFileProcedure 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.
public NfsRemoveRequest makeRemoveRequest() throws java.io.IOException
NfsFileProcedure 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.
public NfsRmdirResponse rmdir() throws java.io.IOException
NfsFileProcedure 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.
public NfsRmdirRequest makeRmdirRequest() throws java.io.IOException
NfsFileProcedure 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.
public NfsRenameResponse rename(F toFile) throws java.io.IOException
NfsFile
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.
public NfsRenameRequest makeRenameRequest(F toFile) throws java.io.IOException
NfsFile
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.
public NfsLinkResponse link(F source) throws java.io.IOException
NfsFile
Procedure LINK creates a hard link from source to this file.
This file and source must reside on the same file system and
server.
public NfsLinkRequest makeLinkRequest(F source) throws java.io.IOException
NfsFile
Procedure LINK creates a hard link from source to this file.
This file and source must reside on the same file system and
server.
public NfsReaddirResponse readdir(long cookie, long cookieverf, int count) throws java.io.IOException
NfsFileProcedure 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.
readdir in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsReaddirResponse readdir(long cookie, long cookieverf, int count, java.util.List<NfsDirectoryEntry> entries) throws java.io.IOException
NfsFileProcedure 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.
readdir in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsReaddirRequest makeReaddirRequest(long cookie, long cookieverf, int count) throws java.io.IOException
NfsFileProcedure 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.
makeReaddirRequest in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsReaddirplusResponse readdirplus(long cookie, long cookieverf, int dircount, int maxcount) throws java.io.IOException
NfsFileProcedure 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.
readdirplus in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsReaddirplusResponse readdirplus(long cookie, long cookieverf, int dircount, int maxcount, java.util.List<NfsDirectoryPlusEntry> entries) throws java.io.IOException
NfsFileProcedure 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.
readdirplus in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsReaddirplusRequest makeReaddirplusRequest(long cookie, long cookieverf, int dircount, int maxcount) throws java.io.IOException
NfsFileProcedure 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.
makeReaddirplusRequest in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsFsStatResponse fsstat() throws java.io.IOException
NfsFileProcedure FSSTAT retrieves volatile file system state information.
public NfsFsStatRequest makeFsStatRequest() throws java.io.IOException
NfsFileProcedure FSSTAT retrieves volatile file system state information.
public NfsFsInfoResponse fsinfo() throws java.io.IOException
NfsFileProcedure FSINFO retrieves nonvolatile file system state information and general information about the NFS version 3 protocol server implementation.
public NfsFsInfoRequest makeFsInfoRequest() throws java.io.IOException
NfsFileProcedure FSINFO retrieves nonvolatile file system state information and general information about the NFS version 3 protocol server implementation.
public NfsPathconfResponse pathconf() throws java.io.IOException
NfsFileProcedure 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.
public NfsPathconfRequest makePathconfRequest() throws java.io.IOException
NfsFileProcedure 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.
public NfsCommitResponse commit(long offsetToCommit, int dataSizeToCommit) throws java.io.IOException
NfsFileProcedure COMMIT forces or flushes data to stable storage that was previously written with a WRITE procedure call with the stable field set to UNSTABLE.
commit in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionpublic NfsCommitRequest makeCommitRequest(long offsetToCommit, int dataSizeToCommit) throws java.io.IOException
NfsFileProcedure COMMIT forces or flushes data to stable storage that was previously written with a WRITE procedure call with the stable field set to UNSTABLE.
makeCommitRequest in interface NfsFile<N extends Nfs<F>,F extends NfsFile<N,F>>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.java.io.IOExceptionprotected java.util.List<F> getChildFiles(java.util.List<java.lang.String> childNames) throws java.io.IOException
childNames - A list of child names.java.io.IOExceptionprotected final void setFileHandle(byte[] fileHandle)
fileHandle - protected final F newFile(java.lang.String path) throws java.io.IOException
path - the absolute path from the mount point.java.io.IOExceptionprotected abstract F newFile(java.lang.String path, LinkTracker<N,F> linkTracker) throws java.io.IOException
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.java.io.IOExceptionprotected final void setPathFields(F toFile)
toFile -