X-Git-Url: http://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Flibrary%2FRemoteLibrary.java;h=a4f00ceff53546eaf1849e526c656add37fa6d17;hb=2ef9514282fc9d93bfa73bfcda7f8cc85bd32c5b;hp=e7b98282b422786eb95a077056a987039984cbfd;hpb=fb25273cf02653ac343d5437083b1bc41af5ce23;p=fanfix.git diff --git a/src/be/nikiroo/fanfix/library/RemoteLibrary.java b/src/be/nikiroo/fanfix/library/RemoteLibrary.java index e7b9828..a4f00ce 100644 --- a/src/be/nikiroo/fanfix/library/RemoteLibrary.java +++ b/src/be/nikiroo/fanfix/library/RemoteLibrary.java @@ -25,6 +25,29 @@ import be.nikiroo.utils.serial.server.ConnectActionClientObject; * @author niki */ public class RemoteLibrary extends BasicLibrary { + interface RemoteAction { + public void action(ConnectActionClientObject action) throws Exception; + } + + class RemoteConnectAction extends ConnectActionClientObject { + public RemoteConnectAction() throws IOException { + super(host, port, key); + } + + @Override + public Object send(Object data) throws IOException, + NoSuchFieldException, NoSuchMethodException, + ClassNotFoundException { + Object rep = super.send(data); + if (rep instanceof RemoteLibraryException) { + RemoteLibraryException remoteEx = (RemoteLibraryException) rep; + throw remoteEx.unwrapException(); + } + + return rep; + } + } + private String host; private int port; private final String key; @@ -33,8 +56,6 @@ public class RemoteLibrary extends BasicLibrary { // informative only (server will make the actual checks) private boolean rw; - // TODO: error handling is not up to par! - /** * Create a {@link RemoteLibrary} linked to the given server. *

@@ -57,7 +78,7 @@ public class RemoteLibrary extends BasicLibrary { *

  • wl: flag to allow access to all the stories (bypassing the * whitelist if it exists)
  • * - * + *

    * Some examples: *