com.evolution.player.core.network
Interface IClient

All Superinterfaces:
INetworkNode

public interface IClient
extends INetworkNode

The client is the node in the network which can be controlled, it is you, the client. This interface allows basic control over the client. Be wise and responsible when using the force!

Clients must not implement.

Since:
0.6
See Also:
EvolutionPlayerCore.getClient(), INetwork

Method Summary
 void connect(INetworkNode node)
          Connect to the given node if possible.
 void connect(java.lang.String ip, int port)
          Connect to a node at the given address.
 void disconnect(INetworkNode node)
          Disconnect from the given node.
 void getMediaDetails(IRemoteNetworkNode node, MediaId[] medias)
          Collect information about the given medias.
 INetwork getNetwork()
          The network describing the network around this client
 IWritableScoreBoard getScoreBoard()
          The score board for this node.
 boolean isConnected()
          Is this client connected to any node?
 void scan(IRemoteNetworkNode node)
          Collect information about the given node.
 
Methods inherited from interface com.evolution.player.core.network.INetworkNode
getIp, getPort, getUUID
 

Method Detail

isConnected

boolean isConnected()
Is this client connected to any node?

Returns:
true if this client is connected

getNetwork

INetwork getNetwork()
The network describing the network around this client

Returns:
the network

scan

void scan(IRemoteNetworkNode node)
          throws java.io.IOException
Collect information about the given node. This has only an effect if the node is either connected to this client or connected to a neighbor of this client. This asynchronously updates the given nodes neighbors and score list.

Parameters:
node - the node to scan
Throws:
java.io.IOException - if the node could not be scanned

connect

void connect(INetworkNode node)
             throws java.net.UnknownHostException,
                    java.io.IOException
Connect to the given node if possible. This is possible if the node is either reachable or connected to a neighbor of this client. This asynchronously updates the network of this client.

Parameters:
node - the node to connect to
Throws:
java.net.UnknownHostException - if the address is not valid
java.io.IOException - if a connection could not be established

connect

void connect(java.lang.String ip,
             int port)
             throws java.net.UnknownHostException,
                    java.io.IOException
Connect to a node at the given address. This only works if the node at the address is reachable.

Parameters:
ip - the address of the node to connect to
port - the port on which the node is listening
Throws:
java.net.UnknownHostException - if the address is not valid
java.io.IOException - if a connection could not be established

disconnect

void disconnect(INetworkNode node)
                throws java.io.IOException
Disconnect from the given node.

Parameters:
node - the node to disconnect from
Throws:
java.io.IOException - if disconnecting was not possible

getMediaDetails

void getMediaDetails(IRemoteNetworkNode node,
                     MediaId[] medias)
                     throws java.io.IOException,
                            java.lang.IllegalArgumentException
Collect information about the given medias. This only works if this client is connected to the given node and the node has information about the given medias. This asynchronously updates the library of this client with the information retrieved from the given node for the given medias.

Parameters:
node - the node to ask for media details
medias - the medias to retrieve details for
Throws:
java.io.IOException - if retrieving details was not possible
java.lang.IllegalArgumentException - if the given node is not connected to the client

getScoreBoard

IWritableScoreBoard getScoreBoard()
Description copied from interface: INetworkNode
The score board for this node.

Specified by:
getScoreBoard in interface INetworkNode
Returns:
the score board