Weaver 3.1.0a1-D1

com.oldlight.weaver.interpreter
Class WeaverApplicationContextImpl

java.lang.Object
  extended bycom.oldlight.weaver.interpreter.WeaverApplicationContextImpl
All Implemented Interfaces:
WeaverApplicationContext

public class WeaverApplicationContextImpl
extends Object
implements WeaverApplicationContext

Storage of application scoped (context wide) values.

Author:
Paul Harvey

Field Summary
private  Map initParameterMap
           
private  Object initParameterMapSync
           
private  Properties properties
           
private  ServletContext servletContext
           
private  String uploadDir
           
 
Constructor Summary
WeaverApplicationContextImpl(ServletContext theServletContext, Properties theProperties)
          Create a new application context.
 
Method Summary
 Object getAttribute(String name)
          Get an application scoped attribute.
 Map getAttributeMap()
          Get an attribute name to value map.
 String getConfigValue(String name)
          Retrieve the global/context-wide configuration value.
 Set getConfigValueNames()
          Get all configuration value names.
 String getInitParameter(String name)
          Get a global/context-wide parameter.
 Map getInitParameterMap()
          Get a map of init param names to values.
 String getMimeType(String file)
          Return the MIME type of a given file.
 String getRealPath(String thePath)
          Returns a String containing the real path for a given virtual path.
 String getUploadDir()
           
 void removeAttribute(String name)
          Remove an application scoped attribute.
 void setAttribute(String name, Object value)
          Set an application scoped attribute.
 void setUploadDir(String uploadDir)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

servletContext

private ServletContext servletContext

properties

private Properties properties

uploadDir

private String uploadDir

initParameterMap

private Map initParameterMap

initParameterMapSync

private Object initParameterMapSync
Constructor Detail

WeaverApplicationContextImpl

public WeaverApplicationContextImpl(ServletContext theServletContext,
                                    Properties theProperties)
Create a new application context. This method is typically only ever called by the Weaver infrastructure.

Parameters:
theServletContext - Servlet context in which the application is running.
theProperties - Global configuration.
Method Detail

getUploadDir

public String getUploadDir()

setUploadDir

public void setUploadDir(String uploadDir)

getMimeType

public String getMimeType(String file)
Return the MIME type of a given file.

Specified by:
getMimeType in interface WeaverApplicationContext
Parameters:
file - The name of the file from which to determine the MIME type.
Returns:
The MIME type

getConfigValue

public String getConfigValue(String name)
Retrieve the global/context-wide configuration value.

Specified by:
getConfigValue in interface WeaverApplicationContext
Parameters:
name - Name of the config value to retrieve.
Returns:
Context-wide configuration value, or null if it can't be found.

getConfigValueNames

public Set getConfigValueNames()
Get all configuration value names.

Specified by:
getConfigValueNames in interface WeaverApplicationContext
Returns:
Set of configuration value names.

getRealPath

public String getRealPath(String thePath)
Returns a String containing the real path for a given virtual path. See the documentation for ServletContext.getRealPath.

Specified by:
getRealPath in interface WeaverApplicationContext
Parameters:
thePath - The virtual path.
Returns:
The real path determined from the given virtual path.

getAttribute

public Object getAttribute(String name)
Get an application scoped attribute.

Specified by:
getAttribute in interface WeaverApplicationContext
Parameters:
name - The name of the attribute to be retrieved.
Returns:
The retrieved attribute - or null if the attribute cannot be found.

setAttribute

public void setAttribute(String name,
                         Object value)
Set an application scoped attribute.

Specified by:
setAttribute in interface WeaverApplicationContext
Parameters:
name - The name of the attribute to set.
value - The value to set the attribute to.

removeAttribute

public void removeAttribute(String name)
Remove an application scoped attribute.

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

getAttributeMap

public Map getAttributeMap()
Get an attribute name to value map. (This is used to by the EL variable resolver).

Returns:
Attribute name to value map.

getInitParameter

public String getInitParameter(String name)
Get a global/context-wide parameter. This method retrieves both values set in the global configuration file and in context wide init parameters set in the deployment descriptor.

Specified by:
getInitParameter in interface WeaverApplicationContext
Parameters:
name - The name of the parameter to retrieve in the form of a '/' separated path.
Returns:
The named parameter's value - or null if it cannot be found.

getInitParameterMap

public Map getInitParameterMap()
Get a map of init param names to values. (This is used by the EL variable resolver).

Returns:
Init param name to value map.

Copyright ©Paul Harvey