| 1 | <cfscript> |
|---|
| 2 | // usage: |
|---|
| 3 | // <transfer:init |
|---|
| 4 | // datasource="/config/datasource.xml" |
|---|
| 5 | // configuration="/config/transfer.xml" |
|---|
| 6 | // definitions="/output" /> |
|---|
| 7 | if (fb_.verbInfo.executionMode is "start") { |
|---|
| 8 | // validate attributes |
|---|
| 9 | // configuration - string (path) |
|---|
| 10 | if (not structKeyExists(fb_.verbInfo.attributes,"configuration")) { |
|---|
| 11 | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
|---|
| 12 | "Required attribute is missing", |
|---|
| 13 | "The attribute 'configuration' is required, for a 'init' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
|---|
| 14 | } |
|---|
| 15 | // datasource - string (path) |
|---|
| 16 | if (not structKeyExists(fb_.verbInfo.attributes,"datasource")) { |
|---|
| 17 | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
|---|
| 18 | "Required attribute is missing", |
|---|
| 19 | "The attribute 'datasource' is required, for a 'init' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
|---|
| 20 | } |
|---|
| 21 | // definitions - string (path) |
|---|
| 22 | if (not structKeyExists(fb_.verbInfo.attributes,"definitions")) { |
|---|
| 23 | fb_throw("fusebox.badGrammar.requiredAttributeMissing", |
|---|
| 24 | "Required attribute is missing", |
|---|
| 25 | "The attribute 'definitions' is required, for a 'init' verb in fuseaction #fb_.verbInfo.circuit#.#fb_.verbInfo.fuseaction#."); |
|---|
| 26 | } |
|---|
| 27 | // generate code: |
|---|
| 28 | fb_appendLine('<cfset myFusebox.getApplication().getApplicationData().transferFactory = ' & |
|---|
| 29 | 'createObject("component","transfer.TransferFactory")' & |
|---|
| 30 | '.init("#fb_.verbInfo.attributes.datasource#","#fb_.verbInfo.attributes.configuration#","#fb_.verbInfo.attributes.definitions#") />'); |
|---|
| 31 | fb_appendLine('<cfset myFusebox.trace("Transfer","Created TransferFactory") />'); |
|---|
| 32 | } else { |
|---|
| 33 | } |
|---|
| 34 | </cfscript> |
|---|