X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.databoard%2Fsrc-isv%2Fdoc%2Frpc.mediawiki;fp=bundles%2Forg.simantics.databoard%2Fsrc-isv%2Fdoc%2Frpc.mediawiki;h=8e209e3016c2a81446de8519692ee7bc7b40dcb9;hb=969bd23cab98a79ca9101af33334000879fb60c5;hp=0000000000000000000000000000000000000000;hpb=866dba5cd5a3929bbeae85991796acb212338a08;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.databoard/src-isv/doc/rpc.mediawiki b/bundles/org.simantics.databoard/src-isv/doc/rpc.mediawiki new file mode 100644 index 000000000..8e209e301 --- /dev/null +++ b/bundles/org.simantics.databoard/src-isv/doc/rpc.mediawiki @@ -0,0 +1,55 @@ +=Remote Procedure Call= +Utilities [../javadoc/org/simantics/databoard/method/Server.html|Server] and [../javadoc/org/simantics/databoard/method/Client.html|Client] put MethodInterface over TCP Socket. +
+ Server myServer = new Server(8192, mi); + MethodInterface mi = new Client("localhost", 8192); ++ +MethodInterface with Server and Client together forms a Remote Procedure Call (RPC) mechanism. +
+ public interface MyInterface { String helloWorld(String msg); } + + [Server] + MethodInterface mi = Methods.bindInterface( MyInterface.class, myObject ); + Server myServer = new Server(8192, mi); + + [Client] + MethodInterface mi = new Client("localhost", 8192); + MyInterface myObject = Methods.createProxy( MyInterface.class, mi ); ++ +==Interface Types== +There are interfaces, method types and method type definitions. +Interface type describes a software interface. It is a collection of methods type definitions. +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. +Method type definition is nominal method description. + +The respective Java classes are: +*[../javadoc/org/simantics/databoard/method/Interface.html|Interface] +*[../javadoc/org/simantics/databoard/method/MethodTypeDefinition.html|MethodTypeDefinition] +*[../javadoc/org/simantics/databoard/method/MethodType.html|MethodType] + +In java InterfaceType description can be created with one of the following methods: +* Implementing InterfaceType +* Reading an Java Interface Class using reflection +
+ Interface it = new Interface( ... methodDefinitions ); + Interface it = getInterface( MyInterface.class ); ++ +[../javadoc/org/simantics/databoard/method/MethodInterface.html|MethodInterface] is a binding of an +Java Instance and an Interface Type. It decouples the method invocation from the object. + +MethodInterface can be created with the following methods: +* Implementation +* Reflection +
+ MethodInterface mi = new MethodInterface() {...} + MethodInterface mi = Datatypes.bindInterface( MyInterface.class, myObject ); ++ +Utilities
Datatypes.createProxy()
and Datatypes.bindInterface()
adapt between MethodInterface and Java Instance.
++ MethodInterface mi = Datatypes.bindInterface( MyInterface.class, myObject ); + MyInterface myObject = Datatypes.createProxy( MyInterface.class, mi ); +