avoid importing the mapping every time we parse a uniprot record.
authorjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 4 Oct 2012 15:48:12 +0000 (16:48 +0100)
committerjprocter <jprocter@compbio.dundee.ac.uk>
Thu, 4 Oct 2012 15:48:12 +0000 (16:48 +0100)
src/jalview/ws/dbsources/Uniprot.java

index 167758f..e431c76 100644 (file)
@@ -100,16 +100,21 @@ public class Uniprot extends DbSourceProxyImpl implements DbSourceProxy
 
   private EBIFetchClient ebi = null;
 
+  private static org.exolab.castor.mapping.Mapping map;
+
   public Vector getUniprotEntries(File file)
   {
     UniprotFile uni = new UniprotFile();
     try
     {
-      // 1. Load the mapping information from the file
-      org.exolab.castor.mapping.Mapping map = new org.exolab.castor.mapping.Mapping(
-              uni.getClass().getClassLoader());
-      java.net.URL url = getClass().getResource("/uniprot_mapping.xml");
-      map.loadMapping(url);
+      if (map == null)
+      {
+        // 1. Load the mapping information from the file
+        map = new org.exolab.castor.mapping.Mapping(uni.getClass()
+                .getClassLoader());
+        java.net.URL url = getClass().getResource("/uniprot_mapping.xml");
+        map.loadMapping(url);
+      }
 
       // 2. Unmarshal the data
       Unmarshaller unmar = new Unmarshaller(uni);