Hi all,
As it was proposed, yesterday I wrote an example. It is fully functional and contains a client and a server that implement the following IDL:
service Calculator
{
long add(long param1, long param2);
long subtract(long param1, long param2);
};
This example shows a possible future API, although the naming is not final. I tried to make it simple and user-friendly. This API is very easy to implement, and I developed a complete working example within one day.
To develop a client application, the user should select the network transport and the serialization mechanism. Then he has to create the proxy to connect to the remote service.
// Create custom transport, serializer and the proxy.
ProxyTransport transport = new TCPProxyTransport("127.0.0.1",8080);
Serializer ser = new Cdr();
CalculatorProxy proxy= new CalculatorProxy(ser, transport);
After these steps, he can call the remote methods.
// Call 'add' method.
ret = proxy.add(param1, param2);
To develop a server application, the user should select the network transport and the serialization mechanism. Then he has to invoke a server instance.
ServerTransport transport = new TCPServerTransport(8080);
Serializer serializer = new Cdr();
Server server = new Server(serializer, transport);
After these steps, he can add his servants and run the server.
Servant servant = new CalculatorServantExample();
server.addService(servant);
server.serve();
This source code the user has to write is located in the directory 'user_src'.
Also this example contains source code that should be generated by a IDL compiler. It is located in the folder 'gen_src'. The KIARA core source code is located in 'kiara_src'. You can see the code is pretty straightforward and just 20-30 lines of generated code do all the necessary tasks.
This example can be compiled using 'ant', although I already provide the bytecode. The archive contains two bash script to execute the client (clientexample.sh) and the server (serverexample.sh)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.fiware.org/private/miwi-middleware/attachments/20141001/75a8bd35/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kiara_java.tar.gz
Type: application/x-compressed-tar
Size: 18487 bytes
Desc: kiara_java.tar.gz
URL: <https://lists.fiware.org/private/miwi-middleware/attachments/20141001/75a8bd35/attachment.bin>
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy