uk.ac.ic.doc.rodex.p2p
Class DirectoryServicePeer

java.lang.Object
  extended by uk.ac.ic.doc.automed.p2p.communication.AbstractRequestListener
      extended by uk.ac.ic.doc.automed.p2p.AutoMedPeer
          extended by uk.ac.ic.doc.rodex.p2p.Peer
              extended by uk.ac.ic.doc.rodex.p2p.DirectoryServicePeer
All Implemented Interfaces:
RequestListener, StateChangedListener

public class DirectoryServicePeer
extends Peer

DirectoryServicePeer.java

Represents directory service peer on the network. It is basically an AutoMedPeer with capabilities of an P2PDirectory object.

As such this class relies on P2PDirectory to serve network requests but but uses its own handling routine.

Author:
Duc M Le dmle@doc.ic.ac.uk
Created on April 19, 2006
Department of Computing, Imperial College

Nested Class Summary
 
Nested classes/interfaces inherited from class uk.ac.ic.doc.automed.p2p.AutoMedPeer
AutoMedPeer.PeerProcessDescription
 
Field Summary
 
Fields inherited from class uk.ac.ic.doc.automed.p2p.AutoMedPeer
config, peerAddress, role, ROLE_AUTOMED_PEER, ROLE_DSP, ROLE_PEER, thePeer
 
Constructor Summary
protected DirectoryServicePeer(java.lang.String name, PeerStateHandler stateHandler)
          Creates a new instance of DirectoryServicePeer
 
Method Summary
 void addEventListener(java.util.EventListener listener)
          Register an EventListener object
 void addRequestListener(RequestListener listener)
          Register a RequestListener object to client requests
 P2PDirectory getDirectory()
          Return directory service object
static DirectoryServicePeer getInstance(java.lang.String name, PeerStateHandler stateHandler)
          Returns a single instance of the dsp
 void initDirectoryRepository()
          This method allows a peer to indirectly re-initialises the directory repository
used by the peer's P2PDirectory instance
 void initHelloProtocol()
          Intialise the hello protocol for directory service
 void initSICP()
          Initialises SICP protocol
 
Methods inherited from class uk.ac.ic.doc.rodex.p2p.Peer
finalize, get, get, get, getIDString, getLastKeyString, getLastRouteString, getMyKeys, getMyValues, getMyValues, getOverlayController, getQEP, getQueryAggregator, getRoutingTableString, getSelfIDAddressPair, initOverlay, initOverlay, joinOverlay, newPeer, newPeerProcess, outputQuery, put, put, requestAbstractPathToSource, requestQuery
 
Methods inherited from class uk.ac.ic.doc.automed.p2p.AutoMedPeer
authenticate, close, getAutoMedPeer, getCache, getDaemonPort, getMessageHandler, getMessagingHelper, getName, getPeerAddress, getPeerConfig, getPeerHost, getPeerPort, getPeerState, getQueryMediator, getReplyForRequest, getRole, getStateHandler, handleRequest, initAuthentication, initDirectory, initMessagingPeer, initRegistry, initRepository, isJoinedNetwork, newAutoMedPeer, outputPathway, outputPathwayToSource, outputSchema, outputSourcePathways, performStateAction, register, requestPathToSource, requestPathway, requestSchema, sendRequest, setName, setPeerAddress, setPeerState, unregister
 
Methods inherited from class uk.ac.ic.doc.automed.p2p.communication.AbstractRequestListener
getRequestMessage, getResponseData, getType, handleRequest, handleRequest, handleRequest, handleUDPRequest, handleUDPRequest, handleUDPRequest
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DirectoryServicePeer

protected DirectoryServicePeer(java.lang.String name,
                               PeerStateHandler stateHandler)
                        throws StateChangedException,
                               AutoMedException
Creates a new instance of DirectoryServicePeer

Throws:
StateChangedException
AutoMedException
Method Detail

getInstance

public static DirectoryServicePeer getInstance(java.lang.String name,
                                               PeerStateHandler stateHandler)
                                        throws StateChangedException,
                                               AutoMedException
Returns a single instance of the dsp

Throws:
StateChangedException
AutoMedException

initDirectoryRepository

public void initDirectoryRepository()
                             throws AutoMedException
This method allows a peer to indirectly re-initialises the directory repository
used by the peer's P2PDirectory instance

Overrides:
initDirectoryRepository in class AutoMedPeer
Throws:
AutoMedException

getDirectory

public P2PDirectory getDirectory()
Return directory service object

Overrides:
getDirectory in class AutoMedPeer

addRequestListener

public void addRequestListener(RequestListener listener)
Register a RequestListener object to client requests

Overrides:
addRequestListener in class AutoMedPeer

addEventListener

public void addEventListener(java.util.EventListener listener)
Register an EventListener object


initHelloProtocol

public void initHelloProtocol()
                       throws CommunicationException,
                              AutoMedException
Intialise the hello protocol for directory service

Overrides:
initHelloProtocol in class Peer
Throws:
CommunicationException
AutoMedException

initSICP

public void initSICP()
Initialises SICP protocol

Overrides:
initSICP in class Peer