summaryrefslogtreecommitdiff
path: root/shared/remotecall/ServerResponse.java
blob: d2990bcf567708c3f8916d0fbf8e4c18d466bcd7 (plain)
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
package shared.remotecall;

import java.io.*;
import java.util.Vector;

/**
 * This class represents a server response. A server response will sent from the calendar
 * server to the calendar client if the client has sent a client request.
 * @author buetow
 *
 */
public final class ServerResponse extends RemoteCall implements Serializable {
	private static final long serialVersionUID = 1L;
	private Vector vecEvents = null;

	/**
	 * Simple constructor, creates a server response which can be sent to the calendar client.
	 * @param vecEvents Specifies all calendar events to be sent to the calendar client.
	 */
	public ServerResponse(Vector vecEvents) {
		this.vecEvents = vecEvents;
	}
	
	/**
	 * Needed for ojbect serialization (sending part).
	 * @param objectOutputStream Specifies the output stream.
	 * @throws IOException
	 */
	private void writeObject(ObjectOutputStream objectOutputStream)
     	throws IOException {
		super.writeObjectIfDefined(objectOutputStream, vecEvents);
	}
	
	/**
	 * Needed for object serialization (recieving part).
	 * @param objectInputStream Specifies the input stream.
	 * @throws IOException
	 * @throws ClassNotFoundException
	 */
	private void readObject(ObjectInputStream objectInputStream) 
		throws IOException, ClassNotFoundException {
		if (objectInputStream.readBoolean())
			vecEvents = (Vector) objectInputStream.readObject();
	}
	
	/**
	 * This method returns a vector of all requested calendar events.
	 * @return Returns a Vector of all requested CalendarEvent objects.
	 */
	public Vector getEvents() {
		return vecEvents;
	}
}