From c56392962706a7a93001d9aeb4e541f7e7d044e3 Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 8 Nov 2005 11:39:18 +0000 Subject: [PATCH] Preliminary storeJalview --- src/jalview/io/VamsasDatastore.java | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/jalview/io/VamsasDatastore.java b/src/jalview/io/VamsasDatastore.java index 69213af..efc13da 100755 --- a/src/jalview/io/VamsasDatastore.java +++ b/src/jalview/io/VamsasDatastore.java @@ -24,6 +24,8 @@ import org.vamsas.objects.core.*; import jalview.gui.*; import java.io.*; import java.util.jar.*; +import org.exolab.castor.xml.*; +import org.exolab.castor.mapping.Mapping; /* @@ -50,6 +52,33 @@ public class VamsasDatastore storeVAMSAS(file); } + public void storeJalview(String file, AlignFrame af) + { + try + { + // 1. Load the mapping information from the file + Mapping map = new Mapping(getClass().getClassLoader()); + java.net.URL url = getClass().getResource("/jalview_mapping.xml"); + map.loadMapping(url); + + // 2. Unmarshal the data + // Unmarshaller unmar = new Unmarshaller(); + //unmar.setIgnoreExtraElements(true); + //unmar.setMapping(map); + // uni = (UniprotFile) unmar.unmarshal(new FileReader(file)); + + // 3. marshal the data with the total price back and print the XML in the console + Marshaller marshaller = new Marshaller( new FileWriter(file) ); + + marshaller.setMapping(map); + marshaller.marshal(af); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + public VAMSAS storeVAMSAS(String file) -- 1.7.10.2