API for File Transfer

  1 post   Feedicon  
Replies: 0 - Last Post: July 06, 2009 17:55
by: Jørgen Austvik
« Older Topic » Newer Topic
showing 1 - 1 of 1
 
Posted: July 06, 2009 17:55 by Jørgen Austvik
We need a MBean that is running in JAG permanently to let iJETBatch copy files to machines where the tests should run (earlier we did local copy over NFS).

I am thinking about calling the MBean JAGFileTransfere[Ops]

We use the JAGFileServer to transfere files, which are started, returns an InetAddress and a port number where it is running, are told where to store it's next file, and then stores the next transfer to that path.

The existing API in FileOps is something like this:

public void copyFileFromAgent(InetAddress inetAddr,
Integer port,
String filename) throws JAGException;

(Use pattern: 1. start JAGFileServer locally, tell it where to store the file, 2- call this method with the JAGFileServer address and port, and which file to read from the agent).

This method can be used in a loop - start the JAGFileServer locally, transfere a lot of files, close the server.

For copying files to the server, we had these methods.

public InetAddress copyFileToAgent(FileInfoHolder fileInfo) throws JAGException;
public Boolean checkResultFilePut throws JAGException;


Here the port number would be read from the FileServerPortno attribute, and copyFileToAgent would start a file server on that port. checkResultFilePut returns true when the file is transfered, or throw an exception if something goes wrong.

I think the existing API for copying files from the Agent to the client is OK, but I don't like the current interface for copying from the client to the Agent.

I think about making something like this in JAGFileTransfere[MBean]:

/**
* Return a lost of all the file servers running on this JAG.
*
* @return List of file servers running in this JAG
*/
public List<Integer> getAllFileServers();

/**
* Wait for the current file transfer to finish.
*
* @param port Identifying which file server to communicate with
* @return True if the fransfere was successfullt, False if it failed
* @throws JAGException in case of failure during file transfere
*/
public Boolean checkResultFilePut(Integer port) throws JAGException;

/**
* Starts a file server that accepts connections.
*
* @return port number to connect to
* @throws JAGException if the server can't be started
*/
public int startFileServer() throws JAGException;

/**
* Shuts down one file server.
*
* @param port The port number to close the connection to
* @throws JAGException
*/
public void closeFileServer(Integer port) throws JAGException;

/**
* Prepare the file server for the next file that will be copied over.
*
* @param port The file server to prepare
* @param fileInfo The name and information about the file to write
* @throws JAGException If there are no server running here
*/
public void copyFileToAgent(Integer port, FileInfoHolder fileInfo) throws JAGException;


This will let us start, stop and list a set of file servers per JAG, so that multiple tests can transfer files simultaneously. The checkFilePut method must now have a port number to identify which server it checks. The copyFileToAgent aøso have the port number.

Alternatively we could load special MBeans with unique object names for each server. Then we could have something like


ObjectName createFileServer()


The ObjectName would identify a JAGFileServerMBean which has a PortNumber attribute, InetAddress attribute, and a copyTo(FileInfoHolder) and checkProgress() method.

Adding even more beans, we could have something like:

ObjectName copyTo(FileInfoHolder)


Where the object name would lead to a JAGFileTransferOperationMBean whilch would have attributes from the FileInfoHolder, plus a checkProgress() method.

On the client I plan to have methods like

copyFileToAgent(File fromFile, String toFile)
copyFilesToAgent(File fromPath, String toPath)
copyFileFromAgent(String fromFile, File toFile)
copyFilesFromAgent(String fromPath, File toPath)


What do you think?
Replies: 0 - Last Post: July 06, 2009 17:55
by: Jørgen Austvik
« Older Topic » Newer Topic
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close