p2ps.imp.peer
Class PeerImp

java.lang.Object
  extended byp2ps.imp.peer.PeerImp
All Implemented Interfaces:
Peer

public class PeerImp
extends java.lang.Object
implements Peer

The main peer class that groups all the services together.

Version:
$Revision: 295 $
Author:
Ian Wang

Field Summary
protected  AdvertisementFactory adverts
          the advertisement factory
protected  Config config
          the configuration of this peer
protected  DiscoveryService discovery
          the discovery service
protected  GroupService group
          the group service
protected  PipeService pipes
          the pipe service
protected  RendezvousService rendezvous
          the advertisement factory
 
Constructor Summary
PeerImp(Config config)
          Constructs but does not initialise a peer.
PeerImp(Config config, char[] password)
          Constructs but does not initialise a peer.
PeerImp(Peer parent)
          Constructs a group peer with the specified parent.
 
Method Summary
 AdvertisementFactory getAdvertisementFactory()
           
 Config getConfig()
           
 DiscoveryService getDiscoveryService()
           
 java.lang.String[] getGroupIDs()
           
 GroupService getGroupService()
           
 java.lang.String getIDPath()
           
 java.lang.String getPeerID()
           
 PipeService getPipeService()
           
 RendezvousService getRendezvousService()
           
 SecurityContext getSecurityContext()
           
 SecurityManager getSecurityManager()
           
 void init()
          Initialises the peer
 void init(GroupAdvertisement groupad, Peer parent)
          Initialises the peer to belong to the specified group
protected  void initAdvertisementFactory()
          Initialises the advertisement factory.
protected  void initDiscoveryService()
          Initialises the discovery service
protected  void initGroupService()
          Initialises the rendezvous service
protected  void initIDFactory()
          Initializes the id factory
protected  void initLogging()
          Kicks off the autoconfiguration of the default logging within the autolog package.
protected  void initNetworkInterface()
          Initializes the id factory
protected  void initPipeService()
          Initialises the pipe service
protected  void initRendezvousService()
          Initialises the rendezvous service
protected  java.lang.Object initService(java.lang.String clsname)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

adverts

protected AdvertisementFactory adverts
the advertisement factory


discovery

protected DiscoveryService discovery
the discovery service


rendezvous

protected RendezvousService rendezvous
the advertisement factory


pipes

protected PipeService pipes
the pipe service


group

protected GroupService group
the group service


config

protected Config config
the configuration of this peer

Constructor Detail

PeerImp

public PeerImp(Config config)
        throws InitializationException,
               java.io.IOException
Constructs but does not initialise a peer. Call init() to initialise.


PeerImp

public PeerImp(Config config,
               char[] password)
        throws InitializationException,
               java.io.IOException
Constructs but does not initialise a peer. Call init() to initialise.


PeerImp

public PeerImp(Peer parent)
        throws InitializationException,
               java.io.IOException
Constructs a group peer with the specified parent. The peer configuration is taken from the parent with standard modifications, such as disabling discovery pipes.

Call init() to initialise.

Method Detail

initLogging

protected void initLogging()
Kicks off the autoconfiguration of the default logging within the autolog package.


initIDFactory

protected void initIDFactory()
Initializes the id factory


initNetworkInterface

protected void initNetworkInterface()
Initializes the id factory


initAdvertisementFactory

protected void initAdvertisementFactory()
Initialises the advertisement factory.


initPipeService

protected void initPipeService()
                        throws java.io.IOException
Initialises the pipe service

Throws:
java.io.IOException

initDiscoveryService

protected void initDiscoveryService()
                             throws java.io.IOException
Initialises the discovery service

Throws:
java.io.IOException

initRendezvousService

protected void initRendezvousService()
                              throws InitializationException,
                                     java.io.IOException
Initialises the rendezvous service

Throws:
InitializationException
java.io.IOException

initGroupService

protected void initGroupService()
                         throws java.io.IOException
Initialises the rendezvous service

Throws:
java.io.IOException

initService

protected java.lang.Object initService(java.lang.String clsname)
                                throws java.io.IOException
Throws:
java.io.IOException

init

public void init()
          throws InitializationException,
                 java.io.IOException
Initialises the peer

Specified by:
init in interface Peer
Throws:
InitializationException
java.io.IOException

init

public void init(GroupAdvertisement groupad,
                 Peer parent)
          throws UnknownAuthorizationMechanismException,
                 AuthorizationException,
                 InitializationException,
                 java.io.IOException
Initialises the peer to belong to the specified group

Specified by:
init in interface Peer
Throws:
UnknownAuthorizationMechanismException
AuthorizationException
InitializationException
java.io.IOException

getPeerID

public java.lang.String getPeerID()
Specified by:
getPeerID in interface Peer
Returns:
the unique id for this peer

getGroupIDs

public java.lang.String[] getGroupIDs()
Specified by:
getGroupIDs in interface Peer
Returns:
the group id hierarchy for this peer (current group at index 0)

getIDPath

public java.lang.String getIDPath()
Specified by:
getIDPath in interface Peer
Returns:
the group and peer id hierarchy for this peer in the form groupid[n].groupid[n-1]...groupid[0].peerid

getConfig

public Config getConfig()
Specified by:
getConfig in interface Peer
Returns:
the configuration for the peer

getSecurityContext

public SecurityContext getSecurityContext()
Specified by:
getSecurityContext in interface Peer
Returns:
the security context of the peer

getSecurityManager

public SecurityManager getSecurityManager()
Specified by:
getSecurityManager in interface Peer
Returns:
the security context for the specified URI

getAdvertisementFactory

public AdvertisementFactory getAdvertisementFactory()
Specified by:
getAdvertisementFactory in interface Peer
Returns:
the advertisement factory

getDiscoveryService

public DiscoveryService getDiscoveryService()
Specified by:
getDiscoveryService in interface Peer
Returns:
the discovery service

getRendezvousService

public RendezvousService getRendezvousService()
Specified by:
getRendezvousService in interface Peer
Returns:
the rendezvous service (null if not rendezvous)

getPipeService

public PipeService getPipeService()
Specified by:
getPipeService in interface Peer
Returns:
the pipe service

getGroupService

public GroupService getGroupService()
Specified by:
getGroupService in interface Peer
Returns:
the group service