*/
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);
+ }
+ initSessionDocFromFile(importingArchive);
+ // 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);
sessdoc.putVamsasDocument(doc, sdoc.vorba);
sessdoc.closeArchive();
log.debug("Imported new vamsas data from "+importingArchive);
+
} catch (Exception e) {
sessdoc.cancelArchive();
- // write a dummy iohandler
+ // 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