HADOOP-13418. Fix javadoc warnings by JDK8 in hadoop-nfs package. Contributed by Kai Sasaki.

This commit is contained in:
Masatake Iwasaki 2016-08-06 12:22:02 +09:00
parent 49ba09a922
commit 10ed06a0c9
17 changed files with 296 additions and 51 deletions

View File

@ -43,7 +43,10 @@ public int getValue() {
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) {
if (value < 0 || value >= values().length) {
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);
/** 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);
/** 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);
/** 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);
/** 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);
/** MNTPROC_EXPORT and MNTPROC_EXPORTALL - Return export list */

View File

@ -36,7 +36,14 @@ public class 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,
byte[] handle) {
RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr);
@ -50,7 +57,13 @@ public static XDR writeMNTResponse(int status, XDR xdr, int xid,
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) {
RpcAcceptedReply.getAcceptInstance(xid, new VerifierNone()).write(xdr);
for (MountEntry mountEntry : mounts) {
@ -62,7 +75,14 @@ public static XDR writeMountList(XDR xdr, int xid, List<MountEntry> mounts) {
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,
List<NfsExports> hostMatcher) {
assert (exports.size() == hostMatcher.size());

View File

@ -48,8 +48,8 @@ public RpcProgram getRpcProgram() {
/**
* Constructor
* @param program
* @throws IOException
* @param program rpc server which handles mount request
* @throws IOException fail to construct MountdBase
*/
public MountdBase(RpcProgram program) throws IOException {
rpcProgram = program;

View File

@ -172,6 +172,7 @@ public long getExpirationTime() {
/**
* Return the configured group list
* @return host group list
*/
public String[] getHostGroupList() {
int listSize = mMatches.size();

View File

@ -54,6 +54,7 @@ public int getNseconds() {
/**
* Get the total time in milliseconds
* @return convert to milli seconds
*/
public long getMilliSeconds() {
return (long) (seconds) * 1000 + (long) (nseconds) / 1000000;

View File

@ -45,6 +45,7 @@ public FileHandle() {
/**
* Handle is a 32 bytes number. For HDFS, the last 8 bytes is fileId.
* @param v file id
*/
public FileHandle(long v) {
fileId = v;

View File

@ -76,7 +76,11 @@ public int getValue() {
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) {
if (value < 0 || value >= values().length) {
return null;

View File

@ -26,69 +26,176 @@
*/
public interface Nfs3Interface {
/** NULL: Do nothing */
/**
* NULL: Do nothing.
* @return null NFS procedure
*/
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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
/** 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);
}

View File

@ -40,6 +40,7 @@ static FileHandle readHandle(XDR xdr) throws IOException {
/**
* Subclass should implement. Usually handle is the first to be serialized
* @param xdr XDR message
*/
public abstract void serialize(XDR xdr);
}

View File

@ -43,6 +43,10 @@ public void setStatus(int status) {
/**
* Write the response, along with the rpc header (including verifier), to the
* 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) {
RpcAcceptedReply reply = RpcAcceptedReply.getAcceptInstance(xid, verifier);

View File

@ -122,12 +122,20 @@ protected boolean removeEldestEntry(
};
}
/** Return the program name */
/**
* Return the program name.
* @return RPC program name
*/
public String getProgram() {
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) {
ClientRequest req = new ClientRequest(clientId, xid);
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
* as in progress.
* @param clientId client IP address
* @param xid transaction id
* @return cached entry
*/
public CacheEntry checkOrAddToCache(InetAddress clientId, int xid) {
ClientRequest req = new ClientRequest(clientId, xid);
@ -154,14 +165,17 @@ public CacheEntry checkOrAddToCache(InetAddress clientId, int xid) {
return e;
}
/** Return number of cached entries */
/**
* Return number of cached entries.
* @return cache size
*/
public int size() {
return map.size();
}
/**
* Iterator to the cache entries
* @return iterator
* Iterator to the cache entries.
* @return iterator cache iterator
*/
@VisibleForTesting
public Iterator<Entry<ClientRequest, CacheEntry>> iterator() {

View File

@ -87,6 +87,8 @@ protected RpcProgram(String program, String host, int port, int progNumber,
/**
* 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) {
if (boundPort != port) {
@ -104,6 +106,8 @@ public void register(int transport, int boundPort) {
/**
* 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) {
if (boundPort != port) {
@ -121,6 +125,8 @@ public void unregister(int transport, int boundPort) {
/**
* 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) {
XDR mappingRequest = PortmapRequest.create(mapEntry, set);

View File

@ -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) {
return xdr.buf.remaining() >= len;
}
@ -231,7 +236,12 @@ static byte[] recordMark(int size, boolean last) {
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) {
Preconditions.checkState(request.state == XDR.State.WRITING);
ByteBuffer b = request.buf.duplicate();
@ -243,7 +253,11 @@ public static ChannelBuffer writeMessageTcp(XDR request, boolean last) {
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) {
Preconditions.checkState(response.state == XDR.State.READING);
// TODO: Investigate whether making a copy of the buffer is necessary.

View File

@ -48,6 +48,8 @@ public static Credentials readFlavorAndCredentials(XDR xdr) {
/**
* Write AuthFlavor and the credentials to the XDR
* @param cred credentials
* @param xdr XDR message
*/
public static void writeFlavorAndCredentials(Credentials cred, XDR xdr) {
if (cred instanceof CredentialsNone) {

View File

@ -57,10 +57,15 @@ protected RpcAuthInfo(AuthFlavor flavor) {
this.flavor = flavor;
}
/** Load auth info */
/**
* Load auth info.
* @param xdr XDR message
*/
public abstract void read(XDR xdr);
/** Write auth info */
/** Write auth info.
* @param xdr XDR message
*/
public abstract void write(XDR xdr);
public AuthFlavor getFlavor() {

View File

@ -41,27 +41,51 @@ public boolean isWrapRequired() {
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 {
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 {
throw new UnsupportedOperationException();
}
/** Used by AUTH_SYS */
/**
* Used by AUTH_SYS.
* Return the uid of the NFS user credential.
* @return uid
*/
public int getUid() {
throw new UnsupportedOperationException();
}
/** Used by AUTH_SYS */
/**
* Used by AUTH_SYS.
* Return the gid of the NFS user credential.
* @return gid
*/
public int getGid() {
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() {
throw new UnsupportedOperationException();
}

View File

@ -33,7 +33,11 @@ protected Verifier(AuthFlavor 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) {
AuthFlavor flavor = AuthFlavor.fromValue(xdr.readInt());
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) {
if (verifier instanceof VerifierNone) {