From 4aeaba257ad7e3206158565b356da7e4b15bf0a2 Mon Sep 17 00:00:00 2001 From: jprocter Date: Fri, 14 Sep 2007 13:48:09 +0000 Subject: [PATCH] moved methods for opening a stored session document in a new vamsas session into the VamsasSession. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@465 be28352e-c001-0410-b1a7-c7978e42abec --- .../vamsas/client/simpleclient/SimpleClient.java | 30 ++++---------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java b/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java index d5dc880..43ec15d 100644 --- a/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java +++ b/src/uk/ac/vamsas/client/simpleclient/SimpleClient.java @@ -25,6 +25,7 @@ import uk.ac.vamsas.client.Events; import uk.ac.vamsas.client.IClient; import uk.ac.vamsas.client.IClientDocument; import uk.ac.vamsas.client.IObjectUpdate; +import uk.ac.vamsas.client.InvalidSessionDocumentException; import uk.ac.vamsas.client.InvalidSessionUrnException; import uk.ac.vamsas.client.SessionHandle; import uk.ac.vamsas.client.UserHandle; @@ -94,42 +95,23 @@ public class SimpleClient implements IClient { } /** - * construct new session by importing objects from an existing vamsas document + * construct new SimpleClientsession by importing objects from an existing vamsas document * @param user * @param client * @param sess * @param importingArchive * @throws Exception IOExceptions for Session IO problems, and general Exception if importing document is invalid. - */ protected SimpleClient(UserHandle user, ClientHandle client, VamsasSession sess, File importingArchive) throws Exception { this(user, client, sess); if (log.isDebugEnabled()) { - log.debug("Attempting to create a new session from file: "+importingArchive); + log.debug("Attempting to overwrite session document with file: "+importingArchive); } - initSessionDocFromFile(importingArchive); - // TODO: write provenance entry for new session indicating the import. + // TODO: write provenance entry for new session indicating the import. + } + */ - private void initSessionDocFromFile(File importingArchive) throws Exception { - VamsasArchive sessdoc = _session.getVamsasDocument(); - try { - VamsasArchiveReader odoc = new VamsasArchiveReader(importingArchive); - SimpleDocument sdoc = new SimpleDocument(makeVorbaIdFactory()); - VamsasDocument doc = sdoc.getVamsasDocument(odoc); - sessdoc.putVamsasDocument(doc, sdoc.vorba); - sessdoc.closeArchive(); - log.debug("Imported new vamsas data from "+importingArchive); - - } catch (Exception e) { - sessdoc.cancelArchive(); - // TODO: check that new session is really writeable if the imported document was invalid ? or is removed - _session.slog.info("Exception when importing document data from "+importingArchive); - log.warn("While importing session data from existing archive in "+importingArchive, e); - throw new Exception("Failed to import data from "+importingArchive, e); - } - } - /* * (non-Javadoc) * LATER: check that build substitution variables are correct -- 1.7.10.2