| 1 | <cfscript>
|
|---|
| 2 | // @ Author Qasim Rasheed (qasimrasheed@gmail.com)
|
|---|
| 3 | // Original idea taken by COldSpring lexicon by Nathan Strutz.
|
|---|
| 4 | // used as a child tag with coldspring initialize tag
|
|---|
| 5 | // usage:
|
|---|
| 6 | // 1. add the lexicon declaration to your circuit file:
|
|---|
| 7 | // <circuit xmlns:cs="coldspring/">
|
|---|
| 8 | // 2 add bean tag as a child to initialize tag
|
|---|
| 9 | // <cs:initialize coldspringfactory="servicefactory" defaultproperties="default coldspring properties">
|
|---|
| 10 | // <cs:bean beanDefinitionFile="..." />
|
|---|
| 11 | // more bean tags......
|
|---|
| 12 | // </cs:initialize>
|
|---|
| 13 |
|
|---|
| 14 | if (fb_.verbInfo.executionMode is "start") {
|
|---|
| 15 | // validates attributes
|
|---|
| 16 | // beanDefinitionFile is required
|
|---|
| 17 | if (not structKeyExists( fb_.verbInfo.attributes, "beanDefinitionFile" ) ) {
|
|---|
| 18 | fb_throw("fusebox.badGrammar.requiredAttributeMissing",
|
|---|
| 19 | "Required attribute is missing",
|
|---|
| 20 | "The attribute 'beanDefinitionFile' is required, for a 'bean' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
|
|---|
| 21 | }
|
|---|
| 22 |
|
|---|
| 23 | // must be nested inside an <cf:initialize>
|
|---|
| 24 | if (not structKeyExists(fb_.verbInfo,"parent") or fb_.verbInfo.parent.lexiconVerb is not "initialize") {
|
|---|
| 25 | fb_throw("fusebox.badGrammar.parameterNeedsInclude",
|
|---|
| 26 | "Verb 'bean' has no parent 'initialize' verb",
|
|---|
| 27 | "Found 'bean' verb with no valid parent 'initialize' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#.");
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | // append this bean to the parent data:
|
|---|
| 31 | arrayAppend( fb_.verbInfo.parent.beans,fb_.verbInfo.attributes.beanDefinitionFile );
|
|---|
| 32 |
|
|---|
| 33 | }
|
|---|
| 34 | </cfscript>
|
|---|