开发者

Missing methods on JXTA 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 i开发者_运维百科n 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.


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.


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜