jtge.engine.net
Class Peer

java.lang.Object
  extended byjtge.engine.net.Peer
All Implemented Interfaces:
IClosable, IConsumer
Direct Known Subclasses:
Client, Server

public class Peer
extends java.lang.Object
implements IClosable, IConsumer

Captures client and server common behaviours.

Version:
$Revision: 1.1 $ $Date: 2005/09/04 20:56:28 $
Author:
Mathieu Champlon

Constructor Summary
Peer(IPeerFactory factory)
          Create an abstract peer.
 
Method Summary
 void close()
          Perform a close operation.
 void handle(ICommand command)
          Handle a command.
protected  void onClose()
          Perform custom close.
 void register(IChannelObserver observer)
          Register a channel observer.
 void register(IConsumer consumer)
          Hook a consumer to receive commands sent to the peer.
 void register(IStatusObserver observer)
          Register a status observer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Peer

public Peer(IPeerFactory factory)
Create an abstract peer.

Parameters:
factory - the peer factory
Method Detail

register

public final void register(IConsumer consumer)
Hook a consumer to receive commands sent to the peer.

Parameters:
consumer - the consumer

register

public final void register(IChannelObserver observer)
Register a channel observer.

Parameters:
observer - the observer

register

public final void register(IStatusObserver observer)
Register a status observer.

Parameters:
observer - the observer

close

public final void close()
Perform a close operation.

Specified by:
close in interface IClosable

onClose

protected void onClose()
Perform custom close.


handle

public final void handle(ICommand command)
Handle a command.

Specified by:
handle in interface IConsumer
Parameters:
command - the command to handle


Copyright © 2003-2005 . All Rights Reserved.