2 package org.vamsas.client.simpleclient;
5 import java.io.FileOutputStream;
6 import java.io.FileReader;
7 import java.io.IOException;
8 import java.io.InputStream;
9 import java.io.InputStreamReader;
10 import java.io.PrintWriter;
11 import java.util.Timer;
12 import java.util.jar.JarEntry;
13 import java.util.jar.JarFile;
14 import java.util.jar.JarInputStream;
15 import java.util.jar.JarOutputStream;
17 import org.vamsas.objects.core.LockFileDescriptor;
20 * low level vamsas document management routines
21 * analogous to ClientsFile
22 * This class is not thread safe.
26 public class VamsasFile extends SessionFile {
29 * Connect to an existing Vamsas document in a given sessionDir
30 * or create a new one.
33 * @throws java.io.IOException
35 public VamsasFile(File sessionFile) throws java.io.IOException {
39 * Expand a previously stored session into the sessionDir
41 * @param storedSession
43 public VamsasFile(File sessionDir, JarFile storedSession) throws IOException {
44 // check if sessionDir is live or not
45 if (!sessionDir.exists()) {
50 // check its actually a writable directory
53 File sfile = new File(sessionDir, "vamsas.jar");
55 // if live - try to merge storedSession with sessionDir
56 // - will probably fail through duplicate object references needing to be dereferenced.
57 // TODO: think of a way of specifying vorba_id scope for an application's references to allow merging of one vamsasDocument with another.
63 * gets a locked Reader for the vamsas document.
64 * @return reader for vamsasdocument.xml enrty
66 public Lock getLock() {
72 public java.io.Reader getDocumentReader() {
75 JarFile session = new JarFile("vamsasJar");
76 //JarEntry vamsasDocument = session.getJarEntry("vamsasDocument.xml");
77 //return new InputStreamReader(session.getInputStream(vamsasDocument));
78 } catch (IOException e) {
79 // TODO Auto-generated catch block