Package omero :: Package util :: Module sessions :: Class SessionsStore
[hide private]
[frames] | no frames]

Class SessionsStore

source code


The store is a file-based repository of user sessions. By default, stores use $HOME/omero/sessions as their repository path.

Use add() to add items to the repository

Instance Methods [hide private]
 
__init__(self, dir=None)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
report(self)
Simple dump utility
source code
 
add(self, host, name, id, props)
Stores a file containing the properties at REPO/host/name/id
source code
 
conflicts(self, host, name, id, new_props, ignore_nulls=False)
Compares if the passed properties are compatible with with those for the host, name, id tuple
source code
 
remove(self, host, name, uuid)
Removes the given session file from the store and removes the sess_file() if it is equal to the session we just removed.
source code
 
exists(self, host, name, uuid)
Checks if the given file exists.
source code
 
get(self, host, name, uuid)
Returns the properties stored in the given session file
source code
 
available(self, host, name)
Returns the path to property files which are stored.
source code
 
set_current(self, host, name=None, uuid=None)
Sets the current session, user, and host files These are used as defaults by other methods.
source code
 
get_current(self) source code
 
last_host(self)
Prints either the last saved host (see get_current()) or "localhost"
source code
 
find_name_by_key(self, server, uuid)
Returns the name of a user for which the session key exists.
source code
 
contents(self)
Returns a map of maps with all the contents of the store.
source code
 
count(self, host=None, name=None)
Returns the sum of all files visited by walk()
source code
 
walk(self, func, host=None, name=None, sess=None)
Applies func to all host, name, and session path-objects.
source code
 
attach(self, server, name, sess, set_current=True)
Simple helper.
source code
 
create(self, name, pasw, props, new=True, set_current=True)
Creates a new omero.client object, and returns: (cilent, session_id, timeToIdle, timeToLive)
source code
 
clear(self, host=None, name=None, sess=None)
Walks through all sessions and calls killSession.
source code
 
host_file(self)
Returns the path-object which stores the last active host
source code
 
user_file(self, host)
Returns the path-object which stores the last active user
source code
 
sess_file(self, host, user)
Returns the path-object which stores the last active session
source code
 
non_dot(self, d)
Only returns the files (not directories) contained in d that don't start with a dot
source code
 
props(self, f)
Parses the path-object into properties
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, dir=None)
(Constructor)

source code 

x.__init__(...) initializes x; see x.__class__.__doc__ for signature

Overrides: object.__init__

conflicts(self, host, name, id, new_props, ignore_nulls=False)

source code 

Compares if the passed properties are compatible with with those for the host, name, id tuple

If ignore_nulls is True, then a null in new_props means matches anything.

available(self, host, name)

source code 

Returns the path to property files which are stored. Internal accounting files are not returned.

find_name_by_key(self, server, uuid)

source code 

Returns the name of a user for which the session key exists. This value is taken from the path rather than from the properties file since that value may have been overwritten. An exception is raised if there is more than one name since keys should be UUIDs. A None may be returned.

contents(self)

source code 

Returns a map of maps with all the contents of the store. Internal accounting files are skipped.

attach(self, server, name, sess, set_current=True)

source code 

Simple helper. Delegates to create() using the session as both the username and the password. This reproduces the logic of client.joinSession()

clear(self, host=None, name=None, sess=None)

source code 

Walks through all sessions and calls killSession. Regardless of exceptions, it will remove the session files from the store.