Project JXTA

net.jxta.protocol
Class SrdiMessage

java.lang.Object
  extended by net.jxta.protocol.SrdiMessage

public abstract class SrdiMessage
extends Object

A generic message that can be used by services to push shared resources to other peers on the network


Nested Class Summary
static class SrdiMessage.Entry
          Entries object, which describes each entry described by this message
 
Constructor Summary
SrdiMessage()
           
 
Method Summary
 void addEntry(SrdiMessage.Entry entry)
           
 void addEntry(String key, String value, long expiration)
           
 void decrementTTL()
          decrements ttl
abstract  Document getDocument(MimeMediaType asMimeType)
          Write advertisement into a document. asMimeType is a mime media-type specification and provides the form of the document which is being requested.
 Collection getEntries()
          returns the entries of this SrdiMessage
static String getMessageType()
          All messages have a type (in xml this is !
 PeerID getPeerID()
          returns the source peerid
 String getPrimaryKey()
          get the primary key
 int getTTL()
          returns the ttl
 void setEntries(Collection newEntries)
          set the Entries
 void setPeerID(PeerID peerid)
          set the source peerid
 void setPrimaryKey(String pkey)
          set the primary key
 void setTTL(int newTTL)
          sets the ttl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SrdiMessage

public SrdiMessage()
Method Detail

getDocument

public abstract Document getDocument(MimeMediaType asMimeType)
Write advertisement into a document. asMimeType is a mime media-type specification and provides the form of the document which is being requested. Two standard document forms are defined. 'text/text' encodes the document in a form nice for printing out and 'text/xml' which provides an XML format.

Parameters:
asMimeType - mime-type requested representation for the returned document
Returns:
Document document representing the advertisement

getPeerID

public PeerID getPeerID()
returns the source peerid

Returns:
PeerID

getPrimaryKey

public String getPrimaryKey()
get the primary key

Returns:
primaryKey

getTTL

public int getTTL()
returns the ttl

Returns:
ttl

setTTL

public void setTTL(int newTTL)
sets the ttl


decrementTTL

public void decrementTTL()
decrements ttl


getEntries

public Collection getEntries()
returns the entries of this SrdiMessage

Returns:
the entries of this SrdiMessage

addEntry

public void addEntry(String key,
                     String value,
                     long expiration)

addEntry

public void addEntry(SrdiMessage.Entry entry)

setEntries

public void setEntries(Collection newEntries)
set the Entries

Parameters:
entries - Entries

setPeerID

public void setPeerID(PeerID peerid)
set the source peerid

Parameters:
peerid - the source PeerID

setPrimaryKey

public void setPrimaryKey(String pkey)
set the primary key

Parameters:
pkey - the primary key

getMessageType

public static String getMessageType()
All messages have a type (in xml this is !doctype) which identifies the message, if no expiration is defined Default expiration infinite for entries. This is the amount of time which an entry will live in cache. After this time, the entry is garbage collected, it also worthy to note that it is up to the peer caching these entries to honor the lifetime of the entry, and peer may choose to garbage collect entries based on quotas, relationship with other peers, etc. *

Returns:
String "jxta:GenSRDI"

JXTA J2SE