Project JXTA

net.jxta.impl.rendezvous
Class RendezVousServiceImpl

java.lang.Object
  extended by net.jxta.impl.rendezvous.RendezVousServiceImpl
All Implemented Interfaces:
Module, RendezVousService, Service

public final class RendezVousServiceImpl
extends Object
implements RendezVousService

A JXTA RendezvousService implementation which implements the standard JXTA Rendezvous Protocol (RVP).

See Also:
RendezvousService, JXTA Protocols Specification : Rendezvous Protocol

Field Summary
 EndpointService endpoint
           
protected static int MAX_MSGIDS
           
 PeerView rpv
          The peer view for this peer group.
 
Fields inherited from interface net.jxta.rendezvous.RendezVousService
DEFAULT_TTL
 
Fields inherited from interface net.jxta.platform.Module
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_OK
 
Constructor Summary
RendezVousServiceImpl()
          Constructor for the RendezVousServiceImpl object
 
Method Summary
 void addListener(RendezvousListener listener)
          
 boolean addMsgId(UUID id)
          Checks if a message id has been recorded
 boolean addPropagateListener(String name, EndpointListener listener)
          
 boolean addPropagateListener(String serviceName, String serviceParam, EndpointListener listener)
          
 void challengeRendezVous(ID peer, long delay)
          
 void connectToRendezVous(EndpointAddress addr)
          
 void connectToRendezVous(PeerAdvertisement adv)
          
 UUID createMsgId()
           
 void disconnectFromRendezVous(ID peerId)
          
static RouteAdvertisement extractRouteAdv(PeerAdvertisement adv)
           
protected  void finalize()
          
 void generateEvent(int type, ID regarding)
          Creates a rendezvous event and sends it to all registered listeners.
 ID getAssignedID()
           
 Vector getConnectedPeerIDs()
          
 Enumeration getConnectedPeers()
          
 Enumeration getConnectedRendezVous()
          
 Enumeration getDisconnectedRendezVous()
          
 Advertisement getImplAdvertisement()
          
 Service getInterface()
          
 EndpointListener getListener(String str)
           
 Vector getLocalWalkView()
          
(package private)  RendezVousServiceProvider getRendezvousProvider()
          Deprecated. This is private for debugging and diagnostics only.
 RendezVousStatus getRendezVousStatus()
           
 void init(PeerGroup g, ID assignedID, Advertisement impl)
          

Note: it is permissible to pass null as the impl parameter when this instance is not being loaded via the module framework.

 boolean isConnectedToRendezVous()
          Gets the rendezvousConnected attribute of the RendezVousServiceImpl object
 boolean isMsgIdRecorded(UUID id)
           
 boolean isRendezVous()
          
 void propagate(Enumeration destPeerIDs, Message msg, String serviceName, String serviceParam, int defaultTTL)
          
 void propagate(Message msg, String serviceName, String serviceParam, int defaultTTL)
          
 void propagateInGroup(Message msg, String serviceName, String serviceParam, int ttl)
          
 void propagateInGroup(Message msg, String serviceName, String serviceParam, int ttl, String prunePeer)
          
 void propagateToNeighbors(Message msg, String serviceName, String serviceParam, int ttl)
          
 void propagateToNeighbors(Message msg, String serviceName, String serviceParam, int ttl, String prunePeer)
          
 boolean removeListener(RendezvousListener listener)
          
 EndpointListener removePropagateListener(String name, EndpointListener listener)
          
 EndpointListener removePropagateListener(String serviceName, String serviceParam, EndpointListener listener)
          
 boolean setAutoStart(boolean auto)
          (@inheritDoc}
 boolean setAutoStart(boolean auto, long period)
          (@inheritDoc}
 int startApp(String[] arg)
          
 void startRendezVous()
          
 void stopApp()
          
 void stopRendezVous()
          
 void walk(Message msg, String serviceName, String serviceParam, int defaultTTL)
          
 void walk(Vector destPeerIDs, Message msg, String serviceName, String serviceParam, int defaultTTL)
          
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_MSGIDS

protected static final int MAX_MSGIDS
See Also:
Constant Field Values

endpoint

public EndpointService endpoint

rpv

public volatile PeerView rpv
The peer view for this peer group.

Constructor Detail

RendezVousServiceImpl

public RendezVousServiceImpl()
Constructor for the RendezVousServiceImpl object

Method Detail

extractRouteAdv

public static final RouteAdvertisement extractRouteAdv(PeerAdvertisement adv)

finalize

protected void finalize()
                 throws Throwable

Overrides:
finalize in class Object
Throws:
Throwable

getInterface

public Service getInterface()

Specified by:
getInterface in interface Service

getImplAdvertisement

public Advertisement getImplAdvertisement()

Specified by:
getImplAdvertisement in interface Service

getAssignedID

public ID getAssignedID()

init

public void init(PeerGroup g,
                 ID assignedID,
                 Advertisement impl)

Note: it is permissible to pass null as the impl parameter when this instance is not being loaded via the module framework.

Specified by:
init in interface Module

startApp

public int startApp(String[] arg)

Specified by:
startApp in interface Module

stopApp

public void stopApp()

Specified by:
stopApp in interface Module

isRendezVous

public boolean isRendezVous()

Specified by:
isRendezVous in interface RendezVousService

getRendezVousStatus

public RendezVousStatus getRendezVousStatus()
Specified by:
getRendezVousStatus in interface RendezVousService

setAutoStart

public boolean setAutoStart(boolean auto)
(@inheritDoc}

Specified by:
setAutoStart in interface RendezVousService

setAutoStart

public boolean setAutoStart(boolean auto,
                            long period)
(@inheritDoc}

Specified by:
setAutoStart in interface RendezVousService

connectToRendezVous

public void connectToRendezVous(PeerAdvertisement adv)
                         throws IOException

Specified by:
connectToRendezVous in interface RendezVousService
Throws:
IOException

connectToRendezVous

public void connectToRendezVous(EndpointAddress addr)
                         throws IOException

Specified by:
connectToRendezVous in interface RendezVousService
Throws:
IOException

challengeRendezVous

public void challengeRendezVous(ID peer,
                                long delay)

Specified by:
challengeRendezVous in interface RendezVousService

disconnectFromRendezVous

public void disconnectFromRendezVous(ID peerId)

Specified by:
disconnectFromRendezVous in interface RendezVousService

getConnectedRendezVous

public Enumeration getConnectedRendezVous()

Specified by:
getConnectedRendezVous in interface RendezVousService

getDisconnectedRendezVous

public Enumeration getDisconnectedRendezVous()

Specified by:
getDisconnectedRendezVous in interface RendezVousService

getConnectedPeers

public Enumeration getConnectedPeers()

Specified by:
getConnectedPeers in interface RendezVousService

getConnectedPeerIDs

public Vector getConnectedPeerIDs()

Specified by:
getConnectedPeerIDs in interface RendezVousService

isConnectedToRendezVous

public boolean isConnectedToRendezVous()
Gets the rendezvousConnected attribute of the RendezVousServiceImpl object

Specified by:
isConnectedToRendezVous in interface RendezVousService
Returns:
true if connected to a rendezvous, false otherwise

startRendezVous

public void startRendezVous()

Specified by:
startRendezVous in interface RendezVousService

stopRendezVous

public void stopRendezVous()

Specified by:
stopRendezVous in interface RendezVousService

addPropagateListener

public boolean addPropagateListener(String name,
                                    EndpointListener listener)

Specified by:
addPropagateListener in interface RendezVousService

addPropagateListener

public boolean addPropagateListener(String serviceName,
                                    String serviceParam,
                                    EndpointListener listener)

Specified by:
addPropagateListener in interface RendezVousService

getListener

public EndpointListener getListener(String str)

removePropagateListener

public EndpointListener removePropagateListener(String name,
                                                EndpointListener listener)

Specified by:
removePropagateListener in interface RendezVousService

removePropagateListener

public EndpointListener removePropagateListener(String serviceName,
                                                String serviceParam,
                                                EndpointListener listener)

Specified by:
removePropagateListener in interface RendezVousService

propagate

public void propagate(Message msg,
                      String serviceName,
                      String serviceParam,
                      int defaultTTL)
               throws IOException

Specified by:
propagate in interface RendezVousService
Throws:
IOException

propagate

public void propagate(Enumeration destPeerIDs,
                      Message msg,
                      String serviceName,
                      String serviceParam,
                      int defaultTTL)
               throws IOException

Specified by:
propagate in interface RendezVousService
Throws:
IOException

walk

public void walk(Message msg,
                 String serviceName,
                 String serviceParam,
                 int defaultTTL)
          throws IOException

Specified by:
walk in interface RendezVousService
Throws:
IOException

walk

public void walk(Vector destPeerIDs,
                 Message msg,
                 String serviceName,
                 String serviceParam,
                 int defaultTTL)
          throws IOException

Specified by:
walk in interface RendezVousService
Throws:
IOException

getLocalWalkView

public Vector getLocalWalkView()

Specified by:
getLocalWalkView in interface RendezVousService

propagateToNeighbors

public void propagateToNeighbors(Message msg,
                                 String serviceName,
                                 String serviceParam,
                                 int ttl,
                                 String prunePeer)
                          throws IOException

Specified by:
propagateToNeighbors in interface RendezVousService
Throws:
IOException

propagateToNeighbors

public void propagateToNeighbors(Message msg,
                                 String serviceName,
                                 String serviceParam,
                                 int ttl)
                          throws IOException

Specified by:
propagateToNeighbors in interface RendezVousService
Throws:
IOException

propagateInGroup

public void propagateInGroup(Message msg,
                             String serviceName,
                             String serviceParam,
                             int ttl,
                             String prunePeer)
                      throws IOException

Specified by:
propagateInGroup in interface RendezVousService
Throws:
IOException

propagateInGroup

public void propagateInGroup(Message msg,
                             String serviceName,
                             String serviceParam,
                             int ttl)
                      throws IOException

Specified by:
propagateInGroup in interface RendezVousService
Throws:
IOException

addListener

public final void addListener(RendezvousListener listener)

Specified by:
addListener in interface RendezVousService

removeListener

public final boolean removeListener(RendezvousListener listener)

Specified by:
removeListener in interface RendezVousService

generateEvent

public final void generateEvent(int type,
                                ID regarding)
Creates a rendezvous event and sends it to all registered listeners.


isMsgIdRecorded

public boolean isMsgIdRecorded(UUID id)

addMsgId

public boolean addMsgId(UUID id)
Checks if a message id has been recorded

Parameters:
id - message to record.

createMsgId

public UUID createMsgId()

getRendezvousProvider

RendezVousServiceProvider getRendezvousProvider()
Deprecated. This is private for debugging and diagnostics only.

Get the current provider. This is for debugging purposes only.


JXTA J2SE