Object rep = super.send(data);
if (rep instanceof RemoteLibraryException) {
RemoteLibraryException remoteEx = (RemoteLibraryException) rep;
- IOException cause = remoteEx.getCause();
- if (cause == null) {
- cause = new IOException("IOException");
- }
-
- throw cause;
+ throw remoteEx.unwrapException();
}
return rep;
* <li><b>wl</b>: flag to allow access to all the stories (bypassing the
* whitelist if it exists)</li>
* </ul>
- *
+ * <p>
* Some examples:
* <ul>
* <li><b>my_key</b>: normal connection, will take the default server
@Override
public Status getStatus() {
- Instance.getTraceHandler().trace("Getting remote lib status...");
+ Instance.getInstance().getTraceHandler().trace("Getting remote lib status...");
Status status = getStatusDo();
- Instance.getTraceHandler().trace("Remote lib status: " + status);
+ Instance.getInstance().getTraceHandler().trace("Remote lib status: " + status);
return status;
}
@Override
// Could work (more slowly) without it
- public Story imprt(final URL url, Progress pg) throws IOException {
+ public MetaData imprt(final URL url, Progress pg) throws IOException {
// Import the file locally if it is actually a file
+
if (url == null || url.getProtocol().equalsIgnoreCase("file")) {
return super.imprt(url, pg);
}
pg = new Progress();
}
- pg.setMinMax(0, 2);
- Progress pgImprt = new Progress();
- Progress pgGet = new Progress();
- pg.addProgress(pgImprt, 1);
- pg.addProgress(pgGet, 1);
-
- final Progress pgF = pgImprt;
+ final Progress pgF = pg;
final String[] luid = new String[1];
connectRemoteAction(new RemoteAction() {
throw new IOException("Remote failure");
}
- Story story = getStory(luid[0], pgGet);
- pgGet.done();
-
pg.done();
- return story;
+ return getInfo(luid[0]);
}
@Override
/**
* Stop the server.
+ *
+ * @throws IOException
+ * in case of I/O error (including bad key)
*/
public void exit() throws IOException {
connectRemoteAction(new RemoteAction() {
public void action(ConnectActionClientObject action)
throws Exception {
action.send(new Object[] { subkey, "EXIT" });
+ Thread.sleep(100);
}
});
}
}
@Override
- protected List<MetaData> getMetas(Progress pg) throws IOException {
+ protected synchronized List<MetaData> getMetas(Progress pg) throws IOException {
return getMetasList("*", pg);
}
@Override
protected void onError(Exception e) {
if (!(e instanceof IOException)) {
- Instance.getTraceHandler().error(e);
+ Instance.getInstance().getTraceHandler().error(e);
return;
}