+ /**
+ * Check if this {@link RemoteLibraryServer} is able to connect and identify
+ * to the remote server.
+ *
+ * @return TRUE if it is online
+ */
+ public boolean isOnline() {
+ final Boolean[] result = new Boolean[1];
+
+ result[0] = false;
+ try {
+ new ConnectActionClientObject(host, port, true) {
+ @Override
+ public void action(Version serverVersion) throws Exception {
+ Object rep = send(new Object[] { key, "PING" });
+ result[0] = "PONG".equals(rep);
+ }
+
+ @Override
+ protected void onError(Exception e) {
+ Instance.getTraceHandler().error(e);
+ }
+ }.connect();
+ } catch (Exception e) {
+ Instance.getTraceHandler().error(e);
+ }
+
+ return result[0];
+ }
+
+ @Override
+ protected List<MetaData> getMetas(Progress pg) {
+ final Progress pgF = pg;
+ final List<MetaData> metas = new ArrayList<MetaData>();
+
+ try {
+ new ConnectActionClientObject(host, port, true) {
+ @Override
+ public void action(Version serverVersion) throws Exception {
+ Progress pg = pgF;
+ if (pg == null) {
+ pg = new Progress();
+ }
+
+ Object rep = send(new Object[] { key, "GET_METADATA", "*" });
+
+ while (true) {
+ if (!RemoteLibraryServer.updateProgress(pg, rep)) {
+ break;
+ }
+
+ rep = send(null);
+ }
+
+ for (MetaData meta : (MetaData[]) rep) {
+ metas.add(meta);
+ }
+ }
+
+ @Override
+ protected void onError(Exception e) {
+ Instance.getTraceHandler().error(e);
+ }
+ }.connect();
+ } catch (Exception e) {
+ Instance.getTraceHandler().error(e);
+ }
+
+ return metas;
+ }
+
+ @Override
+ protected void clearCache() {
+ }
+