org.makumba.commons.attributes
Class RequestAttributes

java.lang.Object
  extended by org.makumba.commons.attributes.RequestAttributes
All Implemented Interfaces:
Attributes

public class RequestAttributes
extends Object
implements Attributes

Implementation of the Makumba Attributes

Version:
$Id: RequestAttributes.java 1707 2007-09-28 15:35:48Z manuel_gay $
Author:
Cristian Bogdan

Field Summary
static String ATTRIBUTES_NAME
           
(package private)  Object controller
           
static String CONTROLLER_NAME
           
(package private) static Logger logger
           
static Object notFound
           
static String PARAMETERS_NAME
           
static String PROVIDER_ATTRIBUTE
           
(package private)  HttpServletRequest request
           
 
Constructor Summary
RequestAttributes(HttpServletRequest req)
           
RequestAttributes(Object controller, HttpServletRequest req, String db)
           
 
Method Summary
 Object checkLogicForAttribute(String s)
           
 Object checkParameterForAttribute(String s)
           
 Object checkServletLoginForAttribute(String s)
           
 Object checkSessionForAttribute(String s)
           
 Object getAttribute(String s)
          Gets the attribute with the given name.
static RequestAttributes getAttributes(HttpServletRequest req)
           
static DbConnectionProvider getConnectionProvider(HttpServletRequest req)
          Gives a provider to get connection to the database
(package private) static Map<Object,Object> getFormRedirectionResponseParameters(HttpServletRequest req)
           
static HttpParameters getParameters(HttpServletRequest req)
           
 Object getRequestController()
           
 String getRequestDatabase()
           
 boolean hasAttribute(String s)
          Checks whether an attribute exists
static HttpParameters makeParameters(HttpServletRequest req, Map<Object,Object> reloadedParams)
           
 void removeAttribute(String s)
          Removes an attribute
static void setAttribute(HttpServletRequest req, String var, Object o)
           
 Object setAttribute(String s, Object o)
          Sets the value of an attribute
(package private) static void setFormRedirectionResponseAttributes(HttpServletRequest req)
           
 Map<String,Object> toMap()
          Computes a Map that holds all Attributes (meaning, session attributes, request attributes and parameters) FIXME should also take into account all the rest (BL, login, ...)
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

PARAMETERS_NAME

public static final String PARAMETERS_NAME
See Also:
Constant Field Values

ATTRIBUTES_NAME

public static final String ATTRIBUTES_NAME
See Also:
Constant Field Values

CONTROLLER_NAME

public static final String CONTROLLER_NAME
See Also:
Constant Field Values

logger

static final Logger logger

request

HttpServletRequest request

controller

Object controller

PROVIDER_ATTRIBUTE

public static final String PROVIDER_ATTRIBUTE
See Also:
Constant Field Values

notFound

public static final Object notFound
Constructor Detail

RequestAttributes

RequestAttributes(HttpServletRequest req)
            throws LogicException
Throws:
LogicException

RequestAttributes

public RequestAttributes(Object controller,
                         HttpServletRequest req,
                         String db)
                  throws LogicException
Throws:
LogicException
Method Detail

getRequestDatabase

public String getRequestDatabase()

getRequestController

public Object getRequestController()

getAttributes

public static RequestAttributes getAttributes(HttpServletRequest req)
                                       throws LogicException
Throws:
LogicException

getFormRedirectionResponseParameters

static Map<Object,Object> getFormRedirectionResponseParameters(HttpServletRequest req)

setFormRedirectionResponseAttributes

static void setFormRedirectionResponseAttributes(HttpServletRequest req)

getConnectionProvider

public static DbConnectionProvider getConnectionProvider(HttpServletRequest req)
Gives a provider to get connection to the database

Parameters:
req - the http request corresponding to the current access
Returns:
A DbConnectionProvider providing the database connection service

getParameters

public static HttpParameters getParameters(HttpServletRequest req)

makeParameters

public static HttpParameters makeParameters(HttpServletRequest req,
                                            Map<Object,Object> reloadedParams)

setAttribute

public static void setAttribute(HttpServletRequest req,
                                String var,
                                Object o)

setAttribute

public Object setAttribute(String s,
                           Object o)
Description copied from interface: Attributes
Sets the value of an attribute

Specified by:
setAttribute in interface Attributes
Parameters:
s - the name of the attribute
o - the value of the attribute
Returns:
the old value of the attribue, or null if there was none
See Also:
Attributes.setAttribute(java.lang.String, java.lang.Object)

removeAttribute

public void removeAttribute(String s)
                     throws LogicException
Description copied from interface: Attributes
Removes an attribute

Specified by:
removeAttribute in interface Attributes
Parameters:
s - the name of the attribute
Throws:
LogicException - if a business logic problem occured while trying to remove the attribute
See Also:
Attributes.removeAttribute(java.lang.String)

hasAttribute

public boolean hasAttribute(String s)
Description copied from interface: Attributes
Checks whether an attribute exists

Specified by:
hasAttribute in interface Attributes
Parameters:
s - the name of the attribute
Returns:
true if the attribute exists, false otherwise.
See Also:
Attributes.hasAttribute(java.lang.String)

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

getAttribute

public Object getAttribute(String s)
                    throws LogicException
Description copied from interface: Attributes
Gets the attribute with the given name.

Specified by:
getAttribute in interface Attributes
Parameters:
s - the name of the attribute
Returns:
the attribute value
Throws:
LogicException - if a business logic problem occured while trying to determine the attribute
AttributeNotFoundException - if there was no error but the attribute could not be found.
See Also:
Attributes.getAttribute(java.lang.String)

checkSessionForAttribute

public Object checkSessionForAttribute(String s)

checkServletLoginForAttribute

public Object checkServletLoginForAttribute(String s)

checkLogicForAttribute

public Object checkLogicForAttribute(String s)
                              throws LogicException
Throws:
LogicException

checkParameterForAttribute

public Object checkParameterForAttribute(String s)

toMap

public Map<String,Object> toMap()
Computes a Map that holds all Attributes (meaning, session attributes, request attributes and parameters) FIXME should also take into account all the rest (BL, login, ...)