Hi Alan.
thats not the problem as I have really. In order to change the
permissions I need access to a 'FileSystem' object. but I don't see how
to get one
the code in hadoop to do the same thing is in FsShellPermissions
public void run(FileStatus file, FileSystem srcFs) throws IOException {
FsPermission perms = file.getPermission();
int existing = perms.toShort();
boolean exeOk = file.isDir() || (existing & 0111) != 0;
int newperms = ( applyChmod(userType, userMode,
(existing>>>6)&7, exeOk) << 6 |
applyChmod(groupType, groupMode,
(existing>>>3)&7, exeOk) << 3 |
applyChmod(othersType, othersMode, existing&7,
exeOk) );
if (existing != newperms) {
try {
srcFs.setPermission(file.getPath(),
new FsPermission((short)newperms));
} catch (IOException e) {
System.err.println(getName() + ": changing permissions of '" +
file.getPath() + "':" + e.getMessage());
}
}
}
which I presume is the only way to do it.
Alan Gates wrote:
Take a look at org.apache.pig.tools.grunt.GruntParser.java. All of
the file system commands are implemented in there. That's probably
also where you chmod et al should go.
Alan.
On Nov 9, 2008, at 5:22 PM, Ian Holsman wrote:
hi.
I was about to add these commands into the grunt command shell, but I
couldn't for the life of me figure out how to actually get to the
FileSystem object so I could change fire off the command.
any hints on how to do this?
-- Ian