Skip to main content

Creating Custom Advertisement and finding with DiscoveryService

2 replies [Last post]
Joined: 2009-08-02

This is a strange one so if any of you have any tips it will be much appreciated.

I have created a custom advertisement, registered it, and published it locally.

When I perform a local discovery such as the following I can see the advert:

(i) Enumeration advertisementEnum = discoveryService.getLocalAdvertisements( DiscoveryService.ADV, null, null );

However if I look for the advert more selectively I get nothing:

(ii) Enumeration advertisementEnum = discoveryService.getLocalAdvertisements( DiscoveryService.ADV, "UniqueId", "john" );

The advert looks like the following so it is surprising I do not find it with the selective search (ii):

<?xml version="1.0"?>





I thought that may be it is something to do with a JXTA bug with the indexing of a custom advertisement. I am using jxta 2.5.

Are any of you aware of bugs with the discovery of Custom Advertisements in jxta 2.5 ?

Thank you

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2008-07-03

Hi John,

Does your customized adv list UniqueId in result array of getIndexFields()?

If it dont, then its not added into cm, and thus cannot be found by discovery search.

Hope this helps.

Joined: 2009-08-02

Hi Seiska,

Thanks for the hint. Yes it does include the UniqueID in the getIndexFields() of customized adv.

On another note: I find JXTA a bit over challenging and often believe that the implementation of JXTA has issues. I find that I spend a lot of time getting anything working. I have spent time creating abstract classes, namely AbstractPeer that makes the creation of Peer Groups and the adding of services that much more easy, but problems of this nature (See this thread) are too challenging for me. I tried delving into the Cm class to try and understand how the search for adverts works but it is too tough for me and I cannot find any document or context help any where.

I have created a sandbox that loads up application jars and uses event driven byte code modification libraries to intercept malicious calls (e.g. to ). A security exception is thrown if a p2p application attempts to use libraries directly instead of the secure and wrapped P2P proprietary ones. In this way I can encourage the developer to use proprietary IO classes adapted to P2P security rather than the ones.

The idea is that one can run P2P applications without relying on the trust relationship with the author. My intention was to make JXTA easier to use by developers through some abstract classes that allow for the easy creation of groups, their services, give a simplified membership implementation and importantly run securely in my sandbox. That way P2P applications could be distributed and safely run within my sandbox. Unfortunately it seems to me that JXTA is not supported enough in its current stage so that I can resolve issues when they pop up.

It is therefore with sadness that I have embarked on making a much more simple and much more cut down equivalent of JXTA using HTTP, nodes and super nodes with Relay capabilities. On talking to a mate of mine he advised me that I would spend less time in the long run writing a cut down version than resolving challenging issues that appear unsupported. JXTA is a framework that has a lot of potential and flexibility however with its potential comes complexity which slows down its adoption and appeal. If this complexity was accompanied by better support then I think it could flourish. However it does not appear to be the case that Sun is pumping funds into this project. I thought hiring a full time person to support the forum would be a good start and wrote an email to that effect.