net.tomp2p.rpc
Class TrackerRPC

java.lang.Object
  extended by org.jboss.netty.channel.SimpleChannelHandler
      extended by net.tomp2p.rpc.ReplyHandler
          extended by net.tomp2p.rpc.TrackerRPC
All Implemented Interfaces:
org.jboss.netty.channel.ChannelDownstreamHandler, org.jboss.netty.channel.ChannelHandler, org.jboss.netty.channel.ChannelUpstreamHandler

public class TrackerRPC
extends ReplyHandler


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jboss.netty.channel.ChannelHandler
org.jboss.netty.channel.ChannelHandler.Sharable
 
Field Summary
static int MAX_MSG_SIZE_UDP
           
 
Constructor Summary
TrackerRPC(PeerBean peerBean, ConnectionBean connectionBean, P2PConfiguration p2pConfiguration)
           
 
Method Summary
 FutureResponse addToTracker(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, byte[] attachement, boolean signMessage, boolean primary, Set<Number160> knownPeers, ChannelCreator channelCreator)
          Deprecated. 
 FutureResponse addToTracker(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, byte[] attachement, boolean signMessage, boolean primary, Set<Number160> knownPeers, ChannelCreator channelCreator, boolean forceUDP, boolean forceTCP)
           
 FutureResponse addToTracker(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, byte[] attachement, int offset, int legth, boolean signMessage, boolean primary, Set<Number160> knownPeers, ChannelCreator channelCreator)
          Deprecated. 
 FutureResponse addToTracker(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, byte[] attachement, int offset, int legth, boolean signMessage, boolean primary, Set<Number160> knownPeers, ChannelCreator channelCreator, boolean forceUDP, boolean forceTCP)
           
 boolean checkMessage(Message message)
          Before a reply can be done, the message needs to be checked.
 FutureResponse getFromTracker(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, boolean expectAttachement, boolean signMessage, Set<Number160> knownPeers, ChannelCreator channelCreator)
           
 FutureResponse getFromTracker(PeerAddress remotePeer, Number160 locationKey, Number160 domainKey, boolean expectAttachement, boolean signMessage, Set<Number160> knownPeers, ChannelCreator channelCreator, boolean forceUDP, boolean forceTCP)
           
 PeerAddress getPeerAddress()
           
 Message handleResponse(Message message, boolean sign)
          If the message is OK, that has been previously checked by the user using checkMessage, a reply to the message is generated here.
static boolean isPrimary(FutureResponse response)
           
static boolean isSecondary(FutureResponse response)
           
 
Methods inherited from class net.tomp2p.rpc.ReplyHandler
createMessage, exceptionCaught, forwardMessage, registerIoHandler, setSignReply
 
Methods inherited from class org.jboss.netty.channel.SimpleChannelHandler
bindRequested, channelBound, channelClosed, channelConnected, channelDisconnected, channelInterestChanged, channelOpen, channelUnbound, childChannelClosed, childChannelOpen, closeRequested, connectRequested, disconnectRequested, handleDownstream, handleUpstream, messageReceived, setInterestOpsRequested, unbindRequested, writeComplete, writeRequested
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_MSG_SIZE_UDP

public static final int MAX_MSG_SIZE_UDP
See Also:
Constant Field Values
Constructor Detail

TrackerRPC

public TrackerRPC(PeerBean peerBean,
                  ConnectionBean connectionBean,
                  P2PConfiguration p2pConfiguration)
Parameters:
peerBean -
connectionBean -
Method Detail

getPeerAddress

public PeerAddress getPeerAddress()

addToTracker

@Deprecated
public FutureResponse addToTracker(PeerAddress remotePeer,
                                              Number160 locationKey,
                                              Number160 domainKey,
                                              byte[] attachement,
                                              boolean signMessage,
                                              boolean primary,
                                              Set<Number160> knownPeers,
                                              ChannelCreator channelCreator)
Deprecated. 


addToTracker

public FutureResponse addToTracker(PeerAddress remotePeer,
                                   Number160 locationKey,
                                   Number160 domainKey,
                                   byte[] attachement,
                                   boolean signMessage,
                                   boolean primary,
                                   Set<Number160> knownPeers,
                                   ChannelCreator channelCreator,
                                   boolean forceUDP,
                                   boolean forceTCP)

isPrimary

public static boolean isPrimary(FutureResponse response)

isSecondary

public static boolean isSecondary(FutureResponse response)

addToTracker

@Deprecated
public FutureResponse addToTracker(PeerAddress remotePeer,
                                              Number160 locationKey,
                                              Number160 domainKey,
                                              byte[] attachement,
                                              int offset,
                                              int legth,
                                              boolean signMessage,
                                              boolean primary,
                                              Set<Number160> knownPeers,
                                              ChannelCreator channelCreator)
Deprecated. 


addToTracker

public FutureResponse addToTracker(PeerAddress remotePeer,
                                   Number160 locationKey,
                                   Number160 domainKey,
                                   byte[] attachement,
                                   int offset,
                                   int legth,
                                   boolean signMessage,
                                   boolean primary,
                                   Set<Number160> knownPeers,
                                   ChannelCreator channelCreator,
                                   boolean forceUDP,
                                   boolean forceTCP)

getFromTracker

public FutureResponse getFromTracker(PeerAddress remotePeer,
                                     Number160 locationKey,
                                     Number160 domainKey,
                                     boolean expectAttachement,
                                     boolean signMessage,
                                     Set<Number160> knownPeers,
                                     ChannelCreator channelCreator)

getFromTracker

public FutureResponse getFromTracker(PeerAddress remotePeer,
                                     Number160 locationKey,
                                     Number160 domainKey,
                                     boolean expectAttachement,
                                     boolean signMessage,
                                     Set<Number160> knownPeers,
                                     ChannelCreator channelCreator,
                                     boolean forceUDP,
                                     boolean forceTCP)

checkMessage

public boolean checkMessage(Message message)
Description copied from class: ReplyHandler
Before a reply can be done, the message needs to be checked. If you return false, then the peer is removed from the map and the channel is closed.

Specified by:
checkMessage in class ReplyHandler
Parameters:
message - Request message
Returns:
True if a request should be generated, false if channel should be closed and nothing should be replied

handleResponse

public Message handleResponse(Message message,
                              boolean sign)
                       throws Exception
Description copied from class: ReplyHandler
If the message is OK, that has been previously checked by the user using checkMessage, a reply to the message is generated here.

Specified by:
handleResponse in class ReplyHandler
Parameters:
message - Request message
Throws:
Exception


Copyright © 2012. All Rights Reserved.