From: jprocter Date: Thu, 4 Oct 2012 15:48:12 +0000 (+0100) Subject: avoid importing the mapping every time we parse a uniprot record. X-Git-Tag: Jalview_2_9~269 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=bd4bf64c52ee6e9ea08dbc35cae6e982d9204b5d;p=jalview.git avoid importing the mapping every time we parse a uniprot record. --- diff --git a/src/jalview/ws/dbsources/Uniprot.java b/src/jalview/ws/dbsources/Uniprot.java index 167758f..e431c76 100644 --- a/src/jalview/ws/dbsources/Uniprot.java +++ b/src/jalview/ws/dbsources/Uniprot.java @@ -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);