Skip to main content

Peer advertisement JXTA

1 reply [Last post]
salahbensalah
Offline
Joined: 2010-07-06
Points: 0

hello friends ,
it's very urgent.
How can I add other tag in a peer advertisement other than the original tag like Name and description ?

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
boylejohnr
Offline
Joined: 2008-10-27
Points: 0

Hi,

never tried to, but I suspect you want to get the advertisement as XML doc, change it then set it back in the advertisement. There may be a better way.....

The following code is lifted from PipeAdvertisement.java.

/**
* Return the description meta-data for the pipe described by this advertisement.
*
* @return The description meta-data for the pipe described by this advertisement.
*/
public StructuredDocument getDesc() {
if (null != description) {
StructuredDocument newDoc = StructuredDocumentUtils.copyAsDocument(description);

return newDoc;
}
return null;
}

/**
* Set the description meta-data for the pipe described by this advertisement.
*
* @param desc The description meta-data for the pipe described by this advertisement.
*/
public void setDesc(Element desc) {

if (null != desc) {
this.description = StructuredDocumentUtils.copyAsDocument(desc);
} else {
this.description = null;
}
}