0

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.

Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
Giannis
  • 5,286
  • 15
  • 58
  • 113
  • If the book you're using needs 2.6, you can use 2.6 or you can find another book. I'd be inclined to the latter solution myself. – Tom Zych Sep 06 '11 at 19:27
  • Well the official book is Practical JXTAII.. i haven't yet found another book thats based on 2.7 . Maybe that is because its relatively new edition. – Giannis Sep 06 '11 at 20:22
  • Really, I don't know what you're asking for. Opinion? Prognostication on the ultimate relative usefulness of 2.6 vs. 2.7, or how soon a good 2.7 book will be out? Someone to decide for you, so you won't have to take responsibility for the decision? – Tom Zych Sep 06 '11 at 21:02
  • What i was really hoping for was someone that has got on the same example and solved it to tell me what he did :) . Although i am probably going to use 2.6 for now . Thanks for answering . – Giannis Sep 06 '11 at 21:16

2 Answers2

1

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.

Jérôme Verstrynge
  • 57,710
  • 92
  • 283
  • 453
  • Yes thats what i was trying. I decided to just learn the 2.6. I need to use it for a university project so i guess it wont be huge disadvantage using an old version . – Giannis Sep 11 '11 at 15:45
  • @latusaki There are a couple of glitches with 2.6, but it is used in production by some companies. I would recommend 2.7, but if you are happy with 2.6... stick with it. – Jérôme Verstrynge Sep 11 '11 at 16:18
  • Well the main problem is that the examples of the book dont work with 2.7. If i figure im able to use 2.7 after im done with the book i will . Thanks for responding ! :) – Giannis Sep 11 '11 at 17:14
  • @latusaki The examples of Practical JXTA II should work with 2.7. If not, can you post a code example? I'll take a look at it. – Jérôme Verstrynge Sep 11 '11 at 18:33
  • I posted code as answer because i couldnt add format on comment. – Giannis Sep 11 '11 at 23:14
0
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

Giannis
  • 5,286
  • 15
  • 58
  • 113