将java接口移植到IDL
我有一个 java RMI 应用程序,我想使用 CORBA 移植到该应用程序。为此,我必须将远程接口定义从 java 更改为 IDL,但我不确定如何执行此操作。
目前,java 接口中的方法之一有一个参数,该参数不是预定义的数据类型(如 string、int 等),而是我自己定义的。在 java 接口中,您可以这样定义它:
public int doSomething(MyObject o);
在 RMI 实现中,对象的传递成为可能,因为客户端和服务器在其构建路径上都有类 MyObject 的定义。
所以我想知道如果我将 MyObject 文件放在客户端和服务器上,然后将 IDL 中的方法定义更改为如下内容是否可行:
long doSomething(in MyObject o);
或者我是否需要在 IDL 中以某种方式定义此类及其方法?
I have a java RMI app that I want to port to using CORBA. To do that, I have to change the remote interface definition from java to IDL but I'm not exactly sure how to do that.
At the moment one of the methods in the java interface has a parameter that is not a predefined datatype (like string, int etc) but one that I defined myself. In the java interface you would define it like that:
public int doSomething(MyObject o);
In the RMI implementation passing of the object is made possible because both the client and server have the definition of class MyObject on their build path.
So I am wondering if it would work if I put the MyObject files on both client and server and then change the method definition in IDL to something like this:
long doSomething(in MyObject o);
Or do I need to define this class and its methods somehow also in the IDL?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
rmic -idl 将为您做到这一点。请参阅工具文档。
rmic -idl will do that for you. See the tools documentation.
您需要在 idl 模块中定义好 MyObject。在客户端和服务器的构建路径中定义类是不够的。
You need to define MyObject in your idl module well. It's not sufficient to have the class defined in the build path for both client and server.