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.

Version:
$Id: DefaultFlowFilter.java,v 1.50 2010-08-17 13:35:27 cvsimp Exp $
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
 
Constructor Summary
DefaultFlowFilter()
          Constructs a new filter.
DefaultFlowFilter(String key)
          Constructs a new filter with a key.
 
Method Summary
 void addDefaultActionNames(String[] tasks)
          Adds more names of the default actions applied to flows without flow specific templates.
 void addDefaultTemplatePaths(String[] templates)
          Adds more paths of the default templates applied to flows without flow specific templates.
 void addDefaultVariableTypes(String[] types)
          Adds more types of the default variables applied to flows without flow specific variables.
 void addFlowActionNames(String name, String[] tasks)
          Adds more names of the actions applied to the named flow.
 boolean addFlowName(String name)
          Adds a named flow if absent.
 void addFlowNames(String[] names)
          Adds named flows if absent.
 void addFlowTemplatePaths(String name, String[] templates)
          Adds more paths of the templates applied to the named flow.
 void addFlowVariableTypes(String name, String[] types)
          Adds more types of the variables applied to the named flow.
 void addStepName(String name, int index, String step)
          Adds a new step to the named flow.
 void addStepNames(String name, String[] steps)
          Adds more step names to the named flow.
 void clearContextAttributes()
          Clears all global context attributes.
 void clearFlowActions(String name)
          Clears the actions applied to the named flow.
 void clearFlows()
          Clears all flows.
 void clearFlowTemplates(String name)
          Clears the templates applied to the named flow.
 void clearFlowVariables(String name)
          Clears the variables applied to the named flow.
 void clearSteps(String name)
          Clears all steps from the named flow.
 boolean containsContextAttribute(Object key)
          Checks the named global context attribute.
 boolean containsFlow(String name)
          Checks the named flow.
 boolean containsStep(String name, int index)
          Checks the indexed step.
 Set<Object> contextAttributeKeySet()
          Returns a set of global context attribute keys.
 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.
 Task.Control executeActions(FlowStep step, StepFlowContext context, ServletRequest request, ServletResponse response, FilterChain chain)
          Executes actions of the specified step in the given flow context.
 Set<String> flowNameSet()
          Returns a read-only set of flow names.
 Object getContextAttribute(Object key)
          Gets a global context attribute.
 StepFlowContext getCurrentContext(ServletRequest request, ServletResponse response, FilterChain chain)
          Gets the step flow context of the specified request.
 String[] getDefaultActionNames()
          Gets the names of the default actions applied to flows without flow specific templates.
 String getDefaultBaseName()
          Gets the default base name.
 String getDefaultFlowName()
          Gets the name of the default flow.
 Identity getDefaultIdentity()
          Gets the default identity.
 String getDefaultLabel()
          Gets the default flow label.
 Object getDefaultProperty(Object property)
          Gets the specified default property.
 String[] getDefaultTemplatePaths()
          Gets the paths of the default templates applied to flows without flow specific templates.
 Object getDefaultTransition(Object state)
          Gets the default transition of the specified state.
 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[] getFlowActionNames(String name)
          Gets the names of the actions applied to the named flow.
 String getFlowBaseName(String name)
          Gets the base name of the specified flow.
 FlowStep getFlowDefault()
          Gets the flow default.
 Identity getFlowIdentity(String name)
          Gets the identity of the specified flow.
 String getFlowLabel(String name)
          Gets the label of the named flow.
 String getFlowName(String path)
          Gets the flow name of the flow step path.
 String[] getFlowParameters(String path)
          Gets the flow parameters of the flow step path.
 String getFlowPath(String path)
          Gets the flow path of the flow step path.
 Object getFlowProperty(String name, Object property)
          Gets the specified property of the named flow.
 String[] getFlowTemplatePaths(String name)
          Gets the paths of the templates applied to the named flow.
 Object getFlowTransition(String name, Object state)
          Gets the transition of the named flow.
 String[] getFlowVariableTypes(String name)
          Gets the types of the variables applied to the named flow.
 int getPropertyIndex(Object property)
          Gets the index of the property within this filter.
 int getPropertyIndex(Object property, boolean add)
          Gets and optionally adds the index of the property within this filter.
 StepMatrix getRouteMatrix(String name)
          Gets the matrix defining enabled routes for flow steps.
 int getStateIndex(Object state)
          Gets the index of the state within this filter.
 int getStateIndex(Object state, boolean add)
          Gets and optionally adds the index of the 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 first index of the flow step path.
 int[] getStepIndices(String path)
          Gets the indices of the flow step path.
 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, Object... params)
          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.
 int getTransitionIndex(Object state)
          Gets the index of the transition within this filter.
 int getTransitionIndex(Object state, boolean add)
          Gets and optionally adds the index of the transition within 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 isDefaultHeritable()
          Checks whether flows are heritable by default.
 boolean isDefaultState(Object state)
          Checks whether the specified state is set by default.
 boolean isFlowHeritable(String name)
          Checks whether the named flow is heritable.
 boolean isFlowLocalized(String name)
          Checks whether the specified flow is localized.
 boolean isFlowState(String name, Object state)
          Checks whether the specified state is set for the named flow.
 boolean isLocalizedFlows()
          Gets the localized flows flag.
 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.
 void removeContextAttribute(Object key)
          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(Object key, Object value)
          Sets a global context attribute.
 void setDefaultActionNames(String[] tasks)
          Sets the names of the default actions applied to flows without flow specific templates.
 void setDefaultBaseName(String baseName)
          Sets the default base name.
 void setDefaultFlowName(String name)
          Sets the name of the default flow.
 void setDefaultHeritable(boolean flag)
          Sets whether flows are heritable by default.
 void setDefaultIdentity(Identity identity)
          Sets the default identity.
 void setDefaultLabel(String label)
          Sets the default flow label.
 void setDefaultProperties(Object[] properties)
          Sets the specified default properties as consecutive pairs of properties and values.
 void setDefaultProperty(Object property, Object value)
          Sets the specified default property.
 void setDefaultState(Object state, boolean flag)
          Sets whether the specified state is set by default.
 void setDefaultStates(Object[] states)
          Sets the specified states on by default.
 void setDefaultTemplatePaths(String[] templates)
          Sets the paths of the default templates applied to flows without flow specific templates.
 void setDefaultTransition(Object state, Object value)
          Sets the default transition of the specified state.
 void setDefaultTransitions(Object[] transitions)
          Sets the default transitions as consecutive pairs of states and values.
 void setDefaultVariableTypes(String[] types)
          Sets the types of the default variables applied to flows without flow specific variables.
 void setFlowActionNames(String name, String[] tasks)
          Sets the names of the actions applied to the named flow.
 void setFlowBaseName(String name, String baseName)
          Sets the base name of the specified flow.
 void setFlowHeritable(String name, boolean flag)
          Sets whether the named flow is heritable.
 void setFlowIdentity(String name, Identity identity)
          Sets the identity of the specified flow.
 void setFlowLabel(String name, String label)
          Sets the label of the named flow.
 void setFlowLocalized(String name, boolean flag)
          Sets whether the specified flow is localized.
 void setFlowName(String name)
          Sets or replaces a named flow.
 void setFlowNames(String[] names)
          Sets or replaces named flows.
 void setFlowProperties(String name, Object[] properties)
          Sets the specified properties of the named flow as consecutive pairs of properties and values.
 void setFlowProperty(String name, Object property, Object value)
          Sets the specified property of the named flow.
 void setFlowState(String name, Object state, boolean flag)
          Sets whether the specified state is set for the named flow.
 void setFlowStates(String name, Object[] states)
          Sets the specified states of the named flow.
 void setFlowTemplatePaths(String name, String[] templates)
          Sets the paths of the templates applied to the named flow.
 void setFlowTransition(String name, Object state, Object value)
          Sets the transition of the named flow.
 void setFlowTransitions(String name, Object[] transitions)
          Sets the transitions of the named flow as consecutive pairs of states and values.
 void setFlowVariableTypes(String name, String[] types)
          Sets the types of the variables applied to the named flow.
 void setLocalizedFlows(boolean flag)
          Sets the localized flows flag.
 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 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.
 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, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, 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
 
Methods inherited from interface org.norther.tammi.core.security.AccessController
addAllowedPermission, addDeniedPermission, allowedPermissions, allowedRoleSet, checkPermission, clearAllowedPermissions, clearDeniedPermissions, deniedPermissions, deniedRoleSet, getPermissibleRoles, isProtected, removeAllowedPermissions, removeDeniedPermissions, setAllowedPermissions, setDeniedPermissions
 
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 name 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 and parameters.

getFlowPath

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

Specified by:
getFlowPath in interface FlowFilter
Parameters:
path - the flow step path.
Returns:
the flow path without a step index and parameters.

getStepIndices

public int[] getStepIndices(String path)
Description copied from interface: FlowFilter
Gets the indices of the flow step path.

Specified by:
getStepIndices in interface FlowFilter
Parameters:
path - the flow step path.
Returns:
the defined indices or null if not included.

getStepIndex

public int getStepIndex(String path,
                        int index)
Description copied from interface: FlowFilter
Gets the first index 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.

getFlowParameters

public String[] getFlowParameters(String path)
Description copied from interface: FlowFilter
Gets the flow parameters of the flow step path.

Specified by:
getFlowParameters in interface FlowFilter
Parameters:
path - the flow step path.
Returns:
the flow parameters or null if not included.

getStepPath

public String getStepPath(String name,
                          int index,
                          Object... params)
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.
params - optional parameters.
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.

getFlowDefault

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

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

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 default flow label.

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

isLocalizedFlows

public boolean isLocalizedFlows()
Description copied from interface: FlowFilter
Gets the localized flows flag.

Specified by:
isLocalizedFlows in interface FlowFilter
Returns:
the localized flows flag.

setLocalizedFlows

public void setLocalizedFlows(boolean flag)
Description copied from interface: FlowFilter
Sets the localized flows flag.

Specified by:
setLocalizedFlows in interface FlowFilter
Parameters:
flag - the localized flows flag.

getDefaultBaseName

public String getDefaultBaseName()
Description copied from interface: FlowFilter
Gets the default base name.

Specified by:
getDefaultBaseName in interface FlowFilter
Returns:
the base name of the default bundle or null.

setDefaultBaseName

public void setDefaultBaseName(String baseName)
Description copied from interface: FlowFilter
Sets the default base name.

Specified by:
setDefaultBaseName in interface FlowFilter
Parameters:
baseName - the base name of the default bundle.

getDefaultIdentity

public Identity getDefaultIdentity()
Description copied from interface: FlowFilter
Gets the default identity.

Specified by:
getDefaultIdentity in interface FlowFilter
Returns:
the default identity or null.

setDefaultIdentity

public void setDefaultIdentity(Identity identity)
Description copied from interface: FlowFilter
Sets the default identity.

Specified by:
setDefaultIdentity in interface FlowFilter
Parameters:
identity - the default identity.

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 replace existing ones.

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

addDefaultTemplatePaths

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

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

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 replace existing ones.

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

addDefaultVariableTypes

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

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

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 replace existing ones.

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

addDefaultActionNames

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

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

isDefaultHeritable

public boolean isDefaultHeritable()
Description copied from interface: FlowFilter
Checks whether flows are heritable by default.

Specified by:
isDefaultHeritable in interface FlowFilter
Returns:
true if heritable, false otherwise.

setDefaultHeritable

public void setDefaultHeritable(boolean flag)
Description copied from interface: FlowFilter
Sets whether flows are heritable by default.

Specified by:
setDefaultHeritable in interface FlowFilter
Parameters:
flag - true if heritable, false otherwise.

isDefaultState

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

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

setDefaultState

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

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

setDefaultStates

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

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

getStateIndex

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

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

getStateIndex

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

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

getDefaultProperty

public Object getDefaultProperty(Object property)
Description copied from interface: FlowFilter
Gets the specified default property.

Specified by:
getDefaultProperty in interface FlowFilter
Parameters:
property - the property.
Returns:
the value of the property or null.

setDefaultProperty

public void setDefaultProperty(Object property,
                               Object value)
Description copied from interface: FlowFilter
Sets the specified default property.

Specified by:
setDefaultProperty in interface FlowFilter
Parameters:
property - the property.
value - the value of the property.

setDefaultProperties

public void setDefaultProperties(Object[] properties)
Description copied from interface: FlowFilter
Sets the specified default properties as consecutive pairs of properties and values.

Specified by:
setDefaultProperties in interface FlowFilter
Parameters:
properties - the properties and values.

getPropertyIndex

public int getPropertyIndex(Object property)
Description copied from interface: FlowFilter
Gets the index of the property within this filter.

Specified by:
getPropertyIndex in interface FlowFilter
Parameters:
property - the property.
Returns:
the index of the property or -1.

getPropertyIndex

public int getPropertyIndex(Object property,
                            boolean add)
Description copied from interface: FlowFilter
Gets and optionally adds the index of the property within this filter.

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

getDefaultTransition

public Object getDefaultTransition(Object state)
Description copied from interface: FlowFilter
Gets the default transition of the specified state.

Specified by:
getDefaultTransition in interface FlowFilter
Parameters:
state - the state.
Returns:
the value of the transition or null.

setDefaultTransition

public void setDefaultTransition(Object state,
                                 Object value)
Description copied from interface: FlowFilter
Sets the default transition of the specified state.

Specified by:
setDefaultTransition in interface FlowFilter
Parameters:
state - the state.
value - the value of the transition.

setDefaultTransitions

public void setDefaultTransitions(Object[] transitions)
Description copied from interface: FlowFilter
Sets the default transitions as consecutive pairs of states and values.

Specified by:
setDefaultTransitions in interface FlowFilter
Parameters:
transitions - the states and values of the transitions.

getTransitionIndex

public int getTransitionIndex(Object state)
Description copied from interface: FlowFilter
Gets the index of the transition within this filter.

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

getTransitionIndex

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

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

isRestrictedRoutes

public boolean isRestrictedRoutes()
Description copied from interface: FlowFilter
Checks whether step routes of flows of this filter are restricted by a route matrix.

Specified by:
isRestrictedRoutes in interface FlowFilter
Returns:
true if restricted, false otherwise.

setRestrictedRoutes

public void setRestrictedRoutes(boolean flag)
Description copied from interface: FlowFilter
Sets whether step routes of flows of this filter are restricted by a route matrix.

Specified by:
setRestrictedRoutes in interface FlowFilter
Parameters:
flag - true if restricted, false otherwise.

getFlow

public FlowStep getFlow(String name)
Description copied from interface: FlowFilter
Gets the named flow.

Specified by:
getFlow in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
a clone of the named flow or null.

containsFlow

public boolean containsFlow(String name)
Description copied from interface: FlowFilter
Checks the named flow.

Specified by:
containsFlow in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
true if the flow exists, false otherwise.

removeFlow

public void removeFlow(String name)
Description copied from interface: FlowFilter
Removes the named flow.

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

clearFlows

public void clearFlows()
Description copied from interface: FlowFilter
Clears all flows.

Specified by:
clearFlows in interface FlowFilter

setFlowName

public void setFlowName(String name)
Description copied from interface: FlowFilter
Sets or replaces a named flow.

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

addFlowName

public boolean addFlowName(String name)
Description copied from interface: FlowFilter
Adds a named flow if absent.

Specified by:
addFlowName in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
true id added, false otherwise.

setFlowNames

public void setFlowNames(String[] names)
Description copied from interface: FlowFilter
Sets or replaces named flows.

Specified by:
setFlowNames in interface FlowFilter
Parameters:
names - the names of the flows.

addFlowNames

public void addFlowNames(String[] names)
Description copied from interface: FlowFilter
Adds named flows if absent.

Specified by:
addFlowNames in interface FlowFilter
Parameters:
names - the names of the flows.

flowNameSet

public Set<String> flowNameSet()
Description copied from interface: FlowFilter
Returns a read-only set of flow names.

Specified by:
flowNameSet in interface FlowFilter
Returns:
a set of flow names.

containsStep

public boolean containsStep(String name,
                            int index)
Description copied from interface: FlowFilter
Checks the indexed step.

Specified by:
containsStep in interface FlowFilter
Parameters:
name - the name of the flow.
index - the index of the step.
Returns:
true if the step exists, false otherwise.

indexOfStep

public int indexOfStep(String name,
                       String step)
Description copied from interface: FlowFilter
Return the index of the named step of the named flow.

Specified by:
indexOfStep in interface FlowFilter
Parameters:
name - the name of the flow.
step - the name of the step.
Returns:
the index of the step or -1 if not found.

removeStep

public void removeStep(String name,
                       int index)
Description copied from interface: FlowFilter
Removes the indexed step from the named flow.

Specified by:
removeStep in interface FlowFilter
Parameters:
name - the name of the flow.
index - the index of the step.

clearSteps

public void clearSteps(String name)
Description copied from interface: FlowFilter
Clears all steps from the named flow.

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

getStepName

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

Specified by:
getStepName in interface FlowFilter
Parameters:
name - the name of the flow.
index - the index of the step.
Returns:
the name of the step or null.

setStepName

public void setStepName(String name,
                        int index,
                        String step)
Description copied from interface: FlowFilter
Sets the name of the step of the named flow.

Specified by:
setStepName in interface FlowFilter
Parameters:
name - the name of the flow.
index - the index of the step.
step - the name of the step.

addStepName

public void addStepName(String name,
                        int index,
                        String step)
Description copied from interface: FlowFilter
Adds a new step to the named flow.

Specified by:
addStepName in interface FlowFilter
Parameters:
name - the name of the flow.
index - the index of the step.
step - the name of the step.

getStepNames

public String[] getStepNames(String name)
Description copied from interface: FlowFilter
Gets the step names of the named flow.

Specified by:
getStepNames in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
an array of step names or null.

setStepNames

public void setStepNames(String name,
                         String[] steps)
Description copied from interface: FlowFilter
Sets the step names of the named flow.

Specified by:
setStepNames in interface FlowFilter
Parameters:
name - the name of the flow.
steps - an array of step names.

addStepNames

public void addStepNames(String name,
                         String[] steps)
Description copied from interface: FlowFilter
Adds more step names to the named flow.

Specified by:
addStepNames in interface FlowFilter
Parameters:
name - the name of the flow.
steps - an array of step names.

getStepCount

public int getStepCount(String name)
Description copied from interface: FlowFilter
Gets the number of steps in the named flow.

Specified by:
getStepCount in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
the number of steps.

getRouteMatrix

public StepMatrix getRouteMatrix(String name)
Description copied from interface: FlowFilter
Gets the matrix defining enabled routes for flow steps. The size of the matrix is (n+1)*(n+1) where n is the step count.

Specified by:
getRouteMatrix in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
the step matrix or null.

setRouteMatrix

public void setRouteMatrix(String name,
                           StepMatrix matrix)
Description copied from interface: FlowFilter
Sets the matrix defining enabled routes for flow steps. The size of the matrix is (n+1)*(n+1) where n is the step count.

Specified by:
setRouteMatrix in interface FlowFilter
Parameters:
name - the name of the flow.
matrix - the step matrix.

setRouteArray

public void setRouteArray(String name,
                          String array)
Description copied from interface: FlowFilter
Sets the matrix defining enabled routes for flow steps as a string. Whitespaces are stripped, chars 0, '0' and '-' are considered as disabled routes, all other chars as enabled routes.

Specified by:
setRouteArray in interface FlowFilter
Parameters:
name - the name of the flow.
array - a string of size (n+1)*(n+1) where n is the step count.

setRoutesEnabled

public void setRoutesEnabled(String name,
                             boolean flag)
Description copied from interface: FlowFilter
Sets the matrix defining enabled routes for flow steps as a boolean. True enables all routes and false disables them.

Specified by:
setRoutesEnabled in interface FlowFilter
Parameters:
name - the name of the flow.
flag - true to enable routes, false to disable.

getFlowLabel

public String getFlowLabel(String name)
Description copied from interface: FlowFilter
Gets the label of the named flow.

Specified by:
getFlowLabel in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
the label of the flow or null.

setFlowLabel

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

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

isFlowLocalized

public boolean isFlowLocalized(String name)
Description copied from interface: FlowFilter
Checks whether the specified flow is localized.

Specified by:
isFlowLocalized in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
the true if localized, false otherwise.

setFlowLocalized

public void setFlowLocalized(String name,
                             boolean flag)
Description copied from interface: FlowFilter
Sets whether the specified flow is localized.

Specified by:
setFlowLocalized in interface FlowFilter
Parameters:
name - the name of the flow.
flag - the true if localized, false otherwise.

getFlowBaseName

public String getFlowBaseName(String name)
Description copied from interface: FlowFilter
Gets the base name of the specified flow.

Specified by:
getFlowBaseName in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
the base name or null.

setFlowBaseName

public void setFlowBaseName(String name,
                            String baseName)
Description copied from interface: FlowFilter
Sets the base name of the specified flow.

Specified by:
setFlowBaseName in interface FlowFilter
Parameters:
name - the name of the flow.
baseName - the base name.

getFlowIdentity

public Identity getFlowIdentity(String name)
Description copied from interface: FlowFilter
Gets the identity of the specified flow.

Specified by:
getFlowIdentity in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
the flow identity or null.

setFlowIdentity

public void setFlowIdentity(String name,
                            Identity identity)
Description copied from interface: FlowFilter
Sets the identity of the specified flow.

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

getFlowTemplatePaths

public String[] getFlowTemplatePaths(String name)
Description copied from interface: FlowFilter
Gets the paths of the templates applied to the named flow.

Specified by:
getFlowTemplatePaths in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
the paths of the templates or null.

setFlowTemplatePaths

public void setFlowTemplatePaths(String name,
                                 String[] templates)
Description copied from interface: FlowFilter
Sets the paths of the templates applied to the named flow.

Specified by:
setFlowTemplatePaths in interface FlowFilter
Parameters:
name - the name of the flow.
templates - the paths of the templates.

addFlowTemplatePaths

public void addFlowTemplatePaths(String name,
                                 String[] templates)
Description copied from interface: FlowFilter
Adds more paths of the templates applied to the named flow.

Specified by:
addFlowTemplatePaths in interface FlowFilter
Parameters:
name - the name of the flow.
templates - the paths of the templates.

clearFlowTemplates

public void clearFlowTemplates(String name)
Description copied from interface: FlowFilter
Clears the templates applied to the named flow.

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

getFlowVariableTypes

public String[] getFlowVariableTypes(String name)
Description copied from interface: FlowFilter
Gets the types of the variables applied to the named flow.

Specified by:
getFlowVariableTypes in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
the types of the variables or null.

setFlowVariableTypes

public void setFlowVariableTypes(String name,
                                 String[] types)
Description copied from interface: FlowFilter
Sets the types of the variables applied to the named flow.

Specified by:
setFlowVariableTypes in interface FlowFilter
Parameters:
name - the name of the flow.
types - the types of the variables.

addFlowVariableTypes

public void addFlowVariableTypes(String name,
                                 String[] types)
Description copied from interface: FlowFilter
Adds more types of the variables applied to the named flow.

Specified by:
addFlowVariableTypes in interface FlowFilter
Parameters:
name - the name of the flow.
types - the types of the variables.

clearFlowVariables

public void clearFlowVariables(String name)
Description copied from interface: FlowFilter
Clears the variables applied to the named flow.

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

getFlowActionNames

public String[] getFlowActionNames(String name)
Description copied from interface: FlowFilter
Gets the names of the actions applied to the named flow.

Specified by:
getFlowActionNames in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
the names of the actions or null.

setFlowActionNames

public void setFlowActionNames(String name,
                               String[] tasks)
Description copied from interface: FlowFilter
Sets the names of the actions applied to the named flow.

Specified by:
setFlowActionNames in interface FlowFilter
Parameters:
name - the name of the flow.
tasks - the names of the actions.

addFlowActionNames

public void addFlowActionNames(String name,
                               String[] tasks)
Description copied from interface: FlowFilter
Adds more names of the actions applied to the named flow.

Specified by:
addFlowActionNames in interface FlowFilter
Parameters:
name - the name of the flow.
tasks - the names of the actions.

clearFlowActions

public void clearFlowActions(String name)
Description copied from interface: FlowFilter
Clears the actions applied to the named flow.

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

isFlowHeritable

public boolean isFlowHeritable(String name)
Description copied from interface: FlowFilter
Checks whether the named flow is heritable.

Specified by:
isFlowHeritable in interface FlowFilter
Parameters:
name - the name of the flow.
Returns:
true if heritable, false otherwise.

setFlowHeritable

public void setFlowHeritable(String name,
                             boolean flag)
Description copied from interface: FlowFilter
Sets whether the named flow is heritable.

Specified by:
setFlowHeritable in interface FlowFilter
Parameters:
name - the name of the flow.
flag - true if heritable, false otherwise.

isFlowState

public boolean isFlowState(String name,
                           Object state)
Description copied from interface: FlowFilter
Checks whether the specified state is set for the named flow.

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

setFlowState

public void setFlowState(String name,
                         Object state,
                         boolean flag)
Description copied from interface: FlowFilter
Sets whether the specified state is set for the named flow.

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

setFlowStates

public void setFlowStates(String name,
                          Object[] states)
Description copied from interface: FlowFilter
Sets the specified states of the named flow.

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

getFlowProperty

public Object getFlowProperty(String name,
                              Object property)
Description copied from interface: FlowFilter
Gets the specified property of the named flow.

Specified by:
getFlowProperty in interface FlowFilter
Parameters:
name - the name of the flow.
property - the property.
Returns:
the value of the property or null.

setFlowProperty

public void setFlowProperty(String name,
                            Object property,
                            Object value)
Description copied from interface: FlowFilter
Sets the specified property of the named flow.

Specified by:
setFlowProperty in interface FlowFilter
Parameters:
name - the name of the flow.
property - the property.
value - the value of the property.

setFlowProperties

public void setFlowProperties(String name,
                              Object[] properties)
Description copied from interface: FlowFilter
Sets the specified properties of the named flow as consecutive pairs of properties and values.

Specified by:
setFlowProperties in interface FlowFilter
Parameters:
name - the name of the flow or step.
properties - the properties and values.

getFlowTransition

public Object getFlowTransition(String name,
                                Object state)
Description copied from interface: FlowFilter
Gets the transition of the named flow.

Specified by:
getFlowTransition in interface FlowFilter
Parameters:
name - the name of the flow.
state - the state.
Returns:
the value of the transition or null.

setFlowTransition

public void setFlowTransition(String name,
                              Object state,
                              Object value)
Description copied from interface: FlowFilter
Sets the transition of the named flow.

Specified by:
setFlowTransition in interface FlowFilter
Parameters:
name - the name of the flow.
state - the state.
value - the value of the transition.

setFlowTransitions

public void setFlowTransitions(String name,
                               Object[] transitions)
Description copied from interface: FlowFilter
Sets the transitions of the named flow as consecutive pairs of states and values.

Specified by:
setFlowTransitions in interface FlowFilter
Parameters:
name - the name of the flow or step.
transitions - the states and values of the transitions.

getContextAttribute

public Object getContextAttribute(Object key)
Description copied from interface: FlowFilter
Gets a global context attribute.

Specified by:
getContextAttribute in interface FlowFilter
Parameters:
key - the attribute key.
Returns:
the attribute value or null.

setContextAttribute

public void setContextAttribute(Object key,
                                Object value)
Description copied from interface: FlowFilter
Sets a global context attribute.

Specified by:
setContextAttribute in interface FlowFilter
Parameters:
key - the attribute key.
value - the attribute value.

containsContextAttribute

public boolean containsContextAttribute(Object key)
Description copied from interface: FlowFilter
Checks the named global context attribute.

Specified by:
containsContextAttribute in interface FlowFilter
Parameters:
key - the attribute key.
Returns:
true if defined, false othwerwise.

removeContextAttribute

public void removeContextAttribute(Object key)
Description copied from interface: FlowFilter
Removes the named global context attribute.

Specified by:
removeContextAttribute in interface FlowFilter
Parameters:
key - the attribute key.

clearContextAttributes

public void clearContextAttributes()
Description copied from interface: FlowFilter
Clears all global context attributes.

Specified by:
clearContextAttributes in interface FlowFilter

contextAttributeKeySet

public Set<Object> contextAttributeKeySet()
Description copied from interface: FlowFilter
Returns a set of global context attribute keys.

Specified by:
contextAttributeKeySet in interface FlowFilter
Returns:
a read-only set of keys.

getTaskLoaderName

public ObjectName getTaskLoaderName()
Description copied from interface: FlowFilter
Gets the the task loader to be applied by contexts of this filter.

Specified by:
getTaskLoaderName in interface FlowFilter
Returns:
the object name of the task loader or a query.

setTaskLoaderName

public void setTaskLoaderName(ObjectName loader)
Description copied from interface: FlowFilter
Sets the task loader to be applied by contexts of this filter. If it is not set, the default one will be used.

Specified by:
setTaskLoaderName in interface FlowFilter
Parameters:
loader - the object name of the task loader or a query.

getVariableRegistryName

public ObjectName getVariableRegistryName()
Description copied from interface: FlowFilter
Gets the the variable registry to be applied by contexts of this filter.

Specified by:
getVariableRegistryName in interface FlowFilter
Returns:
the object name of the variable registry or a query.

setVariableRegistryName

public void setVariableRegistryName(ObjectName registry)
Description copied from interface: FlowFilter
Sets the variable registry to be applied by contexts this filter. If it is not set, the default one will be used.

Specified by:
setVariableRegistryName in interface FlowFilter
Parameters:
registry - the object name of the variable registry or a query.

getCurrentContext

public StepFlowContext getCurrentContext(ServletRequest request,
                                         ServletResponse response,
                                         FilterChain chain)
Description copied from interface: FlowFilter
Gets the step flow context of the specified request.

Specified by:
getCurrentContext in interface FlowFilter
Parameters:
request - the request.
response - the response.
chain - the filter chain.
Returns:
the step flow context or null.

createVariable

public Variable createVariable(String type)
                        throws ConstructionException
Description copied from interface: FlowFilter
Creates a new variable MBean instance of the specified type.

Specified by:
createVariable in interface FlowFilter
Parameters:
type - the type of the variable.
Returns:
the variable MBean instance.
Throws:
ConstructionException - if construction fails.

executeActions

public Task.Control executeActions(FlowStep step,
                                   StepFlowContext context,
                                   ServletRequest request,
                                   ServletResponse response,
                                   FilterChain chain)
                            throws AccessDeniedException,
                                   ExecutionException,
                                   InterruptedException
Description copied from interface: FlowFilter
Executes actions of the specified step in the given flow context.

Specified by:
executeActions in interface FlowFilter
Parameters:
step - the flow step.
context - the flow context.
request - the request.
response - the response.
chain - the filter chain.
Returns:
the execution state or null.
Throws:
AccessDeniedException - for denied access.
ExecutionException - for execution errors.
InterruptedException - if execution is interrupted.

doFilter

public void doFilter(ServletRequest request,
                     ServletResponse response,
                     FilterChain chain)
              throws ServletException,
                     IOException
Activates a flow. The flow key is first applied to request attributes to find a flow. If the key does not define a flow, the filter key, which defaults to 'flow', is applied to request parameters. If a flow is still not found, the current flow continues. If the current flow is not available, the default flow will be activated.

A flow template corresponding to the current step is added to request attributes. If an overriding template is already present and can be adapted, the flow and step specific ones are ignored.

Step actions, if defined, are executed as a post-action of the previous step and as a pre-action of the current step.

Specified by:
doFilter in interface Filter
Overrides:
doFilter in class DefaultFilter
Parameters:
request - the request to process.
response - the response to return.
chain - the current filter chain.
Throws:
ServletException - for servlet errors.
IOException - for general errors.


Copyright © 2004 The Norther Organization. All rights reserved.