org.norther.tammi.spray.template
Class DefaultFormFilter

java.lang.Object
  extended by org.norther.tammi.core.base.Adaptee
      extended by org.norther.tammi.spray.filter.DefaultFilter
          extended by org.norther.tammi.spray.filter.DefaultKeyFilter
              extended by org.norther.tammi.spray.filter.DefaultSecureKeyFilter
                  extended by org.norther.tammi.spray.template.DefaultFormFilter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Filter, Manageable, MBeanDelegate, Refreshable, CacheClient, AccessController, KeyFilter, SecureFilter, SecureKeyFilter, FormFilter

public class DefaultFormFilter
extends DefaultSecureKeyFilter
implements FormFilter

A default implementation of FormFilter.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
protected static String DEFAULT_FORM
          The default form.
protected static String DEFAULT_INFO
          The default info.
protected static String DEFAULT_INPUT
          The default input.
protected static String DEFAULT_OUTPUT
          The default output.
protected static String ENUMERATION
          The enumeration type key.
protected static String ENUMERATIONS
          The enumeration array type key.
static String FORM_KEY
          The form key.
 
Fields inherited from class org.norther.tammi.spray.filter.DefaultKeyFilter
DEFAULT_KEY
 
Fields inherited from class org.norther.tammi.core.base.Adaptee
ADAPTEE_NOTIF_DESCRIPTION, ADAPTEE_NOTIFICATIONS
 
Fields inherited from interface org.norther.tammi.spray.template.FormFilter
FORM_ID_NAME, FORM_INDEX_NAME
 
Fields inherited from interface org.norther.tammi.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultFormFilter()
          Constructs a new filter.
DefaultFormFilter(String key)
          Constructs a new filter with a key.
 
Method Summary
 void clearCached()
          Clears all cached entries without notifying.
 void clearControlAttributes()
          Clears all control attributes.
 void clearFormProperties()
          Clears all form properties.
 void clearFormTemplates()
          Clears all form templates.
 void clearInfoTemplates()
          Clears all info templates.
 void clearInputTemplates()
          Clears all input templates.
 void clearOutputTemplates()
          Clears all output templates.
 void clearParameterMap(ServletRequest request, ServletResponse response, FilterChain chain)
          Clears the parameter map of the specified request.
 void clearParameterMap(String prefix, ServletRequest request, ServletResponse response, FilterChain chain)
          Clears the prefixed parameter map of the specified request.
 Set controlAttributeSet()
          Returns a read-only set of control attribute qualifiers.
 Variable createVariable(String type)
          Creates a new variable instance of the specified type.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
           
 void expireCached(long timestamp)
          Expires all cached entries notifying them about expiration.
 void expireFraction(long timestamp, float fraction)
          Expires the specified fraction of cached entries notifying them about expiration.
 Set formPropertySet()
          Returns a read-only set of form property qualifiers.
 Set formQualifierSet()
          Returns a read-only set of form template qualifiers.
 ConcurrentMap getCache(boolean create)
          Gets and optionally creates the cache.
 String getControlAttribute(String qualifier)
          Gets the qualified control attribute.
 String getCurrentForm(ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the current form of the specified request.
 String getDefaultFormName()
          Gets the theme of the default form.
 String getFormIdName()
          Gets the name of the form id field.
 String getFormIndexName()
          Gets the name of the form index field.
 String getFormProperty(String qualifier)
          Gets the qualified form property.
 String getFormTemplate()
          Gets the default form template.
 String getFormTemplate(String qualifier)
          Gets the qualified form template.
 String getInfoTemplate()
          Gets the default info template.
 String getInfoTemplate(String qualifier)
          Gets the qualified info template.
 String getInputTemplate()
          Gets the default input template.
 String getInputTemplate(String qualifier)
          Gets the qualified input template.
 String getOutputTemplate()
          Gets the default output template.
 String getOutputTemplate(String qualifier)
          Gets the qualified output template.
 Map getParameterMap(ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the parameter map of the specified request.
 Map getParameterMap(String prefix, ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the prefixed parameter map of the specified request.
 Map getParameterMap(Variable variable, String prefix, ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the parameter map of the specified variable.
 long getRefreshed()
          Gets the last refresh timestamp.
 Map getValidationMap(Variable variable, String prefix, ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the validation map of the specified variable.
 ObjectName getVariableRegistryName()
          Gets the the variable registry of this filter.
 Set infoQualifierSet()
          Returns a read-only set of info template qualifiers.
 Set inputQualifierSet()
          Returns a read-only set of input template qualifiers.
 boolean isCachingDisabled()
          Checks whether the caching is disabled.
 boolean isLocalizedForms()
          Gets the localized forms flag.
 boolean isValidated(Variable variable, String prefix, ServletRequest request, ServletResponse response, FilterChain chain)
          Checks whether the specified variable is validated.
 Set outputQualifierSet()
          Returns a read-only set of output template qualifiers.
 void postmanaged()
          This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time.
 void refresh()
          Refreshes the MBean.
 void removeCache()
          Removes the cache.
 void removeControlAttribute(String qualifier)
          Removes the qualified control attribute.
 void removeFormProperty(String qualifier)
          Removes the qualified form property.
 void removeFormTemplate(String qualifier)
          Removes the qualified form template.
 void removeInfoTemplate(String qualifier)
          Removes the qualified info template.
 void removeInputTemplate(String qualifier)
          Removes the qualified input template.
 void removeOutputTemplate(String qualifier)
          Removes the qualified output template.
 void removeVariable(String prefix, Variable variable, ServletRequest request, ServletResponse response, FilterChain chain)
          Removes the specified form variable from a session.
 void render(String name, Variable variable, boolean readonly, ServletRequest request, ServletResponse response, FilterChain chain)
          Renders a form as Variable.
 void render(String name, Variable variable, MBeanAttributeInfo attribute, boolean readonly, ServletRequest request, ServletResponse response, FilterChain chain)
          Renders a control as the specified attribute of Variable.
 void render(String template, Variable variable, MBeanAttributeInfo attribute, ServletRequest request, ServletResponse response, FilterChain chain)
          Renders a control as the specified attribute of Variable using a fixed template.
 void render(String template, Variable variable, ServletRequest request, ServletResponse response, FilterChain chain)
          Renders a form as Variable using a fixed template.
 String resetCurrentForm(ServletRequest request, ServletResponse response, FilterChain chain)
          Resets the current form of the specified request to the default form.
 String resetCurrentForm(String name, ServletRequest request, ServletResponse response, FilterChain chain)
          Resets the current form of the specified request to the named form.
 void resetParameterMap(ServletRequest request, ServletResponse response, FilterChain chain)
          Resets the parameter map of the specified request.
 void resetParameterMap(String prefix, ServletRequest request, ServletResponse response, FilterChain chain)
          Resets the prefixed parameter map of the specified request.
 ConcurrentMap resolve(String name, Variable variable, MBeanAttributeInfo attribute)
          Resolves form properties of the specified attribute of Variable.
 Variable restoreVariable(String prefix, String type, boolean create, ServletRequest request, ServletResponse response, FilterChain chain)
          Restores a saved form variable from a session or optionally creates a missing one.
 void saveVariable(String prefix, Variable variable, ServletRequest request, ServletResponse response, FilterChain chain)
          Saves the specified form variable to a session.
 void setCachingDisabled(boolean flag)
          Sets the caching disabled flag.
 void setControlAttribute(String qualifier, String attribute)
          Sets the qualified control property.
 void setDefaultFormName(String name)
          Sets the theme of the default form.
 void setFormIdName(String name)
          Sets the name of the form id field to post the unique name of the submitted form.
 void setFormIndexName(String name)
          Sets the name of the form index field to post variable indeces of the submitted form.
 void setFormProperty(String qualifier, String property)
          Sets the qualified form property.
 void setFormTemplate(String template)
          Sets the default form template.
 void setFormTemplate(String qualifier, String template)
          Sets the qualified form template.
 void setInfoTemplate(String template)
          Sets the default info template.
 void setInfoTemplate(String qualifier, String template)
          Sets the qualified info template.
 void setInputTemplate(String template)
          Sets the default input template.
 void setInputTemplate(String qualifier, String template)
          Sets the qualified input template.
 void setLocalizedForms(boolean flag)
          Sets the localized forms flag.
 void setOutputTemplate(String template)
          Sets the default output template.
 void setOutputTemplate(String qualifier, String template)
          Sets the qualified output template.
 void setVariableRegistryName(ObjectName registry)
          Sets the variable registry of this filter.
 void unmanaged()
          This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.
 boolean updateForm(Variable variable, String prefix, ServletRequest request, ServletResponse response, FilterChain chain)
          Updates the specified variable with request parameters.
 boolean validateForm(Variable variable, String prefix, ServletRequest request, ServletResponse response, FilterChain chain)
          Validates the specified variable with request parameters.
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultSecureKeyFilter
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, checkPermission, checkPermission, checkPermission, checkPermission, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, getPermissibleRoles, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultKeyFilter
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from class org.norther.tammi.spray.filter.DefaultFilter
destroy, getFilterConfig, getRequestMap, getSessionMap, init
 
Methods inherited from class org.norther.tammi.core.base.Adaptee
addAdaptee, addNotificationListener, getAttributeSupport, getBroker, getCanonicalName, getDomain, getFactory, getLoader, getLog, getLog, getMBean, getMBeanServer, getNotificationInfo, getObjectName, getRegistrationTime, getSequenceNumber, hasListeners, isRegistered, premanaged, removeNotificationListener, removeNotificationListener, sendNotification, sendNotification, sendNotification, sendNotification, unregister
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.norther.tammi.spray.filter.SecureFilter
checkPermission, checkPermission, checkPermission
 
Methods inherited from interface org.norther.tammi.core.security.AccessController
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, checkPermission, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, getPermissibleRoles, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 
Methods inherited from interface javax.servlet.Filter
destroy, init
 
Methods inherited from interface org.norther.tammi.spray.filter.KeyFilter
getKey, getKeyValue, getKeyValues, isLinkedKey, setKey, setLinkedKey
 
Methods inherited from interface javax.servlet.Filter
destroy, init
 

Field Detail

FORM_KEY

public static final String FORM_KEY
The form key.

See Also:
Constant Field Values

DEFAULT_FORM

protected static final String DEFAULT_FORM
The default form.

See Also:
Constant Field Values

DEFAULT_INFO

protected static final String DEFAULT_INFO
The default info.

See Also:
Constant Field Values

DEFAULT_INPUT

protected static final String DEFAULT_INPUT
The default input.

See Also:
Constant Field Values

DEFAULT_OUTPUT

protected static final String DEFAULT_OUTPUT
The default output.

See Also:
Constant Field Values

ENUMERATION

protected static final String ENUMERATION
The enumeration type key.

See Also:
Constant Field Values

ENUMERATIONS

protected static final String ENUMERATIONS
The enumeration array type key.

See Also:
Constant Field Values
Constructor Detail

DefaultFormFilter

public DefaultFormFilter()
Constructs a new filter.


DefaultFormFilter

public DefaultFormFilter(String key)
Constructs a new filter with a key.

Parameters:
key - the filter key.
Method Detail

postmanaged

public void postmanaged()
Description copied from interface: Manageable
This method is called when the implementing adaptee has been managed either during post-registration of the corresponding adapter MBean or just after it is explicitly added to the adapter MBean during run-time.

Specified by:
postmanaged in interface Manageable
Overrides:
postmanaged in class Adaptee

unmanaged

public void unmanaged()
               throws Exception
Description copied from interface: Manageable
This method is called when the implementing adaptee is unmanaged either during pre-deregistration of the corresponding adapter MBean or just before it is explicitly removed from the adapter MBean during run-time.

Specified by:
unmanaged in interface Manageable
Overrides:
unmanaged in class Adaptee
Throws:
Exception - if the adaptee refused to be unmanaged.

isCachingDisabled

public boolean isCachingDisabled()
Description copied from interface: CacheClient
Checks whether the caching is disabled.

Specified by:
isCachingDisabled in interface CacheClient
Returns:
true if the caching is disabled, true otherwise.

setCachingDisabled

public void setCachingDisabled(boolean flag)
Description copied from interface: CacheClient
Sets the caching disabled flag.

Specified by:
setCachingDisabled in interface CacheClient
Parameters:
flag - the caching disabled flag.

expireCached

public void expireCached(long timestamp)
Description copied from interface: CacheClient
Expires all cached entries notifying them about expiration.

Specified by:
expireCached in interface CacheClient
Parameters:
timestamp - the timestamp of the expiration.

expireFraction

public void expireFraction(long timestamp,
                           float fraction)
Description copied from interface: CacheClient
Expires the specified fraction of cached entries notifying them about expiration.

Specified by:
expireFraction in interface CacheClient
Parameters:
timestamp - the timestamp of the expiration.
fraction - the fraction of entries to expire (0.0..1.0).

clearCached

public void clearCached()
Description copied from interface: CacheClient
Clears all cached entries without notifying.

Specified by:
clearCached in interface CacheClient

getCache

public ConcurrentMap getCache(boolean create)
Description copied from interface: CacheClient
Gets and optionally creates the cache.

Specified by:
getCache in interface CacheClient
Parameters:
create - true to create a missing cache.
Returns:
the cache or null if disabled.

removeCache

public void removeCache()
Description copied from interface: CacheClient
Removes the cache.

Specified by:
removeCache in interface CacheClient

refresh

public void refresh()
Description copied from interface: Refreshable
Refreshes the MBean.

Specified by:
refresh in interface Refreshable

getRefreshed

public long getRefreshed()
Description copied from interface: Refreshable
Gets the last refresh timestamp.

Specified by:
getRefreshed in interface Refreshable
Returns:
the timestamp of the last refresh.

isLocalizedForms

public boolean isLocalizedForms()
Description copied from interface: FormFilter
Gets the localized forms flag.

Specified by:
isLocalizedForms in interface FormFilter
Returns:
the localized forms flag.

setLocalizedForms

public void setLocalizedForms(boolean flag)
Description copied from interface: FormFilter
Sets the localized forms flag.

Specified by:
setLocalizedForms in interface FormFilter
Parameters:
flag - the localized forms flag.

getDefaultFormName

public String getDefaultFormName()
Description copied from interface: FormFilter
Gets the theme of the default form.

Specified by:
getDefaultFormName in interface FormFilter
Returns:
the default form.

setDefaultFormName

public void setDefaultFormName(String name)
Description copied from interface: FormFilter
Sets the theme of the default form.

Specified by:
setDefaultFormName in interface FormFilter
Parameters:
name - the default form.

getFormIdName

public String getFormIdName()
Description copied from interface: FormFilter
Gets the name of the form id field.

Specified by:
getFormIdName in interface FormFilter
Returns:
the form id attribute name.

setFormIdName

public void setFormIdName(String name)
Description copied from interface: FormFilter
Sets the name of the form id field to post the unique name of the submitted form.

Specified by:
setFormIdName in interface FormFilter
Parameters:
name - the form id attribute name.

getFormIndexName

public String getFormIndexName()
Description copied from interface: FormFilter
Gets the name of the form index field.

Specified by:
getFormIndexName in interface FormFilter
Returns:
the form index attribute name.

setFormIndexName

public void setFormIndexName(String name)
Description copied from interface: FormFilter
Sets the name of the form index field to post variable indeces of the submitted form.

Specified by:
setFormIndexName in interface FormFilter
Parameters:
name - the form id attribute name.

getFormTemplate

public String getFormTemplate()
Description copied from interface: FormFilter
Gets the default form template.

Specified by:
getFormTemplate in interface FormFilter
Returns:
the default template or null.

setFormTemplate

public void setFormTemplate(String template)
Description copied from interface: FormFilter
Sets the default form template.

Specified by:
setFormTemplate in interface FormFilter
Parameters:
template - the default template.

getInfoTemplate

public String getInfoTemplate()
Description copied from interface: FormFilter
Gets the default info template.

Specified by:
getInfoTemplate in interface FormFilter
Returns:
the default template or null.

setInfoTemplate

public void setInfoTemplate(String template)
Description copied from interface: FormFilter
Sets the default info template.

Specified by:
setInfoTemplate in interface FormFilter
Parameters:
template - the default template.

getInputTemplate

public String getInputTemplate()
Description copied from interface: FormFilter
Gets the default input template.

Specified by:
getInputTemplate in interface FormFilter
Returns:
the default template or null.

setInputTemplate

public void setInputTemplate(String template)
Description copied from interface: FormFilter
Sets the default input template.

Specified by:
setInputTemplate in interface FormFilter
Parameters:
template - the default template.

getOutputTemplate

public String getOutputTemplate()
Description copied from interface: FormFilter
Gets the default output template.

Specified by:
getOutputTemplate in interface FormFilter
Returns:
the default template or null.

setOutputTemplate

public void setOutputTemplate(String template)
Description copied from interface: FormFilter
Sets the default output template.

Specified by:
setOutputTemplate in interface FormFilter
Parameters:
template - the default template.

getFormTemplate

public String getFormTemplate(String qualifier)
Description copied from interface: FormFilter
Gets the qualified form