ColdBox Platform v3.8.0

coldbox.system.web.services
Class InterceptorService

WEB-INF.cftags.component
        extended by coldbox.system.web.services.BaseService
            extended by coldbox.system.web.services.InterceptorService

public class InterceptorService
extends BaseService

The coldbox interceptor service

Constructor Summary
init(any controller)
          Constructor
 
Method Summary
 any appendInterceptionPoints(any customPoints)
          Append a list of custom interception points to the CORE interception points and returns itself
 any configure()
          Configure the interceptor service
private any createInterceptor(any interceptorClass, any interceptorName, [any<struct> interceptorProperties='[runtime expression]'])
          Create an interceptor object
 any<array> getInterceptionPoints()
          Get the interceptionPoints ENUM of all registered points of execution as an array
 any<struct> getInterceptionStates()
          Get all the interception states defined in this service
 any getInterceptor([string interceptorName])
          Get an interceptor according to its name from a state
 any getRequestBuffer()
          Get a coldbox request buffer: coldbox
 any getStateContainer(any state)
          Get a State Container, it will return a blank structure if the state is not found
private any newPointRecord()
          Create a new interception point record
 any onConfigurationLoad()
          Fires after the main ColdBox application configuration is loaded
private struct parseMetadata(any metadata, any points)
          I get a components valid interception points
 any processState(any state, [any interceptData='[runtime expression]'], [boolean async='false'], [boolean asyncAll='false'], [boolean asyncAllJoin='true'], [string asyncPriority='NORMAL'], [numeric asyncJoinTimeout='0'])
          Announce an interception to the system
 any registerInterceptionPoint(any interceptorKey, any state, any oInterceptor, [any interceptorMD])
          Register an Interception point into a new or created interception state
 any registerInterceptor([any interceptorClass], [any interceptorObject], [any<struct> interceptorProperties='[runtime expression]'], [any customPoints=''], [any interceptorName])
          Register an interceptor
 any registerInterceptors()
          Register all the interceptors according to ColdBox configuration
 boolean unregister(any interceptorName, [any state=''])
          Unregister an interceptor from an interception state or all states
private any wireboxSetup()
          Verifies the setup for interceptor classes is online
 
Methods inherited from class coldbox.system.web.services.BaseService
convertToColdBox, getColdboxOCM, getController, getUtil, isFamilyType, onShutdown, setController
 
Methods inherited from class WEB-INF.cftags.component
None
 

Constructor Detail

init

public init(any controller)
Constructor

Parameters:
controller
Method Detail

appendInterceptionPoints

public any appendInterceptionPoints(any customPoints)
Append a list of custom interception points to the CORE interception points and returns itself

Parameters:
customPoints - A comma delimmited list or array of custom interception points to append. If they already exists, then they will not be added again.

configure

public any configure()
Configure the interceptor service


createInterceptor

private any createInterceptor(any interceptorClass, any interceptorName, [any<struct> interceptorProperties='[runtime expression]'])
Create an interceptor object

Parameters:
interceptorClass - The class path to instantiate
interceptorName - The unique name of the interceptor
interceptorProperties - The properties

getInterceptionPoints

public any<array> getInterceptionPoints()
Get the interceptionPoints ENUM of all registered points of execution as an array


getInterceptionStates

public any<struct> getInterceptionStates()
Get all the interception states defined in this service


getInterceptor

public any getInterceptor([string interceptorName])
Get an interceptor according to its name from a state. If retrieved, it does not mean that the interceptor is registered still. Use the deepSearch argument if you want to check all the interception states for the interceptor.

Parameters:
interceptorName - The name of the interceptor to search for

getRequestBuffer

public any getRequestBuffer()
Get a coldbox request buffer: coldbox.system.core.util.RequestBuffer


getStateContainer

public any getStateContainer(any state)
Get a State Container, it will return a blank structure if the state is not found.

Parameters:
state - The state name to retrieve

newPointRecord

private any newPointRecord()
Create a new interception point record


onConfigurationLoad

public any onConfigurationLoad()
Fires after the main ColdBox application configuration is loaded

Overrides:
onConfigurationLoad in class BaseService

parseMetadata

private struct parseMetadata(any metadata, any points)
I get a components valid interception points

Parameters:
metadata - The recursive metadata
points - The active points structure

processState

public any processState(any state, [any interceptData='[runtime expression]'], [boolean async='false'], [boolean asyncAll='false'], [boolean asyncAllJoin='true'], [string asyncPriority='NORMAL'], [numeric asyncJoinTimeout='0'])
Announce an interception to the system. If you use the asynchronous facilities, you will get a thread structure report as a result.

Parameters:
state - An interception state to process
interceptData - A data structure used to pass intercepted information.
async - If true, the entire interception chain will be ran in a separate thread.
asyncAll - If true, each interceptor in the interception chain will be ran in a separate thread and then joined together at the end.
asyncAllJoin - If true, each interceptor in the interception chain will be ran in a separate thread and joined together at the end by default. If you set this flag to false then there will be no joining and waiting for the threads to finalize.
asyncPriority - The thread priority to be used. Either LOW, NORMAL or HIGH. The default value is NORMAL
asyncJoinTimeout - The timeout in milliseconds for the join thread to wait for interceptor threads to finish. By default there is no timeout.

registerInterceptionPoint

public any registerInterceptionPoint(any interceptorKey, any state, any oInterceptor, [any interceptorMD])
Register an Interception point into a new or created interception state.

Parameters:
interceptorKey - The interceptor key to use for lookups in the state.
state - The state to create
oInterceptor - The interceptor to register
interceptorMD - The metadata about the interception point: {async, asyncPriority, eventPattern}

registerInterceptor

public any registerInterceptor([any interceptorClass], [any interceptorObject], [any<struct> interceptorProperties='[runtime expression]'], [any customPoints=''], [any interceptorName])
Register an interceptor. This method is here for runtime additions. If the interceptor is already in a state, it will not be added again. You can register an interceptor by class or with an already instantiated and configured object.

Parameters:
interceptorClass - Mutex with interceptorObject, this is the qualified class of the interceptor to register
interceptorObject - Mutex with interceptor Class, this is used to register an already instantiated object as an interceptor
interceptorProperties - The structure of properties to register this interceptor with.
customPoints - A comma delimmited list or array of custom interception points, if the object or class sent in observes them.
interceptorName - The name to use for the interceptor when stored. If not used, we will use the name found in the object's class

registerInterceptors

public any registerInterceptors()
Register all the interceptors according to ColdBox configuration. All interception states are lazy loaded in.


unregister

public boolean unregister(any interceptorName, [any state=''])
Unregister an interceptor from an interception state or all states. If the state does not exists, it returns false

Parameters:
interceptorName - The name of the interceptor to search for
state - The named state to unregister this interceptor from. If not passed, then it will be unregistered from all states.

wireboxSetup

private any wireboxSetup()
Verifies the setup for interceptor classes is online


ColdBox Platform v3.8.0