coldbox.system.core.events

Class EventPoolManager

lucee.Component
    extended by coldbox.system.core.events.EventPoolManager

Copyright Since 2005 ColdBox Framework by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com --- 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

Class Attributes:
  • synchronized : false
  •  
  • accessors : true
  •  
  • persistent : false
  •  
    Property Summary
    type property default serializable required
    struct eventPoolContainer
          Pool container struct.

    • access = public
    • returntype = any
    true false
    any eventStates
          Event states to listen for.

    • access = public
    • returntype = any
    true false
    any stopRecursionClasses
          Stop recurssion classes.

    • access = public
    • returntype = any
    true false
    Constructor Summary
    init(array eventStates, [any stopRecursionClasses=''])
          Constructor.
    Method Summary
    array appendInterceptionPoints(any customStates)
         Append a list of custom interception points to the CORE interception points and returns the points.
    any getEventPool(any state)
         Get an event pool by state name, if not found, it returns an empty structure.
    string getEventPoolContainer()
    string getEventStates()
    any getObject(any name)
         Get an object from the pool.
    string getStopRecursionClasses()
    private any getUtil()
         Get ColdBox utility object.
    private struct parseMetadata(any metadata, struct eventsFound)
         I get a component's valid observation states for registration.
    any processState(any state, [struct interceptData='[runtime expression]'])
         Process a state announcement.
    any register(any target, [any name=''], [any customStates=''])
         Register an object in an event pool.
    any registerInEventState(any key, any state, any target)
         Register an object with a specified event observation state.
    any setEventPoolContainer(struct eventPoolContainer)
    any setEventStates(any eventStates)
    any setStopRecursionClasses(any stopRecursionClasses)
    boolean unregister(any name, [any state=''])
         Unregister an object form an event pool state.
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

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

    Constructor

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

    Property Detail

    eventPoolContainer

    property struct eventPoolContainer

    Pool container struct

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    eventStates

    property any eventStates

    Event states to listen for

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    stopRecursionClasses

    property any stopRecursionClasses

    Stop recurssion classes

    Attributes:
    access - public
    required - false
    returntype - any
    serializable - true

    Method Detail

    appendInterceptionPoints

    public array appendInterceptionPoints(any customStates)

    Append a list of custom interception points to the CORE interception points and returns the points

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

    getEventPool

    public any getEventPool(any state)

    Get an event pool by state name, if not found, it returns an empty structure

    Parameters:
    state - The state to retrieve

    getEventPoolContainer

    public string getEventPoolContainer()


    getEventStates

    public string getEventStates()


    getObject

    public any getObject(any name)

    Get an object from the pool

    Parameters:
    name - The name of the object
    Throws:
    EventPoolManager.ObjectNotFound

    getStopRecursionClasses

    public string getStopRecursionClasses()


    getUtil

    private any getUtil()

    Get ColdBox utility object


    parseMetadata

    private struct parseMetadata(any metadata, struct eventsFound)

    I get a component's valid observation states for registration.

    Parameters:
    metadata
    eventsFound

    processState

    public any processState(any 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 - The data to pass into the interception event
    Returns:
    EventPoolManager

    register

    public any register(any target, [any name=''], [any 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
    Returns:
    EventPoolManager

    registerInEventState

    public any registerInEventState(any key, any 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
    Returns:
    EventPoolManager

    setEventPoolContainer

    public any setEventPoolContainer(struct eventPoolContainer)

    Parameters:
    eventPoolContainer

    setEventStates

    public any setEventStates(any eventStates)

    Parameters:
    eventStates

    setStopRecursionClasses

    public any setStopRecursionClasses(any stopRecursionClasses)

    Parameters:
    stopRecursionClasses

    unregister

    public boolean unregister(any name, [any 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 state to unregister from. If not passed, then we will unregister from ALL pools