X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fext%2Fparadise%2FAnnotate3D.java;h=d50ad878f1b1857666001ba4f500aac466c77416;hb=accb26f3cc680534a35c012accbfb7e7383cc606;hp=3930fc042d645a17d3df039a405532f1369a66c4;hpb=aced09c4feeaf3406269442c14e54abeeb4cad81;p=jalview.git
diff --git a/src/jalview/ext/paradise/Annotate3D.java b/src/jalview/ext/paradise/Annotate3D.java
index 3930fc0..d50ad87 100644
--- a/src/jalview/ext/paradise/Annotate3D.java
+++ b/src/jalview/ext/paradise/Annotate3D.java
@@ -1,6 +1,6 @@
/*
- * Jalview - A Sequence Alignment Editor and Viewer (Version 2.8.2)
- * Copyright (C) 2014 The Jalview Authors
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
*
* This file is part of Jalview.
*
@@ -23,13 +23,13 @@ package jalview.ext.paradise;
import jalview.util.MessageManager;
import jalview.ws.HttpClientUtils;
+import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.StringReader;
import java.net.URL;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.Iterator;
import java.util.List;
@@ -37,7 +37,6 @@ import org.apache.http.NameValuePair;
import org.apache.http.message.BasicNameValuePair;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
-import org.json.simple.JSONStreamAware;
import org.json.simple.parser.ContentHandler;
import org.json.simple.parser.ParseException;
@@ -46,13 +45,20 @@ import org.json.simple.parser.ParseException;
*
* @author jimp
*
- * History: v1.0 revised from original due to refactoring of
- * paradise-ubmc.u-strasbg.fr/webservices/annotate3d to
- * http://arn-ibmc.in2p3.fr/api/compute/2d?tool=rnaview
+ * @version v1.0 revised from original due to refactoring of
+ * paradise-ubmc.u-strasbg.fr/webservices/annotate3d to
+ * http://arn-ibmc.in2p3.fr/api/compute/2d?tool=rnaview
+ * See also testing URL from fjossinet:
+ * http://charn2-ibmc.u-strasbg.fr:8080/api/compute/2d
+ * If in doubt, check against the REST client at:
+ * https://github.com/fjossinet/RNA-Science
+ * -Toolbox/blob/master/pyrna/restclient.py
*/
public class Annotate3D
{
- private static String twoDtoolsURL = "http://arn-ibmc.in2p3.fr/api/compute/2d";
+ // also test with
+ // "http://charn2-ibmc.u-strasbg.fr:8080/api/compute/2d";
+ private static String twoDtoolsURL = "http://arn-ibmc.in2p3.fr/api/compute/2d?tool=rnaview";
private static ContentHandler createContentHandler()
{
@@ -88,8 +94,8 @@ public class Annotate3D
}
@Override
- public boolean startObjectEntry(String key) throws ParseException,
- IOException
+ public boolean startObjectEntry(String key)
+ throws ParseException, IOException
{
// TODO Auto-generated method stub
return false;
@@ -117,8 +123,8 @@ public class Annotate3D
}
@Override
- public boolean primitive(Object value) throws ParseException,
- IOException
+ public boolean primitive(Object value)
+ throws ParseException, IOException
{
// TODO Auto-generated method stub
return false;
@@ -138,7 +144,9 @@ public class Annotate3D
// return processJsonResponseFor(HttpClientUtils.doHttpUrlPost(twoDtoolsURL,
// vals));
ArrayList readers = new ArrayList();
- readers.add(HttpClientUtils.doHttpUrlPost(twoDtoolsURL, vals));
+ final BufferedReader postResponse = HttpClientUtils
+ .doHttpUrlPost(twoDtoolsURL, vals, 0, 0);
+ readers.add(postResponse);
return readers.iterator();
}
@@ -175,29 +183,31 @@ public class Annotate3D
;
if (sval == null)
{
- System.err
- .println("DEVELOPER WARNING: Annotate3d didn't return a '2D' tag in its response. Consider checking output of server. Response was :"
+ System.err.println(
+ "DEVELOPER WARNING: Annotate3d didn't return a '2D' tag in its response. Consider checking output of server. Response was :"
+ val.toString());
sval = "";
}
- return new StringReader(
- (sval instanceof JSONObject) ? ((JSONObject) sval)
- .toString() : sval.toString());
+ return new StringReader((sval instanceof JSONObject)
+ ? ((JSONObject) sval).toString()
+ : sval.toString());
}
@Override
public void remove()
{
- throw new Error(MessageManager.getString("error.not_implemented_remove"));
+ throw new Error(
+ MessageManager.getString("error.not_implemented_remove"));
}
@Override
protected Object clone() throws CloneNotSupportedException
{
- throw new CloneNotSupportedException(MessageManager.getString("error.not_implemented_clone"));
+ throw new CloneNotSupportedException(
+ MessageManager.getString("error.not_implemented_clone"));
}
@Override
@@ -218,7 +228,9 @@ public class Annotate3D
};
} catch (Exception foo)
{
- throw new Exception(MessageManager.getString("exception.couldnt_parse_responde_from_annotated3d_server"), foo);
+ throw new Exception(MessageManager.getString(
+ "exception.couldnt_parse_responde_from_annotated3d_server"),
+ foo);
}
}