diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RegistrationClient.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RegistrationClient.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RegistrationClient.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RegistrationClient.java
index c96f1d53bb..469acbb256 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RegistrationClient.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RegistrationClient.java
@@ -86,7 +86,7 @@ public void channelRead(ChannelHandlerContext ctx, Object msg) {
}
private void handle(RpcDeniedReply deniedReply) {
- LOG.warn("Portmap mapping registration request was denied , " +
+ LOG.warn("Portmap mapping registration request was denied , " +
deniedReply);
}
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcAcceptedReply.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcAcceptedReply.java
similarity index 97%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcAcceptedReply.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcAcceptedReply.java
index 9b6b57b997..b5df9c8a4b 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcAcceptedReply.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcAcceptedReply.java
@@ -19,7 +19,7 @@
import org.apache.hadoop.oncrpc.security.Verifier;
-/**
+/**
* Represents RPC message MSG_ACCEPTED reply body. See RFC 1831 for details.
* This response is sent to a request to indicate success of the request.
*/
@@ -32,7 +32,7 @@ public enum AcceptState {
PROC_UNAVAIL, /* program can't support procedure */
GARBAGE_ARGS, /* procedure can't decode params */
SYSTEM_ERR; /* e.g. memory allocation failure */
-
+
public static AcceptState fromValue(int value) {
return values()[value];
}
@@ -41,12 +41,12 @@ public int getValue() {
return ordinal();
}
};
-
- public static RpcAcceptedReply getAcceptInstance(int xid,
+
+ public static RpcAcceptedReply getAcceptInstance(int xid,
Verifier verifier) {
return getInstance(xid, AcceptState.SUCCESS, verifier);
}
-
+
public static RpcAcceptedReply getInstance(int xid, AcceptState state,
Verifier verifier) {
return new RpcAcceptedReply(xid, ReplyState.MSG_ACCEPTED, verifier,
@@ -70,7 +70,7 @@ public static RpcAcceptedReply read(int xid, ReplyState replyState, XDR xdr) {
public AcceptState getAcceptState() {
return acceptState;
}
-
+
@Override
public XDR write(XDR xdr) {
xdr.writeInt(xid);
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java
index 04fddecea5..de7d783e42 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCall.java
@@ -31,17 +31,17 @@ public class RpcCall extends RpcMessage {
public static RpcCall read(XDR xdr) {
return new RpcCall(xdr.readInt(), RpcMessage.Type.fromValue(xdr.readInt()),
- xdr.readInt(), xdr.readInt(), xdr.readInt(), xdr.readInt(),
+ xdr.readInt(), xdr.readInt(), xdr.readInt(), xdr.readInt(),
Credentials.readFlavorAndCredentials(xdr),
Verifier.readFlavorAndVerifier(xdr));
}
-
+
public static RpcCall getInstance(int xid, int program, int version,
int procedure, Credentials cred, Verifier verifier) {
return new RpcCall(xid, RpcMessage.Type.RPC_CALL, 2, program, version,
procedure, cred, verifier);
}
-
+
private final int rpcVersion;
private final int program;
private final int version;
@@ -64,14 +64,14 @@ protected RpcCall(int xid, RpcMessage.Type messageType, int rpcVersion,
}
validate();
}
-
+
private void validateRpcVersion() {
if (rpcVersion != RPC_VERSION) {
throw new IllegalArgumentException("RPC version is expected to be "
+ RPC_VERSION + " but got " + rpcVersion);
}
}
-
+
public void validate() {
validateMessageType(RpcMessage.Type.RPC_CALL);
validateRpcVersion();
@@ -95,7 +95,7 @@ public int getVersion() {
public int getProcedure() {
return procedure;
}
-
+
public Credentials getCredential() {
return credentials;
}
@@ -103,7 +103,7 @@ public Credentials getCredential() {
public Verifier getVerifier() {
return verifier;
}
-
+
@Override
public XDR write(XDR xdr) {
xdr.writeInt(xid);
@@ -116,7 +116,7 @@ public XDR write(XDR xdr) {
Verifier.writeFlavorAndVerifier(verifier, xdr);
return xdr;
}
-
+
@Override
public String toString() {
return String.format("Xid:%d, messageType:%s, rpcVersion:%d, program:%d,"
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java
similarity index 97%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java
index 3a2a25038f..0de4048c0a 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcCallCache.java
@@ -39,34 +39,34 @@
*
* A request is identified by the client ID (address of the client) and
* transaction ID (xid) from the Rpc call.
- *
+ *
*/
public class RpcCallCache {
-
+
public static class CacheEntry {
private RpcResponse response; // null if no response has been sent
-
+
public CacheEntry() {
response = null;
}
-
+
public boolean isInProgress() {
return response == null;
}
-
+
public boolean isCompleted() {
return response != null;
}
-
+
public RpcResponse getResponse() {
return response;
}
-
+
public void setResponse(RpcResponse response) {
this.response = response;
}
}
-
+
/**
* Call that is used to track a client in the {@link RpcCallCache}
*/
@@ -85,9 +85,9 @@ public ClientRequest(InetAddress clientId, int xid) {
@Override
public int hashCode() {
- return xid + clientId.hashCode() * 31;
+ return xid + clientId.hashCode() * 31;
}
-
+
@Override
public boolean equals(Object obj) {
if (this == obj) {
@@ -100,11 +100,11 @@ public boolean equals(Object obj) {
return clientId.equals(other.clientId) && (xid == other.xid);
}
}
-
+
private final String program;
-
+
private final Map map;
-
+
public RpcCallCache(final String program, final int maxEntries) {
if (maxEntries <= 0) {
throw new IllegalArgumentException("Cache size is " + maxEntries
@@ -121,7 +121,7 @@ protected boolean removeEldestEntry(
}
};
}
-
+
/**
* Return the program name.
* @return RPC program name
@@ -144,7 +144,7 @@ public void callCompleted(InetAddress clientId, int xid, RpcResponse response) {
}
e.response = response;
}
-
+
/**
* Check the cache for an entry. If it does not exist, add the request
* as in progress.
@@ -164,7 +164,7 @@ public CacheEntry checkOrAddToCache(InetAddress clientId, int xid) {
}
return e;
}
-
+
/**
* Return number of cached entries.
* @return cache size
@@ -172,8 +172,8 @@ public CacheEntry checkOrAddToCache(InetAddress clientId, int xid) {
public int size() {
return map.size();
}
-
- /**
+
+ /**
* Iterator to the cache entries.
* @return iterator cache iterator
*/
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcDeniedReply.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcDeniedReply.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcDeniedReply.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcDeniedReply.java
index 2c4a0946c0..62bbd93342 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcDeniedReply.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcDeniedReply.java
@@ -19,7 +19,7 @@
import org.apache.hadoop.oncrpc.security.Verifier;
-/**
+/**
* Represents RPC message MSG_DENIED reply body. See RFC 1831 for details.
* This response is sent to a request to indicate failure of the request.
*/
@@ -55,7 +55,7 @@ public static RpcDeniedReply read(int xid, ReplyState replyState, XDR xdr) {
public RejectState getRejectState() {
return rejectState;
}
-
+
@Override
public String toString() {
return new StringBuffer().append("xid:").append(xid)
@@ -63,7 +63,7 @@ public String toString() {
.append(verifier.getFlavor()).append("rejectState:")
.append(rejectState).toString();
}
-
+
@Override
public XDR write(XDR xdr) {
xdr.writeInt(xid);
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcInfo.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcInfo.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcInfo.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcInfo.java
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcMessage.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcMessage.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcMessage.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcMessage.java
index 85cec7613b..dd4ce1196f 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcMessage.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcMessage.java
@@ -26,7 +26,7 @@ public enum Type {
// the order of the values below are significant.
RPC_CALL,
RPC_REPLY;
-
+
public int getValue() {
return ordinal();
}
@@ -41,7 +41,7 @@ public static Type fromValue(int value) {
protected final int xid;
protected final Type messageType;
-
+
RpcMessage(int xid, Type messageType) {
if (messageType != Type.RPC_CALL && messageType != Type.RPC_REPLY) {
throw new IllegalArgumentException("Invalid message type " + messageType);
@@ -49,9 +49,9 @@ public static Type fromValue(int value) {
this.xid = xid;
this.messageType = messageType;
}
-
+
public abstract XDR write(XDR xdr);
-
+
public int getXid() {
return xid;
}
@@ -59,7 +59,7 @@ public int getXid() {
public Type getMessageType() {
return messageType;
}
-
+
protected void validateMessageType(Type expected) {
if (expected != messageType) {
throw new IllegalArgumentException("Message type is expected to be "
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java
index 5364712646..0796ba44e2 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcProgram.java
@@ -49,7 +49,7 @@ public abstract class RpcProgram extends ChannelInboundHandlerAdapter {
private final int lowProgVersion;
private final int highProgVersion;
protected final boolean allowInsecurePorts;
-
+
/**
* If not null, this will be used as the socket to use to connect to the
* system portmap daemon when registering this RPC server program.
@@ -69,7 +69,7 @@ protected RpcProgram(String program, String host, int port, int progNumber,
/**
* Constructor
- *
+ *
* @param program program name
* @param host host where the Rpc server program is started
* @param port port where the Rpc server program is listening to
@@ -117,7 +117,7 @@ public void register(int transport, int boundPort) {
register(mapEntry, true);
}
}
-
+
/**
* Unregister this program with the local portmapper.
* @param transport transport layer for port map
@@ -136,7 +136,7 @@ public void unregister(int transport, int boundPort) {
register(mapEntry, false);
}
}
-
+
/**
* Register the program with Portmap or Rpcbind.
* @param mapEntry port map entries
@@ -159,7 +159,7 @@ protected void register(PortmapMapping mapEntry, boolean set) {
// Start extra daemons or services
public void startDaemons() {}
public void stopDaemons() {}
-
+
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg)
throws Exception {
@@ -178,7 +178,7 @@ private void channelRead(ChannelHandlerContext ctx, RpcInfo info)
if (LOG.isTraceEnabled()) {
LOG.trace(program + " procedure #" + call.getProcedure());
}
-
+
if (this.progNumber != call.getProgram()) {
LOG.warn("Invalid RPC call program " + call.getProgram());
sendAcceptedReply(call, remoteAddress, AcceptState.PROG_UNAVAIL, ctx);
@@ -191,10 +191,10 @@ private void channelRead(ChannelHandlerContext ctx, RpcInfo info)
sendAcceptedReply(call, remoteAddress, AcceptState.PROG_MISMATCH, ctx);
return;
}
-
+
handleInternal(ctx, info);
}
-
+
public boolean doPortMonitoring(SocketAddress remoteAddress) {
if (!allowInsecurePorts) {
if (LOG.isTraceEnabled()) {
@@ -217,7 +217,7 @@ public boolean doPortMonitoring(SocketAddress remoteAddress) {
}
return true;
}
-
+
private void sendAcceptedReply(RpcCall call, SocketAddress remoteAddress,
AcceptState acceptState, ChannelHandlerContext ctx) {
RpcAcceptedReply reply = RpcAcceptedReply.getInstance(call.getXid(),
@@ -234,7 +234,7 @@ private void sendAcceptedReply(RpcCall call, SocketAddress remoteAddress,
RpcResponse rsp = new RpcResponse(b, remoteAddress);
RpcUtil.sendRpcResponse(ctx, rsp);
}
-
+
protected static void sendRejectedReply(RpcCall call,
SocketAddress remoteAddress, ChannelHandlerContext ctx) {
XDR out = new XDR();
@@ -249,14 +249,14 @@ protected static void sendRejectedReply(RpcCall call,
}
protected abstract void handleInternal(ChannelHandlerContext ctx, RpcInfo info);
-
+
@Override
public String toString() {
return "Rpc program: " + program + " at " + host + ":" + port;
}
-
+
protected abstract boolean isIdempotent(RpcCall call);
-
+
public int getPort() {
return port;
}
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcReply.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcReply.java
similarity index 98%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcReply.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcReply.java
index cde554e89a..bb9d7fa134 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcReply.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcReply.java
@@ -30,25 +30,25 @@ public enum ReplyState {
// the order of the values below are significant.
MSG_ACCEPTED,
MSG_DENIED;
-
+
int getValue() {
return ordinal();
}
-
+
public static ReplyState fromValue(int value) {
return values()[value];
}
}
-
+
protected final ReplyState replyState;
protected final Verifier verifier;
-
+
RpcReply(int xid, ReplyState state, Verifier verifier) {
super(xid, RpcMessage.Type.RPC_REPLY);
this.replyState = state;
this.verifier = verifier;
}
-
+
public RpcAuthInfo getVerifier() {
return verifier;
}
@@ -57,7 +57,7 @@ public static RpcReply read(XDR xdr) {
int xid = xdr.readInt();
final Type messageType = Type.fromValue(xdr.readInt());
Preconditions.checkState(messageType == RpcMessage.Type.RPC_REPLY);
-
+
ReplyState stat = ReplyState.fromValue(xdr.readInt());
switch (stat) {
case MSG_ACCEPTED:
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcResponse.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcResponse.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcResponse.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcResponse.java
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcUtil.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcUtil.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/RpcUtil.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/RpcUtil.java
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClient.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClient.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClient.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClient.java
index fdd28bff32..b472c972fb 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClient.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClient.java
@@ -39,11 +39,11 @@ public class SimpleTcpClient {
protected final boolean oneShot;
private NioEventLoopGroup workerGroup;
private ChannelFuture future;
-
+
public SimpleTcpClient(String host, int port, XDR request) {
this(host,port, request, true);
}
-
+
public SimpleTcpClient(String host, int port, XDR request, Boolean oneShot) {
this.host = host;
this.port = port;
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClientHandler.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClientHandler.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClientHandler.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpClientHandler.java
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java
index 29155c80b1..418e638f68 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleTcpServer.java
@@ -93,7 +93,7 @@ protected void initChannel(SocketChannel ch) throws Exception {
LOG.info("Started listening to TCP requests at port " + boundPort + " for "
+ rpcProgram + " with workerCount " + workerCount);
}
-
+
// boundPort will be set only after server starts
public int getBoundPort() {
return this.boundPort;
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpClient.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpClient.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpClient.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpClient.java
index 2b6dcaf0b6..b899dc22a7 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpClient.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpClient.java
@@ -27,7 +27,7 @@
* A simple UDP based RPC client which just sends one request to a server.
*/
public class SimpleUdpClient {
-
+
protected final String host;
protected final int port;
protected final XDR request;
@@ -71,7 +71,7 @@ public void run() throws IOException {
DatagramPacket receivePacket = new DatagramPacket(receiveData,
receiveData.length);
socket.receive(receivePacket);
-
+
// Check reply status
XDR xdr = new XDR(Arrays.copyOfRange(receiveData, 0,
receivePacket.getLength()));
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpServer.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpServer.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpServer.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/SimpleUdpServer.java
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/XDR.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/XDR.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/XDR.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/XDR.java
index 1bf860d49b..9fc67b5eb9 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/XDR.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/XDR.java
@@ -76,7 +76,7 @@ public XDR(ByteBuffer buf, State state) {
* Wraps a byte array as a read-only XDR message. There's no copy involved,
* thus it is the client's responsibility to ensure that the byte array
* remains unmodified when using the XDR object.
- *
+ *
* @param src
* the byte array to be wrapped.
*/
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/package-info.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/package-info.java
new file mode 100644
index 0000000000..0fa7f5e4b0
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/package-info.java
@@ -0,0 +1,28 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This package provides ONC RPC implementation with simple UDP/TCP
+ * Servers and clients.
+ */
+@InterfaceAudience.Private
+@InterfaceStability.Evolving
+package org.apache.hadoop.oncrpc;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java
index e42fc0db2c..73fda275b8 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/Credentials.java
@@ -45,7 +45,7 @@ public static Credentials readFlavorAndCredentials(XDR xdr) {
credentials.read(xdr);
return credentials;
}
-
+
/**
* Write AuthFlavor and the credentials to the XDR
* @param cred credentials
@@ -63,9 +63,9 @@ public static void writeFlavorAndCredentials(Credentials cred, XDR xdr) {
}
cred.write(xdr);
}
-
+
protected int mCredentialsLength;
-
+
protected Credentials(AuthFlavor flavor) {
super(flavor);
}
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsGSS.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsGSS.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsGSS.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsGSS.java
index 0dd80dc089..5173bba8b8 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsGSS.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsGSS.java
@@ -29,13 +29,13 @@ public CredentialsGSS() {
@Override
public void read(XDR xdr) {
// TODO Auto-generated method stub
-
+
}
@Override
public void write(XDR xdr) {
// TODO Auto-generated method stub
-
+
}
}
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsNone.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsNone.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsNone.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsNone.java
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsSys.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsSys.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsSys.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsSys.java
index d057cca654..74445ee5e4 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsSys.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/CredentialsSys.java
@@ -26,7 +26,7 @@
/** Credential used by AUTH_SYS */
public class CredentialsSys extends Credentials {
-
+
private static final String HOSTNAME;
static {
try {
@@ -40,7 +40,7 @@ public class CredentialsSys extends Credentials {
throw new RuntimeException(e);
}
}
-
+
protected int mUID, mGID;
protected int[] mAuxGIDs;
protected String mHostName;
@@ -51,7 +51,7 @@ public CredentialsSys() {
this.mCredentialsLength = 0;
this.mHostName = HOSTNAME;
}
-
+
public int getGID() {
return mGID;
}
@@ -117,12 +117,12 @@ public void write(XDR xdr) {
mCredentialsLength += mAuxGIDs.length * 4;
}
xdr.writeInt(mCredentialsLength);
-
+
xdr.writeInt(mStamp);
xdr.writeString(mHostName);
xdr.writeInt(mUID);
xdr.writeInt(mGID);
-
+
if((mAuxGIDs == null) || (mAuxGIDs.length == 0)) {
xdr.writeInt(0);
} else {
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java
similarity index 98%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java
index 52442720ed..0c3822a7e0 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/RpcAuthInfo.java
@@ -30,17 +30,17 @@ public enum AuthFlavor {
AUTH_SHORT(2),
AUTH_DH(3),
RPCSEC_GSS(6);
-
+
private int value;
-
+
AuthFlavor(int value) {
this.value = value;
}
-
+
public int getValue() {
return value;
}
-
+
static AuthFlavor fromValue(int value) {
for (AuthFlavor v : values()) {
if (v.value == value) {
@@ -50,28 +50,28 @@ static AuthFlavor fromValue(int value) {
throw new IllegalArgumentException("Invalid AuthFlavor value " + value);
}
}
-
+
private final AuthFlavor flavor;
-
+
protected RpcAuthInfo(AuthFlavor flavor) {
this.flavor = flavor;
}
-
+
/**
* Load auth info.
* @param xdr XDR message
*/
public abstract void read(XDR xdr);
-
+
/** Write auth info.
* @param xdr XDR message
*/
public abstract void write(XDR xdr);
-
+
public AuthFlavor getFlavor() {
return flavor;
}
-
+
@Override
public String toString() {
return "(AuthFlavor:" + flavor + ")";
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java
index 4a674e81de..966de52149 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/SecurityHandler.java
@@ -27,7 +27,7 @@
public abstract class SecurityHandler {
public static final Logger LOG =
LoggerFactory.getLogger(SecurityHandler.class);
-
+
public abstract String getUser();
public abstract boolean shouldSilentlyDrop(RpcCall request);
@@ -52,7 +52,7 @@ public boolean isWrapRequired() {
public XDR unwrap(RpcCall request, byte[] data ) throws IOException {
throw new UnsupportedOperationException();
}
-
+
/**
* Used by GSS.
* @param request RPC request
@@ -63,7 +63,7 @@ public XDR unwrap(RpcCall request, byte[] data ) throws IOException {
public byte[] wrap(RpcCall request, XDR response) throws IOException {
throw new UnsupportedOperationException();
}
-
+
/**
* Used by AUTH_SYS.
* Return the uid of the NFS user credential.
@@ -72,7 +72,7 @@ public byte[] wrap(RpcCall request, XDR response) throws IOException {
public int getUid() {
throw new UnsupportedOperationException();
}
-
+
/**
* Used by AUTH_SYS.
* Return the gid of the NFS user credential.
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SysSecurityHandler.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/SysSecurityHandler.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SysSecurityHandler.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/SysSecurityHandler.java
index 1ca4dbe2cc..3603446c3c 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/SysSecurityHandler.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/SysSecurityHandler.java
@@ -22,16 +22,16 @@
import org.apache.hadoop.security.IdMappingServiceProvider;
public class SysSecurityHandler extends SecurityHandler {
-
+
private final IdMappingServiceProvider iug;
private final CredentialsSys mCredentialsSys;
-
+
public SysSecurityHandler(CredentialsSys credentialsSys,
IdMappingServiceProvider iug) {
this.mCredentialsSys = credentialsSys;
this.iug = iug;
}
-
+
@Override
public String getUser() {
return iug.getUserName(mCredentialsSys.getUID(),
@@ -47,12 +47,12 @@ public boolean shouldSilentlyDrop(RpcCall request) {
public VerifierNone getVerifer(RpcCall request) {
return new VerifierNone();
}
-
+
@Override
public int getUid() {
return mCredentialsSys.getUID();
}
-
+
@Override
public int getGid() {
return mCredentialsSys.getGID();
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java
index 585e9fb5f4..2789bb14ed 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/Verifier.java
@@ -56,7 +56,7 @@ public static Verifier readFlavorAndVerifier(XDR xdr) {
verifer.read(xdr);
return verifer;
}
-
+
/**
* Write AuthFlavor and the verifier to the XDR.
* @param verifier written to XDR
@@ -71,5 +71,5 @@ public static void writeFlavorAndVerifier(Verifier verifier, XDR xdr) {
throw new UnsupportedOperationException("Cannot recognize the verifier");
}
verifier.write(xdr);
- }
+ }
}
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/VerifierGSS.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/VerifierGSS.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/VerifierGSS.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/VerifierGSS.java
index 7410070b12..efa08d0711 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/VerifierGSS.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/VerifierGSS.java
@@ -29,13 +29,13 @@ public VerifierGSS() {
@Override
public void read(XDR xdr) {
// TODO Auto-generated method stub
-
+
}
@Override
public void write(XDR xdr) {
// TODO Auto-generated method stub
-
+
}
}
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/VerifierNone.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/VerifierNone.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/oncrpc/security/VerifierNone.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/VerifierNone.java
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/package-info.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/package-info.java
new file mode 100644
index 0000000000..c512430068
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/oncrpc/security/package-info.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This package provides security related implementation for ONC RPC.
+ */
+@InterfaceAudience.Private
+@InterfaceStability.Evolving
+package org.apache.hadoop.oncrpc.security;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/Portmap.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/Portmap.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/Portmap.java
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapMapping.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/PortmapMapping.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapMapping.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/PortmapMapping.java
index f73ab02c60..5cc3c97fdd 100644
--- a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapMapping.java
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/PortmapMapping.java
@@ -22,7 +22,7 @@
/**
* Represents a mapping entry for in the Portmap service for binding RPC
* protocols. See RFC 1833 for details.
- *
+ *
* This maps a program to a port number.
*/
public class PortmapMapping {
@@ -61,7 +61,7 @@ public int getPort() {
public static String key(PortmapMapping mapping) {
return mapping.program + " " + mapping.version + " " + mapping.transport;
}
-
+
@Override
public String toString() {
return String.format("(PortmapMapping-%d:%d:%d:%d)", program, version,
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapRequest.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/PortmapRequest.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapRequest.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/PortmapRequest.java
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapResponse.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/PortmapResponse.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/PortmapResponse.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/PortmapResponse.java
diff --git a/hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/RpcProgramPortmap.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/RpcProgramPortmap.java
similarity index 100%
rename from hadoop-common-project/hadoop-nfs/src/main/java/org/apache/hadoop/portmap/RpcProgramPortmap.java
rename to hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/RpcProgramPortmap.java
diff --git a/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/package-info.java b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/package-info.java
new file mode 100644
index 0000000000..dcfc3066bd
--- /dev/null
+++ b/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/portmap/package-info.java
@@ -0,0 +1,27 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * This package provides a port mapper implementation used by ONC RPC.
+ */
+@InterfaceAudience.Private
+@InterfaceStability.Evolving
+package org.apache.hadoop.portmap;
+
+import org.apache.hadoop.classification.InterfaceAudience;
+import org.apache.hadoop.classification.InterfaceStability;
diff --git a/hadoop-common-project/hadoop-nfs/src/test/java/org/apache/hadoop/oncrpc/TestFrameDecoder.java b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/oncrpc/TestFrameDecoder.java
similarity index 99%
rename from hadoop-common-project/hadoop-nfs/src/test/java/org/apache/hadoop/oncrpc/TestFrameDecoder.java
rename to hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/oncrpc/TestFrameDecoder.java
index 6d103fdd78..a8141d762d 100644
--- a/hadoop-common-project/hadoop-nfs/src/test/java/org/apache/hadoop/oncrpc/TestFrameDecoder.java
+++ b/hadoop-common-project/hadoop-common/src/test/java/org/apache/hadoop/oncrpc/TestFrameDecoder.java
@@ -40,7 +40,7 @@
import org.slf4j.event.Level;
public class TestFrameDecoder {
-
+
static {
GenericTestUtils.setLogLevel(RpcProgram.LOG, Level.TRACE);
}
@@ -78,7 +78,7 @@ protected void handleInternal(ChannelHandlerContext ctx, RpcInfo info) {
return;
}
}
-
+
resultSize = info.data().readableBytes();
RpcAcceptedReply reply = RpcAcceptedReply.getAcceptInstance(1234,
new VerifierNone());
@@ -127,7 +127,7 @@ public void testSingleFrame() {
assertTrue(decoder.isLast());
buf.release();
}
-
+
@Test
public void testMultipleFrames() {
RpcFrameDecoder decoder = new RpcFrameDecoder();
@@ -142,7 +142,7 @@ public void testMultipleFrames() {
assertTrue(XDR.fragmentSize(fragment1)==10);
List