probably deprecating this class.
[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     super(sessionFile);
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     if (!sessionDir.exists()) {
46       sessionDir.mkdir();
47     }
48     
49     {
50       // check its actually a writable directory
51     }
52     
53     File sfile = new File(sessionDir, "vamsas.jar");
54     VamsasFile(sfile);
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.
58     
59   }
60   */
61   
62   /**
63    * gets a locked Reader for the vamsas document.
64    * @return reader for vamsasdocument.xml enrty
65    */
66   public java.io.Reader getDocumentReader() {
67     
68     try {
69       JarFile session = new JarFile("vamsasJar");
70       //JarEntry vamsasDocument = session.getJarEntry("vamsasDocument.xml");
71       //return new InputStreamReader(session.getInputStream(vamsasDocument));
72     } catch (IOException e) {
73       // TODO Auto-generated catch block
74       e.printStackTrace();
75     }
76     return null;
77   }
78   
79   
80 }