- new ConnectActionClient(host, port, true, null) {
- @Override
- public void action(Version serverVersion) throws Exception {
- try {
- Object rep = send("GET_METADATA *");
- for (MetaData meta : (MetaData[]) rep) {
- metas.add(meta);
- }
- } catch (Exception e) {
- Instance.syserr(e);
+ action.connect();
+ } catch (Exception e) {
+ result[0] = Status.UNAVAILABLE;
+ }
+ }
+
+ return result[0];
+ }
+
+ @Override
+ public Image getCover(final String luid) {
+ final Image[] result = new Image[1];
+
+ try {
+ new ConnectActionClientObject(host, port, true) {
+ @Override
+ public void action(Version serverVersion) throws Exception {
+ Object rep = send(new Object[] { md5, "GET_COVER", luid });
+ result[0] = (Image) rep;
+ }
+
+ @Override
+ protected void onError(Exception e) {
+ Instance.getTraceHandler().error(e);
+ }
+ }.connect();
+ } catch (Exception e) {
+ Instance.getTraceHandler().error(e);
+ }
+
+ return result[0];
+ }
+
+ @Override
+ public Image getSourceCover(final String source) {
+ final Image[] result = new Image[1];
+
+ try {
+ new ConnectActionClientObject(host, port, true) {
+ @Override
+ public void action(Version serverVersion) throws Exception {
+ Object rep = send(new Object[] { md5, "GET_SOURCE_COVER",
+ source });
+ result[0] = (Image) rep;
+ }
+
+ @Override
+ protected void onError(Exception e) {
+ Instance.getTraceHandler().error(e);
+ }
+ }.connect();
+ } catch (Exception e) {
+ Instance.getTraceHandler().error(e);
+ }
+
+ return result[0];
+ }
+
+ @Override
+ public synchronized Story getStory(final String luid, Progress pg) {
+ final Progress pgF = pg;
+ final Story[] result = new Story[1];
+
+ 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[] { md5, "GET_STORY", luid });
+
+ MetaData meta = null;
+ if (rep instanceof MetaData) {
+ meta = (MetaData) rep;
+ if (meta.getWords() <= Integer.MAX_VALUE) {
+ pg.setMinMax(0, (int) meta.getWords());