latest schema.
[vamsas.git] / src / org / vamsas / client / SimpleClientFactory.java
1 package org.vamsas.client;
2
3 import java.io.File;
4 import java.io.IOException;
5
6 /**
7  * TODO document type SimpleClientFactory
8  * @author jimp
9  *
10  */
11 public class SimpleClientFactory implements IClientFactory {
12  
13   File sessionArena;
14   
15   /**
16    * default constructor - called by CreateClientFactory only.
17    *
18    */
19   public SimpleClientFactory() {
20     sessionArena = null;
21   }
22   /**
23    * Create a client factory that works with sessions at the given
24    * path.
25    * @param path
26    */
27   public SimpleClientFactory(String path) throws IOException {
28     // Check path is valid and read/writeable.
29     File newarena = new File(path);
30     if (newarena.isDirectory() && newarena.canRead() && newarena.canWrite()) {
31       sessionArena = newarena;
32     } else {
33       sessionArena = null;
34       throw(new IOException("Cannot read and write to a directory called "+path));
35     }
36   }
37   /* (non-Javadoc)
38    * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle)
39    */
40   public IClient getIClient(ClientHandle applicationHandle) {
41     // create a new session
42     // register new ClientHandle in session
43     // create Client instance
44     return null;
45   }
46
47   /* (non-Javadoc)
48    * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, java.lang.String)
49    */
50   public IClient getIClient(ClientHandle applicationHandle, String sessionUrn) {
51     // locate session from Urn
52     // check that clientHandle is unique (with default user) - if not update the clientHandle urn to make it unique.
53     // wait for lock and attach to session
54     // create Client instance
55     return null;
56   }
57
58   /* (non-Javadoc)
59    * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle, java.lang.String)
60    */
61   public IClient getIClient(ClientHandle applicationHandle, UserHandle userId,
62       String sessionUrn) {
63     // locate session from Urn
64     // check Uniqueness of user + ClientHandle in the session. Update clientHandle urn accordingly.
65     // wait for lock, attach to session
66     // create client instance
67     return null;
68   }
69
70   /* (non-Javadoc)
71    * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle)
72    */
73   public IClient getIClient(ClientHandle applicationHandle, UserHandle userId) {
74     // create new session
75     // register Client and UserHandles in session
76     // create client instance
77     return null;
78   }
79
80   public static void main(String[] args) {
81   }
82 }