1 package org.vamsas.client;
4 import java.io.IOException;
7 * TODO document type SimpleClientFactory
11 public class SimpleClientFactory implements IClientFactory {
16 * default constructor - called by CreateClientFactory only.
19 public SimpleClientFactory() {
23 * Create a client factory that works with sessions at the given
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;
34 throw(new IOException("Cannot read and write to a directory called "+path));
38 * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle)
40 public IClient getIClient(ClientHandle applicationHandle) {
41 // create a new session
42 // register new ClientHandle in session
43 // create SimpleClient instance
48 * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, java.lang.String)
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 SimpleClient instance
59 * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle, java.lang.String)
61 public IClient getIClient(ClientHandle applicationHandle, UserHandle userId,
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
71 * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle)
73 public IClient getIClient(ClientHandle applicationHandle, UserHandle userId) {
75 // register SimpleClient and UserHandles in session
76 // create client instance
80 public static void main(String[] args) {