uk.ac.vamsas.client.simpleclient
Class SimpleClientFactory

java.lang.Object
  extended byuk.ac.vamsas.client.simpleclient.SimpleClientFactory
All Implemented Interfaces:
IClientFactory

public class SimpleClientFactory
extends java.lang.Object
implements IClientFactory

creates a session arena in the user home directory under .vamsas. Each session has its own subdirectory.


Constructor Summary
SimpleClientFactory()
          default constructor - called by CreateClientFactory only.
SimpleClientFactory(java.lang.String path)
          Create a client factory that works with sessions at the given path.
 
Method Summary
 java.lang.String[] getCurrentSessions()
          enumerate the active sessions this IClientFactory instance knows about.
 IClient getIClient(ClientHandle applicationHandle)
          Create a new Vorba Session
 IClient getIClient(ClientHandle applicationHandle, java.lang.String sessionUrn)
          the URN should be something like simpleclient:FILEPATH URL encoded
 IClient getIClient(ClientHandle applicationHandle, UserHandle userId)
          New session for application and specific user
 IClient getIClient(ClientHandle applicationHandle, UserHandle userId, java.lang.String sessionUrn)
          returns new vorba for a given session acting as a particular identity
 IClient getNewSessionIClient(ClientHandle applicationHandle)
          Create a new sesssion for the application with the current user
 IClient getNewSessionIClient(ClientHandle applicationHandle, UserHandle userId)
          Create a new session for the application using a particular user identity
 IClient openAsNewSessionIClient(ClientHandle applicationHandle, java.io.File vamsasDocument)
          Create a new session and import an existing vamsas document into it.
 IClient openAsNewSessionIClient(ClientHandle applicationHandle, UserHandle userId, java.io.File vamsasDocument)
          Create a new session as a particular user and import an existing vamsas document into it.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SimpleClientFactory

public SimpleClientFactory()
                    throws java.io.IOException
default constructor - called by CreateClientFactory only. Inits the sessionarena to the directory .vamsas of the user home directory.


SimpleClientFactory

public SimpleClientFactory(java.lang.String path)
                    throws java.io.IOException
Create a client factory that works with sessions at the given path.

Parameters:
path - path to directory called session arena, where will be created session directories and session files.
Method Detail

getIClient

public IClient getIClient(ClientHandle applicationHandle)
                   throws NoDefaultSessionException
Description copied from interface: IClientFactory
Create a new Vorba Session

Specified by:
getIClient in interface IClientFactory
Parameters:
applicationHandle - is the application's VAMSAS handle string
Throws:
NoDefaultSessionException - if more than one session exists that the client may connect to
See Also:
Creates a IClient object, using default UserHandle with system variables:"user.name" or "USERNAME")), "host.name" or "HOSTNAME"

getIClient

public IClient getIClient(ClientHandle applicationHandle,
                          java.lang.String sessionUrn)
the URN should be something like simpleclient:FILEPATH URL encoded

Specified by:
getIClient in interface IClientFactory
Parameters:
applicationHandle -
sessionUrn - session to connect to (or null to create a new session)
Returns:
See Also:
IClientFactory.getIClient(uk.ac.vamsas.client.ClientHandle, java.lang.String)

getIClient

public IClient getIClient(ClientHandle applicationHandle,
                          UserHandle userId,
                          java.lang.String sessionUrn)
Description copied from interface: IClientFactory
returns new vorba for a given session acting as a particular identity

Specified by:
getIClient in interface IClientFactory
Parameters:
applicationHandle -
userId -
sessionUrn - session to connect to (or null to create a new session)
Returns:
See Also:
IClientFactory.getIClient(uk.ac.vamsas.client.ClientHandle, uk.ac.vamsas.client.UserHandle, java.lang.String)

getIClient

public IClient getIClient(ClientHandle applicationHandle,
                          UserHandle userId)
                   throws NoDefaultSessionException
Description copied from interface: IClientFactory
New session for application and specific user

Specified by:
getIClient in interface IClientFactory
Parameters:
applicationHandle -
userId -
Returns:
Throws:
NoDefaultSessionException - if more than one session exists that the client may connect to
See Also:
IClientFactory.getIClient(uk.ac.vamsas.client.ClientHandle, uk.ac.vamsas.client.UserHandle)

getCurrentSessions

public java.lang.String[] getCurrentSessions()
Description copied from interface: IClientFactory
enumerate the active sessions this IClientFactory instance knows about. Can be used by caller to pick a session on catching a NoDefaultSessionException. LATER: Define interface for discovering more information about a session (so it can be presented to a user in a meaningful way)

Specified by:
getCurrentSessions in interface IClientFactory
Returns:
possibly empty array of sessionUrn strings
See Also:
IClientFactory.getCurrentSessions()

getNewSessionIClient

public IClient getNewSessionIClient(ClientHandle applicationHandle)
Description copied from interface: IClientFactory
Create a new sesssion for the application with the current user

Specified by:
getNewSessionIClient in interface IClientFactory
Parameters:
applicationHandle -
Returns:

getNewSessionIClient

public IClient getNewSessionIClient(ClientHandle applicationHandle,
                                    UserHandle userId)
Description copied from interface: IClientFactory
Create a new session for the application using a particular user identity

Specified by:
getNewSessionIClient in interface IClientFactory
Parameters:
applicationHandle -
userId -
Returns:

openAsNewSessionIClient

public IClient openAsNewSessionIClient(ClientHandle applicationHandle,
                                       java.io.File vamsasDocument)
                                throws InvalidSessionDocumentException
Description copied from interface: IClientFactory
Create a new session and import an existing vamsas document into it.

Specified by:
openAsNewSessionIClient in interface IClientFactory
Parameters:
applicationHandle -
vamsasDocument -
Returns:
Throws:
InvalidSessionDocumentException

openAsNewSessionIClient

public IClient openAsNewSessionIClient(ClientHandle applicationHandle,
                                       UserHandle userId,
                                       java.io.File vamsasDocument)
                                throws InvalidSessionDocumentException
Description copied from interface: IClientFactory
Create a new session as a particular user and import an existing vamsas document into it.

Specified by:
openAsNewSessionIClient in interface IClientFactory
Parameters:
applicationHandle -
userId -
vamsasDocument -
Returns:
Throws:
InvalidSessionDocumentException