JXTA

net.jxta.impl.protocol
Class RdvConfigAdv

java.lang.Object
  extended by net.jxta.document.Advertisement
      extended by net.jxta.document.ExtendableAdvertisement
          extended by net.jxta.impl.protocol.RdvConfigAdv
All Implemented Interfaces:
Cloneable

public final class RdvConfigAdv
extends ExtendableAdvertisement
implements Cloneable

Contains parameters for configuration of the Reference Implementation Rendezvous Service.


 <xs:complexType name="RdvConfig">
   <xs:sequence>
     <xs:element name="seeds" minOccurs="0" maxOccurs="1">
       <xs:complexType>
         <xs:sequence>
           <xs:element name="addr" minOccurs="1" maxOccurs="unbounded">
             <xs:complexType>
               <xs:simpleContent>
                 <xs:extension base="jxta:JXTAID">
                   <xs:attribute name="seeding" type="xs:boolean" default="false"/>
                 </xs:extension>
               </xs:simpleContent>
             </xs:complexType>
           </xs:element>
         </xs:sequence>
         <xs:attribute name="useOnlySeeds" type="xs:boolean" default="false"/>
         <xs:attribute name="connectDelay" type="xs:unsignedLong"/>
       </xs:complexType>
     </xs:element>
   </xs:sequence>
   <xs:attribute name="config" type="jxta:RdvConfiguration"/>
   <xs:attribute name="maxTTL" type="xs:unsignedInt"/>
   <xs:attribute name="autoRendezvousInterval" type="xs:unsignedInt"/>
   <xs:attribute name="probeRelays" type="xs:boolean" default="true"/>
   <xs:attribute name="maxClients" type="xs:unsignedInt"/>
   <xs:attribute name="leaseDuration" type="xs:unsignedLong"/>
   <xs:attribute name="leaseMargin" type="xs:unsignedLong"/>
   <xs:attribute name="minHappyPeerView" type="xs:unsignedInt"/>
 </xs:complexType>
 

Since:
JXTA 2.2

Nested Class Summary
static class RdvConfigAdv.Instantiator
          Instantiator for RdvConfigAdv
static class RdvConfigAdv.RendezVousConfiguration
          Possible Rendezvous configurations.
 
Method Summary
 void addSeedingURI(String addr)
           
 void addSeedingURI(URI addr)
           
 void addSeedRendezvous(String addr)
           
 void addSeedRendezvous(URI addr)
           
 void clearSeedingURIs()
           
 void clearSeedRendezvous()
           
 URI getAclUri()
          Return ACL URI if set
static String getAdvertisementType()
          Returns the identifying type of this Advertisement.
 String getAdvType()
          Returns the identifying type of this Advertisement.
 long getAutoRendezvousCheckInterval()
          The interval in relative milliseconds at which this peer will re-evaluate it's state as a rendezvous.
 String getBaseAdvType()
          Returns the base type of this advertisement hierarchy.
 RdvConfigAdv.RendezVousConfiguration getConfiguration()
          True if this peer is to default to act as a rendezvous.
 Document getDocument(MimeMediaType encodeAs)
          Write this advertisement into a document of the requested type.
 ID getID()
          Returns an ID which identifies this Advertisement as uniquely as possible.
 String[] getIndexFields()
          Returns the element names on which this advertisement should be indexed.
 long getLeaseDuration()
          The interval in relative milliseconds of leases offered by rendezvous peers.
 long getLeaseMargin()
          The interval in relative milliseconds of leases offered by rendezvous peers.
 int getMaxClients()
          Return the maximum number of clients.
 int getMaxTTL()
          Returns the maximum TTL for messages propagated by this peer or -1 for the default value.
 int getMinHappyPeerView()
          Returns the minimum peerview size which the rendezvous service will find sufficient.
 boolean getProbeRelays()
          If true then rendezvous clients will probe relay servers for rendezvous.
 URI[] getSeedingURIs()
           
 URI[] getSeedRendezvous()
           
 long getSeedRendezvousConnectDelay()
          The interval in relative milliseconds before which this peer will attempt to contact the the seed peers.
 boolean getUseOnlySeeds()
          If true then this peer will use only seed rendezvous when configured as an edge peer.
protected  boolean handleElement(Element raw)
          Process an individual element from the document during parse.
 boolean removeSeedingURI(URI addr)
           
 boolean removeSeedRendezvous(URI addr)
           
 void setAclUri(URI uri)
          Sets ACL URI
 void setAutoRendezvousCheckInterval(long newvalue)
          Sets the interval in relative milliseconds at which this peer will re-evaluate it's state as a rendezvous.
 void setConfiguration(RdvConfigAdv.RendezVousConfiguration newstate)
          Set the default rendezvous state of this peer.
 void setLeaseDuration(long newvalue)
          Sets interval in relative milliseconds of leases to be offered by rendezvous peers.
 void setLeaseMargin(long newvalue)
          Sets interval in relative milliseconds of leases to be offered by rendezvous peers.
 void setMaxClients(int newvalue)
          Sets he maximum number of clients.
 void setMaxTTL(int newvalue)
          Sets the maximum TTL for messages propagated by this peer.
 void setMinHappyPeerView(int newvalue)
          Sets the minimum peerview size which the rendezvous service will find sufficient.
 void setProbeRelays(boolean doProbe)
          Set whether rendezvous clients will probe relay servers for rendezvous.
 void setSeedRendezvousConnectDelay(long newvalue)
          Sets the interval in relative milliseconds before which this peer will attempt to contact the the seed peers.
 void setUseOnlySeeds(boolean onlySeeds)
          Set whether this peer will use only seed rendezvous when configured as an edge peer.
 
Methods inherited from class net.jxta.document.ExtendableAdvertisement
handleAttribute
 
Methods inherited from class net.jxta.document.Advertisement
clone, toString
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getAdvertisementType

public static String getAdvertisementType()
Returns the identifying type of this Advertisement.

Note: This is a static method. It cannot be used to determine the runtime type of an advertisement. ie.

      Advertisement adv = module.getSomeAdv();
      String advType = adv.getAdvertisementType();
  

This is wrong and does not work the way you might expect. This call is not polymorphic and calls Advertisement.getAdvertisementType() no matter what the real type of the advertisement.

Returns:
String the type of advertisement

getAdvType

public String getAdvType()
Returns the identifying type of this Advertisement. Unlike Advertisement.getAdvertisementType() this method will return the correct runtime type of an Advertisement object.

This implementation is provided for existing advertisements which do not provide their own implementation. In most cases you should provide your own implementation for efficiency reasons.

Overrides:
getAdvType in class Advertisement
Returns:
The identifying type of this Advertisement.

getBaseAdvType

public final String getBaseAdvType()
Returns the base type of this advertisement hierarchy. Typically, only the most basic advertisement of a type will implement this method and declare it as final.

Specified by:
getBaseAdvType in class ExtendableAdvertisement
Returns:
String the base type of advertisements in this hierarchy.

getID

public ID getID()
Returns an ID which identifies this Advertisement as uniquely as possible. This ID is typically used as the primary key for indexing of the Advertisement within databases.

Each advertisement sub-class must choose an appropriate implementation which returns canonical and relatively unique ID values for it's instances. Since this ID is commonly used for indexing, the IDs returned must be as unique as possible to avoid collisions. The value for the ID returned can either be:

For Advertisement types which normally return non-ID.nullID values no ID should be returned when asked to generate an ID while the Advertisement is an inconsistent state (example: uninitialized index fields). Instead IllegalStateException should be thrown.

Specified by:
getID in class Advertisement
Returns:
An ID that relatively uniquely identifies this advertisement or ID.nullID if this advertisement is of a type that is not normally indexed.

handleElement

protected boolean handleElement(Element raw)
Process an individual element from the document during parse. Normally, implementations will allow the base advertisements a chance to handle the element before attempting to handle the element themselves. ie.


  protected boolean handleElement(Element elem) {

      if (super.handleElement()) {
           // it's been handled.
           return true;
           }
      ... handle elements here ...

      // we don't know how to handle the element
      return false;
      }
  

Overrides:
handleElement in class ExtendableAdvertisement
Parameters:
raw - The element to be processed.
Returns:
true if the element was recognized, otherwise false.

getDocument

public Document getDocument(MimeMediaType encodeAs)
Write this advertisement into a document of the requested type. Two standard document forms are defined. "text/plain" encodes the document in a "pretty-print" format for human viewing and "text/xml" which provides an XML format.

We don't have any content to add, just build the document instance and return it to implementations that actually do something with it.

Overrides:
getDocument in class ExtendableAdvertisement
Parameters:
encodeAs - MimeMediaType format representation requested.
Returns:
The Advertisement represented as a Document of the requested MIME Media Type.

getIndexFields

public String[] getIndexFields()
Returns the element names on which this advertisement should be indexed.

Specified by:
getIndexFields in class Advertisement
Returns:
The element names on which this advertisement should be indexed.

getConfiguration

public RdvConfigAdv.RendezVousConfiguration getConfiguration()
True if this peer is to default to act as a rendezvous.

Returns:
True if this peer is to be a rendezvous

setConfiguration

public void setConfiguration(RdvConfigAdv.RendezVousConfiguration newstate)
Set the default rendezvous state of this peer.

Parameters:
newstate - if true then this peer should default to acting as a rendezvous.

getAutoRendezvousCheckInterval

public long getAutoRendezvousCheckInterval()
The interval in relative milliseconds at which this peer will re-evaluate it's state as a rendezvous. If 0 (zero), the default, then the peer will remain in the state of isRendezvous.

Returns:
The interval in relative milliseconds at which this peer will re-evaluate it's state as a rendezvous. If 0 (zero), the default, then the peer will remain in the state of isRendezvous.

setAutoRendezvousCheckInterval

public void setAutoRendezvousCheckInterval(long newvalue)
Sets the interval in relative milliseconds at which this peer will re-evaluate it's state as a rendezvous. If 0 (zero), the default, then the peer will remain in the state of isRendezvous.

Parameters:
newvalue - The interval in relative milliseconds at which this peer will re-evaluate it's state as a rendezvous. If 0 (zero), the default, then the peer will remain in the state of isRendezvous.

getProbeRelays

public boolean getProbeRelays()
If true then rendezvous clients will probe relay servers for rendezvous.

Returns:
If true then rendezvous clients will probe relay servers for rendezvous.

setProbeRelays

public void setProbeRelays(boolean doProbe)
Set whether rendezvous clients will probe relay servers for rendezvous.

Parameters:
doProbe - If true then rendezvous clients will probe relay servers for rendezvous.

getSeedRendezvous

public URI[] getSeedRendezvous()

addSeedRendezvous

public void addSeedRendezvous(URI addr)

addSeedRendezvous

public void addSeedRendezvous(String addr)

removeSeedRendezvous

public boolean removeSeedRendezvous(URI addr)

clearSeedRendezvous

public void clearSeedRendezvous()

getSeedingURIs

public URI[] getSeedingURIs()

addSeedingURI

public void addSeedingURI(URI addr)

addSeedingURI

public void addSeedingURI(String addr)

removeSeedingURI

public boolean removeSeedingURI(URI addr)

clearSeedingURIs

public void clearSeedingURIs()

getUseOnlySeeds

public boolean getUseOnlySeeds()
If true then this peer will use only seed rendezvous when configured as an edge peer.

Returns:
If true then this peer will use only seed rendezvous when configured as an edge peer.

setUseOnlySeeds

public void setUseOnlySeeds(boolean onlySeeds)
Set whether this peer will use only seed rendezvous when configured as an edge peer.

Parameters:
onlySeeds - If true then this peer will use only seed rendezvous when configured as an edge peer.

getSeedRendezvousConnectDelay

public long getSeedRendezvousConnectDelay()
The interval in relative milliseconds before which this peer will attempt to contact the the seed peers.

Returns:
The interval in relative milliseconds before which this peer will attempt to contact the the seed peers.

setSeedRendezvousConnectDelay

public void setSeedRendezvousConnectDelay(long newvalue)
Sets the interval in relative milliseconds before which this peer will attempt to contact the the seed peers.

Parameters:
newvalue - The interval in relative milliseconds before which this peer will attempt to contact the the seed peers or -1 for the default value.

getLeaseDuration

public long getLeaseDuration()
The interval in relative milliseconds of leases offered by rendezvous peers.

Returns:
The interval in relative milliseconds of leases offered by rendezvous peers.

setLeaseDuration

public void setLeaseDuration(long newvalue)
Sets interval in relative milliseconds of leases to be offered by rendezvous peers.

Parameters:
newvalue - The interval in relative milliseconds of leases to be offered by rendezvous peers or -1 for the default value.

getLeaseMargin

public long getLeaseMargin()
The interval in relative milliseconds of leases offered by rendezvous peers.

Returns:
The interval in relative milliseconds of leases offered by rendezvous peers.

setLeaseMargin

public void setLeaseMargin(long newvalue)
Sets interval in relative milliseconds of leases to be offered by rendezvous peers.

Parameters:
newvalue - The interval in relative milliseconds of leases to be offered by rendezvous peers or -1 for the default value.

getMaxClients

public int getMaxClients()
Return the maximum number of clients.

Returns:
The maximum number of clients.

setMaxClients

public void setMaxClients(int newvalue)
Sets he maximum number of clients.

Parameters:
newvalue - The maximum number of clients or -1 for the default value.

getMaxTTL

public int getMaxTTL()
Returns the maximum TTL for messages propagated by this peer or -1 for the default value.

Returns:
the maximum TTL for messages propagated by this peer or -1 for the default value.

setMaxTTL

public void setMaxTTL(int newvalue)
Sets the maximum TTL for messages propagated by this peer.

Parameters:
newvalue - the maximum TTL for messages propagated by this peer or -1 for the default value.

getMinHappyPeerView

public int getMinHappyPeerView()
Returns the minimum peerview size which the rendezvous service will find sufficient.

Returns:
the minimum peerview size.

setMinHappyPeerView

public void setMinHappyPeerView(int newvalue)
Sets the minimum peerview size which the rendezvous service will find sufficient. If the peerview size is below that threshold, the peerview will more aggressively try to discover additional members. If permitted, the local peer may eventually decide to become a rendezvous in order for the peerview to reach that size.

Parameters:
newvalue - the minimum peerview size, which must be > 0 or -1 for the default value.

getAclUri

public URI getAclUri()
Return ACL URI if set

Returns:
ACL URI if set, null otherwise

setAclUri

public void setAclUri(URI uri)
Sets ACL URI

Parameters:
uri - URI if set, null otherwise

JXSE