|
Date |
Version |
Description |
Author(s) |
|
|
1.0 |
First draft |
Giridhar
S (giridhar.s@in.ibm.com) |
|
10 January 2006 |
1.0.0.1 |
Removed extra white space, renamed "RAC" to "Agent Controller" |
RL |
|
|
|
|
|
|
|
|
|
|
/**********************************************************************
*
Copyright (c) 2005 IBM Corporation
*
All rights reserved. This program and the accompanying materials
*
are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
*
http://www.eclipse.org/legal/epl-v10.html
*
*
Contributors:
* As documented in
the Revision History
**********************************************************************/
The Agent Controller Assisted File Transfer service is intended to provide the Hyades Data Collection Engine with the ability to transfer files (binary as well as text) between any Agent Controller client machine and the Agent Controller host machine. The goal of the service is to transfer files between the two machines in a reliable manner and also delete specified files from the host machine, by providing an abstraction over the lower level details like differences in the machines’ “endian” ness, and underlying operating systems, file systems etc.

![]()

The file transfer service is now a part of the
Hyades data collection engine.
The component which is responsible for initiating
the file transfer is the File Server. The File Server is started by the Agent
Controller during its startup phase. Subsequently, the File Server listens for
incoming file transfer requests from clients on a designated port and performs
the task of transferring the requested files. The port on which the file server
listens for incoming requests can be configured by editing the configuration
file.
When a client wants a file to be transferred
to/from or deleted from the host machine, it has to make use of the file
transfer APIs available through the IFileManager interface. The current
implementation of the IFileManager interface is the FileManagerImpl class which
takes care of contacting the file server and completing the file transfer/file
deletion.
For parties interested in implementing the
IFileManager interface, it would be useful to know the protocol involved in
communicating with the file server. The interaction between the FileManager,
Agent Controller, File Server and other necessary components is described
below.
Ř
The FileManager performing the file transfer sends a message to the
Agent Controller, querying the port number on which the File Server is running.
Since the Agent Controller is responsible for starting the file server during
its initialization phase, it is aware of the port number, and this information
is passed back to the FileManager.
Ř
The FileManager then connects to specified file server port. The file
server hands off each connection request it receives, to a connection handler,
which in turn creates a new thread and allocates a client handler to take care
of the file transfer needs of that particular client. The client handler
performs the actual task of transferring the files.
Ř
It is the responsibility of the FileManager to provide the details like
the name of the file to be transferred, nature of operation (get, put or
delete) to the client handler. This information is passed to the client handler
through the socket connecting the File Manager and the client handler, because
the client handler expects the first few bytes of incoming information to be
details about the current file transfer operation.
Ř
Once the client handler has enough information to begin the file
transfer, it starts the file transfer i.e. sending the files if the operation
is a “get” and receiving the file contents if the operation is a “put”. Note
that for the “delete” operation, the Agent Controller performs the task of
deleting the file from the file system, and not the file manager, file server
or related components.
The
file transfer feature can be accessed through the use of the following APIs
available from within the IFileManager interface.
|
public interface IFileManager {
public void getFile (String localName, String remoteName)
throws IOException; public
void putFile (String localName,
String remoteName) throws IOException; public
void deleteFile (String absFileName) throws IOException; } |
Currently, an implementation of the IFileManager
interface is available through the FiieManagerImpl class. To make use of the
FileManagerImpl class, one of the following approaches can be taken:
1) An instance of the FileManagerImpl class can be
queried from an instance of the org.eclipse.hyades.execution.local.NodeImpl
class, after it has been properly instantiated and connected to an Agent
Controller successfully. To illustrate:
|
INode
node = new NodeImpl(“win-giri01”); ISession
session = node.connect(“10002”, null);/* Connect to
the Agent Controller */ IFileManager fileManager
= ((NodeImpl)node).getFileManager(); fileManager.getFile(localFile, remoteFile); /*
Transfer the file */ |
Note: The task of moving the getFileManager method from the NodeImpl
implementation into the INode interface is on the
list of things to be done.
2) An object of the class FileManagerImpl can be
constructed, by passing it a valid Connection object, and then this object can
be used to perform the file transfer.
|
Node node = NodeFactory.createNode(“win-giri01”); node.connect(10002);
/* Connect to the Agent Controller on win-giri01 */ IFileManager fileManager
= new FileManagerImpl(node.getConnection); fileManager.getFile(localFile, remoteFile); /*
Transfer the file */ |
1)
The getFileManager method, currently present
only within the NodeImpl implementation of the INode interface, needs to be moved into the interface to
enable a generic API that returns a FileManager object that can be used for
file transfer.
2)
The filePort variable must be included in the
dtd document corresponding to the service
configuration framework.