|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.rendezvous.RendezVousServiceProvider
public abstract class RendezVousServiceProvider
This abstract class must be extended for all RendezVous Service providers that are managed by RendezVousServiceImpl.
Implementors of providers are responsible for using appropriate synchronization. The RendezvousServiceImpl provides synchronization control only only those methods which involve changing the active provider.
Field Summary | |
---|---|
protected boolean |
closed
|
protected PeerGroup |
group
|
protected int |
MAX_TTL
Maximum TTL we will allow for propagation and repropagation issued by this peer. |
protected String |
PROP_HDR_ELEMENT_NAME
|
protected String |
PropPName
|
protected static String |
PropSName
|
protected static String |
RDV_MSG_NAMESPACE_NAME
|
protected RendezVousServiceImpl |
rdvService
|
protected RendezvousMeter |
rendezvousMeter
|
protected RendezvousServiceMonitor |
rendezvousServiceMonitor
|
Constructor Summary | |
---|---|
protected |
RendezVousServiceProvider(PeerGroup group,
RendezVousServiceImpl rdvService)
|
Method Summary | |
---|---|
abstract void |
challengeRendezVous(ID peer,
long delay)
Resets the local idea of the lease to the specified value. |
protected RendezVousPropagateMessage |
checkPropHeader(Message msg)
Check and updates the header message element |
abstract void |
connectToRendezVous(EndpointAddress addr,
Object hint)
Attempt to connect to the specified rendezvous peer. |
abstract void |
disconnectFromRendezVous(ID peerID)
Remove a RendezVousService point. |
abstract Vector<ID> |
getConnectedPeerIDs()
Returns the peers that are currently connected to this peer. |
protected XMLDocument |
getPeerAdvertisementDoc()
|
protected RendezVousPropagateMessage |
getPropHeader(Message msg)
Get propagate header from the message. |
abstract boolean |
isConnectedToRendezVous()
Return true if connected to a rendezvous. |
protected static EndpointAddress |
mkAddress(ID destPeer,
String serv,
String parm)
Convenience method for constructing an endpoint address from an id |
protected static EndpointAddress |
mkAddress(String destPeer,
String serv,
String parm)
Convenience method for constructing an endpoint address from an id |
void |
processIncomingMessage(Message msg,
EndpointAddress srcAddr,
EndpointAddress dstAddr)
This method is invoked by the EndpointService for each incoming message which is addressed to this listener. |
protected void |
processReceivedMessage(Message message,
RendezVousPropagateMessage propHdr,
EndpointAddress srcAddr,
EndpointAddress dstAddr)
Process a propagated message. |
abstract void |
propagate(Enumeration<? extends ID> destPeerIds,
Message msg,
String serviceName,
String serviceParam,
int initialTTL)
Propagates a message onto as many peers on the local network as possible. |
abstract void |
propagate(Message msg,
String serviceName,
String serviceParam,
int initialTTL)
Propagates a message onto as many peers on the local network as possible. |
abstract void |
propagateInGroup(Message msg,
String serviceName,
String serviceParam,
int ttl)
|
abstract void |
propagateToNeighbors(Message msg,
String serviceName,
String serviceParam,
int initialTTL)
Propagates a message onto as many peers on the local network as possible. |
protected abstract void |
repropagate(Message msg,
RendezVousPropagateMessage propHdr,
String serviceName,
String serviceParam)
Responsible for forwarding received messages to the rest of the network as appropriate. |
protected void |
sendToNetwork(Message msg,
RendezVousPropagateMessage propHdr)
Propagates the message via endpoint propagation (multicast/broadcast) on all Message Transports. |
void |
setRendezvousServiceMonitor(RendezvousServiceMonitor rendezvousServiceMonitor)
Set the RendezvousServiceMonitor. |
protected int |
startApp(String[] arg)
Supply arguments and starts this service if it hadn't started by itself. |
protected void |
stopApp()
Ask this service to stop. |
protected RendezVousPropagateMessage |
updatePropHeader(Message msg,
RendezVousPropagateMessage propHdr,
String serviceName,
String serviceParam,
int initialTTL)
|
abstract void |
walk(Message msg,
String serviceName,
String serviceParam,
int initialTTL)
Walk a message through the rendezvous peers of the network: only rendezvous peers will receive the message. |
abstract void |
walk(Vector<? extends ID> destPeerIDs,
Message msg,
String serviceName,
String serviceParam,
int initialTTL)
Walk a message through the rendezvous peers of the network: only rendezvous peers will receive the message. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final String PropSName
protected static final String RDV_MSG_NAMESPACE_NAME
protected final String PropPName
protected final String PROP_HDR_ELEMENT_NAME
protected int MAX_TTL
protected final PeerGroup group
protected final RendezVousServiceImpl rdvService
protected boolean closed
protected RendezvousServiceMonitor rendezvousServiceMonitor
protected RendezvousMeter rendezvousMeter
Constructor Detail |
---|
protected RendezVousServiceProvider(PeerGroup group, RendezVousServiceImpl rdvService)
group
- the peergrouprdvService
- the implementationMethod Detail |
---|
public void processIncomingMessage(Message msg, EndpointAddress srcAddr, EndpointAddress dstAddr)
processIncomingMessage
in interface EndpointListener
msg
- Incoming messagesrcAddr
- Endpoint Address of the source of the message.dstAddr
- Endpoint Address of the destination of the message.protected XMLDocument getPeerAdvertisementDoc()
protected int startApp(String[] arg)
arg
- argument params
protected void stopApp()
public void setRendezvousServiceMonitor(RendezvousServiceMonitor rendezvousServiceMonitor)
rendezvousServiceMonitor
- The monitor.MonitorManager
public abstract void challengeRendezVous(ID peer, long delay)
peer
- The peer to be challengeddelay
- The delaypublic abstract void connectToRendezVous(EndpointAddress addr, Object hint) throws IOException
addr
- The endpoint address of the rendezvous peer.hint
- An optional hint which may be null
.
IOException
- If no connection could be made to the specified peer.public abstract void disconnectFromRendezVous(ID peerID)
peerID
- the PeerId of the RendezVous to disconnect from.public abstract Vector<ID> getConnectedPeerIDs()
public abstract void propagate(Message msg, String serviceName, String serviceParam, int initialTTL) throws IOException
msg
- is the message to propagate.serviceName
- is the name of the serviceserviceParam
- is the parameter of the serviceinitialTTL
- is the maximum TTL of the message (note that the Rendezvous
Service implementation is free to decrease that value.
IOException
- if an io error occurspublic abstract void propagate(Enumeration<? extends ID> destPeerIds, Message msg, String serviceName, String serviceParam, int initialTTL) throws IOException
destPeerIds
- An enumeration of the peers that are recipients of the
propagated message.msg
- is the message to propagate.serviceName
- is the name of the serviceserviceParam
- is the parameter of the serviceinitialTTL
- is the maximum TTL of the message (note that the Rendezvous
Service implementation is free to decrease that value.
IOException
- if an io error occurspublic abstract void propagateToNeighbors(Message msg, String serviceName, String serviceParam, int initialTTL) throws IOException
msg
- is the message to propagate.serviceName
- is the name of the serviceserviceParam
- is the parameter of the serviceinitialTTL
- is the maximum TTL of the message (note that the Rendezvous
Service implementation is free to decrease that value.
IOException
- if an io error occurspublic abstract boolean isConnectedToRendezVous()
public abstract void walk(Message msg, String serviceName, String serviceParam, int initialTTL) throws IOException
msg
- is the message to walk.serviceName
- is the name of the serviceserviceParam
- is the parameter of the serviceinitialTTL
- is the maximum TTL of the message (note that the Rendezvous
Service implementation is free to decrease that value.
IOException
- when walking the message is impossible (network failure)public abstract void walk(Vector<? extends ID> destPeerIDs, Message msg, String serviceName, String serviceParam, int initialTTL) throws IOException
destPeerIDs
- is a Vector of PeerID of the peers which are receiving
first the walker. Note that each entry in the Vector will create its own
walker.msg
- is the message to walk.serviceName
- is the name of the serviceserviceParam
- is the parameter of the serviceinitialTTL
- is the maximum TTL of the message (note that the Rendezvous
Service implementation is free to decrease that value.
IOException
- when walking the message is impossible (network failure)protected void processReceivedMessage(Message message, RendezVousPropagateMessage propHdr, EndpointAddress srcAddr, EndpointAddress dstAddr)
message
- the message receivedpropHdr
- the message headersrcAddr
- the source addressdstAddr
- the message destination addreessprotected abstract void repropagate(Message msg, RendezVousPropagateMessage propHdr, String serviceName, String serviceParam)
msg
- the message to be repropagated.propHdr
- It's current propagation header.serviceName
- The destination service.serviceParam
- The destination service parameter.public abstract void propagateInGroup(Message msg, String serviceName, String serviceParam, int ttl) throws IOException
IOException
protected void sendToNetwork(Message msg, RendezVousPropagateMessage propHdr) throws IOException
msg
- The message to be propagated.propHdr
- It's current propagation header.
IOException
- if an io error occursprotected static EndpointAddress mkAddress(String destPeer, String serv, String parm)
destPeer
- peer idserv
- the service name (if any)parm
- the service param (if any)
protected static EndpointAddress mkAddress(ID destPeer, String serv, String parm)
destPeer
- peer idserv
- the service name (if any)parm
- the service param (if any)
protected RendezVousPropagateMessage getPropHeader(Message msg)
msg
- The source message.
protected RendezVousPropagateMessage checkPropHeader(Message msg)
msg
- the message to check
protected RendezVousPropagateMessage updatePropHeader(Message msg, RendezVousPropagateMessage propHdr, String serviceName, String serviceParam, int initialTTL)
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |