Project JXTA

net.jxta.impl.rendezvous
Class RendezVousImpl

java.lang.Object
  |
  +--net.jxta.impl.rendezvous.RendezVousImpl

public class RendezVousImpl
extends java.lang.Object
implements net.jxta.rendezvous.RendezVous, EndpointHandler

This class implements the RendezVous service


Inner Class Summary
 class RendezVousImpl.ClientGC
           
protected  class RendezVousImpl.PeerConnection
          Inner class used to store peers and lease associated to them
 
Constructor Summary
RendezVousImpl()
           
 
Method Summary
 void connectRendezVous(net.jxta.endpoint.EndpointAddress addr)
           
 void connectRendezVous(net.jxta.protocol.PeerGroupAdvertisement adv)
          Add a peer as a new RendezVous point.
 void demux(MessageImpl msg)
           
 net.jxta.document.Advertisement getAdvertisement()
          Returns the advertisement for that service.
 java.util.Enumeration getConnectedPeers()
          Returns an Enumeration of PeerID of the peers that are currentely connected.
 net.jxta.service.Service getInterface()
          Service objects are not manipulated directly to protect usage of the service.
 void init(net.jxta.peergroup.PeerGroup g, net.jxta.document.Advertisement sadv)
          Init routine
 java.util.Enumeration listRemovedRendezVous()
          Returns an Enumeration of the PeerID all the RendezVous on which this Peer failed to connect to.
 java.util.Enumeration listRendezVous()
          Returns an Enumeration of the PeerID all the RendezVous on which this Peer is currentely connected.
 void propagateToClients(net.jxta.endpoint.Message msg, java.lang.String serviceName, java.lang.String serviceParam, java.lang.String prunePeer)
          This API is provided to the Core implementation in order to propagate a message onto all the clients.
 void propagateToRendezVous(net.jxta.endpoint.Message msg, java.lang.String serviceName, java.lang.String serviceParam, java.lang.String prunePeer)
          This API is provided to the Core implementation in order to propagate a message onto all the rendez vous.
 void reconnectRendezVous(java.lang.String peer)
           
 void removeRendezVous(net.jxta.peer.PeerID rdv)
          Remove a RendezVous point.
 void sendRendezVousAdv(net.jxta.protocol.PeerAdvertisement destPeer, net.jxta.protocol.PeerAdvertisement rdv)
          Sends advertisement about other RendezVous to a given peer
 net.jxta.rendezvous.RendezVousMonitor setMonitor(net.jxta.rendezvous.RendezVousMonitor handler)
          Register a notification handler that is called each time a RendezVous peer is not reachable anymore.
 int startApp(java.lang.String[] arg)
          Supply arguments and starts this service if it hadn't started by itself.
 void startRendezVous(net.jxta.rendezvous.RendezVousManager handler)
          Start the local peer as a RendezVous peer.
 void stopApp()
          Ask this service to stop.
 void stopRendezVous()
          Stop the RendezVous function on the local Peer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RendezVousImpl

public RendezVousImpl()
Method Detail

startApp

public int startApp(java.lang.String[] arg)
Supply arguments and starts this service if it hadn't started by itself. Currently this service starts by itself and does not expect arguments.
Parameters:
arg - A table of strings arguments.
Returns:
int status indication.

stopApp

public void stopApp()
Ask this service to stop. This request is currently ignored.

getInterface

public net.jxta.service.Service getInterface()
Service objects are not manipulated directly to protect usage of the service. A Service interface is returned to access the service methods.
Returns:
Service public interface of the service

getAdvertisement

public net.jxta.document.Advertisement getAdvertisement()
Returns the advertisement for that service.
Returns:
Advertisement the advertisement.
Since:
JXTA 1.0

init

public void init(net.jxta.peergroup.PeerGroup g,
                 net.jxta.document.Advertisement sadv)
Init routine
Parameters:
myGroup - The Group associated with this service

connectRendezVous

public void connectRendezVous(net.jxta.protocol.PeerGroupAdvertisement adv)
                       throws java.io.IOException
Add a peer as a new RendezVous point.
Specified by:
connectRendezVous in interface net.jxta.rendezvous.RendezVous
Parameters:
adv - the advertisement of the RendezVous peer
timeout - the time to wait to establish the connection
Throws:
java.io.IOException - when the RendezVous peer is not reachable

connectRendezVous

public void connectRendezVous(net.jxta.endpoint.EndpointAddress addr)
                       throws java.io.IOException
Specified by:
connectRendezVous in interface net.jxta.rendezvous.RendezVous

reconnectRendezVous

public void reconnectRendezVous(java.lang.String peer)

removeRendezVous

public void removeRendezVous(net.jxta.peer.PeerID rdv)
Remove a RendezVous point.
Specified by:
removeRendezVous in interface net.jxta.rendezvous.RendezVous
Parameters:
rendezVous - the PeerId of the RendezVous point to remove
Throws:
java.io.IOException - if rendezVous is not connected.

setMonitor

public net.jxta.rendezvous.RendezVousMonitor setMonitor(net.jxta.rendezvous.RendezVousMonitor handler)
Register a notification handler that is called each time a RendezVous peer is not reachable anymore.
Specified by:
setMonitor in interface net.jxta.rendezvous.RendezVous
Parameters:
handler - a handler that is called each time a RendezVous peer is is not reachable anymore.
Returns:
RendezVousMonitor returns, if any, the current RendezVousMonitor

listRendezVous

public java.util.Enumeration listRendezVous()
Returns an Enumeration of the PeerID all the RendezVous on which this Peer is currentely connected.
Specified by:
listRendezVous in interface net.jxta.rendezvous.RendezVous

listRemovedRendezVous

public java.util.Enumeration listRemovedRendezVous()
Returns an Enumeration of the PeerID all the RendezVous on which this Peer failed to connect to.
Specified by:
listRemovedRendezVous in interface net.jxta.rendezvous.RendezVous

sendRendezVousAdv

public void sendRendezVousAdv(net.jxta.protocol.PeerAdvertisement destPeer,
                              net.jxta.protocol.PeerAdvertisement rdv)
Sends advertisement about other RendezVous to a given peer
Specified by:
sendRendezVousAdv in interface net.jxta.rendezvous.RendezVous
Parameters:
destPeer - is the advertisement of the peer to which to send the RendezVous advertisement.
rendezVous - is the advertisment of a RendezVous peer

startRendezVous

public void startRendezVous(net.jxta.rendezvous.RendezVousManager handler)
                     throws java.io.IOException
Start the local peer as a RendezVous peer. The caller must provide a handler to an authorization manager.
Specified by:
startRendezVous in interface net.jxta.rendezvous.RendezVous
Parameters:
handler - is the RendezVousManager that will be invoked each time a new Peer request to be connected.
Throws:
java.io.IOException - when a handler has already been connected

stopRendezVous

public void stopRendezVous()
Stop the RendezVous function on the local Peer. All connected Peer are disconnected.
Specified by:
stopRendezVous in interface net.jxta.rendezvous.RendezVous
Throws:
java.io.IOException - if the local peer was not a RendezVous peer.

getConnectedPeers

public java.util.Enumeration getConnectedPeers()
Returns an Enumeration of PeerID of the peers that are currentely connected.
Specified by:
getConnectedPeers in interface net.jxta.rendezvous.RendezVous

demux

public void demux(MessageImpl msg)
Specified by:
demux in interface EndpointHandler

propagateToClients

public void propagateToClients(net.jxta.endpoint.Message msg,
                               java.lang.String serviceName,
                               java.lang.String serviceParam,
                               java.lang.String prunePeer)
This API is provided to the Core implementation in order to propagate a message onto all the clients.
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.

propagateToRendezVous

public void propagateToRendezVous(net.jxta.endpoint.Message msg,
                                  java.lang.String serviceName,
                                  java.lang.String serviceParam,
                                  java.lang.String prunePeer)
This API is provided to the Core implementation in order to propagate a message onto all the rendez vous.
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.

Project JXTA