X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FRemoteLibraryServer.java;h=4ee3f74d221c3497978cc57d70fc935fd466579f;hb=a5d1f0e6320710cc4c8163adf2dc402e8f05fb96;hp=661bf54d61b8100d0b00a964b9016f77945666c8;hpb=a85e807750081c6e77a7916ca4e79506b5a98537;p=fanfix.git
diff --git a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java b/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java
deleted file mode 100644
index 661bf54..0000000
--- a/src/be/nikiroo/fanfix/library/RemoteLibraryServer.java
+++ /dev/null
@@ -1,72 +0,0 @@
-package be.nikiroo.fanfix.library;
-
-import java.io.IOException;
-import java.util.List;
-
-import be.nikiroo.fanfix.Instance;
-import be.nikiroo.fanfix.data.MetaData;
-import be.nikiroo.utils.Version;
-import be.nikiroo.utils.serial.ConnectActionServer;
-import be.nikiroo.utils.serial.Server;
-
-/**
- * Create a new remote server that will listen for order on the given port.
- *
- * The available commands are:
- *
- * - GET_METADATA *: will get the metadata of all the stories in the library
- * - GET_STORY [luid]: will return the given story if it exists (or NULL if
- * not)
- *
- *
- * @author niki
- */
-public class RemoteLibraryServer extends Server {
-
- /**
- * Create a new remote server (will not be active until
- * {@link RemoteLibraryServer#start()} is called).
- *
- * @param port
- * the port to listen on
- *
- * @throws IOException
- * in case of I/O error
- */
- public RemoteLibraryServer(int port) throws IOException {
- super(port, true);
- }
-
- @Override
- protected Object onRequest(ConnectActionServer action,
- Version clientVersion, Object data) throws Exception {
- String command = null;
- String args = null;
- if (data instanceof String) {
- command = (String) data;
- int pos = command.indexOf(" ");
- if (pos >= 0) {
- args = command.substring(pos + 1);
- command = command.substring(0, pos);
- }
- }
-
- System.out.println(String.format("COMMAND: [%s], ARGS: [%s]", command,
- args));
-
- // TODO: progress (+send name + %age info back to client)
-
- if ("GET_METADATA".equals(command)) {
- if (args != null && args.equals("*")) {
- List metas = Instance.getLibrary().getMetas(null);
- return metas.toArray(new MetaData[] {});
- }
- } else if ("GET_STORY".equals(command)) {
- if (args != null) {
- return Instance.getLibrary().getStory(args, null);
- }
- }
-
- return null;
- }
-}