Update Server, breaks API + remove deprecated
[nikiroo-utils.git] / src / be / nikiroo / utils / serial / server / ConnectActionServer.java
similarity index 51%
rename from src/be/nikiroo/utils/serial/ConnectActionServer.java
rename to src/be/nikiroo/utils/serial/server/ConnectActionServer.java
index 2d85c79c86f41b2d7807bb3fcc3ad6b508a3cddc..85b46a2fdd89f594528d166f78e26a7177eb8e2c 100644 (file)
@@ -1,6 +1,5 @@
-package be.nikiroo.utils.serial;
+package be.nikiroo.utils.serial.server;
 
-import java.io.IOException;
 import java.net.Socket;
 
 import be.nikiroo.utils.Version;
@@ -13,8 +12,13 @@ import be.nikiroo.utils.Version;
  * 
  * @author niki
  */
-public class ConnectActionServer {
-       private ConnectAction action;
+abstract class ConnectActionServer {
+       /**
+        * The underlying {@link ConnectAction}.
+        * <p>
+        * Cannot be NULL.
+        */
+       protected ConnectAction action;
 
        /**
         * Create a new {@link ConnectActionServer} with the current application
@@ -86,51 +90,6 @@ public class ConnectActionServer {
        public void action(Version clientVersion) throws Exception {
        }
 
-       /**
-        * Serialise and send the given object to the client.
-        * 
-        * @param data
-        *            the data to send
-        * 
-        * @throws IOException
-        *             in case of I/O error
-        * @throws NoSuchFieldException
-        *             if the serialised data contains information about a field
-        *             which does actually not exist in the class we know of
-        * @throws NoSuchMethodException
-        *             if a class described in the serialised data cannot be created
-        *             because it is not compatible with this code
-        * @throws ClassNotFoundException
-        *             if a class described in the serialised data cannot be found
-        */
-       public void send(Object data) throws IOException, NoSuchFieldException,
-                       NoSuchMethodException, ClassNotFoundException {
-               action.send(data);
-       }
-
-       /**
-        * (Flush the data to the client if needed and) retrieve its answer.
-        * 
-        * @return the deserialised answer (which can actually be NULL)
-        * 
-        * @throws IOException
-        *             in case of I/O error
-        * @throws NoSuchFieldException
-        *             if the serialised data contains information about a field
-        *             which does actually not exist in the class we know of
-        * @throws NoSuchMethodException
-        *             if a class described in the serialised data cannot be created
-        *             because it is not compatible with this code
-        * @throws ClassNotFoundException
-        *             if a class described in the serialised data cannot be found
-        * @throws java.lang.NullPointerException
-        *             if the counter part has no data to send
-        */
-       public Object rec() throws NoSuchFieldException, NoSuchMethodException,
-                       ClassNotFoundException, IOException, java.lang.NullPointerException {
-               return action.rec();
-       }
-
        /**
         * Handler called when an unexpected error occurs in the code.
         * <p>
@@ -156,25 +115,4 @@ public class ConnectActionServer {
                        @SuppressWarnings("unused") Version clientVersion) {
                return action.getVersion();
        }
-
-       // old stuff:
-
-       /**
-        * Not used anymore. See {@link ConnectActionServer#rec()}.
-        */
-       @SuppressWarnings("javadoc")
-       @Deprecated
-       public Object flush() throws NoSuchFieldException, NoSuchMethodException,
-                       ClassNotFoundException, IOException, java.lang.NullPointerException {
-               return rec();
-       }
-
-       /**
-        * Not used anymore. See
-        * {@link ConnectActionServer#negotiateVersion(Version)}.
-        */
-       @SuppressWarnings({ "unused", "javadoc" })
-       @Deprecated
-       protected void onClientVersionReceived(Version clientVersion) {
-       }
 }
\ No newline at end of file