public class SetUIDFileAccess extends Object implements FileAccess
DEFAULT_BUFFERSIZE
Constructor and Description |
---|
SetUIDFileAccess() |
Modifier and Type | Method and Description |
---|---|
void |
asUser(Runnable runnable,
String userID,
String groupID)
execute the given Runnable as given user
|
String |
getHome(String userID)
gets the user's home directory
|
RandomAccessFile |
getRandomAccessFile(File file,
String userID,
String groupID,
String mode)
create a
RandomAccessFile for accessing the given path |
FileInfo[] |
listFiles(File dir,
String userID,
String groupID)
lists files in the given directory
|
void |
mkdir(String path,
String userID,
String groupID)
create a directory.
|
InputStream |
readFile(String canonicalPath,
String userID,
String groupID,
int bufferSize)
create a
InputStream for reading |
void |
rm(String path,
String userID,
String groupID)
delete a file or directory
|
void |
setUser(String canonicalPath,
String user,
String group)
set user/group on the given file
|
FileInfo |
stat(String path,
String userID,
String groupID)
get info on a single file
|
OutputStream |
writeFile(String canonicalPath,
boolean append,
String userID,
String groupID,
int bufferSize)
create a
OutputStream for writing |
public InputStream readFile(String canonicalPath, String userID, String groupID, int bufferSize) throws Exception
FileAccess
InputStream
for readingreadFile
in interface FileAccess
canonicalPath
- - the canonical path to the fileuserID
- - the user idgroupID
- - the group idbufferSize
- - the buffer size for reading fromInputStream
Exception
public OutputStream writeFile(String canonicalPath, boolean append, String userID, String groupID, int bufferSize) throws Exception
FileAccess
OutputStream
for writingwriteFile
in interface FileAccess
canonicalPath
- - the canonical path to the fileuserID
- - the user idgroupID
- - the group idbufferSize
- - the buffer size for writing to diskOutputStream
Exception
public void setUser(String canonicalPath, String user, String group) throws Exception
FileAccess
setUser
in interface FileAccess
Exception
public RandomAccessFile getRandomAccessFile(File file, String userID, String groupID, String mode) throws IOException
FileAccess
RandomAccessFile
for accessing the given pathgetRandomAccessFile
in interface FileAccess
file
- - the pathuserID
- - the user idgroupID
- - the group idmode
- - the mode (see RandomAccessFile.RandomAccessFile(java.io.File, String)
IOException
public FileInfo[] listFiles(File dir, String userID, String groupID)
FileAccess
listFiles
in interface FileAccess
userID
- - the user idgroupID
- - the group idFileInfo
objectspublic FileInfo stat(String path, String userID, String groupID)
FileAccess
stat
in interface FileAccess
path
- - the fileuserID
- - the user idgroupID
- - the group idpublic void mkdir(String path, String userID, String groupID) throws IOException
FileAccess
mkdir
in interface FileAccess
path
- - the directory to createuserID
- - user IDgroupID
- - group IPIOException
public void rm(String path, String userID, String groupID) throws IOException
FileAccess
rm
in interface FileAccess
path
- - the file/directory to deleteuserID
- - user IDgroupID
- - group IPIOException
public String getHome(String userID)
FileAccess
getHome
in interface FileAccess
public void asUser(Runnable runnable, String userID, String groupID) throws Exception
FileAccess
asUser
in interface FileAccess
runnable
- - a very SHORT taskuserID
- - user IDgroupID
- - group IDException
Copyright © 2010–2016 UNICORE. All rights reserved.