From bd4bf64c52ee6e9ea08dbc35cae6e982d9204b5d Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 4 Oct 2012 16:48:12 +0100 Subject: [PATCH] avoid importing the mapping every time we parse a uniprot record. --- src/jalview/ws/dbsources/Uniprot.java | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) 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); -- 1.7.10.2