public interface FileAgent extends Remote
FileService
Modifier and Type | Field and Description |
---|---|
static int |
APPEND
Open for write in append mode.
|
static int |
READ
Open for reading.
|
static int |
WRITE
Open for writing.
|
Modifier and Type | Method and Description |
---|---|
boolean |
doesFileExist(String fileName)
Checks whether the given remote file exists.
|
FileTransfer |
get(String srcFile,
String destFile)
Gets a file from the local system to the master.
|
String |
getProperty(String configFile,
String propName)
Gets a property from a given file.
|
boolean |
isDirectory(String fileName)
Checks whether the given remote file exists and is a directory.
|
boolean |
isFile(String fileName)
Checks whether the given remote file exists and is a normal file.
|
FileService |
open(String file,
int mode)
Open a file for reading and/or writing.
|
long |
push(FileTransfer transfer)
Pushes a file, as encapsulated in the FileTransfer, from a the master
to this agent.
|
String |
readWholeFile(String file)
Read a file from this machine and return the contents as a String.
|
boolean |
removeFile(String fileName)
Remove a file.
|
boolean |
removeFiles(String dirName,
FileFilter filter)
Remove files from a directory matched by the filter.
|
boolean |
truncateFile(String fileName)
Truncates a file to zero-length.
|
boolean |
writeWholeFile(String file,
String contents)
Write the given file to this machine.
|
static final int READ
static final int WRITE
static final int APPEND
FileService open(String file, int mode) throws RemoteException, FileServiceException
file
- filenamemode
- file open mode - READ, WRITE, APPENDRemoteException
- A communications error occurred.FileServiceException
- Error opening fileString readWholeFile(String file) throws IOException
file
- name of the fileIOException
- An I/O error occurredboolean writeWholeFile(String file, String contents) throws RemoteException
file
- pathcontents
- of the file.RemoteException
- A communications error occurred.boolean removeFile(String fileName) throws RemoteException
fileName
- - The pathname for the file.RemoteException
- A communications error occurred.boolean truncateFile(String fileName) throws RemoteException
fileName
- The pathname for the fileRemoteException
- An error occurred.boolean removeFiles(String dirName, FileFilter filter) throws RemoteException
dirName
- The directory path namefilter
- The filterRemoteException
- A communications error occurred.String getProperty(String configFile, String propName) throws IOException
configFile
- The config file namepropName
- The property key nameIOException
- If there is an error accessing the config fileboolean doesFileExist(String fileName) throws RemoteException
fileName
- The file name to test.RemoteException
- A communications error occurred.boolean isFile(String fileName) throws RemoteException
fileName
- The file name to test.RemoteException
- A communications error occurred.boolean isDirectory(String fileName) throws RemoteException
fileName
- The file name to test.RemoteException
- A communications error occurred.long push(FileTransfer transfer) throws RemoteException
transfer
- The file transfer descriptionRemoteException
- If there is an error in the transferFileTransfer get(String srcFile, String destFile) throws IOException
srcFile
- The source file on the host the agent is running ondestFile
- The destination file on the masterIOException
- If there is an error reading or transferring