From 0fa0f75f9a36ed8123f9f05e476fbf7d1c80f417 Mon Sep 17 00:00:00 2001 From: jprocter Date: Sun, 26 Mar 2006 17:06:51 +0000 Subject: [PATCH] added new constructor and File object accessor to make VamsasFile usable with VamsasArchive. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@213 be28352e-c001-0410-b1a7-c7978e42abec --- src/org/vamsas/client/simpleclient/VamsasArchive.java | 10 +++++++++- src/org/vamsas/client/simpleclient/VamsasFile.java | 17 +++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/org/vamsas/client/simpleclient/VamsasArchive.java b/src/org/vamsas/client/simpleclient/VamsasArchive.java index d769a5c..f065d04 100644 --- a/src/org/vamsas/client/simpleclient/VamsasArchive.java +++ b/src/org/vamsas/client/simpleclient/VamsasArchive.java @@ -196,7 +196,15 @@ public class VamsasArchive { */ public VamsasArchive(VamsasFile archive, boolean vamsasdocument, boolean overwrite) throws IOException { this(archive.sessionFile, overwrite, vamsasdocument, archive); - log.debug("using non-functional lock-IO stream jar access constructor"); + // log.debug("using non-functional lock-IO stream jar access constructor"); + } + /** + * read and write to archive - will not overwrite original contents, and will always write an up to date vamsas document structure. + * @param archive + * @throws IOException + */ + public VamsasArchive(VamsasFile archive) throws IOException { + this(archive, true, false); } /** * diff --git a/src/org/vamsas/client/simpleclient/VamsasFile.java b/src/org/vamsas/client/simpleclient/VamsasFile.java index ecacdb9..3dd2581 100644 --- a/src/org/vamsas/client/simpleclient/VamsasFile.java +++ b/src/org/vamsas/client/simpleclient/VamsasFile.java @@ -37,6 +37,13 @@ public class VamsasFile extends SessionFile { super(sessionFile); } /** + * + * @return the VamsasFile + */ + public File getVamsasFile() { + return sessionFile; + } + /** * Expand a previously stored session into the sessionDir * @param sessionDir * @param storedSession @@ -72,6 +79,16 @@ public class VamsasFile extends SessionFile { return null; } /** + * + * @param extantLock + * @return null, extantLock or new Lock. + */ + public Lock getLock(Lock extantLock) { + if (lockFile(extantLock)) + return fileLock; + return null; + } + /** * explicitly unlocks vamsas file. * if you have called getLock() you *must* * call this to release the lock. -- 1.7.10.2