ColdBox Platform Version 3.7.0

coldbox.system.core.events
Class EventPoolManager

WEB-INF.cftags.component
        extended by coldbox.system.core.events.EventPoolManager

public class EventPoolManager
extends WEB-INF.cftags.component

A basic event pool manager for observed event pools. This event manager will manage 1 or more event pools. The manager will inspect target objects for implemented functions and match them to event states. However, if a function has the metadata attribute of 'observe=true' on it, then it will also add it as a custom state.


Constructor Summary
init(array eventStates, [string stopRecursionClasses=''])
          Constructor
 
Method Summary
 void appendInterceptionPoints(string customStates)
          Append a list of custom event states to the CORE observation states
 any getEventPool(string state)
          Get an event pool by state name, if not found, it returns an empty structure
 struct getEventPoolContainer()
          Get all the registered event pools in the event manager
 string getEventStates()
          Get the registered event states in this event manager
 any getObject([string name])
          Get an object from a registered event pool
 string getStopRecursionClasses()
          The classes that should stop recursion for observation points
private Util getUtil()
          Create and return a util object
private struct parseMetadata(any metadata, struct eventsFound)
          I get a component's valid observation states for registration
 void processState(string state, [struct interceptData='[runtime expression]'])
          Process a state announcement
 void register(any target, [string name=''], [string customStates=''])
          Register an object in an event pool
private void registerInEventState(string key, string state, any target)
          Register an object with a specified event observation state
 boolean unregister(string name, string state='')
          Unregister an object form an event pool state
 
Methods inherited from class WEB-INF.cftags.component
 

Constructor Detail

init

public init(array eventStates, [string stopRecursionClasses=''])
Constructor

Parameters:
eventStates - The event states to listen for
stopRecursionClasses - The classes (comma-delim) to not inspect for events
Method Detail

appendInterceptionPoints

public void appendInterceptionPoints(string customStates)
Append a list of custom event states to the CORE observation states

Parameters:
customStates - A comma delimmited list of custom observation states to append. If they already exists, then they will not be added again.

getEventPool

public any getEventPool(string state)
Get an event pool by state name, if not found, it returns an empty structure

Parameters:
state - The state to retrieve

getEventPoolContainer

public struct getEventPoolContainer()
Get all the registered event pools in the event manager


getEventStates

public string getEventStates()
Get the registered event states in this event manager


getObject

public any getObject([string name])
Get an object from a registered event pool.

Parameters:
name - The name of the object to search for

getStopRecursionClasses

public string getStopRecursionClasses()
The classes that should stop recursion for observation points


getUtil

private Util getUtil()
Create and return a util object


parseMetadata

private struct parseMetadata(any metadata, struct eventsFound)
I get a component's valid observation states for registration.

Parameters:
metadata - The recursive metadata
eventsFound - The event states found in the object

processState

public void processState(string state, [struct interceptData='[runtime expression]'])
Process a state announcement. If the state does not exist, it will ignore it

Parameters:
state - The state to process
interceptData - A data structure used to pass intercepted information.

register

public void register(any target, [string name=''], [string customStates=''])
Register an object in an event pool. If the target object is already in a state, it will not be added again. The object get's inspected for registered states or you can even send custom states in. Also, you can annotate the methods in the target object with 'observe=true' and we will register that state also.

Parameters:
target - The target object to register in an event pool
name - The name to use when registering the object. If not passed, the name will be used from the object's metadata
customStates - A comma delimmited list of custom states, if the object or class sent in observes them.

registerInEventState

private void registerInEventState(string key, string state, any target)
Register an object with a specified event observation state.

Parameters:
key - The key to use when storing the object.
state - The event state pool to save the object in
target - The object to register

unregister

public boolean unregister(string name, string state='')
Unregister an object form an event pool state. If no event state is passed, then we will unregister the object from ALL the pools the object exists in.

Parameters:
name - The name of the object to unregister
state - The named state to unregister this object from. If not passed, then we will unregister the object from ALL the pools it exists in.

ColdBox Platform Version 3.7.0