Rev 15 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 15 | Rev 73 | ||
|---|---|---|---|
| 1 | /* |
1 | /* |
| 2 | * MbInternetAddress.java |
2 | * MbInternetAddress.java |
| 3 | * |
3 | * |
| 4 | * Created on den 26 augusti 2003, 11:37 |
4 | * Created on den 26 augusti 2003, 11:37 |
| 5 | */ |
5 | */ |
| 6 | package Macbeth.System; |
6 | package Macbeth.System; |
| 7 | 7 | ||
| 8 | /** |
8 | /** |
| 9 | * Holds an address to a kernel server. |
9 | * Holds an address to a kernel server. |
| 10 | * This simply consists of a hostname and a port. |
10 | * This simply consists of a hostname and a port. |
| 11 | * @author Jimmy |
11 | * @author Jimmy |
| 12 | */ |
12 | */ |
| 13 | public class MbInternetAddress { |
13 | public class MbInternetAddress { |
| 14 | private String hostname; |
14 | private String hostname; |
| 15 | private int port; |
15 | private int port; |
| 16 | 16 | ||
| 17 | /** Creates a new instance of MbInternetAddress */ |
17 | /** Creates a new instance of MbInternetAddress */ |
| 18 | public MbInternetAddress() { |
18 | public MbInternetAddress() { |
| 19 | this.hostname = "localhost"; |
19 | this.hostname = "localhost"; |
| 20 | this.port = 19000; |
20 | this.port = 19000; |
| 21 | } |
21 | } |
| 22 | 22 | ||
| 23 | /** Creates a new instance of MbInternetAddress */ |
23 | /** Creates a new instance of MbInternetAddress */ |
| 24 | public MbInternetAddress(String hostname, int port) { |
24 | public MbInternetAddress(String hostname, int port) { |
| 25 | this.hostname = hostname; |
25 | this.hostname = hostname; |
| 26 | this.port = port; |
26 | this.port = port; |
| 27 | } |
27 | } |
| 28 | 28 | ||
| 29 | /** |
29 | /** |
| 30 | * Gets the hostname. Can be an ip number or a dns name. |
30 | * Gets the hostname. Can be an ip number or a dns name. |
| 31 | * @return The hostname. There is no guarantee that this is a valid hostname. |
31 | * @return The hostname. There is no guarantee that this is a valid hostname. |
| 32 | */ |
32 | */ |
| 33 | public String getHostname() { |
33 | public String getHostname() { |
| 34 | return hostname; |
34 | return hostname; |
| 35 | } |
35 | } |
| 36 | 36 | ||
| 37 | /** |
37 | /** |
| 38 | * Sets the hostname. Can be an ip number or a dns name. |
38 | * Sets the hostname. Can be an ip number or a dns name. |
| 39 | * The hostname will not be checked for validity. |
39 | * The hostname will not be checked for validity. |
| 40 | * @param hostname The hostname. |
40 | * @param hostname The hostname. |
| 41 | */ |
41 | */ |
| 42 | public void setHostname(String hostname) { |
42 | public void setHostname(String hostname) { |
| 43 | this.hostname = hostname; |
43 | this.hostname = hostname; |
| 44 | } |
44 | } |
| 45 | 45 | ||
| 46 | /** |
46 | /** |
| 47 | * Gets the port. |
47 | * Gets the port. |
| 48 | * @return The port number; |
48 | * @return The port number; |
| 49 | */ |
49 | */ |
| 50 | public int getPort() { |
50 | public int getPort() { |
| 51 | return port; |
51 | return port; |
| 52 | } |
52 | } |
| 53 | 53 | ||
| 54 | /** |
54 | /** |
| 55 | * Sets the port. |
55 | * Sets the port. |
| 56 | * @param port The port number. |
56 | * @param port The port number. |
| 57 | */ |
57 | */ |
| 58 | public void setPort(int port) { |
58 | public void setPort(int port) { |
| 59 | this.port = port; |
59 | this.port = port; |
| 60 | } |
60 | } |
| 61 | 61 | ||
| 62 | /** |
62 | /** |
| 63 | * Thrown when this address is invalid (i.e. can't be reached) |
63 | * Thrown when this address is invalid (i.e. can't be reached) |
| 64 | */ |
64 | */ |
| 65 | public static class InvalidAddressException extends Exception { |
65 | public static class InvalidAddressException extends Exception { |
| 66 | public InvalidAddressException(String s) { |
66 | public InvalidAddressException(String s) { |
| 67 | super(s); |
67 | super(s); |
| 68 | } |
68 | } |
| 69 | public InvalidAddressException() { |
69 | public InvalidAddressException() { |
| 70 | super(); |
70 | super(); |
| 71 | } |
71 | } |
| 72 | } |
72 | } |
| 73 | } |
73 | } |
| 74 | 74 | ||