You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by co...@apache.org on 2010/07/28 05:21:10 UTC
svn commit: r979943 - in /hadoop/common/branches/branch-0.21: ./
src/contrib/ec2/ src/docs/ src/java/ src/test/core/
src/test/system/aop/org/apache/hadoop/test/system/
src/test/system/java/org/apache/hadoop/test/system/
Author: cos
Date: Wed Jul 28 03:21:10 2010
New Revision: 979943
URL: http://svn.apache.org/viewvc?rev=979943&view=rev
Log:
HADOOP-6869. svn merge -c 979942 from trunk
Modified:
hadoop/common/branches/branch-0.21/ (props changed)
hadoop/common/branches/branch-0.21/CHANGES.txt (contents, props changed)
hadoop/common/branches/branch-0.21/src/contrib/ec2/ (props changed)
hadoop/common/branches/branch-0.21/src/docs/ (props changed)
hadoop/common/branches/branch-0.21/src/java/ (props changed)
hadoop/common/branches/branch-0.21/src/test/core/ (props changed)
hadoop/common/branches/branch-0.21/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
hadoop/common/branches/branch-0.21/src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonClient.java
hadoop/common/branches/branch-0.21/src/test/system/java/org/apache/hadoop/test/system/DaemonProtocol.java
Propchange: hadoop/common/branches/branch-0.21/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 28 03:21:10 2010
@@ -1,2 +1,2 @@
-/hadoop/common/trunk:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,955438,961559,962914,964130,964134,964939,966508,966919,967220,979485
+/hadoop/common/trunk:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,955438,961559,962914,964130,964134,964939,966508,966919,967220,979485,979942
/hadoop/core/branches/branch-0.19/core:713112
Modified: hadoop/common/branches/branch-0.21/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.21/CHANGES.txt?rev=979943&r1=979942&r2=979943&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.21/CHANGES.txt (original)
+++ hadoop/common/branches/branch-0.21/CHANGES.txt Wed Jul 28 03:21:10 2010
@@ -283,6 +283,9 @@ Release 0.21.0 - 2010-07-01
HADOOP-6692. Add FileContext#listStatus that returns an iterator.
(hairong)
+ HADOOP-6869. Functionality to create file or folder on a remote daemon
+ side (Vinay Thota via cos)
+
IMPROVEMENTS
HADOOP-6798. Align Ivy version for all Hadoop subprojects. (cos)
Propchange: hadoop/common/branches/branch-0.21/CHANGES.txt
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 28 03:21:10 2010
@@ -1,4 +1,4 @@
-/hadoop/common/trunk/CHANGES.txt:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,951614,953504,955438,961559,962914,964130,964134,964939,966508,966919,967220
+/hadoop/common/trunk/CHANGES.txt:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,951614,953504,955438,961559,962914,964130,964134,964939,966508,966919,967220,979942
/hadoop/core/branches/branch-0.18/CHANGES.txt:727226
/hadoop/core/branches/branch-0.19/CHANGES.txt:713112
/hadoop/core/trunk/CHANGES.txt:776175-785643,785929-786278
Propchange: hadoop/common/branches/branch-0.21/src/contrib/ec2/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 28 03:21:10 2010
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/contrib/ec2:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,955438,961559,962914,964130,964134,964939,966508,966919,967220,979485
+/hadoop/common/trunk/src/contrib/ec2:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,955438,961559,962914,964130,964134,964939,966508,966919,967220,979485,979942
/hadoop/core/branches/branch-0.19/core/src/contrib/ec2:713112
/hadoop/core/trunk/src/contrib/ec2:776175-784663
Propchange: hadoop/common/branches/branch-0.21/src/docs/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 28 03:21:10 2010
@@ -1,2 +1,2 @@
-/hadoop/common/trunk/src/docs:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,955438,961559,962914,964130,964134,964939,966508,966919,967220,979485
+/hadoop/common/trunk/src/docs:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,955438,961559,962914,964130,964134,964939,966508,966919,967220,979485,979942
/hadoop/core/branches/branch-0.19/src/docs:713112
Propchange: hadoop/common/branches/branch-0.21/src/java/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 28 03:21:10 2010
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/java:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,955438,961559,962914,964130,964134,964939,966508,966919,967220,979485
+/hadoop/common/trunk/src/java:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,955438,961559,962914,964130,964134,964939,966508,966919,967220,979485,979942
/hadoop/core/branches/branch-0.19/core/src/java:713112
/hadoop/core/trunk/src/core:776175-785643,785929-786278
Propchange: hadoop/common/branches/branch-0.21/src/test/core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Wed Jul 28 03:21:10 2010
@@ -1,3 +1,3 @@
-/hadoop/common/trunk/src/test/core:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,955438,961559,962914,964130,964134,964939,966508,966919,967220,979485
+/hadoop/common/trunk/src/test/core:944521,945941-945953,947218,947222,947882,948174,948237,948242,950309,951259,955438,961559,962914,964130,964134,964939,966508,966919,967220,979485,979942
/hadoop/core/branches/branch-0.19/core/src/test/core:713112
/hadoop/core/trunk/src/test/core:776175-785643,785929-786278
Modified: hadoop/common/branches/branch-0.21/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.21/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj?rev=979943&r1=979942&r2=979943&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.21/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj (original)
+++ hadoop/common/branches/branch-0.21/src/test/system/aop/org/apache/hadoop/test/system/DaemonProtocolAspect.aj Wed Jul 28 03:21:10 2010
@@ -34,6 +34,8 @@ import org.apache.hadoop.util.Shell.Shel
import org.apache.hadoop.util.Shell;
import org.apache.hadoop.fs.FileStatus;
import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.permission.FsAction;
+import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.conf.Configuration;
@@ -53,6 +55,10 @@ public aspect DaemonProtocolAspect {
new HashMap<Object, List<ControlAction>>();
private static final Log LOG = LogFactory.getLog(
DaemonProtocolAspect.class.getName());
+
+ private static FsPermission defaultPermission = new FsPermission(
+ FsAction.READ_WRITE, FsAction.READ_WRITE, FsAction.READ_WRITE);
+
/**
* Set if the daemon process is ready or not, concrete daemon protocol should
* implement pointcuts to determine when the daemon is ready and use the
@@ -126,6 +132,50 @@ public aspect DaemonProtocolAspect {
FileStatus fileStatus = fs.getFileStatus(p);
return cloneFileStatus(fileStatus);
}
+
+ /**
+ * Create a file with given permissions in a file system.
+ * @param path - source path where the file has to create.
+ * @param fileName - file name.
+ * @param permission - file permissions.
+ * @param local - identifying the path whether its local or not.
+ * @throws IOException - if an I/O error occurs.
+ */
+ public void DaemonProtocol.createFile(String path, String fileName,
+ FsPermission permission, boolean local) throws IOException {
+ Path p = new Path(path);
+ FileSystem fs = getFS(p, local);
+ Path filePath = new Path(path, fileName);
+ fs.create(filePath);
+ if (permission == null) {
+ fs.setPermission(filePath, defaultPermission);
+ } else {
+ fs.setPermission(filePath, permission);
+ }
+ fs.close();
+ }
+
+ /**
+ * Create a folder with given permissions in a file system.
+ * @param path - source path where the file has to be creating.
+ * @param folderName - folder name.
+ * @param permission - folder permissions.
+ * @param local - identifying the path whether its local or not.
+ * @throws IOException - if an I/O error occurs.
+ */
+ public void DaemonProtocol.createFolder(String path, String folderName,
+ FsPermission permission, boolean local) throws IOException {
+ Path p = new Path(path);
+ FileSystem fs = getFS(p, local);
+ Path folderPath = new Path(path, folderName);
+ fs.mkdirs(folderPath);
+ if (permission == null) {
+ fs.setPermission(folderPath, defaultPermission);
+ } else {
+ fs.setPermission(folderPath, permission);
+ }
+ fs.close();
+ }
public FileStatus[] DaemonProtocol.listStatus(String path, boolean local)
throws IOException {
Modified: hadoop/common/branches/branch-0.21/src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonClient.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.21/src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonClient.java?rev=979943&r1=979942&r2=979943&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.21/src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonClient.java (original)
+++ hadoop/common/branches/branch-0.21/src/test/system/java/org/apache/hadoop/test/system/AbstractDaemonClient.java Wed Jul 28 03:21:10 2010
@@ -27,6 +27,8 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
+import org.apache.hadoop.fs.permission.FsPermission;
import org.apache.hadoop.test.system.process.RemoteProcess;
/**
* Abstract class which encapsulates the DaemonClient which is used in the
@@ -166,6 +168,56 @@ public abstract class AbstractDaemonClie
}
/**
+ * Create a file with full permissions in a file system.
+ * @param path - source path where the file has to create.
+ * @param fileName - file name
+ * @param local - identifying the path whether its local or not.
+ * @throws IOException - if an I/O error occurs.
+ */
+ public void createFile(String path, String fileName,
+ boolean local) throws IOException {
+ getProxy().createFile(path, fileName, null, local);
+ }
+
+ /**
+ * Create a file with given permissions in a file system.
+ * @param path - source path where the file has to create.
+ * @param fileName - file name.
+ * @param permission - file permissions.
+ * @param local - identifying the path whether its local or not.
+ * @throws IOException - if an I/O error occurs.
+ */
+ public void createFile(String path, String fileName,
+ FsPermission permission, boolean local) throws IOException {
+ getProxy().createFile(path, fileName, permission, local);
+ }
+
+ /**
+ * Create a folder with default permissions in a file system.
+ * @param path - source path where the file has to be creating.
+ * @param folderName - folder name.
+ * @param local - identifying the path whether its local or not.
+ * @throws IOException - if an I/O error occurs.
+ */
+ public void createFolder(String path, String folderName,
+ boolean local) throws IOException {
+ getProxy().createFolder(path, folderName, null, local);
+ }
+
+ /**
+ * Create a folder with given permissions in a file system.
+ * @param path - source path where the file has to be creating.
+ * @param folderName - folder name.
+ * @param permission - folder permissions.
+ * @param local - identifying the path whether its local or not.
+ * @throws IOException - if an I/O error occurs.
+ */
+ public void createFolder(String path, String folderName,
+ FsPermission permission, boolean local) throws IOException {
+ getProxy().createFolder(path, folderName, permission, local);
+ }
+
+ /**
* List the statuses of the files/directories in the given path if the path is
* a directory.
*
Modified: hadoop/common/branches/branch-0.21/src/test/system/java/org/apache/hadoop/test/system/DaemonProtocol.java
URL: http://svn.apache.org/viewvc/hadoop/common/branches/branch-0.21/src/test/system/java/org/apache/hadoop/test/system/DaemonProtocol.java?rev=979943&r1=979942&r2=979943&view=diff
==============================================================================
--- hadoop/common/branches/branch-0.21/src/test/system/java/org/apache/hadoop/test/system/DaemonProtocol.java (original)
+++ hadoop/common/branches/branch-0.21/src/test/system/java/org/apache/hadoop/test/system/DaemonProtocol.java Wed Jul 28 03:21:10 2010
@@ -23,8 +23,10 @@ import java.io.IOException;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileStatus;
+import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.ipc.VersionedProtocol;
+import org.apache.hadoop.fs.permission.FsPermission;
/**
* RPC interface of a given Daemon.
@@ -77,6 +79,27 @@ public interface DaemonProtocol extends
FileStatus getFileStatus(String path, boolean local) throws IOException;
/**
+ * Create a file with given permissions in a file system.
+ * @param path - source path where the file has to create.
+ * @param fileName - file name.
+ * @param permission - file permissions.
+ * @param local - identifying the path whether its local or not.
+ * @throws IOException - if an I/O error occurs.
+ */
+ void createFile(String path, String fileName,
+ FsPermission permission, boolean local) throws IOException;
+
+ /**
+ * Create a folder with given permissions in a file system.
+ * @param path - source path where the file has to be creating.
+ * @param folderName - folder name.
+ * @param permission - folder permissions.
+ * @param local - identifying the path whether its local or not.
+ * @throws IOException - if an I/O error occurs.
+ */
+ public void createFolder(String path, String folderName,
+ FsPermission permission, boolean local) throws IOException;
+ /**
* List the statuses of the files/directories in the given path if the path is
* a directory.
*