1 package org.vamsas.client.simpleclient;
4 import java.io.IOException;
6 import org.vamsas.client.ClientHandle;
7 import org.vamsas.client.IClient;
8 import org.vamsas.client.IClientFactory;
9 import org.vamsas.client.UserHandle;
12 * TODO document type SimpleClientFactory
16 public class SimpleClientFactory implements IClientFactory {
21 * default constructor - called by CreateClientFactory only.
24 public SimpleClientFactory() {
28 * Create a client factory that works with sessions at the given
32 public SimpleClientFactory(String path) throws IOException {
33 // Check path is valid and read/writeable.
34 File newarena = new File(path);
35 if (newarena.isDirectory() && newarena.canRead() && newarena.canWrite()) {
36 sessionArena = newarena;
39 throw(new IOException("Cannot read and write to a directory called "+path));
43 * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle)
45 public IClient getIClient(ClientHandle applicationHandle) {
46 // create a new session
47 // register new ClientHandle in session
48 // create SimpleClient instance
53 * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, java.lang.String)
55 public IClient getIClient(ClientHandle applicationHandle, String sessionUrn) {
56 // locate session from Urn
57 // check that clientHandle is unique (with default user) - if not update the clientHandle urn to make it unique.
58 // wait for lock and attach to session
59 // create SimpleClient instance
64 * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle, java.lang.String)
66 public IClient getIClient(ClientHandle applicationHandle, UserHandle userId,
68 // locate session from Urn
69 // check Uniqueness of user + ClientHandle in the session. Update clientHandle urn accordingly.
70 // wait for lock, attach to session
71 // create client instance
76 * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle)
78 public IClient getIClient(ClientHandle applicationHandle, UserHandle userId) {
80 // register SimpleClient and UserHandles in session
81 // create client instance
85 public static void main(String[] args) {