You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-commits@hadoop.apache.org by sz...@apache.org on 2012/04/18 05:26:42 UTC
svn commit: r1327366 - in
/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs: ./
src/main/java/
src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/
src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/
Author: szetszwo
Date: Wed Apr 18 03:26:42 2012
New Revision: 1327366
URL: http://svn.apache.org/viewvc?rev=1327366&view=rev
Log:
svn merge -c 1327365 from trunk for HDFS-3294. Fix code indentation in NamenodeWebHdfsMethods and DatanodeWebHdfsMethods.
Modified:
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/ (props changed)
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/ (props changed)
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/DatanodeWebHdfsMethods.java
hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
Propchange: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs:r1327365
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt?rev=1327366&r1=1327365&r2=1327366&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/CHANGES.txt Wed Apr 18 03:26:42 2012
@@ -254,6 +254,9 @@ Release 2.0.0 - UNRELEASED
HDFS-3279. Move the FSEditLog constructor with @VisibleForTesting to
TestEditLog. (Arpit Gupta via szetszwo)
+ HDFS-3294. Fix code indentation in NamenodeWebHdfsMethods and
+ DatanodeWebHdfsMethods. (szetszwo)
+
OPTIMIZATIONS
HDFS-2477. Optimize computing the diff between a block report and the
Propchange: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/
------------------------------------------------------------------------------
Merged /hadoop/common/trunk/hadoop-hdfs-project/hadoop-hdfs/src/main/java:r1327365
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/DatanodeWebHdfsMethods.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/DatanodeWebHdfsMethods.java?rev=1327366&r1=1327365&r2=1327366&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/DatanodeWebHdfsMethods.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/datanode/web/resources/DatanodeWebHdfsMethods.java Wed Apr 18 03:26:42 2012
@@ -178,8 +178,25 @@ public class DatanodeWebHdfsMethods {
return ugi.doAs(new PrivilegedExceptionAction<Response>() {
@Override
public Response run() throws IOException, URISyntaxException {
+ return put(in, ugi, delegation, nnRpcAddr, path.getAbsolutePath(), op,
+ permission, overwrite, bufferSize, replication, blockSize);
+ }
+ });
+ }
- final String fullpath = path.getAbsolutePath();
+ private Response put(
+ final InputStream in,
+ final UserGroupInformation ugi,
+ final DelegationParam delegation,
+ final InetSocketAddress nnRpcAddr,
+ final String fullpath,
+ final PutOpParam op,
+ final PermissionParam permission,
+ final OverwriteParam overwrite,
+ final BufferSizeParam bufferSize,
+ final ReplicationParam replication,
+ final BlockSizeParam blockSize
+ ) throws IOException, URISyntaxException {
final DataNode datanode = (DataNode)context.getAttribute("datanode");
switch(op.getValue()) {
@@ -214,8 +231,6 @@ public class DatanodeWebHdfsMethods {
default:
throw new UnsupportedOperationException(op + " is not supported");
}
- }
- });
}
/** Handle HTTP POST request for the root for the root. */
@@ -265,8 +280,21 @@ public class DatanodeWebHdfsMethods {
return ugi.doAs(new PrivilegedExceptionAction<Response>() {
@Override
public Response run() throws IOException {
+ return post(in, ugi, delegation, nnRpcAddr, path.getAbsolutePath(), op,
+ bufferSize);
+ }
+ });
+ }
- final String fullpath = path.getAbsolutePath();
+ private Response post(
+ final InputStream in,
+ final UserGroupInformation ugi,
+ final DelegationParam delegation,
+ final InetSocketAddress nnRpcAddr,
+ final String fullpath,
+ final PostOpParam op,
+ final BufferSizeParam bufferSize
+ ) throws IOException {
final DataNode datanode = (DataNode)context.getAttribute("datanode");
switch(op.getValue()) {
@@ -292,8 +320,6 @@ public class DatanodeWebHdfsMethods {
default:
throw new UnsupportedOperationException(op + " is not supported");
}
- }
- });
}
/** Handle HTTP GET request for the root. */
@@ -348,8 +374,22 @@ public class DatanodeWebHdfsMethods {
return ugi.doAs(new PrivilegedExceptionAction<Response>() {
@Override
public Response run() throws IOException {
+ return get(ugi, delegation, nnRpcAddr, path.getAbsolutePath(), op,
+ offset, length, bufferSize);
+ }
+ });
+ }
- final String fullpath = path.getAbsolutePath();
+ private Response get(
+ final UserGroupInformation ugi,
+ final DelegationParam delegation,
+ final InetSocketAddress nnRpcAddr,
+ final String fullpath,
+ final GetOpParam op,
+ final OffsetParam offset,
+ final LengthParam length,
+ final BufferSizeParam bufferSize
+ ) throws IOException {
final DataNode datanode = (DataNode)context.getAttribute("datanode");
final Configuration conf = new Configuration(datanode.getConf());
@@ -412,7 +452,5 @@ public class DatanodeWebHdfsMethods {
default:
throw new UnsupportedOperationException(op + " is not supported");
}
- }
- });
}
}
Modified: hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java?rev=1327366&r1=1327365&r2=1327366&view=diff
==============================================================================
--- hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java (original)
+++ hadoop/common/branches/branch-2/hadoop-hdfs-project/hadoop-hdfs/src/main/java/org/apache/hadoop/hdfs/server/namenode/web/resources/NamenodeWebHdfsMethods.java Wed Apr 18 03:26:42 2012
@@ -314,8 +314,40 @@ public class NamenodeWebHdfsMethods {
public Response run() throws IOException, URISyntaxException {
REMOTE_ADDRESS.set(request.getRemoteAddr());
try {
+ return put(ugi, delegation, username, doAsUser,
+ path.getAbsolutePath(), op, destination, owner, group,
+ permission, overwrite, bufferSize, replication, blockSize,
+ modificationTime, accessTime, renameOptions, createParent,
+ delegationTokenArgument);
+ } finally {
+ REMOTE_ADDRESS.set(null);
+ }
+ }
+ });
+ }
+
+ private Response put(
+ final UserGroupInformation ugi,
+ final DelegationParam delegation,
+ final UserParam username,
+ final DoAsParam doAsUser,
+ final String fullpath,
+ final PutOpParam op,
+ final DestinationParam destination,
+ final OwnerParam owner,
+ final GroupParam group,
+ final PermissionParam permission,
+ final OverwriteParam overwrite,
+ final BufferSizeParam bufferSize,
+ final ReplicationParam replication,
+ final BlockSizeParam blockSize,
+ final ModificationTimeParam modificationTime,
+ final AccessTimeParam accessTime,
+ final RenameOptionSetParam renameOptions,
+ final CreateParentParam createParent,
+ final TokenArgumentParam delegationTokenArgument
+ ) throws IOException, URISyntaxException {
- final String fullpath = path.getAbsolutePath();
final Configuration conf = (Configuration)context.getAttribute(JspHelper.CURRENT_CONF);
final NameNode namenode = (NameNode)context.getAttribute("name.node");
final NamenodeProtocols np = namenode.getRpcServer();
@@ -396,12 +428,6 @@ public class NamenodeWebHdfsMethods {
default:
throw new UnsupportedOperationException(op + " is not supported");
}
-
- } finally {
- REMOTE_ADDRESS.set(null);
- }
- }
- });
}
/** Handle HTTP POST request for the root. */
@@ -452,8 +478,24 @@ public class NamenodeWebHdfsMethods {
public Response run() throws IOException, URISyntaxException {
REMOTE_ADDRESS.set(request.getRemoteAddr());
try {
+ return post(ugi, delegation, username, doAsUser,
+ path.getAbsolutePath(), op, bufferSize);
+ } finally {
+ REMOTE_ADDRESS.set(null);
+ }
+ }
+ });
+ }
- final String fullpath = path.getAbsolutePath();
+ private Response post(
+ final UserGroupInformation ugi,
+ final DelegationParam delegation,
+ final UserParam username,
+ final DoAsParam doAsUser,
+ final String fullpath,
+ final PostOpParam op,
+ final BufferSizeParam bufferSize
+ ) throws IOException, URISyntaxException {
final NameNode namenode = (NameNode)context.getAttribute("name.node");
switch(op.getValue()) {
@@ -466,12 +508,6 @@ public class NamenodeWebHdfsMethods {
default:
throw new UnsupportedOperationException(op + " is not supported");
}
-
- } finally {
- REMOTE_ADDRESS.set(null);
- }
- }
- });
}
/** Handle HTTP GET request for the root. */
@@ -534,9 +570,28 @@ public class NamenodeWebHdfsMethods {
public Response run() throws IOException, URISyntaxException {
REMOTE_ADDRESS.set(request.getRemoteAddr());
try {
+ return get(ugi, delegation, username, doAsUser,
+ path.getAbsolutePath(), op, offset, length, renewer, bufferSize);
+ } finally {
+ REMOTE_ADDRESS.set(null);
+ }
+ }
+ });
+ }
+ private Response get(
+ final UserGroupInformation ugi,
+ final DelegationParam delegation,
+ final UserParam username,
+ final DoAsParam doAsUser,
+ final String fullpath,
+ final GetOpParam op,
+ final OffsetParam offset,
+ final LengthParam length,
+ final RenewerParam renewer,
+ final BufferSizeParam bufferSize
+ ) throws IOException, URISyntaxException {
final NameNode namenode = (NameNode)context.getAttribute("name.node");
- final String fullpath = path.getAbsolutePath();
final NamenodeProtocols np = namenode.getRpcServer();
switch(op.getValue()) {
@@ -613,13 +668,7 @@ public class NamenodeWebHdfsMethods {
}
default:
throw new UnsupportedOperationException(op + " is not supported");
- }
-
- } finally {
- REMOTE_ADDRESS.set(null);
- }
- }
- });
+ }
}
private static DirectoryListing getDirectoryListing(final NamenodeProtocols np,
@@ -712,25 +761,35 @@ public class NamenodeWebHdfsMethods {
public Response run() throws IOException {
REMOTE_ADDRESS.set(request.getRemoteAddr());
try {
-
- final NameNode namenode = (NameNode)context.getAttribute("name.node");
- final String fullpath = path.getAbsolutePath();
-
- switch(op.getValue()) {
- case DELETE:
- {
- final boolean b = namenode.getRpcServer().delete(fullpath, recursive.getValue());
- final String js = JsonUtil.toJsonString("boolean", b);
- return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
- }
- default:
- throw new UnsupportedOperationException(op + " is not supported");
- }
-
+ return delete(ugi, delegation, username, doAsUser,
+ path.getAbsolutePath(), op, recursive);
} finally {
REMOTE_ADDRESS.set(null);
}
}
});
}
+
+ private Response delete(
+ final UserGroupInformation ugi,
+ final DelegationParam delegation,
+ final UserParam username,
+ final DoAsParam doAsUser,
+ final String fullpath,
+ final DeleteOpParam op,
+ final RecursiveParam recursive
+ ) throws IOException {
+ final NameNode namenode = (NameNode)context.getAttribute("name.node");
+
+ switch(op.getValue()) {
+ case DELETE:
+ {
+ final boolean b = namenode.getRpcServer().delete(fullpath, recursive.getValue());
+ final String js = JsonUtil.toJsonString("boolean", b);
+ return Response.ok(js).type(MediaType.APPLICATION_JSON).build();
+ }
+ default:
+ throw new UnsupportedOperationException(op + " is not supported");
+ }
+ }
}