|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectp2ps.imp.rendezvous.PeerConnectionManager
A class for managing the connections between a standard peer and rendezvous peers. This class is responsible for creating new connections and ensuring the required connectivity is maintained.
| Field Summary | |
static int |
MAX_CONNECTIONS
|
static int |
PEER
|
static int |
RENDEZVOUS
|
protected java.util.Hashtable |
rendezvousconnect
a hashtable of rendezvous connection managers keyed by peer id |
| Constructor Summary | |
protected |
PeerConnectionManager(int type,
Peer peer)
|
|
PeerConnectionManager(Peer peer)
|
| Method Summary | |
void |
advertDiscovered(DiscoveryEvent event)
|
void |
connectionAccepted(java.lang.String peerid,
RendezvousConnection connection)
Called when a rendezvous connection is accepted |
void |
connectionDeclined(java.lang.String peerid,
RendezvousConnection connection)
Called when a rendezvous connection is declined |
void |
connectionFailed(java.lang.String peerid,
RendezvousConnection connection)
Called when a rendezvous connection fails |
void |
dispose()
Dispose the connection manager |
protected void |
forwardAdvert(Advertisement advert)
Forwards an advertisement to all the rendezvous to which the peer is connected. |
protected void |
forwardCache(RendezvousConnection connect)
Forwards the local cache to the specified rendezvous |
java.lang.String[] |
getConnectedRendezvous()
|
int |
getCurrentRendezvousConnections()
|
RendezvousAdvertisement |
getRendezvousAdvertisement()
|
int |
getRequiredRendezvousConnections()
|
protected void |
handleAdvert(Advertisement advert,
OutputPipe replypipe)
Handles an advert as required by the connection manager (e.g. |
void |
init()
Initializes the connection manager |
void |
initConnection(RendezvousAdvertisement advert)
Initializes a connection to the specified rendezvous |
protected void |
initNewConnection()
Tries to establish a new rendezvous connections |
boolean |
isRendezvousConnectionRequired()
|
void |
send(Advertisement advert)
Send an advertisement to all the rendezvous to which the peer is connected. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int PEER
public static final int RENDEZVOUS
public static int MAX_CONNECTIONS
protected java.util.Hashtable rendezvousconnect
| Constructor Detail |
public PeerConnectionManager(Peer peer)
throws java.io.IOException
protected PeerConnectionManager(int type,
Peer peer)
throws java.io.IOException
| Method Detail |
public void init()
throws java.io.IOException
init in interface ConnectionManagerjava.io.IOExceptionpublic RendezvousAdvertisement getRendezvousAdvertisement()
getRendezvousAdvertisement in interface ConnectionManagerpublic boolean isRendezvousConnectionRequired()
isRendezvousConnectionRequired in interface ConnectionManagerpublic int getRequiredRendezvousConnections()
getRequiredRendezvousConnections in interface ConnectionManagerpublic int getCurrentRendezvousConnections()
getCurrentRendezvousConnections in interface ConnectionManagerpublic java.lang.String[] getConnectedRendezvous()
getConnectedRendezvous in interface ConnectionManager
public void initConnection(RendezvousAdvertisement advert)
throws InitializationException,
java.io.IOException
initConnection in interface ConnectionManagerInitializationException
java.io.IOExceptionprotected void initNewConnection()
public void send(Advertisement advert)
throws java.io.IOException
send in interface ConnectionManagerjava.io.IOException
protected void handleAdvert(Advertisement advert,
OutputPipe replypipe)
throws java.io.IOException
java.io.IOExceptionprotected void forwardCache(RendezvousConnection connect)
protected void forwardAdvert(Advertisement advert)
throws java.io.IOException
java.io.IOExceptionpublic void advertDiscovered(DiscoveryEvent event)
advertDiscovered in interface DiscoveryListener
public void connectionAccepted(java.lang.String peerid,
RendezvousConnection connection)
connectionAccepted in interface ConnectionListener
public void connectionDeclined(java.lang.String peerid,
RendezvousConnection connection)
connectionDeclined in interface ConnectionListener
public void connectionFailed(java.lang.String peerid,
RendezvousConnection connection)
connectionFailed in interface ConnectionListenerpublic void dispose()
ConnectionManager
dispose in interface ConnectionManager
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||