|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.rmi.server.RemoteObject java.rmi.server.RemoteServer java.rmi.server.UnicastRemoteObject com.sun.faban.harness.agent.FileAgentImpl
public class FileAgentImpl
This is the class that reads/writes files for remote objects.
FileAgent
,
Serialized FormField Summary |
---|
Fields inherited from class java.rmi.server.RemoteObject |
---|
ref |
Fields inherited from interface com.sun.faban.harness.agent.FileAgent |
---|
APPEND, READ, WRITE |
Constructor Summary | |
---|---|
FileAgentImpl()
Constructs the file agent. |
Method Summary | |
---|---|
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. |
static void |
main(String[] argv)
Starts a standalong file agent. |
FileService |
open(String file,
int mode)
This method creates a new FileServiceImpl object and returns a reference to its interface, FileService. |
long |
push(FileTransfer transfer)
Pushes a file, as encapsulated in the FileTransfer, from a the master to this agent. |
String |
readWholeFile(String file)
Read the contents of a file. |
boolean |
removeFile(String fileName)
Removes 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 fileName,
String contents)
Write contents to a file. |
Methods inherited from class java.rmi.server.UnicastRemoteObject |
---|
clone, exportObject, exportObject, exportObject, unexportObject |
Methods inherited from class java.rmi.server.RemoteServer |
---|
getClientHost, getLog, setLog |
Methods inherited from class java.rmi.server.RemoteObject |
---|
equals, getRef, hashCode, toString, toStub |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FileAgentImpl() throws RemoteException
RemoteException
- A communications error occurred.Method Detail |
---|
public FileService open(String file, int mode) throws RemoteException, FileServiceException
open
in interface FileAgent
file
- - The pathname for the file.mode
- - specifies whether the file is opened for reading or
for writing. The mode is specified by the FileAgent
interface class variables - READ, WRITE, APPEND.
RemoteException
- A communications error occurred.
FileServiceException
- Error opening filepublic String readWholeFile(String file) throws IOException
readWholeFile
in interface FileAgent
file
- - The pathname for the file
IOException
- An I/O error occurredpublic String getProperty(String configFile, String propName) throws IOException
getProperty
in interface FileAgent
configFile
- The config file namepropName
- The property key name
IOException
- If there is an error accessing the config filepublic boolean writeWholeFile(String fileName, String contents)
writeWholeFile
in interface FileAgent
fileName
- - The pathname for the file.contents
- - Contents of the file as a String object.
public boolean removeFile(String fileName)
removeFile
in interface FileAgent
fileName
- - The pathname for the file.
public boolean truncateFile(String fileName)
truncateFile
in interface FileAgent
fileName
- The pathname for the file
public boolean removeFiles(String dirName, FileFilter filter)
removeFiles
in interface FileAgent
dirName
- The directory path namefilter
- The filter
public boolean doesFileExist(String fileName)
doesFileExist
in interface FileAgent
fileName
- The file name to test.
public boolean isFile(String fileName)
isFile
in interface FileAgent
fileName
- The file name to test.
public boolean isDirectory(String fileName)
isDirectory
in interface FileAgent
fileName
- The file name to test.
public long push(FileTransfer transfer) throws RemoteException
push
in interface FileAgent
transfer
- The file transfer description
RemoteException
- If there is an error in the transferpublic FileTransfer get(String srcFile, String destFile) throws IOException
get
in interface FileAgent
srcFile
- The source file on the host the agent is running ondestFile
- The destination file on the master
RemoteException
- If there is an error reading or transferring
IOException
- If there is an error reading or transferringpublic static void main(String[] argv)
argv
- Command line arguments, not used
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |