Project JXTA

net.jxta.rendezvous
Interface RendezVousService

All Superinterfaces:
Module, Service

public interface RendezVousService
extends Service

This interface provides an API to the Jxta RendezVous Service.

The RendezVous Service is responsible for propagating message within a JXTA PeerGroup.

While the internal protcol of diffusion is let to the implementation of the service, the JXTA RendezVous Service defines a subscribe mechanism allowing JXTA peers to receive propagated messages (clients of the service) or become a repeater of the service (rendezvous peers). At least one peer in a given PeerGroup must be a rendezvous. However, rendezvous peers can dynamically join or leave the PeerGroup.

When a peers becomes a rendezvous, it publishes a special advertisement, a RdvAdvertisement that can be found by other peers which are looking for a rendezvous in the PeerGroup.

Since:
JXTA 1.0
Version:
$Revision: 1.7 $
See Also:
RendezVousManager, RendezVousMonitor, RdvAdvertisement, PeerAdvertisement

Method Summary
 void addListener(RendezvousListener listener)
          Add a listener for RenDezVousEvents
 void addPropagateListener(java.lang.String name, EndpointListener listener)
          Clients of the rendezvous service can use this to receive raw propagation rather than crawling query/responses.
 void connectToRendezVous(EndpointAddress addr)
          Add a peer as a new RendezVousService point.
 void connectToRendezVous(PeerAdvertisement adv)
          Add a peer as a new RendezVousService point.
 void disconnectFromRendezVous(ID peerID)
          Remove a RendezVousService point.
 java.util.Enumeration getConnectedPeers()
          Returns an Enumeration of PeerID of the peers that are currentely connected.
 java.util.Enumeration getConnectedRendezVous()
          Returns an Enumeration of the PeerID all the RendezVous on which this Peer is currentely connected.
 java.util.Enumeration getDisconnectedRendezVous()
          Returns an Enumeration of the PeerID all the RendezVous on which this Peer failed to connect to.
 boolean isConnectedToRendezVous()
          Return true if connected to a rendezvous.
 boolean isRendezVous()
          tells whether this rendezvous service currently acts as a "super-node" "rendezvous", knowlege hub, influence broker, or whichever higher status applies to the implementation.
 void propagate(Message msg, java.lang.String serviceName, java.lang.String serviceParam, int defaultTTL)
          Propagates a message onto as many peers on the local network as possible.
 void propagateInGroup(Message msg, java.lang.String serviceName, java.lang.String serviceParam, int defaultTTL, java.lang.String prunePeer)
          Deprecated.  
 void propagateToNeighbors(Message msg, java.lang.String serviceName, java.lang.String serviceParam, int defaultTTL, java.lang.String prunePeer)
          Deprecated.  
 boolean removeListener(RendezvousListener listener)
          Removes a Listener previously added with addListener.
 void removePropagateListener(java.lang.String name, EndpointListener listener)
          Removes a Listener previously added with addPropagateListener.
 void sendRendezVousAdv(PeerAdvertisement destPeer, PeerAdvertisement rendezVous)
          Sends advertisement about other RendezVous to a given peer
 RendezVousMonitor setMonitor(RendezVousMonitor monitor)
          Register a notification monitor that is called each time a RendezVous peer is not reachable anymore.
 void startRendezVous()
          Start the local peer as a RendezVous peer with the default manager.
 void startRendezVous(RendezVousManager monitor)
          Start the local peer as a RendezVous peer.
 void stopRendezVous()
          Stop the RendezVous function on the local Peer.
 
Methods inherited from interface net.jxta.service.Service
getImplAdvertisement, getInterface
 
Methods inherited from interface net.jxta.platform.Module
init, startApp, stopApp
 

Method Detail

connectToRendezVous

public void connectToRendezVous(PeerAdvertisement adv)
                         throws java.io.IOException
Add a peer as a new RendezVousService point. If/When the RendezVousService accepts the connection, the RendezVousService service will invoke the RendezVousMonitor.
Parameters:
adv - the advertisement of the RendezVousService peer
Throws:
java.io.IOException - when the RendezVousService peer is not reachable
Since:
JXTA 1.0

connectToRendezVous

public void connectToRendezVous(EndpointAddress addr)
                         throws java.io.IOException
Add a peer as a new RendezVousService point. If/When the RendezVousService accepts the connection, the RendezVousService service will invoke the RendezVousMonitor.
Parameters:
addr - EndpointAddress of the rendezvous peer
Throws:
java.io.IOException - when the RendezVousService peer is not reachable
Since:
JXTA 1.0

disconnectFromRendezVous

public void disconnectFromRendezVous(ID peerID)
Remove a RendezVousService point.
Parameters:
peerID - the PeerId of the RendezVous to disconnect from.
Since:
JXTA 1.0

setMonitor

public RendezVousMonitor setMonitor(RendezVousMonitor monitor)
Register a notification monitor that is called each time a RendezVous peer is not reachable anymore.
Parameters:
monitor - a monitor that is called each time a RendezVous peer is is not reachable anymore.
Returns:
RendezVousMonitor returns, if any, the current RendezVousMonitor
Since:
JXTA 1.0

getConnectedRendezVous

public java.util.Enumeration getConnectedRendezVous()
Returns an Enumeration of the PeerID all the RendezVous on which this Peer is currentely connected.

return Enumeration enumeration of RendezVous

Since:
JXTA 1.0

getDisconnectedRendezVous

public java.util.Enumeration getDisconnectedRendezVous()
Returns an Enumeration of the PeerID all the RendezVous on which this Peer failed to connect to.
Returns:
Enumeration enumeration of RendezVous
Since:
JXTA 1.0

startRendezVous

public void startRendezVous(RendezVousManager monitor)
                     throws java.io.IOException
Start the local peer as a RendezVous peer. The caller must provide a monitor to an authorization manager.
Parameters:
monitor - is the RendezVousManager that will be invoked each time a new Peer request to be connected.
Throws:
java.io.IOException - when a monitor has already been connected
Since:
JXTA 1.0

startRendezVous

public void startRendezVous()
Start the local peer as a RendezVous peer with the default manager.
Since:
JXTA 1.0

stopRendezVous

public void stopRendezVous()
Stop the RendezVous function on the local Peer. All connected Peer are disconnected.
Since:
JXTA 1.0

getConnectedPeers

public java.util.Enumeration getConnectedPeers()
Returns an Enumeration of PeerID of the peers that are currentely connected.
Returns:
Enumeration enumeration of peers connected to that rendezvous
Since:
JXTA 1.0

sendRendezVousAdv

public void sendRendezVousAdv(PeerAdvertisement destPeer,
                              PeerAdvertisement rendezVous)
Sends advertisement about other RendezVous to a given peer
Parameters:
destPeer - is the advertisement of the peer to which to send the RendezVous advertisement.
rendezVous - is the advertisment of a RendezVous peer
Since:
JXTA 1.0

addPropagateListener

public void addPropagateListener(java.lang.String name,
                                 EndpointListener listener)
                          throws java.io.IOException
Clients of the rendezvous service can use this to receive raw propagation rather than crawling query/responses. It takes care of TTL counting and loop detection.
Parameters:
name - The name of the listener.
listener - An EndpointListener to process the message.

removePropagateListener

public void removePropagateListener(java.lang.String name,
                                    EndpointListener listener)
                             throws java.io.IOException
Removes a Listener previously added with addPropagateListener.
Parameters:
name - The name of the listener.
listener - An EndpointListener to process the message.

addListener

public void addListener(RendezvousListener listener)
Add a listener for RenDezVousEvents
Parameters:
listener - An RendezvousListener to process the event.

removeListener

public boolean removeListener(RendezvousListener listener)
Removes a Listener previously added with addListener.
Parameters:
listener - the RendezvousListener listener remove

propagate

public void propagate(Message msg,
                      java.lang.String serviceName,
                      java.lang.String serviceParam,
                      int defaultTTL)
               throws java.io.IOException
Propagates a message onto as many peers on the local network as possible. Typically the message will go to all the peers to which at least one endpoint transport can address without using the router. Only a single HOP at a time is performed. Messages are always delivered to the destination handler on arrival. This handler is responsible for repropagating further, if deemed appropropriate. Loop and TTL control are performed automatically. Messages can be propagated via this method for the first time or can be re-propagated by re-using a message that came in via propagation. In the later case, the TTL and loop detection parameters CANNOT be re-initialized. If one wants to "re-propagate" a message with a new TTL and blank gateways list one must generate a completely new message. This limits the risk of accidental propagation storms, although they can always be engineered deliberately. Note: The original msg is not modified and may be reused upon return.
Parameters:
msg - is the message to propagate.
serviceName - is the name of the service
serviceParam - is the parameter of the service

propagateToNeighbors

public void propagateToNeighbors(Message msg,
                                 java.lang.String serviceName,
                                 java.lang.String serviceParam,
                                 int defaultTTL,
                                 java.lang.String prunePeer)
                          throws java.io.IOException
Deprecated.  

Propagates a message onto as many peers on the local network as possible. Typically the message will go to all the peers to which at least one endpoint transport can address without using the router. Only a single HOP at a time is performed. Messages are always delivered to the destination handler on arrival. This handler is responsible for repropagating further, if deemed appropropriate. Loop and TTL control are performed automatically. Messages can be propagated via this method for the first time or can be re-propagated by re-using a message that came in via propagation. In the later case, the TTL and loop detection parameters CANNOT be re-initialized. If one wants to "re-propagate" a message with a new TTL and blank gateways list one must generate a completely new message. This limits the risk of accidental propagation storms, although they can always be engineered deliberately. Note: The original msg is not modified and may be reused upon return.
Parameters:
msg - is the message to propagate.
serviceName - is the name of the service
serviceParam - is the parameter of the service
prunePeer - is a peer to prune in the propagation.
See Also:
propagate(net.jxta.endpoint.Message, java.lang.String, java.lang.String, int)

propagateInGroup

public void propagateInGroup(Message msg,
                             java.lang.String serviceName,
                             java.lang.String serviceParam,
                             int defaultTTL,
                             java.lang.String prunePeer)
                      throws java.io.IOException
Deprecated.  

Propagates a message onto as many peers in the group as possible. Only a single HOP at a time is performed. Messages are always delivered to the destination handler on arrival. This handler is responsible for repropagating further, if deemed appropropriate. Loop and TTL control are performed automatically. Messages can be propagated via this method for the first time or can be re-propagated by re-using a message that came in via propagation. In the later case, the TTL and loop detection parameters CANNOT be re-initialized. If one wants to "re-propagate" a message with a new TTL and blank gateways list one must generate a completely new message. This limits the risk of accidental propagation storms, although they can always be engineered deliberately. Note: The original msg is not modified and may be reused upon return.
Parameters:
msg - is the message to propagate.
serviceName - is the name of the service
serviceParam - is the parameter of the service
prunePeer - is a peer to prune in the propagation.
See Also:
propagate(net.jxta.endpoint.Message, java.lang.String, java.lang.String, int)

isConnectedToRendezVous

public boolean isConnectedToRendezVous()
Return true if connected to a rendezvous.
Returns:
true if connected to a rendezvous, false otherwise

isRendezVous

public boolean isRendezVous()
tells whether this rendezvous service currently acts as a "super-node" "rendezvous", knowlege hub, influence broker, or whichever higher status applies to the implementation.
Returns:
boolean true if this rendezvous acts as a "rendezvous" per the implementation definition.

Project JXTA