org.alliance.core.node
Class FriendManager

java.lang.Object
  extended by org.alliance.core.Manager
      extended by org.alliance.core.node.FriendManager

public class FriendManager
extends Manager

The FriendManager keeps track of all nodes. Contains a list of friends and a list of all nodes (Friend extends Node so friends are nodes too).

Launches the FriendConnector that tries to connect to disconnected friends reguraly (using a separate thread).

Use the FriendManager to manage information about nodes.

Created by IntelliJ IDEA. User: maciek Date: 2005-dec-28 Time: 14:30:09


Constructor Summary
FriendManager(CoreSubsystem core, Settings settings)
           
 
Method Summary
 void addFriend(Friend f, boolean foundFriendUsingInvitation)
           
 void addUntrustedNode(UntrustedNode n)
           
 void connect(Friend f)
           
 void connectionClosed(Connection connection)
          Callback from netMan
 void connectionEstablished(AuthenticatedConnection c)
          Callback from netMan
 void forwardInvitation(int fromGuid, int toGuid, java.lang.String invitationCode)
           
 void forwardInvitationTo(int guid)
           
 java.util.Collection<Friend> friends()
           
 BroadcastManager getBroadcastManager()
           
 CoreSubsystem getCore()
           
 Friend getFriend(int guid)
           
 Friend getFriend(java.lang.String nickname)
           
 FriendConnector getFriendConnector()
           
 MyNode getMe()
           
 int getMyGUID()
           
 NetworkManager getNetMan()
           
 Node getNode(int guid)
           
 int getNUsersConnected()
           
 Settings getSettings()
           
 long getTotalBytesShared()
           
 UntrustedNode getUntrustedNode(int guid)
           
 void init()
           
 void loadSubnodesFor(Node node)
           
 java.lang.String nickname(int guid)
           
 void permanentlyRemove(Friend f)
           
 void ping()
           
 void runFriendConnectorIn(int ms)
           
 void shutdown()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FriendManager

public FriendManager(CoreSubsystem core,
                     Settings settings)
              throws java.lang.Exception
Throws:
java.lang.Exception
Method Detail

init

public void init()
          throws java.lang.Exception
Specified by:
init in class Manager
Throws:
java.lang.Exception

getMyGUID

public int getMyGUID()

addFriend

public void addFriend(Friend f,
                      boolean foundFriendUsingInvitation)
               throws java.lang.Exception
Throws:
java.lang.Exception

connectionEstablished

public void connectionEstablished(AuthenticatedConnection c)
                           throws java.io.IOException
Callback from netMan

Throws:
java.io.IOException

getFriend

public Friend getFriend(int guid)

getFriend

public Friend getFriend(java.lang.String nickname)

connectionClosed

public void connectionClosed(Connection connection)
Callback from netMan


ping

public void ping()
          throws java.io.IOException
Throws:
java.io.IOException

getNetMan

public NetworkManager getNetMan()

friends

public java.util.Collection<Friend> friends()

getSettings

public Settings getSettings()

connect

public void connect(Friend f)
             throws java.io.IOException
Throws:
java.io.IOException

runFriendConnectorIn

public void runFriendConnectorIn(int ms)

getUntrustedNode

public UntrustedNode getUntrustedNode(int guid)

addUntrustedNode

public void addUntrustedNode(UntrustedNode n)

getNode

public Node getNode(int guid)

loadSubnodesFor

public void loadSubnodesFor(Node node)
                     throws java.io.IOException
Throws:
java.io.IOException

getMe

public MyNode getMe()

getCore

public CoreSubsystem getCore()

getBroadcastManager

public BroadcastManager getBroadcastManager()

nickname

public java.lang.String nickname(int guid)

shutdown

public void shutdown()
              throws java.io.IOException
Throws:
java.io.IOException

getTotalBytesShared

public long getTotalBytesShared()

forwardInvitation

public void forwardInvitation(int fromGuid,
                              int toGuid,
                              java.lang.String invitationCode)
                       throws java.io.IOException
Throws:
java.io.IOException

getNUsersConnected

public int getNUsersConnected()

getFriendConnector

public FriendConnector getFriendConnector()

forwardInvitationTo

public void forwardInvitationTo(int guid)
                         throws java.lang.Exception
Throws:
java.lang.Exception

permanentlyRemove

public void permanentlyRemove(Friend f)