org.norther.tammi.spray.template
Class DefaultFlowFilter

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.DefaultFlowFilter
All Implemented Interfaces:
Serializable, NotificationBroadcaster, NotificationEmitter, Filter, Manageable, MBeanDelegate, AccessController, KeyFilter, SecureFilter, SecureKeyFilter, FlowFilter

public class DefaultFlowFilter
extends DefaultSecureKeyFilter
implements FlowFilter

A default implementation of FlowFilter.

Author:
Ilkka Priha
See Also:
Serialized Form

Field Summary
static String FLOW_KEY
          The default 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.core.base.MBeanDelegate
ARRAY_TYPE, OBJECT_TYPE, PRIMITIVE_TYPE, STRING_TYPE
 
Constructor Summary
DefaultFlowFilter()
          Constructs a new filter.
DefaultFlowFilter(String key)
          Constructs a new filter with a key.
 
Method Summary
 boolean addFlowName(String name)
          Adds a named flow if absent.
 void addStepName(String name, int index, String step)
          Adds a new step to the named flow.
 void clearContextAttributes()
          Clears all global context attributes.
 void clearFlows()
          Clears all flows.
 void clearSteps(String name)
          Clears all steps from the named flow.
 boolean containsContextAttribute(String name)
          Checks the named global context attribute.
 boolean containsFlow(String name)
          Checks the named flow.
 boolean containsStep(String name, int index)
          Checks the indexed step.
 Map contextAttributeMap()
          Returns a map of global context attributes.
 Variable createVariable(String type)
          Creates a new variable MBean instance of the specified type.
 void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
          Activates a flow.
 boolean executeActions(FlowStep step, StepFlowContext context, ServletRequest request, ServletResponse response, FilterChain chain)
          Executes actions of the specified step in the given flow context.
 Set flowNameSet()
          Returns a read-only set of flow names.
 Object getContextAttribute(String name)
          Gets the named global context attribute.
 StepFlowContext getCurrentContext(ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the step flow context of the specified request.
 String getDefaultActionName()
          Gets the name of the default action applied to flows without a flow specific action.
 String[] getDefaultActionNames()
          Gets the names of the default actions applied to flows without flow specific templates.
 FlowStep getDefaultFlow()
          Gets the default flow.
 String getDefaultFlowName()
          Gets the name of the default flow.
 String getDefaultLabel()
          Gets the default flow label.
 String getDefaultProperty(String property)
          Gets the named default property.
 String getDefaultTemplatePath()
          Gets the path of the default template applied to flows without a flow or specific template.
 String[] getDefaultTemplatePaths()
          Gets the paths of the default templates applied to flows without flow specific templates.
 String getDefaultTransition(String state)
          Gets the default transition of the named state.
 String getDefaultVariableType()
          Gets the type of the default variable applied to flows without a flow specific variable.
 String[] getDefaultVariableTypes()
          Gets the types of the default variables applied to flows without flow specific variables.
 FlowStep getFlow(String name)
          Gets the named flow.
 String getFlowActionName(String name)
          Gets the name of the action applied to the named flow.
 String[] getFlowActionNames(String name)
          Gets the names of the actions applied to the named flow.
 String getFlowLabel(String name)
          Gets the label of the named flow.
 String getFlowName(String path)
          Gets the flow part of the flow step path.
 String[] getFlowNames()
          Gets the names of all flows.
 String getFlowProperty(String name, String property)
          Gets the named property of the named flow.
 String getFlowTemplatePath(String name)
          Gets the pathname of the template applied to the named flow.
 String[] getFlowTemplatePaths(String name)
          Gets the paths of the templates applied to the named flow.
 String getFlowTransition(String name, String state)
          Gets the transition of the named flow.
 String getFlowVariableType(String name)
          Gets the type of the variable applied to the named flow.
 String[] getFlowVariableTypes(String name)
          Gets the types of the variables applied to the named flow.
 int getPropertyIndex(String property)
          Gets the index of the named property within this filter.
 int getPropertyIndex(String property, boolean add)
          Gets and optionally adds the index of the named property within this filter.
 StepMatrix getRouteMatrix(String name)
          Gets the matrix defining enabled routes for flow steps.
 int getStateIndex(String state)
          Gets the index of the named state within this filter.
 int getStateIndex(String state, boolean add)
          Gets and optionally adds the index of the named state within this filter.
 int getStepCount(String name)
          Gets the number of steps in the named flow.
 int getStepIndex(String path, int index)
          Gets the index part of the flow step path.
 String getStepName(String name)
          Gets the name of the step of the named flow or step.
 String getStepName(String name, int index)
          Gets the name of the step of the named flow.
 String[] getStepNames(String name)
          Gets the step names of the named flow.
 String getStepPath(String name, int index)
          Gets the path to the indexed step of the named flow.
 ObjectName getTaskLoaderName()
          Gets the the task loader to be applied by contexts of this filter.
 ObjectName getVariableRegistryName()
          Gets the the variable registry to be applied by contexts of this filter.
 int indexOfStep(String name, String step)
          Return the index of the named step of the named flow.
 boolean isDefaultState(String state)
          Checks whether the named state is set by default.
 boolean isFlowState(String name, String state)
          Checks whether the named state is set for the named flow.
 boolean isRestrictedRoutes()
          Checks whether step routes of flows of this filter are restricted by a route matrix.
 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.
 List propertyNameList()
          Returns a read-only list of names of known properties within this filter.
 void removeContextAttribute(String name)
          Removes the named global context attribute.
 void removeFlow(String name)
          Removes the named flow.
 void removeStep(String name, int index)
          Removes the indexed step from the named flow.
 void setContextAttribute(String name, Object value)
          Sets the named global context attribute.
 void setDefaultActionName(String task)
          Sets the name of the default action applied to to flows without a flow specific action.
 void setDefaultActionNames(String[] tasks)
          Sets the names of the default actions applied to flows without flow specific templates.
 void setDefaultFlowName(String name)
          Sets the name of the default flow.
 void setDefaultLabel(String label)
          Sets the label of the named flow.
 void setDefaultProperties(String[] properties)
          Sets the named default properties as consecutive pairs of names and values.
 void setDefaultProperty(String property, String value)
          Sets the named default property.
 void setDefaultState(String state, boolean flag)
          Sets whether the named state is set by default.
 void setDefaultStates(String[] states)
          Sets the named states on by default.
 void setDefaultTemplatePath(String template)
          Sets the path of the default template applied to flows without a flow specific template.
 void setDefaultTemplatePaths(String[] templates)
          Sets the paths of the default templates applied to flows without flow specific templates.
 void setDefaultTransition(String state, String value)
          Sets the default transition of the named state.
 void setDefaultTransitions(String[] transitions)
          Sets the default transitions as consecutive pairs of states and values.
 void setDefaultVariableType(String type)
          Sets the type of the default variable applied to flows without a flow specific variable.
 void setDefaultVariableTypes(String[] types)
          Sets the types of the default variables applied to flows without flow specific variables.
 void setFlowActionName(String name, String task)
          Sets the name of the action applied to the named flow.
 void setFlowActionNames(String name, String[] tasks)
          Sets the names of the actions applied to the named flow.
 void setFlowLabel(String name, String label)
          Sets the label of the named flow.
 void setFlowName(String name)
          Sets or replaces a named flow if absent.
 void setFlowNames(String[] names)
          Sets the names of absent flows.
 void setFlowProperties(String name, String[] properties)
          Sets the named properties of the named flow as consecutive pairs of names and values.
 void setFlowProperty(String name, String property, String value)
          Sets the named property of the named flow.
 void setFlowState(String name, String state, boolean flag)
          Sets whether the named state is set for the named flow.
 void setFlowStates(String name, String[] states)
          Sets the named states of the named flow.
 void setFlowTemplatePath(String name, String template)
          Sets the path of the template applied to the named flow.
 void setFlowTemplatePaths(String name, String[] templates)
          Sets the paths of the templates applied to the named flow.
 void setFlowTransition(String name, String state, String flow)
          Sets the transition of the named flow.
 void setFlowTransitions(String name, String[] transitions)
          Sets the transitions of the named flow as consecutive pairs of states and values.
 void setFlowVariableType(String name, String type)
          Sets the type of the variable applied to the named flow.
 void setFlowVariableTypes(String name, String[] types)
          Sets the types of the variables applied to the named flow.
 void setRestrictedRoutes(boolean flag)
          Sets whether step routes of flows of this filter are restricted by a route matrix.
 void setRouteArray(String name, String array)
          Sets the matrix defining enabled routes for flow steps as a string.
 void setRouteMatrix(String name, StepMatrix matrix)
          Sets the matrix defining enabled routes for flow steps.
 void setRoutesEnabled(String name, boolean flag)
          Sets the matrix defining enabled routes for flow steps as a boolean.
 void setStepName(String name, int index, String step)
          Sets the name of the step of the named flow.
 void setStepName(String name, String step)
          Sets the name of the step applied of the named flow or step.
 void setStepNames(String name, String[] steps)
          Sets the step names of the named flow.
 void setTaskLoaderName(ObjectName loader)
          Sets the task loader to be applied by contexts of this filter.
 void setVariableRegistryName(ObjectName registry)
          Sets the variable registry to be applied by contexts this filter.
 List stateNameList()
          Returns a read-only list of names of known states within 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.
 
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

FLOW_KEY

public static final String FLOW_KEY
The default key.

See Also:
Constant Field Values
Constructor Detail

DefaultFlowFilter

public DefaultFlowFilter()
Constructs a new filter.


DefaultFlowFilter

public DefaultFlowFilter(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.

getFlowName

public String getFlowName(String path)
Description copied from interface: FlowFilter
Gets the flow part of the flow step path.

Specified by:
getFlowName in interface FlowFilter
Parameters:
path - the flow step path.
Returns:
the flow name without a step index.

getStepIndex

public int getStepIndex(String path,
                        int index)
Description copied from interface: FlowFilter
Gets the index part of the flow step path.

Specified by:
getStepIndex in interface FlowFilter
Parameters:
path - the flow step path.
index - the default index.
Returns:
the defined index or the default one if not included.

getStepPath

public String getStepPath(String name,
                          int index)
Description copied from interface: FlowFilter
Gets the path to the indexed step of the named flow.

Specified by:
getStepPath in interface FlowFilter
Parameters:
name - the flow step name.
index - the step index.
Returns:
the path to the specified step.

getDefaultFlowName

public String getDefaultFlowName()
Description copied from interface: FlowFilter
Gets the name of the default flow.

Specified by:
getDefaultFlowName in interface FlowFilter
Returns:
the name of the flow or null.

setDefaultFlowName

public void setDefaultFlowName(String name)
Description copied from interface: FlowFilter
Sets the name of the default flow.

Specified by:
setDefaultFlowName in interface FlowFilter
Parameters:
name - the name of the flow.

getDefaultFlow

public FlowStep getDefaultFlow()
Description copied from interface: FlowFilter
Gets the default flow.

Specified by:
getDefaultFlow in interface FlowFilter
Returns:
the read-only default flow.

getDefaultLabel

public String getDefaultLabel()
Description copied from interface: FlowFilter
Gets the default flow label.

Specified by:
getDefaultLabel in interface FlowFilter
Returns:
the label of the flow or null.

setDefaultLabel

public void setDefaultLabel(String label)
Description copied from interface: FlowFilter
Sets the label of the named flow.

Specified by:
setDefaultLabel in interface FlowFilter
Parameters:
label - the label of the flow.

getDefaultTemplatePath

public String getDefaultTemplatePath()
Description copied from interface: FlowFilter
Gets the path of the default template applied to flows without a flow or specific template.

Note that if several templates are defined, the first one is returned.

Specified by:
getDefaultTemplatePath in interface FlowFilter
Returns:
the path of the template or null.

setDefaultTemplatePath

public void setDefaultTemplatePath(String template)
Description copied from interface: FlowFilter
Sets the path of the default template applied to flows without a flow specific template.

Note that all previously defined templates are replaced with the new one.

Specified by:
setDefaultTemplatePath in interface FlowFilter
Parameters:
template - the path of the template.

getDefaultTemplatePaths

public String[] getDefaultTemplatePaths()
Description copied from interface: FlowFilter
Gets the paths of the default templates applied to flows without flow specific templates.

Specified by:
getDefaultTemplatePaths in interface FlowFilter
Returns:
the paths of the templates or null.

setDefaultTemplatePaths

public void setDefaultTemplatePaths(String[] templates)
Description copied from interface: FlowFilter
Sets the paths of the default templates applied to flows without flow specific templates. New templates are added after existing ones.

Specified by:
setDefaultTemplatePaths in interface FlowFilter
Parameters:
templates - the paths of the templates.

getDefaultVariableType

public String getDefaultVariableType()
Description copied from interface: FlowFilter
Gets the type of the default variable applied to flows without a flow specific variable.

Note that if several variables are defined, the first one is returned.

Specified by:
getDefaultVariableType in interface FlowFilter
Returns:
the type of the variable or null.

setDefaultVariableType

public void setDefaultVariableType(String type)
Description copied from interface: FlowFilter
Sets the type of the default variable applied to flows without a flow specific variable.

Note that all previously defined variables are replaced with the new one.

Specified by:
setDefaultVariableType in interface FlowFilter
Parameters:
type - the type of the variable.

getDefaultVariableTypes

public String[] getDefaultVariableTypes()
Description copied from interface: FlowFilter
Gets the types of the default variables applied to flows without flow specific variables.

Specified by:
getDefaultVariableTypes in interface FlowFilter
Returns:
the types of the variables or null.

setDefaultVariableTypes

public void setDefaultVariableTypes(String[] types)
Description copied from interface: FlowFilter
Sets the types of the default variables applied to flows without flow specific variables. New variables are added after existing ones.

Specified by:
setDefaultVariableTypes in interface FlowFilter
Parameters:
types - the types of the variables.

getDefaultActionName

public String getDefaultActionName()
Description copied from interface: FlowFilter
Gets the name of the default action applied to flows without a flow specific action.

Note that if several actions are defined, the first one is returned.

Specified by:
getDefaultActionName in interface FlowFilter
Returns:
the name of the action or null.

setDefaultActionName

public void setDefaultActionName(String task)
Description copied from interface: FlowFilter
Sets the name of the default action applied to to flows without a flow specific action.

Note that all previously defined actions are replaced with the new one.

Specified by:
setDefaultActionName in interface FlowFilter
Parameters:
task - the name of the action.

getDefaultActionNames

public String[] getDefaultActionNames()
Description copied from interface: FlowFilter
Gets the names of the default actions applied to flows without flow specific templates.

Specified by:
getDefaultActionNames in interface FlowFilter
Returns:
the names of the actions or null.

setDefaultActionNames

public void setDefaultActionNames(String[] tasks)
Description copied from interface: FlowFilter
Sets the names of the default actions applied to flows without flow specific templates. New actions are added after existing ones.

Specified by:
setDefaultActionNames in interface FlowFilter
Parameters:
tasks - the names of the actions.

isDefaultState

public boolean isDefaultState(String state)
Description copied from interface: FlowFilter
Checks whether the named state is set by default.

Specified by:
isDefaultState in interface FlowFilter
Parameters:
state - the name of the state.
Returns:
true if the state is on, false otherwise.

setDefaultState

public void setDefaultState(String state,
                            boolean flag)
Description copied from interface: FlowFilter
Sets whether the named state is set by default.

Specified by:
setDefaultState in interface FlowFilter
Parameters:
state - the name of the state.
flag - true if the state is on, false otherwise.

setDefaultStates

public void setDefaultStates(String[] states)
Description copied from interface: FlowFilter
Sets the named states on by default.

Specified by:
setDefaultStates in interface FlowFilter
Parameters:
states - the names of the states.

getStateIndex

public int getStateIndex(String state)
Description copied from interface: FlowFilter
Gets the index of the named state within this filter.

Specified by:
getStateIndex in interface FlowFilter
Parameters:
state - the name of the state.
Returns:
the index of the state or -1.

getStateIndex

public int getStateIndex(String state,
                         boolean add)
Description copied from interface: FlowFilter
Gets and optionally adds the index of the named state within this filter.

Specified by:
getStateIndex in interface FlowFilter
Parameters:
state - the name of the state.
add - true to add a missing state.
Returns:
the index of the state or -1.

stateNameList

public Lis