Lightweight Bartering Grid

lbg.peer.register
Class PeerRegister

java.lang.Object
  extended by lbg.peer.register.PeerRegister

public class PeerRegister
extends java.lang.Object

Author:
Cyril Briquet

Constructor Summary
PeerRegister(Peer managed_peer, StrategyDescriptor strategy, PeerStrategyConfiguration peer_strategy_config)
           
 
Method Summary
 boolean checkProfile(java.lang.String peer_id)
          Checks the Profile of the target Peer, and creates one if required.
 void createProfile(ExternalPeerHandle peer_handle)
          Creates a Profile in the PeerRegister for the target Peer.
 ExternalPeerHandle getHandle(java.lang.String peer_id)
          Returns the Handle of stored Peer.
 NeighborhoodBarteringProfile getNeighborhoodBarteringProfile()
           
 NeighborhoodNegotiationProfile getNeighborhoodNegotiationProfile()
           
 PeerProfile getProfile(java.lang.String peer_id)
          Returns the Profile of the target Peer.
 java.util.Iterator<PeerProfile> getProfiles()
          Returns the Profiles of the stored Peers.
 void removeProfile(java.lang.String peer_id)
          Removes a Profile from the PeerRegister for the target Peer.
 int size()
          Returns the size of the PeerRegister.
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PeerRegister

public PeerRegister(Peer managed_peer,
                    StrategyDescriptor strategy,
                    PeerStrategyConfiguration peer_strategy_config)
             throws GridException
Throws:
GridException
Method Detail

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

size

public int size()
Returns the size of the PeerRegister.

Returns:
number of Peers registered into the PeerRegister

createProfile

public void createProfile(ExternalPeerHandle peer_handle)
                   throws GridException
Creates a Profile in the PeerRegister for the target Peer.

DANGER: Peer authentication currently relies only on PeerHandle.id()

Parameters:
peer_handle - targer Peer
Throws:
GridException

removeProfile

public void removeProfile(java.lang.String peer_id)
                   throws GridException
Removes a Profile from the PeerRegister for the target Peer.

DANGER: Peer authentication currently relies only on PeerHandle.id()

Parameters:
peer_id - targer Peer id
Throws:
GridException

checkProfile

public boolean checkProfile(java.lang.String peer_id)
                     throws GridException
Checks the Profile of the target Peer, and creates one if required.

Parameters:
peer_id - target Peer
Returns:
true if the managed Peer is authorized to communicate with target Peer
Throws:
GridException

getProfile

public PeerProfile getProfile(java.lang.String peer_id)
                       throws GridException
Returns the Profile of the target Peer.

DANGER: Peer authentication currently relies only on PeerHandle.id()

Parameters:
peer_id - targer Peer id
Returns:
Profile of the target Peer
Throws:
GridException

getProfiles

public java.util.Iterator<PeerProfile> getProfiles()
Returns the Profiles of the stored Peers.

DANGER: Peer authentication currently relies only on PeerHandle.id()

Returns:
Profiles of stored Peer

getHandle

public ExternalPeerHandle getHandle(java.lang.String peer_id)
                             throws GridException
Returns the Handle of stored Peer.

Parameters:
peer_id - targer Peer id
Returns:
Profile of the target Peer
Throws:
GridException

getNeighborhoodNegotiationProfile

public NeighborhoodNegotiationProfile getNeighborhoodNegotiationProfile()

getNeighborhoodBarteringProfile

public NeighborhoodBarteringProfile getNeighborhoodBarteringProfile()

Lightweight Bartering Grid

Copyright (c) 2005-2008, Cyril Briquet, parts Xavier Dalem.