planetj.dataengine
Class ExecutingContext

java.lang.Object
  |
  +--planetj.dataengine.ExecutingContext
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
HttpExecutingContext

public class ExecutingContext
extends Object
implements Serializable

An ExecutingContext contains information or data to be used for the currently executing state of some action, operation, or request being carried out by the user.

Author:
PlanetJ Corp.
See Also:
Serialized Form

Constructor Summary
ExecutingContext()
          Creates a new ExecutingContext object
ExecutingContext(IUser user)
          Creates a new ExecutingContext object
ExecutingContext(IUser user, Application application)
          Creates a new ExecutingContext object
 
Method Summary
static void clearCurrentExecutingContext()
          Sets the current executing context
 Application getApplication()
          Get the current application of this executing context.
static ExecutingContext getCurrentExecutingContext()
          Gets the current executing context
static ExecutingContext getCurrentExecutingContext(IUser user)
          Gets the current executing context.
static HttpExecutingContext getCurrentHttpExecutingContext()
          Gets the current Http executing context
static ExecutingContext getDefaultExecutingContext()
          Return a default ExecutingContext with unknown user and application
static ExecutingContext getDefaultExecutingContext(int pMode)
          Return a default ExecutingContext with unknown user and application, and the specified mode
 int getMode()
          Gets the mode of the current action being performed on the database (e.g.
 Object getObject(Object key)
           
 Object getRuntimeParameterValue(String name)
          Gets the value of a runtime parameter
 IUser getUser()
          Get the current user of this executing context.
 String getUserLibrary()
          Gets the current user library.
 Object putObject(Object key, Object value)
           
 Object removeObject(Object key)
           
 void setApplication(Application application)
          Set the current application of this executing context.
static void setCurrentExecutingContext(ExecutingContext ec)
          Sets the current executing context
 void setDataEngineMode(String newMode)
          Sets the mode of the current action being performed by the application (e.g.
 void setMode(int newMode)
          Sets the mode of the current action being performed on the database (e.g.
 void setUser(IUser user)
          Set the current user of this executing context.
 void setUserLibrary(String newUserLibrary)
          Sets the current user library
static String transformAlias(String originalAlias)
          Given a shared connection alias, returns the appropriate connection alias to use for DB access.
 String transformSystemAlias(String originalAlias)
          Given a shared connection alias, returns the appropriate connection alias to use for DB access.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ExecutingContext

public ExecutingContext()
Creates a new ExecutingContext object


ExecutingContext

public ExecutingContext(IUser user)
Creates a new ExecutingContext object


ExecutingContext

public ExecutingContext(IUser user,
                        Application application)
Creates a new ExecutingContext object

Method Detail

clearCurrentExecutingContext

public static void clearCurrentExecutingContext()
Sets the current executing context


getApplication

public Application getApplication()
Get the current application of this executing context.

Returns:
current application within this executing context

getCurrentExecutingContext

public static ExecutingContext getCurrentExecutingContext()
Gets the current executing context


getCurrentHttpExecutingContext

public static HttpExecutingContext getCurrentHttpExecutingContext()
Gets the current Http executing context

Returns:
null if current executing context is not instanceof HttpExecutingContext

getCurrentExecutingContext

public static ExecutingContext getCurrentExecutingContext(IUser user)
Gets the current executing context. If the user passed in is not null and does not match the user in the current executing context, then the user of the current executing context is set to the user passed in as an argument


getDefaultExecutingContext

public static ExecutingContext getDefaultExecutingContext()
Return a default ExecutingContext with unknown user and application

Returns:
ExecutingContext

getDefaultExecutingContext

public static ExecutingContext getDefaultExecutingContext(int pMode)
Return a default ExecutingContext with unknown user and application, and the specified mode

Returns:
ExecutingContext

getMode

public int getMode()
Gets the mode of the current action being performed on the database (e.g. Row.MODE_INSERT, Row.MODE_UPDATE, etc.)


getObject

public Object getObject(Object key)

getRuntimeParameterValue

public Object getRuntimeParameterValue(String name)
Gets the value of a runtime parameter


getUser

public IUser getUser()
Get the current user of this executing context.

Returns:
current user requesting some action or operation

getUserLibrary

public String getUserLibrary()
Gets the current user library. This is never null


putObject

public Object putObject(Object key,
                        Object value)

removeObject

public Object removeObject(Object key)

setApplication

public void setApplication(Application application)
Set the current application of this executing context.


setCurrentExecutingContext

public static void setCurrentExecutingContext(ExecutingContext ec)
Sets the current executing context


setDataEngineMode

public void setDataEngineMode(String newMode)
Sets the mode of the current action being performed by the application (e.g. IDataEngine.MODE_INSERT, IDataEngine.MODE_UPDATE, etc.)


setMode

public void setMode(int newMode)
Sets the mode of the current action being performed on the database (e.g. Row.MODE_INSERT, Row.MODE_UPDATE, etc.)


setUser

public void setUser(IUser user)
Set the current user of this executing context.


setUserLibrary

public void setUserLibrary(String newUserLibrary)
Sets the current user library


transformAlias

public static String transformAlias(String originalAlias)
Given a shared connection alias, returns the appropriate connection alias to use for DB access. Usually this is just the same connection alias, however in some cases (like if the user is using a personal connection pool instead of a shared one) the returned alias will be different.


transformSystemAlias

public String transformSystemAlias(String originalAlias)
Given a shared connection alias, returns the appropriate connection alias to use for DB access. Usually this is just the same connection alias, however in some cases (like if the user is using a personal connection pool instead of a shared one) the returned alias will be different.