org.net2map.pov.p2p.LocalNode Class Reference

Inheritance diagram for org.net2map.pov.p2p.LocalNode:

Inheritance graph
[legend]
Collaboration diagram for org.net2map.pov.p2p.LocalNode:

Collaboration graph
[legend]
List of all members.

Detailed Description

The Local node.

Instantiating and starting this will cause the whole Jxta related stuff to start.

Author:
Philippe MOULIN

Definition at line 49 of file LocalNode.java.

Public Member Functions

void run ()
 Never call that directly! Use start(), instead.

void stopEverything ()
 Stops the LocalNode task, after having stopped any task the local node may have started.

void startJxta ()
 Instantiates the Jxta platform.

net.jxta.peer.PeerID getMyPeerID ()
 Getter method.

String getMyPeerName ()
 Getter method.

PeerGroup getNetPeerGroup ()
 Getter method.

void sendMessageToRemoteNodes (String theMessage)
 Sends a message to remote nodes.

void sendMessageToRemoteNodes (Message theMessage)
 Sends a message to remote nodes.

void handleIncomingMessage (Message theMessage, RemoteNode theSender)
 Handle a message coming from a remote node.


Static Public Member Functions

LocalNode getInstance ()
 This method creates the single instance if it hasn't been created yet and returns it.


Private Member Functions

 LocalNode ()
 Creates new LocalNode.

void doPeriodicWork ()
 Called every second.

void advertiseTheNode ()
 Publish this Peer's advertisement.


Private Attributes

int discoveryCycleCounter = 30
 Incremented every second, and reset every time discoveryCucleDuration is reached.

int discoveryCycleDuration = 600
 This tast will send discovery request every discoveryCycleDuration seconds.

boolean hasToStop = false
 Setting this to true will make the task stop as soon as possible.

net.jxta.protocol.PeerAdvertisement myPeerAdvertisement = null
 The Local Node's peer advertisement.

org.net2map.pov.p2p.services.searchService.Processor theSearchProcessor
 The Search processor.


Static Private Attributes

org.apache.log4j.Logger logger
 Log4j logger.

PeerGroup netPeerGroup = null
 Jxta's net peer group.

LocalNode instance = null
 Singleton design pattern.


Constructor & Destructor Documentation

org.net2map.pov.p2p.LocalNode.LocalNode  )  [private]
 

Creates new LocalNode.

Definition at line 105 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.logger.

Referenced by org.net2map.pov.p2p.LocalNode.getInstance().


Member Function Documentation

void org.net2map.pov.p2p.LocalNode.advertiseTheNode  )  [private]
 

Publish this Peer's advertisement.

Definition at line 175 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.getNetPeerGroup(), org.net2map.pov.p2p.LocalNode.logger, and org.net2map.pov.p2p.LocalNode.netPeerGroup.

Referenced by org.net2map.pov.p2p.LocalNode.doPeriodicWork().

Here is the call graph for this function:

void org.net2map.pov.p2p.LocalNode.doPeriodicWork  )  [private]
 

Called every second.

Definition at line 158 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.advertiseTheNode(), org.net2map.pov.p2p.LocalNode.discoveryCycleCounter, org.net2map.pov.p2p.LocalNode.discoveryCycleDuration, org.net2map.pov.p2p.LocalNode.netPeerGroup, and org.net2map.pov.p2p.LocalNode.startJxta().

Referenced by org.net2map.pov.p2p.LocalNode.run().

Here is the call graph for this function:

LocalNode org.net2map.pov.p2p.LocalNode.getInstance  )  [static]
 

This method creates the single instance if it hasn't been created yet and returns it.

Note the use of the Double-Checked Locking idiom.

Returns:
The single instance of this class.

Definition at line 90 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.instance, and org.net2map.pov.p2p.LocalNode.LocalNode().

Here is the call graph for this function:

net.jxta.peer.PeerID org.net2map.pov.p2p.LocalNode.getMyPeerID  ) 
 

Getter method.

Returns:
This peer's Jxta UID.

Definition at line 281 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.myPeerAdvertisement.

String org.net2map.pov.p2p.LocalNode.getMyPeerName  ) 
 

Getter method.

Returns:
This Peer's Jxta name.

Definition at line 288 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.myPeerAdvertisement.

PeerGroup org.net2map.pov.p2p.LocalNode.getNetPeerGroup  ) 
 

Getter method.

Returns:
Jxta's Net Peer Group.

Definition at line 295 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.netPeerGroup.

Referenced by org.net2map.pov.p2p.LocalNode.advertiseTheNode().

void org.net2map.pov.p2p.LocalNode.handleIncomingMessage Message  theMessage,
RemoteNode  theSender
 

Handle a message coming from a remote node.

Parameters:
theMessage The message
theSender The RemoteNode who has sent it.

Definition at line 347 of file LocalNode.java.

void org.net2map.pov.p2p.LocalNode.run  ) 
 

Never call that directly! Use start(), instead.

Definition at line 117 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.doPeriodicWork(), and org.net2map.pov.p2p.LocalNode.logger.

Here is the call graph for this function:

void org.net2map.pov.p2p.LocalNode.sendMessageToRemoteNodes Message  theMessage  ) 
 

Sends a message to remote nodes.

Parameters:
theMessage The message to be sent.

Definition at line 319 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.logger.

void org.net2map.pov.p2p.LocalNode.sendMessageToRemoteNodes String  theMessage  ) 
 

Sends a message to remote nodes.

Parameters:
theMessage The message to be sent.

Definition at line 303 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.logger.

void org.net2map.pov.p2p.LocalNode.startJxta  ) 
 

Instantiates the Jxta platform.

Definition at line 236 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.logger, org.net2map.pov.p2p.LocalNode.myPeerAdvertisement, and org.net2map.pov.p2p.LocalNode.netPeerGroup.

Referenced by org.net2map.pov.p2p.LocalNode.doPeriodicWork().

void org.net2map.pov.p2p.LocalNode.stopEverything  ) 
 

Stops the LocalNode task, after having stopped any task the local node may have started.

Definition at line 144 of file LocalNode.java.

References org.net2map.pov.p2p.LocalNode.logger.


Member Data Documentation

int org.net2map.pov.p2p.LocalNode.discoveryCycleCounter = 30 [private]
 

Incremented every second, and reset every time discoveryCucleDuration is reached.

Definition at line 57 of file LocalNode.java.

Referenced by org.net2map.pov.p2p.LocalNode.doPeriodicWork().

int org.net2map.pov.p2p.LocalNode.discoveryCycleDuration = 600 [private]
 

This tast will send discovery request every discoveryCycleDuration seconds.

Definition at line 59 of file LocalNode.java.

Referenced by org.net2map.pov.p2p.LocalNode.doPeriodicWork().

boolean org.net2map.pov.p2p.LocalNode.hasToStop = false [private]
 

Setting this to true will make the task stop as soon as possible.

Definition at line 66 of file LocalNode.java.

LocalNode org.net2map.pov.p2p.LocalNode.instance = null [static, private]
 

Singleton design pattern.

Definition at line 83 of file LocalNode.java.

Referenced by org.net2map.pov.p2p.LocalNode.getInstance().

org.apache.log4j.Logger org.net2map.pov.p2p.LocalNode.logger [static, private]
 

Initial value:

 
    org.apache.log4j.Logger.getLogger(LocalNode.class.getName())
Log4j logger.

Definition at line 62 of file LocalNode.java.

Referenced by org.net2map.pov.p2p.LocalNode.advertiseTheNode(), org.net2map.pov.p2p.LocalNode.LocalNode(), org.net2map.pov.p2p.LocalNode.run(), org.net2map.pov.p2p.LocalNode.sendMessageToRemoteNodes(), org.net2map.pov.p2p.LocalNode.startJxta(), and org.net2map.pov.p2p.LocalNode.stopEverything().

net.jxta.protocol.PeerAdvertisement org.net2map.pov.p2p.LocalNode.myPeerAdvertisement = null [private]
 

The Local Node's peer advertisement.

Definition at line 74 of file LocalNode.java.

Referenced by org.net2map.pov.p2p.LocalNode.getMyPeerID(), org.net2map.pov.p2p.LocalNode.getMyPeerName(), and org.net2map.pov.p2p.LocalNode.startJxta().

PeerGroup org.net2map.pov.p2p.LocalNode.netPeerGroup = null [static, private]
 

Jxta's net peer group.

If this is null, ti means Jxta has not yet been started.

Definition at line 72 of file LocalNode.java.

Referenced by org.net2map.pov.p2p.LocalNode.advertiseTheNode(), org.net2map.pov.p2p.LocalNode.doPeriodicWork(), org.net2map.pov.p2p.LocalNode.getNetPeerGroup(), and org.net2map.pov.p2p.LocalNode.startJxta().

org.net2map.pov.p2p.services.searchService.Processor org.net2map.pov.p2p.LocalNode.theSearchProcessor [private]
 

The Search processor.

Definition at line 78 of file LocalNode.java.


The documentation for this class was generated from the following file:
Accueil | Téléchargement | Manuel | Doc. technique | Sources CVS | Faq | Nous contacter
©2003 - All Rights Reserved