git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-2254 map error text in root node of EMBL XML response
[jalview.git]
/
src
/
jalview
/
datamodel
/
xdb
/
embl
/
EmblFile.java
diff --git
a/src/jalview/datamodel/xdb/embl/EmblFile.java
b/src/jalview/datamodel/xdb/embl/EmblFile.java
index
534b38c
..
1dd854a
100644
(file)
--- a/
src/jalview/datamodel/xdb/embl/EmblFile.java
+++ b/
src/jalview/datamodel/xdb/embl/EmblFile.java
@@
-20,7
+20,6
@@
*/
package jalview.datamodel.xdb.embl;
*/
package jalview.datamodel.xdb.embl;
-import jalview.bin.Cache;
import jalview.datamodel.DBRefEntry;
import jalview.ws.dbsources.Uniprot;
import jalview.datamodel.DBRefEntry;
import jalview.ws.dbsources.Uniprot;
@@
-28,7
+27,6
@@
import java.io.File;
import java.io.FileReader;
import java.io.PrintWriter;
import java.io.Reader;
import java.io.FileReader;
import java.io.PrintWriter;
import java.io.Reader;
-import java.net.URL;
import java.util.Vector;
import org.exolab.castor.mapping.Mapping;
import java.util.Vector;
import org.exolab.castor.mapping.Mapping;
@@
-48,6
+46,8
@@
public class EmblFile
Vector<EmblError> errors;
Vector<EmblError> errors;
+ String text;
+
/**
* @return the entries
*/
/**
* @return the entries
*/
@@
-83,12
+83,12
@@
public class EmblFile
}
/**
}
/**
- * Parse an Embl XML file into an EmblEntry object
+ * Parse an EmblXML file into an EmblFile object
*
* @param file
* @return parsed EmblXML or null if exceptions were raised
*/
*
* @param file
* @return parsed EmblXML or null if exceptions were raised
*/
- public static EmblEntry getEmblEntry(File file)
+ public static EmblFile getEmblFile(File file)
{
if (file == null)
{
{
if (file == null)
{
@@
-96,7
+96,7
@@
public class EmblFile
}
try
{
}
try
{
- return EmblFile.getEntry(new FileReader(file));
+ return EmblFile.getEmblFile(new FileReader(file));
} catch (Exception e)
{
System.err.println("Exception whilst reading EMBLfile from " + file);
} catch (Exception e)
{
System.err.println("Exception whilst reading EMBLfile from " + file);
@@
-105,32
+105,26
@@
public class EmblFile
return null;
}
return null;
}
- /**
- * Reads the XML response from file and unmarshals into a Java object
- *
- * @param fileReader
- * @return
- */
- public static EmblEntry getEntry(Reader fileReader)
+ public static EmblFile getEmblFile(Reader file)
{
{
- EmblEntry record = new EmblEntry();
+ EmblFile record = new EmblFile();
try
{
// 1. Load the mapping information from the file
Mapping map = new Mapping(record.getClass().getClassLoader());
try
{
// 1. Load the mapping information from the file
Mapping map = new Mapping(record.getClass().getClassLoader());
- URL url = record.getClass().getResource("/embl_mapping.xml");
+ java.net.URL url = record.getClass().getResource("/embl_mapping.xml");
map.loadMapping(url);
// 2. Unmarshal the data
Unmarshaller unmar = new Unmarshaller(record);
try
{
map.loadMapping(url);
// 2. Unmarshal the data
Unmarshaller unmar = new Unmarshaller(record);
try
{
- if (Cache.getDefault(Cache.CASTORLOGLEVEL,
+ // uncomment to DEBUG EMBLFile reading
+ if (jalview.bin.Cache.getDefault(jalview.bin.Cache.CASTORLOGLEVEL,
"debug").equalsIgnoreCase("DEBUG"))
{
"debug").equalsIgnoreCase("DEBUG"))
{
- unmar.setDebug(Cache.log.isDebugEnabled());
- // unmar.setDebug(true);// uncomment to debug unmarshalling
+ unmar.setDebug(jalview.bin.Cache.log.isDebugEnabled());
}
} catch (Exception e)
{
}
} catch (Exception e)
{
@@
-139,7
+133,7
@@
public class EmblFile
unmar.setIgnoreExtraAttributes(true);
unmar.setMapping(map);
unmar.setLogWriter(new PrintWriter(System.out));
unmar.setIgnoreExtraAttributes(true);
unmar.setMapping(map);
unmar.setLogWriter(new PrintWriter(System.out));
- record = (EmblEntry) unmar.unmarshal(fileReader);
+ record = (EmblFile) unmar.unmarshal(file);
canonicaliseDbRefs(record);
} catch (Exception e)
canonicaliseDbRefs(record);
} catch (Exception e)
@@
-155,17
+149,17
@@
public class EmblFile
* Change blank version to "0" in any DBRefEntry, to ensure consistent
* comparison with other DBRefEntry in Jalview
*
* Change blank version to "0" in any DBRefEntry, to ensure consistent
* comparison with other DBRefEntry in Jalview
*
- * @param entry
+ * @param record
* @see Uniprot#getDbVersion
*/
* @see Uniprot#getDbVersion
*/
- static void canonicaliseDbRefs(EmblEntry entry)
+ static void canonicaliseDbRefs(EmblFile record)
{
{
- if (entry == null)
+ if (record.getEntries() == null)
{
return;
}
{
return;
}
-// for (EmblEntry entry : record.getEntries())
-// {
+ for (EmblEntry entry : record.getEntries())
+ {
if (entry.getDbRefs() != null)
{
for (DBRefEntry dbref : entry.getDbRefs())
if (entry.getDbRefs() != null)
{
for (DBRefEntry dbref : entry.getDbRefs())
@@
-177,7
+171,7
@@
public class EmblFile
}
}
}
}
- if (entry.getFeatures() != null)
+ if (entry.getFeatures() != null)
{
for (EmblFeature feature : entry.getFeatures())
{
{
for (EmblFeature feature : entry.getFeatures())
{
@@
-193,6
+187,16
@@
public class EmblFile
}
}
}
}
}
}
- // }
+ }
+ }
+
+ public String getText()
+ {
+ return text;
+ }
+
+ public void setText(String text)
+ {
+ this.text = text;
}
}
}
}