git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
1e2d0cb
)
JAL-2137 resolve baseURI for prepending to alignments/PDBs for STRUCTMODEL statement...
author
Jim Procter
<jprocter@issues.jalview.org>
Mon, 4 Jul 2016 10:56:39 +0000
(11:56 +0100)
committer
Jim Procter
<jprocter@issues.jalview.org>
Mon, 4 Jul 2016 10:56:39 +0000
(11:56 +0100)
src/jalview/io/AnnotationFile.java
patch
|
blob
|
history
diff --git
a/src/jalview/io/AnnotationFile.java
b/src/jalview/io/AnnotationFile.java
index
d8f9f15
..
35651bb
100755
(executable)
--- a/
src/jalview/io/AnnotationFile.java
+++ b/
src/jalview/io/AnnotationFile.java
@@
-38,6
+38,7
@@
import jalview.schemes.ResidueProperties;
import jalview.schemes.UserColourScheme;
import java.io.BufferedReader;
import jalview.schemes.UserColourScheme;
import java.io.BufferedReader;
+import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStreamReader;
@@
-690,21
+691,38
@@
public class AnnotationFile
public boolean readAnnotationFile(AlignmentI al, ColumnSelection colSel,
String file, String protocol)
{
public boolean readAnnotationFile(AlignmentI al, ColumnSelection colSel,
String file, String protocol)
{
+ baseUri = "";
BufferedReader in = null;
try
{
if (protocol.equals(AppletFormatAdapter.FILE))
{
in = new BufferedReader(new FileReader(file));
BufferedReader in = null;
try
{
if (protocol.equals(AppletFormatAdapter.FILE))
{
in = new BufferedReader(new FileReader(file));
+ baseUri = new File(file).getParent();
+ if (baseUri == null)
+ {
+ baseUri = "";
+ }
+ else
+ {
+ baseUri += "/";
+ }
}
else if (protocol.equals(AppletFormatAdapter.URL))
{
URL url = new URL(file);
in = new BufferedReader(new InputStreamReader(url.openStream()));
}
else if (protocol.equals(AppletFormatAdapter.URL))
{
URL url = new URL(file);
in = new BufferedReader(new InputStreamReader(url.openStream()));
+ baseUri = url.toURI().getPath();
+ if (baseUri.lastIndexOf("/") > -1)
+ {
+ baseUri = baseUri.substring(0, baseUri.lastIndexOf("/")) + "/";
+ }
}
else if (protocol.equals(AppletFormatAdapter.PASTE))
{
in = new BufferedReader(new StringReader(file));
}
else if (protocol.equals(AppletFormatAdapter.PASTE))
{
in = new BufferedReader(new StringReader(file));
+ // TODO - support mimencoded PDBs for a paste.. ?
+ baseUri = "";
}
else if (protocol.equals(AppletFormatAdapter.CLASSLOADER))
{
}
else if (protocol.equals(AppletFormatAdapter.CLASSLOADER))
{
@@
-712,6
+730,8
@@
public class AnnotationFile
if (is != null)
{
in = new BufferedReader(new java.io.InputStreamReader(is));
if (is != null)
{
in = new BufferedReader(new java.io.InputStreamReader(is));
+ // TODO: this probably doesn't work for classloader - needs a test
+ baseUri = new File("/" + file).getParent() + "/";
}
}
if (in != null)
}
}
if (in != null)
@@
-737,6
+757,12
@@
public class AnnotationFile
String lastread = "";
String lastread = "";
+ /**
+ * used for resolving absolute references to resources relative to
+ * annotationFile location
+ */
+ String baseUri = "";
+
private static String GRAPHLINE = "GRAPHLINE", COMBINE = "COMBINE",
STRUCTMODEL = "STRUCTMODEL";
private static String GRAPHLINE = "GRAPHLINE", COMBINE = "COMBINE",
STRUCTMODEL = "STRUCTMODEL";