View Javadoc

1   /*
2    *  XNap - A P2P framework and client.
3    *
4    *  See the file AUTHORS for copyright information.
5    *
6    *  This program is free software; you can redistribute it and/or modify
7    *  it under the terms of the GNU General Public License as published by
8    *  the Free Software Foundation.
9    *
10   *  This program is distributed in the hope that it will be useful,
11   *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12   *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13   *  GNU General Public License for more details.
14   *
15   *  You should have received a copy of the GNU General Public License
16   *  along with this program; if not, write to the Free Software
17   *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18   */
19  
20  package org.xnap.peer;
21  
22  import javax.swing.Action;
23  
24  /***
25   * Defines the requirements for a peer. Peers are participants of
26   * networks.
27   */
28  public interface Peer {
29  
30      //--- Constant(s) ---
31  
32      //--- Method(s) ---
33  
34      /***
35       * Returns the actions that can performed by the peer.
36       */
37      Action[] getActions();
38  
39      /***
40       * Returns the client info. This is the name of the peer's software, 
41       * e.g. "XNap 2.4"
42       *
43       * @return null, if the client info is unknown; the client info, otherwise
44       */
45      String getClientInfo();
46  
47      /***
48       * Returns the number of shared files by this peer.
49       *
50       * @return -1, if the file count is unknown; the count, otherwise
51       */
52      int getFileCount();
53  
54      /***
55       * Returns the ip address or hostname of this peer. The host can include 
56       * the port separated by a colon like this: "localhost:6699".
57       */
58      String getHost();
59  
60      /***
61       * Returns the link speed of the peer.
62       *  
63       * @return -1, if the link speed is unknown; the speed in kb/s, otherwise
64       */
65      int getLinkSpeed();
66  
67      /***
68       * Returns the number of currently running downloads from this peer.
69       */
70      int getLocalDownloadCount();
71      
72      /***
73       * Returns the number of currently running uploads to this peer.
74       */
75      int getLocalUploadCount();
76  
77      /***
78       * Returns the name of the peer.
79       */
80      String getName();
81  
82      /***
83       * Returns the status of the peer. This could be something like "online" 
84       * or "away".
85       */
86      String getStatus();
87  
88  }