how do I access data sent to an agent written in c++/java? [message #97787] |
Fri, 04 May 2007 20:02 |
Natasha D'Silva Messages: 25 Registered: July 2009 |
Junior Member |
|
|
Hi,
I am writing an agent using the new execution framework in Java and C++.
Using the examples, I get access to an agent and try to send it a command,
as follows:
Java:
agent.sendCommand("<some_command iid=\"com.ibm.myiid\"><file>some more
text</file></dump>", handler);
When the agent recieves the command in its processCommand method,
The only information availalbe is the command name, i.e. "some_command"
Any additional data is not available via getCommandData()
In C++ it is a similar situation, I tried getting the data using the
parseCommand() function in TPTP utils, but I do not get back anything
usable.
In the example above, how do I get access to the <file> tag?
Any tips are appreciated.
Thanks
|
|
|
Re: how do I access data sent to an agent written in c++/java? [message #98635 is a reply to message #97787] |
Tue, 15 May 2007 06:13 |
Igor Alelekov Messages: 139 Registered: July 2009 |
Senior Member |
|
|
Hi Natasha,
You can transfer data to/from agents in two ways:
- Using control channel with custom commands (xml fragments).
- Using data channel - transparent binary channel, suitable for large data
blocks.
Xml commands are parsed on arrival to CmdBlock command blocks.
To process custom commands you could:
- implement method processCommand(CmdBlock* cmd)
- let parent classes process their own commands by calling parent
processCommand()
- get command name via cmdBlock->getCommandName() method
- get command parameter list via cmdBlock->getParamList()
- get parameters values with getStringParam("parameter name", paramList,
¶mValue), getIntegerParam("parameter name", paramList, ¶mValue)
and so on
You can find examples in FileTransferAgent/FileTransferAgent.cpp,
agentBase/BaseAgentImpl.cpp and agentBase/BaseCollectorImpl.cpp in
org.eclipse.tptp.platform.agentcontroller/src-native-new/src /agents
package.
Example of processing paramList you can find in TPTPUtil.cpp
Regards,
Igor
|
|
|
Powered by
FUDForum. Page generated in 0.02370 seconds