From: jprocter Date: Fri, 28 Oct 2005 16:03:13 +0000 (+0000) Subject: refactored documentHandler to VamsasFile to indicate similarity with ClientFile handl... X-Git-Tag: Release_0.2~440 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=370fa3fd8c8641131d1072ee65dd7b1dbb868256;p=vamsas.git refactored documentHandler to VamsasFile to indicate similarity with ClientFile handler class. git-svn-id: https://svn.lifesci.dundee.ac.uk/svn/repository/trunk@80 be28352e-c001-0410-b1a7-c7978e42abec --- diff --git a/src/org/vamsas/client/simpleclient/documentHandler.java b/src/org/vamsas/client/simpleclient/VamsasFile.java similarity index 75% rename from src/org/vamsas/client/simpleclient/documentHandler.java rename to src/org/vamsas/client/simpleclient/VamsasFile.java index d584121..506fea6 100644 --- a/src/org/vamsas/client/simpleclient/documentHandler.java +++ b/src/org/vamsas/client/simpleclient/VamsasFile.java @@ -18,11 +18,12 @@ import org.vamsas.objects.core.LockFileDescriptor; /** * low level vamsas document management routines + * analogous to ClientsFile * This class is not thread safe. * @author jimp * */ -public class documentHandler { +public class VamsasFile { /** * Vamsas client is intialised with a path to create live session directories. * This path may contain a vamsas.properties file @@ -68,16 +69,34 @@ public class documentHandler { private long timeout=1000; // time in milliseconds before we give up getting a lock private long interval=100; // time between attempts to lock private PrintWriter vamsasWriterStream; // non null if there is a write to a new Document in progress. - public documentHandler(File sessionDir) throws java.io.IOException { - newSessionDir = File.createTempFile("vamsasSimple", "session", sessionDir); + /** + * + * Connect to an existing Vamsas document in a given sessionDir + * or create a new one. + * + * @param sessionDir + * @throws java.io.IOException + */ + public VamsasFile(File sessionDir) throws java.io.IOException { + // check if directory exists. if not, create it. + // check if vamsas jar exists, if not, create it. + } - - public documentHandler(File lockfile, File vamsasJar) { - this.lockfile = lockfile; - this.vamsasJar = vamsasJar; + /** + * Expand a previously stored session into the sessionDir + * @param sessionDir + * @param storedSession + */ + public VamsasFile(File sessionDir, JarFile storedSession) throws IOException { + // check if sessionDir is live or not + + // if live - try to merge storedSession with sessionDir + // - will probably fail through duplicate object references needing to be dereferenced. + // TODO: think of a way of specifying vorba_id scope for an application's references to allow merging of one vamsasDocument with another. + } /** - * gets an unlocked stream from the vamsas document. + * gets a locked Reader for the vamsas document. * @return reader for vamsasdocument.xml enrty */ public java.io.Reader getDocumentReader() {