com.pmease.quickbuild
Class Context

java.lang.Object
  extended by com.pmease.quickbuild.Context

public class Context
extends java.lang.Object

This class provides a convenient way to access current configuration and build either from background build thread or UI thread.


Field Summary
static java.lang.String BUILD_KEY
           
static java.lang.String CONFIGURATION_KEY
           
static java.lang.String NODE_KEY
           
static java.lang.String USER_TIMEZONE_ATTRNAME
           
 
Constructor Summary
Context()
           
 
Method Summary
static java.util.Map<java.lang.String,java.lang.Object> buildEvalContext(java.lang.Object currentObj, java.util.Map customContext)
          Construct expression evaluation context.
static void clear()
          Used internally by QuickBuild.
static void clearUserTimeZone()
           
static void detectUserTimeZone(javax.servlet.http.HttpServletRequest request)
           
static Build get()
          Internally used by QuickBuild.
static Build getBuild()
          Get current selected build if access from UI thread or current running build if access from a back end build thread.
static org.apache.wicket.Component getComponent()
           
static Configuration getConfiguration()
          Get current selected configuration if access from UI thread or current running configuration if access from a back end build thread.
static org.slf4j.Logger getLogger()
          Get current logger.
static org.slf4j.Logger getLogger(int stackBacktrackCount)
          Get current logger with specified stack backtrack count.
static BuildRequest getRequest()
          Get the build request.
static Step getStep()
           
static java.util.TimeZone getTimeZone()
          Get current time zone.
static User getUser()
          Get current logged in user if access from UI thread, or the user triggering the build if access from background build thread.
static java.util.TimeZone getUserTimeZone()
           
static boolean isBackend()
          Whether or not current thread is a back end build thread.
static void pop()
          Used internally by QuickBuild.
static void popComponent()
           
static void popStep()
           
static void push(Build build)
          Used internally by QuickBuild.
static void push(Configuration configuration)
          Used internally by QuickBuild.
static void pushComponent(org.apache.wicket.Component component)
           
static void pushStep(Step step)
           
static void setUser(User user)
          Set current user in the context.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

USER_TIMEZONE_ATTRNAME

public static final java.lang.String USER_TIMEZONE_ATTRNAME
See Also:
Constant Field Values

NODE_KEY

public static final java.lang.String NODE_KEY
See Also:
Constant Field Values

CONFIGURATION_KEY

public static final java.lang.String CONFIGURATION_KEY
See Also:
Constant Field Values

BUILD_KEY

public static final java.lang.String BUILD_KEY
See Also:
Constant Field Values
Constructor Detail

Context

public Context()
Method Detail

getConfiguration

public static Configuration getConfiguration()
Get current selected configuration if access from UI thread or current running configuration if access from a back end build thread.

Returns:
null if no configuration is running or no configuration is selected.

getBuild

public static Build getBuild()
Get current selected build if access from UI thread or current running build if access from a back end build thread.

Returns:
null if there is no any builds selected in UI (for example if build history or statistics tab is selected for a configuration), or if configuration is triggered but build is not generated yet in the back end build thread.

getRequest

public static BuildRequest getRequest()
Get the build request.

Returns:
Null if not access from a back end build thread.

get

public static Build get()
Internally used by QuickBuild.

Returns:

isBackend

public static boolean isBackend()
Whether or not current thread is a back end build thread.

Returns:

push

public static void push(Build build)
Used internally by QuickBuild.

Parameters:
context -

push

public static void push(Configuration configuration)
Used internally by QuickBuild.

Parameters:
configuration -

pop

public static void pop()
Used internally by QuickBuild.


clear

public static void clear()
Used internally by QuickBuild.


getUser

public static User getUser()
Get current logged in user if access from UI thread, or the user triggering the build if access from background build thread.

Returns:
null if current user is anonymous user when access from UI thread, or if the user triggering current build is anonymous when access from background build thread, or if the build is triggered by scheduler when access from background build thread.

setUser

public static void setUser(User user)
Set current user in the context. Used internally by QuickBuild.

Parameters:
user -

pushStep

public static void pushStep(Step step)

popStep

public static void popStep()

getStep

public static Step getStep()

getLogger

public static org.slf4j.Logger getLogger(int stackBacktrackCount)
Get current logger with specified stack backtrack count. Used internally by QuickBuild.

Parameters:
stackBacktrackCount -
Returns:

getLogger

public static org.slf4j.Logger getLogger()
Get current logger.

Returns:
build logger if access from background build process and the build is running; otherwise return the system logger.

buildEvalContext

public static java.util.Map<java.lang.String,java.lang.Object> buildEvalContext(java.lang.Object currentObj,
                                                                                java.util.Map customContext)
Construct expression evaluation context.

Parameters:
currentObj - null if no current object
customContext - null or empty if no custom context
Returns:

getTimeZone

public static java.util.TimeZone getTimeZone()
Get current time zone. The returned value will never be null.

Returns:

clearUserTimeZone

public static void clearUserTimeZone()

getUserTimeZone

public static java.util.TimeZone getUserTimeZone()

detectUserTimeZone

public static void detectUserTimeZone(javax.servlet.http.HttpServletRequest request)

pushComponent

public static void pushComponent(org.apache.wicket.Component component)

popComponent

public static void popComponent()

getComponent

public static org.apache.wicket.Component getComponent()


Copyright © 2005-2010 PMEase Inc. All Rights Reserved.