X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FVamsasAppDatastore.java;h=58adfb2f4ba3ea9e62d60ec2a149c2dafc3bcff9;hb=ad15cff29620f960119f80176f1fd443da9f6763;hp=93460e3ad983afe15b3dffd864c7fa9d33260c98;hpb=d6509fcf3a8cc90616e18cb22cec97f85c722bb8;p=jalview.git diff --git a/src/jalview/io/VamsasAppDatastore.java b/src/jalview/io/VamsasAppDatastore.java index 93460e3..58adfb2 100644 --- a/src/jalview/io/VamsasAppDatastore.java +++ b/src/jalview/io/VamsasAppDatastore.java @@ -1,30 +1,29 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.7) - * Copyright (C) 2011 J Procter, AM Waterhouse, J Engelhardt, LM Lui, G Barton, M Clamp, S Searle + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * * Jalview is free software: you can redistribute it and/or * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. - * + * as published by the Free Software Foundation, either version 3 + * of the License, or (at your option) any later version. + * * Jalview is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty * of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along with Jalview. If not, see . + * You should have received a copy of the GNU General Public License + * along with Jalview. If not, see . + * The Jalview Authors are detailed in the 'AUTHORS' file. */ package jalview.io; import jalview.bin.Cache; import jalview.datamodel.AlignedCodonFrame; import jalview.datamodel.AlignmentAnnotation; -import jalview.datamodel.AlignmentI; -import jalview.datamodel.AlignmentView; -import jalview.datamodel.DBRefEntry; import jalview.datamodel.GraphLine; -import jalview.datamodel.SequenceFeature; import jalview.datamodel.SequenceI; import jalview.gui.AlignFrame; import jalview.gui.AlignViewport; @@ -34,7 +33,7 @@ import jalview.io.vamsas.Datasetsequence; import jalview.io.vamsas.DatastoreItem; import jalview.io.vamsas.DatastoreRegistry; import jalview.io.vamsas.Rangetype; -import jalview.util.UrlLink; +import jalview.util.MessageManager; import java.io.IOException; import java.util.Enumeration; @@ -52,14 +51,14 @@ import uk.ac.vamsas.objects.core.*; import uk.ac.vamsas.objects.utils.Properties; /* - * + * * static { * org.exolab.castor.util.LocalConfiguration.getInstance().getProperties().setProperty( * "org.exolab.castor.serializer", "org.apache.xml.serialize.XMLSerilazizer"); } - * + * */ /* - * TODO: check/verify consistency for vamsas sync with group associated alignment annotation + * TODO: check/verify consistency for vamsas sync with group associated alignment annotation */ public class VamsasAppDatastore { @@ -225,8 +224,7 @@ public class VamsasAppDatastore { Cache.log.debug( "Warning? Overwriting existing vamsas id binding for " - + vobj.getVorbaId(), new Exception( - "Overwriting vamsas id binding.")); + + vobj.getVorbaId(), new Exception(MessageManager.getString("exception.overwriting_vamsas_id_binding"))); } else if (jv2vobj.containsKey(jvobj) && !((VorbaId) jv2vobj.get(jvobj)).equals(vobj.getVorbaId())) @@ -313,8 +311,7 @@ public class VamsasAppDatastore if (vbound.getV_parent() != null && dataset != vbound.getV_parent()) { - throw new Error( - "IMPLEMENTATION ERROR: Cannot map an alignment of sequences from different datasets into a single alignment in the vamsas document."); + throw new Error(MessageManager.getString("error.implementation_error_cannot_map_alignment_sequences")); // This occurs because the dataset for the alignment we are // trying to } @@ -547,7 +544,8 @@ public class VamsasAppDatastore else { // first find the alignment sequence to associate this with. - for (SequenceI jvalsq:av.getAlignment().getSequences()) { + for (SequenceI jvalsq : av.getAlignment().getSequences()) + { // saveDatasetSequenceAnnotation(AlSeqMaps,(uk.ac.vamsas.objects.core.Sequence) // sref, aa[i]); if (jvalsq.getDatasetSequence() == aa[i].sequenceRef) @@ -1256,7 +1254,7 @@ public class VamsasAppDatastore /** * list of alignment views created when updating Jalview from document. */ - private Vector newAlignmentViews = new Vector(); + private final Vector newAlignmentViews = new Vector(); /** * update local jalview view settings from the stored appdata (if any) @@ -1288,6 +1286,7 @@ public class VamsasAppDatastore jalview.util.jarInputStreamProvider jprovider = new jalview.util.jarInputStreamProvider() { + @Override public String getFilename() { @@ -1295,6 +1294,7 @@ public class VamsasAppDatastore return "Jalview Vamsas Document Client Data"; } + @Override public JarInputStream getJarInputStream() throws IOException { jalview.bin.Cache.log @@ -1304,7 +1304,7 @@ public class VamsasAppDatastore }; if (dojvsync) { - fromxml.LoadJalviewAlign(jprovider); + fromxml.loadJalviewAlign(jprovider); } } catch (Exception e) { @@ -1334,6 +1334,7 @@ public class VamsasAppDatastore jalview.util.jarInputStreamProvider jarstream = new jalview.util.jarInputStreamProvider() { + @Override public String getFilename() { @@ -1341,6 +1342,7 @@ public class VamsasAppDatastore return "Jalview Vamsas Document User Data"; } + @Override public JarInputStream getJarInputStream() throws IOException { jalview.bin.Cache.log @@ -1350,7 +1352,7 @@ public class VamsasAppDatastore }; if (dojvsync) { - fromxml.LoadJalviewAlign(jarstream); + fromxml.loadJalviewAlign(jarstream); } } catch (Exception e) { @@ -1439,7 +1441,8 @@ public class VamsasAppDatastore if (mappings != null && mappings.length > 0) { jalview.structure.StructureSelectionManager - .getStructureSelectionManager(Desktop.instance).addMappings(mappings); + .getStructureSelectionManager(Desktop.instance) + .addMappings(mappings); } } } @@ -1468,9 +1471,9 @@ public class VamsasAppDatastore Object vobject = jv2vobj.remove(oldjvobject); if (vobject == null) { - throw new Error( - "IMPLEMENTATION ERROR: old jalview object is not bound ! (" - + oldjvobject + ")"); + // NOTE: this happens if user deletes object in one session then updates + // from another client + throw new Error(MessageManager.formatMessage("error.implementation_error_old_jalview_object_not_bound", new String[]{oldjvobject.toString()})); } if (newjvobject != null) { @@ -1495,7 +1498,7 @@ public class VamsasAppDatastore jxml.setSkipList(skipList); if (dojvsync) { - jxml.SaveState(new JarOutputStream(cappdata + jxml.saveState(new JarOutputStream(cappdata .getClientOutputStream())); } @@ -1779,7 +1782,7 @@ public class VamsasAppDatastore for (i = 0, iSize = dsseqs.size(); i < iSize; i++) { seqs[i] = dsseqs.get(i); - dsseqs.set(i,null); + dsseqs.set(i, null); } jal = new jalview.datamodel.Alignment(seqs); Cache.log.debug("New vamsas alignment imported into jalview " @@ -2412,8 +2415,7 @@ public class VamsasAppDatastore int[] se = null; if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0) { - throw new Error( - "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!"); + throw new Error(MessageManager.getString("error.invalid_vamsas_rangetype_cannot_resolve_lists")); } if (dseta.getSegCount() > 0) { @@ -2471,8 +2473,7 @@ public class VamsasAppDatastore int[] se = null; if (dseta.getSegCount() > 0 && dseta.getPosCount() > 0) { - throw new Error( - "Invalid vamsas RangeType - cannot resolve both lists of Pos and Seg from choice!"); + throw new Error(MessageManager.getString("error.invalid_vamsas_rangetype_cannot_resolve_lists")); } if (dseta.getSegCount() > 0) { @@ -2728,8 +2729,7 @@ public class VamsasAppDatastore } } catch (Exception e) { - throw new Exception("Couldn't store sequence mappings for " + title, - e); + throw new Exception(MessageManager.formatMessage("exception.couldnt_store_sequence_mappings", new String[]{title}),e); } }