1 =Remote Procedure Call=
2 Utilities [../javadoc/org/simantics/databoard/method/Server.html|Server] and [../javadoc/org/simantics/databoard/method/Client.html|Client] put MethodInterface over TCP Socket.
4 Server myServer = new Server(8192, mi);
5 MethodInterface mi = new Client("localhost", 8192);
8 MethodInterface with Server and Client together forms a Remote Procedure Call (RPC) mechanism.
10 public interface MyInterface { String helloWorld(String msg); }
13 MethodInterface mi = Methods.bindInterface( MyInterface.class, myObject );
14 Server myServer = new Server(8192, mi);
17 MethodInterface mi = new Client("localhost", 8192);
18 MyInterface myObject = Methods.createProxy( MyInterface.class, mi );
22 There are interfaces, method types and method type definitions.
23 Interface type describes a software interface. It is a collection of methods type definitions.
24 Method type is an unnamed function with the following properties : Response Type, Request Type and ErrorType; where Response Type is any Data Type, Request Type is a Record and Error Type is an Union.
25 Method type definition is nominal method description.
27 The respective Java classes are:
28 *[../javadoc/org/simantics/databoard/method/Interface.html|Interface]
29 *[../javadoc/org/simantics/databoard/method/MethodTypeDefinition.html|MethodTypeDefinition]
30 *[../javadoc/org/simantics/databoard/method/MethodType.html|MethodType]
32 In java InterfaceType description can be created with one of the following methods:
33 * Implementing InterfaceType
34 * Reading an Java Interface Class using reflection
36 Interface it = new Interface( ... methodDefinitions );
37 Interface it = getInterface( MyInterface.class );
40 [../javadoc/org/simantics/databoard/method/MethodInterface.html|MethodInterface] is a binding of an
41 Java Instance and an Interface Type. It decouples the method invocation from the object.
43 MethodInterface can be created with the following methods:
47 MethodInterface mi = new MethodInterface() {...}
48 MethodInterface mi = Datatypes.bindInterface( MyInterface.class, myObject );
51 Utilities <code>Datatypes.createProxy()</code> and <code>Datatypes.bindInterface()</code> adapt between MethodInterface and Java Instance.
53 MethodInterface mi = Datatypes.bindInterface( MyInterface.class, myObject );
54 MyInterface myObject = Datatypes.createProxy( MyInterface.class, mi );