Update Server, breaks API + remove deprecated
[nikiroo-utils.git] / src / be / nikiroo / utils / serial / server / ConnectActionClientObject.java
1 package be.nikiroo.utils.serial.server;
2
3 import java.io.IOException;
4 import java.net.Socket;
5
6 import be.nikiroo.utils.Version;
7
8 /**
9 * Class used for the client basic handling.
10 * <p>
11 * It represents a single action: a client is expected to only execute one
12 * action.
13 *
14 * @author niki
15 */
16 public class ConnectActionClientObject extends ConnectActionClient {
17 /**
18 * Create a new {@link ConnectActionClientObject} with the current
19 * application version (see {@link Version#getCurrentVersion()}) as the
20 * client version.
21 *
22 * @param s
23 * the socket to bind to
24 */
25 public ConnectActionClientObject(Socket s) {
26 super(s);
27 }
28
29 /**
30 * Create a new {@link ConnectActionClientObject} with the current
31 * application version (see {@link Version#getCurrentVersion()}) as the
32 * client version.
33 *
34 * @param host
35 * the host to bind to
36 * @param port
37 * the port to bind to
38 * @param ssl
39 * TRUE for an SSL connection, FALSE for plain text
40 *
41 * @throws IOException
42 * in case of I/O error when creating the socket
43 */
44 public ConnectActionClientObject(String host, int port, boolean ssl)
45 throws IOException {
46 super(host, port, ssl);
47 }
48
49 /**
50 * Create a new {@link ConnectActionClientObject}.
51 *
52 * @param host
53 * the host to bind to
54 * @param port
55 * the port to bind to
56 * @param ssl
57 * TRUE for an SSL connection, FALSE for plain text
58 * @param version
59 * the client version
60 *
61 * @throws IOException
62 * in case of I/O error when creating the socket
63 */
64 public ConnectActionClientObject(String host, int port, boolean ssl,
65 Version version) throws IOException {
66 super(host, port, ssl, version);
67 }
68
69 /**
70 * Create a new {@link ConnectActionClientObject}.
71 *
72 * @param s
73 * the socket to bind to
74 * @param version
75 * the client version
76 */
77 public ConnectActionClientObject(Socket s, Version version) {
78 super(s, version);
79 }
80
81 /**
82 * Serialise and send the given object to the server (and return the
83 * deserialised answer).
84 *
85 * @param data
86 * the data to send
87 *
88 * @return the answer, which can be NULL
89 *
90 * @throws IOException
91 * in case of I/O error
92 * @throws NoSuchFieldException
93 * if the serialised data contains information about a field
94 * which does actually not exist in the class we know of
95 * @throws NoSuchMethodException
96 * if a class described in the serialised data cannot be created
97 * because it is not compatible with this code
98 * @throws ClassNotFoundException
99 * if a class described in the serialised data cannot be found
100 */
101 public Object send(Object data) throws IOException, NoSuchFieldException,
102 NoSuchMethodException, ClassNotFoundException {
103 return action.sendObject(data);
104 }
105 }