HADOOP-13418. Fix javadoc warnings by JDK8 in hadoop-nfs package. Contributed by Kai Sasaki.
This commit is contained in:
parent
49ba09a922
commit
10ed06a0c9
@ -43,7 +43,10 @@ public int getValue() {
|
|||||||
return ordinal();
|
return ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return the procedure corresponding to the value. */
|
/** The procedure of given value.
|
||||||
|
* @param value specifies the procedure index
|
||||||
|
* @return the procedure corresponding to the value.
|
||||||
|
*/
|
||||||
public static MNTPROC fromValue(int value) {
|
public static MNTPROC fromValue(int value) {
|
||||||
if (value < 0 || value >= values().length) {
|
if (value < 0 || value >= values().length) {
|
||||||
return null;
|
return null;
|
||||||
@ -52,19 +55,51 @@ public static MNTPROC fromValue(int value) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** MNTPROC_NULL - Do Nothing */
|
/**
|
||||||
|
* MNTPRC_NULL - Do Nothing.
|
||||||
|
* @param out XDR response used in NFS protocol
|
||||||
|
* @param xid transaction id
|
||||||
|
* @param client represents IP address
|
||||||
|
* @return XDR response
|
||||||
|
*/
|
||||||
public XDR nullOp(XDR out, int xid, InetAddress client);
|
public XDR nullOp(XDR out, int xid, InetAddress client);
|
||||||
|
|
||||||
/** MNTPROC_MNT - Add mount entry */
|
/**
|
||||||
|
* MNTPROC_MNT - Add mount entry.
|
||||||
|
* @param xdr XDR message used in NFS protocol
|
||||||
|
* @param out XDR response used in NFS protocol
|
||||||
|
* @param xid transaction id
|
||||||
|
* @param client represents IP address
|
||||||
|
* @return XDR response
|
||||||
|
*/
|
||||||
public XDR mnt(XDR xdr, XDR out, int xid, InetAddress client);
|
public XDR mnt(XDR xdr, XDR out, int xid, InetAddress client);
|
||||||
|
|
||||||
/** MNTPROC_DUMP - Return mount entries */
|
/**
|
||||||
|
* MNTPROC_DUMP - Return mount entries.
|
||||||
|
* @param out XDR response used in NFS protocol
|
||||||
|
* @param xid transaction id
|
||||||
|
* @param client represents IP address
|
||||||
|
* @return XDR response
|
||||||
|
*/
|
||||||
public XDR dump(XDR out, int xid, InetAddress client);
|
public XDR dump(XDR out, int xid, InetAddress client);
|
||||||
|
|
||||||
/** MNTPROC_UMNT - Remove mount entry */
|
/**
|
||||||
|
* MNTPROC_UMNT - Remove mount entry.
|
||||||
|
* @param xdr XDR message used in NFS protocol
|
||||||
|
* @param out XDR response used in NFS protocol
|
||||||
|
* @param xid transaction id
|
||||||
|
* @param client represents IP address
|
||||||
|
* @return XDR response
|
||||||
|
*/
|
||||||
public XDR umnt(XDR xdr, XDR out, int xid, InetAddress client);
|
public XDR umnt(XDR xdr, XDR out, int xid, InetAddress client);
|
||||||
|
|
||||||
/** MNTPROC_UMNTALL - Remove all mount entries */
|
/**
|
||||||
|
* MNTPROC_UMNTALL - Remove all mount entries.
|
||||||
|
* @param out XDR response used in NFS protocol
|
||||||
|
* @param xid transaction id
|
||||||
|
* @param client represents IP address
|
||||||
|
* @return XDR response
|
||||||
|
*/
|
||||||
public XDR umntall(XDR out, int xid, InetAddress client);
|
public XDR umntall(XDR out, int xid, InetAddress client);
|
||||||
|
|
||||||
/** MNTPROC_EXPORT and MNTPROC_EXPORTALL - Return export list */
|
/** MNTPROC_EXPORT and MNTPROC_EXPORTALL - Return export list */
|
||||||
|
@ -36,7 +36,14 @@ public class MountResponse {
|
|||||||
private MountResponse() {
|
private MountResponse() {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Response for RPC call {@link MountInterface.MNTPROC#MNT} */
|
/**
|
||||||
|
* Response for RPC call {@link MountInterface.MNTPROC#MNT}.
|
||||||
|
* @param status status of mount response
|
||||||
|
* @param xdr XDR message object
|
||||||
|
* @param xid transaction id
|
||||||
|
* @param handle file handle
|
||||||
|
* @return response XDR
|
||||||
|
*/
|
||||||
public static XDR writeMNTResponse(int status, XDR xdr, int xid,
|
public static XDR writeMNTResponse(int status, XDR xdr, int xid,
|
||||||
byte[] handle) {
|
byte[] handle) {
|
||||||
RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr);
|
RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr);
|
||||||
@ -50,7 +57,13 @@ public static XDR writeMNTResponse(int status, XDR xdr, int xid,
|
|||||||
return xdr;
|
return xdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Response for RPC call {@link MountInterface.MNTPROC#DUMP} */
|
/**
|
||||||
|
* Response for RPC call {@link MountInterface.MNTPROC#DUMP}.
|
||||||
|
* @param xdr XDR message object
|
||||||
|
* @param xid transaction id
|
||||||
|
* @param mounts mount entries
|
||||||
|
* @return response XDR
|
||||||
|
*/
|
||||||
public static XDR writeMountList(XDR xdr, int xid, List<MountEntry> mounts) {
|
public static XDR writeMountList(XDR xdr, int xid, List<MountEntry> mounts) {
|
||||||
RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr);
|
RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr);
|
||||||
for (MountEntry mountEntry : mounts) {
|
for (MountEntry mountEntry : mounts) {
|
||||||
@ -62,7 +75,14 @@ public static XDR writeMountList(XDR xdr, int xid, List<MountEntry> mounts) {
|
|||||||
return xdr;
|
return xdr;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Response for RPC call {@link MountInterface.MNTPROC#EXPORT} */
|
/**
|
||||||
|
* Response for RPC call {@link MountInterface.MNTPROC#EXPORT}.
|
||||||
|
* @param xdr XDR message object
|
||||||
|
* @param xid transaction id
|
||||||
|
* @param exports export list
|
||||||
|
* @param hostMatcher the list of export host
|
||||||
|
* @return response XDR
|
||||||
|
*/
|
||||||
public static XDR writeExportList(XDR xdr, int xid, List<String> exports,
|
public static XDR writeExportList(XDR xdr, int xid, List<String> exports,
|
||||||
List<NfsExports> hostMatcher) {
|
List<NfsExports> hostMatcher) {
|
||||||
assert (exports.size() == hostMatcher.size());
|
assert (exports.size() == hostMatcher.size());
|
||||||
|
@ -48,8 +48,8 @@ public RpcProgram getRpcProgram() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
* @param program
|
* @param program rpc server which handles mount request
|
||||||
* @throws IOException
|
* @throws IOException fail to construct MountdBase
|
||||||
*/
|
*/
|
||||||
public MountdBase(RpcProgram program) throws IOException {
|
public MountdBase(RpcProgram program) throws IOException {
|
||||||
rpcProgram = program;
|
rpcProgram = program;
|
||||||
|
@ -172,6 +172,7 @@ public long getExpirationTime() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the configured group list
|
* Return the configured group list
|
||||||
|
* @return host group list
|
||||||
*/
|
*/
|
||||||
public String[] getHostGroupList() {
|
public String[] getHostGroupList() {
|
||||||
int listSize = mMatches.size();
|
int listSize = mMatches.size();
|
||||||
|
@ -54,6 +54,7 @@ public int getNseconds() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the total time in milliseconds
|
* Get the total time in milliseconds
|
||||||
|
* @return convert to milli seconds
|
||||||
*/
|
*/
|
||||||
public long getMilliSeconds() {
|
public long getMilliSeconds() {
|
||||||
return (long) (seconds) * 1000 + (long) (nseconds) / 1000000;
|
return (long) (seconds) * 1000 + (long) (nseconds) / 1000000;
|
||||||
|
@ -45,6 +45,7 @@ public FileHandle() {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle is a 32 bytes number. For HDFS, the last 8 bytes is fileId.
|
* Handle is a 32 bytes number. For HDFS, the last 8 bytes is fileId.
|
||||||
|
* @param v file id
|
||||||
*/
|
*/
|
||||||
public FileHandle(long v) {
|
public FileHandle(long v) {
|
||||||
fileId = v;
|
fileId = v;
|
||||||
|
@ -76,7 +76,11 @@ public int getValue() {
|
|||||||
return ordinal();
|
return ordinal();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @return the procedure corresponding to the value. */
|
/**
|
||||||
|
* Convert to NFS procedure.
|
||||||
|
* @param value specify the index of NFS procedure
|
||||||
|
* @return the procedure corresponding to the value.
|
||||||
|
*/
|
||||||
public static NFSPROC3 fromValue(int value) {
|
public static NFSPROC3 fromValue(int value) {
|
||||||
if (value < 0 || value >= values().length) {
|
if (value < 0 || value >= values().length) {
|
||||||
return null;
|
return null;
|
||||||
|
@ -26,69 +26,176 @@
|
|||||||
*/
|
*/
|
||||||
public interface Nfs3Interface {
|
public interface Nfs3Interface {
|
||||||
|
|
||||||
/** NULL: Do nothing */
|
/**
|
||||||
|
* NULL: Do nothing.
|
||||||
|
* @return null NFS procedure
|
||||||
|
*/
|
||||||
public NFS3Response nullProcedure();
|
public NFS3Response nullProcedure();
|
||||||
|
|
||||||
/** GETATTR: Get file attributes */
|
/**
|
||||||
|
* GETATTR: Get file attributes.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response getattr(XDR xdr, RpcInfo info);
|
public NFS3Response getattr(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** SETATTR: Set file attributes */
|
/**
|
||||||
|
* SETATTR: Set file attributes.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response setattr(XDR xdr, RpcInfo info);
|
public NFS3Response setattr(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** LOOKUP: Lookup filename */
|
/**
|
||||||
|
* LOOKUP: Lookup filename.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response lookup(XDR xdr, RpcInfo info);
|
public NFS3Response lookup(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** ACCESS: Check access permission */
|
/**
|
||||||
|
* ACCESS: Check access permission.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response access(XDR xdr, RpcInfo info);
|
public NFS3Response access(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** READLINK: Read from symbolic link */
|
/** READLINK: Read from symbolic link.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response readlink(XDR xdr, RpcInfo info);
|
public NFS3Response readlink(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** READ: Read from file */
|
/**
|
||||||
|
* READ: Read from file.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response read(XDR xdr, RpcInfo info);
|
public NFS3Response read(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** WRITE: Write to file */
|
/**
|
||||||
|
* WRITE: Write to file.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response write(XDR xdr, RpcInfo info);
|
public NFS3Response write(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** CREATE: Create a file */
|
/**
|
||||||
|
* CREATE: Create a file.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response create(XDR xdr, RpcInfo info);
|
public NFS3Response create(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** MKDIR: Create a directory */
|
/**
|
||||||
|
* MKDIR: Create a directory.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response mkdir(XDR xdr, RpcInfo info);
|
public NFS3Response mkdir(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** SYMLINK: Create a symbolic link */
|
/**
|
||||||
|
* SYMLINK: Create a symbolic link.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response symlink(XDR xdr, RpcInfo info);
|
public NFS3Response symlink(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** MKNOD: Create a special device */
|
/**
|
||||||
|
* MKNOD: Create a special device.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response mknod(XDR xdr, RpcInfo info);
|
public NFS3Response mknod(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** REMOVE: Remove a file */
|
/**
|
||||||
|
* REMOVE: Remove a file.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response remove(XDR xdr, RpcInfo info);
|
public NFS3Response remove(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** RMDIR: Remove a directory */
|
/**
|
||||||
|
* RMDIR: Remove a directory.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response rmdir(XDR xdr, RpcInfo info);
|
public NFS3Response rmdir(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** RENAME: Rename a file or directory */
|
/**
|
||||||
|
* RENAME: Rename a file or directory.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response rename(XDR xdr, RpcInfo info);
|
public NFS3Response rename(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** LINK: create link to an object */
|
/**
|
||||||
|
* LINK: create link to an object.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response link(XDR xdr, RpcInfo info);
|
public NFS3Response link(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** READDIR: Read From directory */
|
/**
|
||||||
|
* READDIR: Read From directory.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response readdir(XDR xdr, RpcInfo info);
|
public NFS3Response readdir(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** READDIRPLUS: Extended read from directory */
|
/**
|
||||||
|
* READDIRPLUS: Extended read from directory.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response readdirplus(XDR xdr, RpcInfo info);
|
public NFS3Response readdirplus(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** FSSTAT: Get dynamic file system information */
|
/**
|
||||||
|
* FSSTAT: Get dynamic file system information.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response fsstat(XDR xdr, RpcInfo info);
|
public NFS3Response fsstat(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** FSINFO: Get static file system information */
|
/**
|
||||||
|
* FSINFO: Get static file system information.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response fsinfo(XDR xdr, RpcInfo info);
|
public NFS3Response fsinfo(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** PATHCONF: Retrieve POSIX information */
|
/**
|
||||||
|
* PATHCONF: Retrieve POSIX information.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response pathconf(XDR xdr, RpcInfo info);
|
public NFS3Response pathconf(XDR xdr, RpcInfo info);
|
||||||
|
|
||||||
/** COMMIT: Commit cached data on a server to stable storage */
|
/**
|
||||||
|
* COMMIT: Commit cached data on a server to stable storage.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param info context of rpc message
|
||||||
|
* @return NFSv3 response
|
||||||
|
*/
|
||||||
public NFS3Response commit(XDR xdr, RpcInfo info);
|
public NFS3Response commit(XDR xdr, RpcInfo info);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ static FileHandle readHandle(XDR xdr) throws IOException {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Subclass should implement. Usually handle is the first to be serialized
|
* Subclass should implement. Usually handle is the first to be serialized
|
||||||
|
* @param xdr XDR message
|
||||||
*/
|
*/
|
||||||
public abstract void serialize(XDR xdr);
|
public abstract void serialize(XDR xdr);
|
||||||
}
|
}
|
||||||
|
@ -43,6 +43,10 @@ public void setStatus(int status) {
|
|||||||
/**
|
/**
|
||||||
* Write the response, along with the rpc header (including verifier), to the
|
* Write the response, along with the rpc header (including verifier), to the
|
||||||
* XDR.
|
* XDR.
|
||||||
|
* @param out XDR output message
|
||||||
|
* @param xid transaction id
|
||||||
|
* @param verifier verifies reply
|
||||||
|
* @return XDR response
|
||||||
*/
|
*/
|
||||||
public XDR serialize(XDR out, int xid, Verifier verifier) {
|
public XDR serialize(XDR out, int xid, Verifier verifier) {
|
||||||
RpcAcceptedReply reply = RpcAcceptedReply.getAcceptInstance(xid, verifier);
|
RpcAcceptedReply reply = RpcAcceptedReply.getAcceptInstance(xid, verifier);
|
||||||
|
@ -122,12 +122,20 @@ protected boolean removeEldestEntry(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return the program name */
|
/**
|
||||||
|
* Return the program name.
|
||||||
|
* @return RPC program name
|
||||||
|
*/
|
||||||
public String getProgram() {
|
public String getProgram() {
|
||||||
return program;
|
return program;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Mark a request as completed and add corresponding response to the cache */
|
/**
|
||||||
|
* Mark a request as completed and add corresponding response to the cache.
|
||||||
|
* @param clientId client IP address
|
||||||
|
* @param xid transaction id
|
||||||
|
* @param response RPC response
|
||||||
|
*/
|
||||||
public void callCompleted(InetAddress clientId, int xid, RpcResponse response) {
|
public void callCompleted(InetAddress clientId, int xid, RpcResponse response) {
|
||||||
ClientRequest req = new ClientRequest(clientId, xid);
|
ClientRequest req = new ClientRequest(clientId, xid);
|
||||||
CacheEntry e;
|
CacheEntry e;
|
||||||
@ -140,6 +148,9 @@ public void callCompleted(InetAddress clientId, int xid, RpcResponse response) {
|
|||||||
/**
|
/**
|
||||||
* Check the cache for an entry. If it does not exist, add the request
|
* Check the cache for an entry. If it does not exist, add the request
|
||||||
* as in progress.
|
* as in progress.
|
||||||
|
* @param clientId client IP address
|
||||||
|
* @param xid transaction id
|
||||||
|
* @return cached entry
|
||||||
*/
|
*/
|
||||||
public CacheEntry checkOrAddToCache(InetAddress clientId, int xid) {
|
public CacheEntry checkOrAddToCache(InetAddress clientId, int xid) {
|
||||||
ClientRequest req = new ClientRequest(clientId, xid);
|
ClientRequest req = new ClientRequest(clientId, xid);
|
||||||
@ -154,14 +165,17 @@ public CacheEntry checkOrAddToCache(InetAddress clientId, int xid) {
|
|||||||
return e;
|
return e;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Return number of cached entries */
|
/**
|
||||||
|
* Return number of cached entries.
|
||||||
|
* @return cache size
|
||||||
|
*/
|
||||||
public int size() {
|
public int size() {
|
||||||
return map.size();
|
return map.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Iterator to the cache entries
|
* Iterator to the cache entries.
|
||||||
* @return iterator
|
* @return iterator cache iterator
|
||||||
*/
|
*/
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
public Iterator<Entry<ClientRequest, CacheEntry>> iterator() {
|
public Iterator<Entry<ClientRequest, CacheEntry>> iterator() {
|
||||||
|
@ -87,6 +87,8 @@ protected RpcProgram(String program, String host, int port, int progNumber,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Register this program with the local portmapper.
|
* Register this program with the local portmapper.
|
||||||
|
* @param transport transport layer for port map
|
||||||
|
* @param boundPort port number of bounded RPC program
|
||||||
*/
|
*/
|
||||||
public void register(int transport, int boundPort) {
|
public void register(int transport, int boundPort) {
|
||||||
if (boundPort != port) {
|
if (boundPort != port) {
|
||||||
@ -104,6 +106,8 @@ public void register(int transport, int boundPort) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Unregister this program with the local portmapper.
|
* Unregister this program with the local portmapper.
|
||||||
|
* @param transport transport layer for port map
|
||||||
|
* @param boundPort port number of bounded RPC program
|
||||||
*/
|
*/
|
||||||
public void unregister(int transport, int boundPort) {
|
public void unregister(int transport, int boundPort) {
|
||||||
if (boundPort != port) {
|
if (boundPort != port) {
|
||||||
@ -121,6 +125,8 @@ public void unregister(int transport, int boundPort) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Register the program with Portmap or Rpcbind
|
* Register the program with Portmap or Rpcbind
|
||||||
|
* @param mapEntry port map entries
|
||||||
|
* @param set specifies registration or not
|
||||||
*/
|
*/
|
||||||
protected void register(PortmapMapping mapEntry, boolean set) {
|
protected void register(PortmapMapping mapEntry, boolean set) {
|
||||||
XDR mappingRequest = PortmapRequest.create(mapEntry, set);
|
XDR mappingRequest = PortmapRequest.create(mapEntry, set);
|
||||||
|
@ -219,7 +219,12 @@ private void ensureFreeSpace(int size) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** check if the rest of data has more than len bytes */
|
/**
|
||||||
|
* check if the rest of data has more than len bytes.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @param len minimum remaining length
|
||||||
|
* @return specify remaining length is enough or not
|
||||||
|
*/
|
||||||
public static boolean verifyLength(XDR xdr, int len) {
|
public static boolean verifyLength(XDR xdr, int len) {
|
||||||
return xdr.buf.remaining() >= len;
|
return xdr.buf.remaining() >= len;
|
||||||
}
|
}
|
||||||
@ -231,7 +236,12 @@ static byte[] recordMark(int size, boolean last) {
|
|||||||
return b;
|
return b;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Write an XDR message to a TCP ChannelBuffer */
|
/**
|
||||||
|
* Write an XDR message to a TCP ChannelBuffer.
|
||||||
|
* @param request XDR request
|
||||||
|
* @param last specifies last request or not
|
||||||
|
* @return TCP buffer
|
||||||
|
*/
|
||||||
public static ChannelBuffer writeMessageTcp(XDR request, boolean last) {
|
public static ChannelBuffer writeMessageTcp(XDR request, boolean last) {
|
||||||
Preconditions.checkState(request.state == XDR.State.WRITING);
|
Preconditions.checkState(request.state == XDR.State.WRITING);
|
||||||
ByteBuffer b = request.buf.duplicate();
|
ByteBuffer b = request.buf.duplicate();
|
||||||
@ -243,7 +253,11 @@ public static ChannelBuffer writeMessageTcp(XDR request, boolean last) {
|
|||||||
return ChannelBuffers.copiedBuffer(headerBuf, b);
|
return ChannelBuffers.copiedBuffer(headerBuf, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Write an XDR message to a UDP ChannelBuffer */
|
/**
|
||||||
|
* Write an XDR message to a UDP ChannelBuffer.
|
||||||
|
* @param response XDR response
|
||||||
|
* @return UDP buffer
|
||||||
|
*/
|
||||||
public static ChannelBuffer writeMessageUdp(XDR response) {
|
public static ChannelBuffer writeMessageUdp(XDR response) {
|
||||||
Preconditions.checkState(response.state == XDR.State.READING);
|
Preconditions.checkState(response.state == XDR.State.READING);
|
||||||
// TODO: Investigate whether making a copy of the buffer is necessary.
|
// TODO: Investigate whether making a copy of the buffer is necessary.
|
||||||
|
@ -48,6 +48,8 @@ public static Credentials readFlavorAndCredentials(XDR xdr) {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Write AuthFlavor and the credentials to the XDR
|
* Write AuthFlavor and the credentials to the XDR
|
||||||
|
* @param cred credentials
|
||||||
|
* @param xdr XDR message
|
||||||
*/
|
*/
|
||||||
public static void writeFlavorAndCredentials(Credentials cred, XDR xdr) {
|
public static void writeFlavorAndCredentials(Credentials cred, XDR xdr) {
|
||||||
if (cred instanceof CredentialsNone) {
|
if (cred instanceof CredentialsNone) {
|
||||||
|
@ -57,10 +57,15 @@ protected RpcAuthInfo(AuthFlavor flavor) {
|
|||||||
this.flavor = flavor;
|
this.flavor = flavor;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Load auth info */
|
/**
|
||||||
|
* Load auth info.
|
||||||
|
* @param xdr XDR message
|
||||||
|
*/
|
||||||
public abstract void read(XDR xdr);
|
public abstract void read(XDR xdr);
|
||||||
|
|
||||||
/** Write auth info */
|
/** Write auth info.
|
||||||
|
* @param xdr XDR message
|
||||||
|
*/
|
||||||
public abstract void write(XDR xdr);
|
public abstract void write(XDR xdr);
|
||||||
|
|
||||||
public AuthFlavor getFlavor() {
|
public AuthFlavor getFlavor() {
|
||||||
|
@ -41,27 +41,51 @@ public boolean isWrapRequired() {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used by GSS */
|
/**
|
||||||
|
* Used by GSS.
|
||||||
|
* @param request RPC request
|
||||||
|
* @param data request data
|
||||||
|
* @throws IOException fail to unwrap RPC call
|
||||||
|
* @return XDR response
|
||||||
|
*/
|
||||||
public XDR unwrap(RpcCall request, byte[] data ) throws IOException {
|
public XDR unwrap(RpcCall request, byte[] data ) throws IOException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used by GSS */
|
/**
|
||||||
|
* Used by GSS.
|
||||||
|
* @param request RPC request
|
||||||
|
* @param response RPC response
|
||||||
|
* @throws IOException fail to wrap RPC call
|
||||||
|
* @return response byte buffer
|
||||||
|
*/
|
||||||
public byte[] wrap(RpcCall request, XDR response) throws IOException {
|
public byte[] wrap(RpcCall request, XDR response) throws IOException {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used by AUTH_SYS */
|
/**
|
||||||
|
* Used by AUTH_SYS.
|
||||||
|
* Return the uid of the NFS user credential.
|
||||||
|
* @return uid
|
||||||
|
*/
|
||||||
public int getUid() {
|
public int getUid() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used by AUTH_SYS */
|
/**
|
||||||
|
* Used by AUTH_SYS.
|
||||||
|
* Return the gid of the NFS user credential.
|
||||||
|
* @return gid
|
||||||
|
*/
|
||||||
public int getGid() {
|
public int getGid() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Used by AUTH_SYS */
|
/**
|
||||||
|
* Used by AUTH_SYS.
|
||||||
|
* Return the auxiliary gids of the NFS user credential.
|
||||||
|
* @return auxiliary gids
|
||||||
|
*/
|
||||||
public int[] getAuxGids() {
|
public int[] getAuxGids() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,11 @@ protected Verifier(AuthFlavor flavor) {
|
|||||||
super(flavor);
|
super(flavor);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Read both AuthFlavor and the verifier from the XDR */
|
/**
|
||||||
|
* Read both AuthFlavor and the verifier from the XDR.
|
||||||
|
* @param xdr XDR message
|
||||||
|
* @return verifier
|
||||||
|
*/
|
||||||
public static Verifier readFlavorAndVerifier(XDR xdr) {
|
public static Verifier readFlavorAndVerifier(XDR xdr) {
|
||||||
AuthFlavor flavor = AuthFlavor.fromValue(xdr.readInt());
|
AuthFlavor flavor = AuthFlavor.fromValue(xdr.readInt());
|
||||||
final Verifier verifer;
|
final Verifier verifer;
|
||||||
@ -50,7 +54,9 @@ public static Verifier readFlavorAndVerifier(XDR xdr) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Write AuthFlavor and the verifier to the XDR
|
* Write AuthFlavor and the verifier to the XDR.
|
||||||
|
* @param verifier written to XDR
|
||||||
|
* @param xdr XDR message
|
||||||
*/
|
*/
|
||||||
public static void writeFlavorAndVerifier(Verifier verifier, XDR xdr) {
|
public static void writeFlavorAndVerifier(Verifier verifier, XDR xdr) {
|
||||||
if (verifier instanceof VerifierNone) {
|
if (verifier instanceof VerifierNone) {
|
||||||
|
Loading…
Reference in New Issue
Block a user