Weaver 3.1.0a1-D1

com.oldlight.weaver.interpreter
Class WeaverExecutionContextImpl

java.lang.Object
  extended bycom.oldlight.weaver.interpreter.WeaverExecutionContextImpl
All Implemented Interfaces:
WeaverExecutionContext

public class WeaverExecutionContextImpl
extends Object
implements WeaverExecutionContext

A collection of classes that together represent the current state of execution of a Weaver application. This is the primary interface via which W-Bean code interacts with Weaver.

Author:
Paul Harvey

Field Summary
private  WeaverApplicationContextImpl applicationContext
           
private  WeaverBean beanClass
           
private  WeaverBeanContextImpl beanContext
           
private  WeaverLocalContextImpl localContext
           
private  WeaverRequestContextImpl requestContext
           
private  WeaverVariableResolver resolver
           
private  WeaverResponseContextImpl responseContext
           
private  WeaverServletContextImpl servletContext
           
private  WeaverSessionContextImpl sessionContext
           
 
Constructor Summary
WeaverExecutionContextImpl(WeaverLocalContextImpl localContext, WeaverRequestContextImpl requestContext, WeaverResponseContextImpl responseContext, WeaverSessionContextImpl sessionContext, WeaverServletContextImpl servletContext, WeaverApplicationContextImpl applicationContext)
          Create a new WeaverExecutionContext object.
 
Method Summary
 Object findAttribute(String name)
          Find a scoped attribute.
 WeaverApplicationContext getApplicationContext()
          Get the application context.
 Object getAttribute(String name, WeaverAttributeScope scope)
          Gets a named attribute from a named scope.
 WeaverBean getBeanClass()
          Gets the W-Bean being executed.
 WeaverBeanContext getBeanContext()
          Get the current bean context.
 WeaverLocalContext getLocalContext()
          Get the current local context.
 WeaverRequestContext getRequestContext()
          Get the current request context.
 WeaverResponseContext getResponseContext()
          Get the current response context.
 WeaverSecurityContext getSecurityContext()
          Get the security context.
 WeaverServletContext getServletContext()
          Get the servlet context.
 WeaverSessionContext getSessionContext()
          Get the session context.
 WeaverVariableResolver getVariableResolver()
          Gets the variable resolver for this context.
 void removeAttribute(String name)
          Remove a named attribute from all scopes.
 void removeAttribute(String name, WeaverAttributeScope scope)
          Remove a named attribute from a named scope.
 void setAttribute(String name, WeaverAttributeScope scope, Object value)
          Sets the value of a named attribute in a named scope.
 void setBeanClass(WeaverBean beanClass)
          Sets the class of the W-Bean being executed.
 void setBeanContext(WeaverBeanContextImpl beanContext)
          Set the bean context.
 void setSessionContext(WeaverSessionContextImpl sessionContext)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

beanClass

private WeaverBean beanClass

beanContext

private WeaverBeanContextImpl beanContext

localContext

private WeaverLocalContextImpl localContext

requestContext

private WeaverRequestContextImpl requestContext

responseContext

private WeaverResponseContextImpl responseContext

sessionContext

private WeaverSessionContextImpl sessionContext

servletContext

private WeaverServletContextImpl servletContext

applicationContext

private WeaverApplicationContextImpl applicationContext

resolver

private WeaverVariableResolver resolver
Constructor Detail

WeaverExecutionContextImpl

public WeaverExecutionContextImpl(WeaverLocalContextImpl localContext,
                                  WeaverRequestContextImpl requestContext,
                                  WeaverResponseContextImpl responseContext,
                                  WeaverSessionContextImpl sessionContext,
                                  WeaverServletContextImpl servletContext,
                                  WeaverApplicationContextImpl applicationContext)
Create a new WeaverExecutionContext object.

Parameters:
localContext - Local context to store.
requestContext - Request context to store.
responseContext - Response context to store.
sessionContext - Session context to store.
servletContext - Servlet context to store.
applicationContext - Application context to store.
Method Detail

getSecurityContext

public WeaverSecurityContext getSecurityContext()
Description copied from interface: WeaverExecutionContext
Get the security context.

Specified by:
getSecurityContext in interface WeaverExecutionContext
Returns:
The security context.

setSessionContext

public void setSessionContext(WeaverSessionContextImpl sessionContext)
Parameters:
sessionContext - The session context.

setBeanClass

public void setBeanClass(WeaverBean beanClass)
Sets the class of the W-Bean being executed. (Called by the Weaver infrastructure).

Parameters:
beanClass - The bean class.

getBeanClass

public WeaverBean getBeanClass()
Gets the W-Bean being executed.

Returns:
The W-Bean being executed.

getVariableResolver

public WeaverVariableResolver getVariableResolver()
Gets the variable resolver for this context. (Called by the Weaver infrastructure)

Returns:
The variable resolver.

setBeanContext

public void setBeanContext(WeaverBeanContextImpl beanContext)
Set the bean context. (Called by the Weaver infrastructure).

Parameters:
beanContext - The bean context.

findAttribute

public Object findAttribute(String name)
Find a scoped attribute. The available scopes are searched for the named attribute.

Specified by:
findAttribute in interface WeaverExecutionContext
Parameters:
name - Name of the attribute to retrieve.
Returns:
Value of the named attribute, or null if not found.

getAttribute

public Object getAttribute(String name,
                           WeaverAttributeScope scope)
Gets a named attribute from a named scope.

Specified by:
getAttribute in interface WeaverExecutionContext
Parameters:
name - Name of the attribute to retrieve.
scope - Scope to retrieve the attribute from (taken from the WeaverAttributeScope values)
Returns:
The value of the name attribute from the named scope, or null if not found.

setAttribute

public void setAttribute(String name,
                         WeaverAttributeScope scope,
                         Object value)
Sets the value of a named attribute in a named scope.

Specified by:
setAttribute in interface WeaverExecutionContext
Parameters:
name - Name of the attribute to set.
scope - Name of scope to set the attribute in (taken from the WeaverAttributeScope values).
value - Value to set the attribute to.

removeAttribute

public void removeAttribute(String name,
                            WeaverAttributeScope scope)
Remove a named attribute from a named scope.

Specified by:
removeAttribute in interface WeaverExecutionContext
Parameters:
name - The name of the attribute to remove.
scope - The scope to remove the attribute from (taken from the WeaverAttributeScope values).

removeAttribute

public void removeAttribute(String name)
Remove a named attribute from all scopes.

Specified by:
removeAttribute in interface WeaverExecutionContext
Parameters:
name - The name of the attribute to remove.

getBeanContext

public WeaverBeanContext getBeanContext()
Get the current bean context.

Specified by:
getBeanContext in interface WeaverExecutionContext
Returns:
The bean context.

getLocalContext

public WeaverLocalContext getLocalContext()
Get the current local context.

Specified by:
getLocalContext in interface WeaverExecutionContext
Returns:
The local context.

getRequestContext

public WeaverRequestContext getRequestContext()
Get the current request context.

Specified by:
getRequestContext in interface WeaverExecutionContext
Returns:
The request context.

getResponseContext

public WeaverResponseContext getResponseContext()
Get the current response context.

Specified by:
getResponseContext in interface WeaverExecutionContext
Returns:
The response context.

getSessionContext

public WeaverSessionContext getSessionContext()
Get the session context.

Specified by:
getSessionContext in interface WeaverExecutionContext
Returns:
The session context.

getServletContext

public WeaverServletContext getServletContext()
Get the servlet context.

Specified by:
getServletContext in interface WeaverExecutionContext
Returns:
The servlet context.

getApplicationContext

public WeaverApplicationContext getApplicationContext()
Get the application context.

Specified by:
getApplicationContext in interface WeaverExecutionContext
Returns:
The application context.

Copyright ©Paul Harvey