-
Notifications
You must be signed in to change notification settings - Fork 0
/
ClientInterface.java
157 lines (141 loc) · 3.5 KB
/
ClientInterface.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
import java.rmi.Remote;
import java.rmi.RemoteException;
import java.util.HashSet;
/**
* ClientInterface provides the functionality for new Clients (peers) to talk to
* each other
*
* @author vaibhavgandhi
*
*/
public interface ClientInterface extends Remote {
/**
* Declaration to get coordinate
*
* @return coordinate of current node
* @throws RemoteException
*/
Coordinate getCoordinate() throws RemoteException;
/**
* Declaration to set coordinate of current node
*
* @param c
* where c is a new coordinate
* @throws RemoteException
*/
void setCoordinate(Coordinate c) throws RemoteException;
/**
* Declaration to get ip address
*
* @return
* @throws RemoteException
*/
String getIPAddress() throws RemoteException;
/**
* Declaration to get identifier
*
* @return
* @throws RemoteException
*/
String getIdentifier() throws RemoteException;
/**
* Declaration to get neighbours
*
* @return neighbours
* @throws RemoteException
*/
HashSet<Neighbour> getNeighbours() throws RemoteException;
/**
* Declaration to add neighbor
*
* @param n
* where n is a new neighbor
* @throws RemoteException
*/
void addNeighbour(Neighbour n) throws RemoteException;
/**
* Declaration to update neighbor
*
* @param n
* where n is an existing neighbor
* @throws RemoteException
*/
void updateNeighbour(Neighbour n) throws RemoteException;
/**
* Declaration to delete a neighbor
*
* @param n
* where n is a neighbor that has to be deleted
* @throws RemoteException
*/
void deleteNeighbour(Neighbour n) throws RemoteException;
/**
* Declaration to route a new node to its destination
*
* @param x
* @param y
* where x and y are destination coordinates
* @param ip
* where ip is the IP address of new node
* @throws RemoteException
*/
String routeNode(double x, double y, String ip) throws RemoteException;
/**
* Declaration to route file to destination node
*
* @param x
* @param y
* where x and y are destination coordinates
* @param filename
* where filename is the name of the file
* @param originatingIP
* where originatingIP is the IP from where files originates
* @throws RemoteException
*/
void routeFile(double x, double y, String filename, String originatingIP)
throws RemoteException;
/**
* Declaration to find file from source node
*
* @param x
* @param y
* where x and y are destination coordinates
* @param filename
* where filename is the name of the file
* @throws RemoteException
*/
String findFile(double x, double y, String filename) throws RemoteException;
/**
* Declaration to get files
*
* @return set of files associated with the current node
* @throws RemoteException
*/
HashSet<String> getFileList() throws RemoteException;
/**
* Declaration to add file
*
* @param file
* name of the file
* @param originatingIP
* ip of origin peer
* @throws RemoteException
*/
void addFile(String file, String originatingIP) throws RemoteException;
/**
* Declaration to save file
*
* @param fileName
* file name
* @return byte form of file
* @throws RemoteException
*/
public byte[] saveFile(String fileName) throws RemoteException;
/**
* Declaration to has joined
*
* @return boolean value
* @throws RemoteException
*/
public boolean hasJoined() throws RemoteException;
}