access for vamsas.xml style vamsas archive
[vamsas.git] / src / org / vamsas / client / simpleclient / VamsasFile.java
1
2 package org.vamsas.client.simpleclient;
3
4 import java.io.File;
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;
16
17 import org.vamsas.objects.core.LockFileDescriptor;
18
19 /**
20  * low level vamsas document management routines
21  * analogous to ClientsFile
22  * This class is not thread safe.
23  * @author jimp
24  *
25  */
26 public class VamsasFile extends SessionFile {
27   /**
28    * 
29    * Connect to an existing Vamsas document in a given sessionDir
30    * or create a new one.
31    * 
32    * @param sessionDir
33    * @throws java.io.IOException
34    */
35   public VamsasFile(File sessionFile) throws java.io.IOException {
36     
37   }
38   /**
39    * Expand a previously stored session into the sessionDir
40    * @param sessionDir
41    * @param storedSession
42    */
43   public VamsasFile(File sessionDir, JarFile storedSession) throws IOException {
44     // check if sessionDir is live or not
45     
46     // if live - try to merge storedSession with sessionDir
47     //  - will probably fail through duplicate object references needing to be dereferenced.
48     // TODO: think of a way of specifying vorba_id scope for an application's references to allow merging of one vamsasDocument with another.
49     
50   }
51   /**
52    * gets a locked Reader for the vamsas document.
53    * @return reader for vamsasdocument.xml enrty
54    */
55   public java.io.Reader getDocumentReader() {
56     
57     try {
58       JarFile session = new JarFile("vamsasJar");
59       //JarEntry vamsasDocument = session.getJarEntry("vamsasDocument.xml");
60       //return new InputStreamReader(session.getInputStream(vamsasDocument));
61     } catch (IOException e) {
62       // TODO Auto-generated catch block
63       e.printStackTrace();
64     }
65     return null;
66   }
67   
68   
69 }