org.melati.poem
Class PoemThread

Package class diagram package PoemThread
java.lang.Object
  extended by org.melati.poem.PoemThread

public final class PoemThread
extends Object

A Poem Thread.


Field Summary
static int threadsMax
          The maximum number of Threads.
 
Method Summary
static AccessToken accessToken()
           
static void assertHasCapability(Capability capability)
          Check that we have the given Capability, throw an AccessPoemException if we don't.
static void commit()
          Commit to the underlying DBMS.
static Database database()
          Retrieve the Database associated with this thread.
static boolean inSession()
          Whether we are currently in a session.
static Vector<SessionToken> openSessions()
          Retrieve the open sessions.
static void rollback()
          Rollback the underlying DBMS.
static SessionToken sessionToken()
           
static void setAccessToken(AccessToken token)
          Change the access token under which your thread is operating.
static ToTidyList toTidy()
          Retrieve the ToTidyList for this session.
static PoemTransaction transaction()
          Retrieve the PoemTransaction for this PoemThread.
static void withAccessToken(AccessToken token, PoemTask task)
          Run a PoemTask under a specified AccessToken, typically Root.
static void writeDown()
          Write to the underlying DBMS.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

threadsMax

public static final int threadsMax
The maximum number of Threads. Must be < Char.MAX_VALUE = 64k

See Also:
Constant Field Values
Method Detail

openSessions

public static Vector<SessionToken> openSessions()
Retrieve the open sessions.

Returns:
a Vector of open SessionTokens

sessionToken

public static SessionToken sessionToken()
                                 throws NotInSessionPoemException
Returns:
the current SessionToken
Throws:
NotInSessionPoemException - if there is no current SessionToken

toTidy

public static ToTidyList toTidy()
                         throws NotInSessionPoemException
Retrieve the ToTidyList for this session.

Returns:
the ToTidyList for this PoemThread.
Throws:
NotInSessionPoemException

transaction

public static PoemTransaction transaction()
Retrieve the PoemTransaction for this PoemThread.

Returns:
the PoemTransaction for this PoemThread.

inSession

public static boolean inSession()
Whether we are currently in a session.

Returns:
whether we are currently in a session

accessToken

public static AccessToken accessToken()
                               throws NotInSessionPoemException,
                                      NoAccessTokenPoemException
Returns:
the access token under which your thread is running.
Throws:
NotInSessionPoemException - if we are not in a session
NoAccessTokenPoemException - if we do not have an AccessToken

setAccessToken

public static void setAccessToken(AccessToken token)
                           throws NonRootSetAccessTokenPoemException
Change the access token under which your thread is operating. You can't do this unless the current token is root.

Throws:
NonRootSetAccessTokenPoemException
See Also:
AccessToken.root

withAccessToken

public static void withAccessToken(AccessToken token,
                                   PoemTask task)
Run a PoemTask under a specified AccessToken, typically Root.

Parameters:
token - the token to run with
task - the task to run

assertHasCapability

public static void assertHasCapability(Capability capability)
                                throws NotInSessionPoemException,
                                       NoAccessTokenPoemException,
                                       AccessPoemException
Check that we have the given Capability, throw an AccessPoemException if we don't.

Parameters:
capability - to check
Throws:
NotInSessionPoemException
NoAccessTokenPoemException
AccessPoemException

database

public static Database database()
                         throws NotInSessionPoemException
Retrieve the Database associated with this thread.

Returns:
the Database associated with this thread.
Throws:
NotInSessionPoemException

writeDown

public static void writeDown()
Write to the underlying DBMS.


commit

public static void commit()
Commit to the underlying DBMS.


rollback

public static void rollback()
Rollback the underlying DBMS.



Copyright © 2000-2010 PanEris. All Rights Reserved.