JXTA 2.7 上缺少方法

发布于 2024-12-03 04:35:47 字数 272 浏览 0 评论 0原文

我已经开始阅读 Practical JXTA II 中的如何使用 JXTA 来构建我想要制作的应用程序。尽管提供的代码(示例)不适用于 JXTA 2.7 。更具体地说 Z_Tools_And_Others 的工具类无法编译,因为 TheRendezVous 类没有 2.6 中存在的 getConnectedPeers() 和 getConnectedRendezVous() 。因此我无法继续,因为大多数示例中都使用了工具类。熟悉这个的人有什么建议吗?使用 2.6 进行学习然后转向 2.7 是否更好?

谢谢。

I have started reading how to use JXTA from Practical JXTA II for an application i want to make. Although the code provided (examples) doesn't work with JXTA 2.7 . More specifically
Tools class of Z_Tools_And_Others doesn't compile since TheRendezVous class doesn't have getConnectedPeers() and getConnectedRendezVous() which exist in 2.6 . Therefor i cant continue since Tools class is used in most of the examples . Anyone familiar with this got any suggestions ? Is it better to use 2.6 for learning purposes and then move to 2.7 ?

Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(2

你的心境我的脸 2024-12-10 04:35:47

抱歉回复晚了:Practical JXTA II 的文件可以从此处获取。

我很确定您正在尝试将 2.6 代码与 2.7 一起使用。如果您在使用 jxta II 实际示例时仍然遇到问题,请告诉我。

Sorry for the late reply: the files for Practical JXTA II are available from here.

I am pretty sure you are trying to use 2.6 code with 2.7. Let me know if you still encounter an issue with the practical jxta II examples.

白况 2024-12-10 04:35:47
package Examples.Z_Tools_And_Others;

public class Tools {
public static void popConnectedRendezvous(RendezVousService TheRendezVous, String Name) {

        Enumeration<ID> TheList = TheRendezVous.getConnectedRendezVous();
        int Count = 0;

        while (TheList.hasMoreElements()) {

            Count = Count + 1;

            PopInformationMessage(Name, "Connected to rendezvous:\n\n"
                    + TheList.nextElement().toString());

        }

        if (Count==0) {

            PopInformationMessage(Name, "No rendezvous connected to this rendezvous!");

        }

    }

TheList 不起作用。方法 getConnectedRendezVous 在 2.7 中被删除。替换它的是返回一个列表。这会在以后产生更多错误。我应该更改代码以便它适用于列表吗?我想我可以使用 listIterator 来替换 .nextElement() 同一类的 popConnectedPeers(RendezVousService TheRendezVous, String Name) 也存在同样的问题。

还有

包 Examples.K_Service 中的第 166 行;

公共类_710_Astrology_Service_Example实现Service,Runnable

Result.setCompat(StdPeerGroup.STD_COMPAT);

STD_COMPAT 被删除。我用这个替换它:

ModuleImplAdvertisement ad =StdPeerGroup.getDefaultModuleImplAdvertisement();

Result.setCompat(ad.getCompat());

不知道它好不好..代码可以编译:P

package Examples.Z_Tools_And_Others;

public class Tools {
public static void popConnectedRendezvous(RendezVousService TheRendezVous, String Name) {

        Enumeration<ID> TheList = TheRendezVous.getConnectedRendezVous();
        int Count = 0;

        while (TheList.hasMoreElements()) {

            Count = Count + 1;

            PopInformationMessage(Name, "Connected to rendezvous:\n\n"
                    + TheList.nextElement().toString());

        }

        if (Count==0) {

            PopInformationMessage(Name, "No rendezvous connected to this rendezvous!");

        }

    }

TheList isnt working .The method getConnectedRendezVous is removed in 2.7 . The one that is replacing it is returning a List .That creates more errors later . Should i change the code so that it works for a List ?I thought i could use a listIterator to replace .nextElement() Same problem exists with popConnectedPeers(RendezVousService TheRendezVous, String Name) of same class.

Also line 166 in

package Examples.K_Service;

public class _710_Astrology_Service_Example implements Service, Runnable

Result.setCompat(StdPeerGroup.STD_COMPAT);

STD_COMPAT is removed . I replaced it with this :

ModuleImplAdvertisement ad =StdPeerGroup.getDefaultModuleImplAdvertisement();

Result.setCompat(ad.getCompat());

No idea if its good or not..code compiles tho :P

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