package org.vamsas.client; import java.io.File; import java.io.IOException; /** * TODO document type SimpleClientFactory * @author jimp * */ public class SimpleClientFactory implements IClientFactory { File sessionArena; /** * default constructor - called by CreateClientFactory only. * */ public SimpleClientFactory() { sessionArena = null; } /** * Create a client factory that works with sessions at the given * path. * @param path */ public SimpleClientFactory(String path) throws IOException { // Check path is valid and read/writeable. File newarena = new File(path); if (newarena.isDirectory() && newarena.canRead() && newarena.canWrite()) { sessionArena = newarena; } else { sessionArena = null; throw(new IOException("Cannot read and write to a directory called "+path)); } } /* (non-Javadoc) * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle) */ public IClient getIClient(ClientHandle applicationHandle) { // create a new session // register new ClientHandle in session // create Client instance return null; } /* (non-Javadoc) * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, java.lang.String) */ public IClient getIClient(ClientHandle applicationHandle, String sessionUrn) { // locate session from Urn // check that clientHandle is unique (with default user) - if not update the clientHandle urn to make it unique. // wait for lock and attach to session // create Client instance return null; } /* (non-Javadoc) * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle, java.lang.String) */ public IClient getIClient(ClientHandle applicationHandle, UserHandle userId, String sessionUrn) { // locate session from Urn // check Uniqueness of user + ClientHandle in the session. Update clientHandle urn accordingly. // wait for lock, attach to session // create client instance return null; } /* (non-Javadoc) * @see org.vamsas.client.IClientFactory#getIClient(org.vamsas.client.ClientHandle, org.vamsas.client.UserHandle) */ public IClient getIClient(ClientHandle applicationHandle, UserHandle userId) { // create new session // register Client and UserHandles in session // create client instance return null; } public static void main(String[] args) { } }