将java接口移植到IDL

发布于 2024-10-03 17:30:44 字数 465 浏览 0 评论 0原文

我有一个 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

停滞 2024-10-10 17:30:44

rmic -idl 将为您做到这一点。请参阅工具文档。

rmic -idl will do that for you. See the tools documentation.

谈情不如逗狗 2024-10-10 17:30:44

您需要在 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文