var refLocal = {}; var DSLNamespace = listFirst(arguments.definition.dsl,":"); WriteLog( file="fb849", application="yes", text="#now()#, =====================================================" ); WriteLog( file="fb849", application="yes", text="#now()#, listFirst1: #listFirst(arguments.definition.dsl, ':')#" ); WriteLog( file="fb849", application="yes", text="#now()#, DSLNamespace1: #DSLNamespace#" ); WriteLog( file="fb849", application="yes", text="#now()#, arguments.definition.dsl1: #arguments.definition.dsl#" ); // Check if Custom DSL exists, if it does, execute it if( structKeyExists( instance.customDSL, DSLNamespace ) ){ return instance.customDSL[ DSLNamespace ].process(argumentCollection=arguments); } // Determine Type of Injection according to type // Some namespaces requires the ColdBox context, if not found, an exception is thrown. switch( DSLNamespace ){ // ColdBox Context DSL case "ocm" : case "coldbox" : { refLocal.dependency = instance.coldboxDSL.process(argumentCollection=arguments); break; } // CacheBox Context DSL case "cacheBox" : { // check if linked if( !instance.injector.isCacheBoxLinked() AND !instance.injector.isColdBoxLinked() ){ throw(message="The DSLNamespace: #DSLNamespace# cannot be used as it requires a ColdBox/CacheBox Context",type="Builder.IllegalDSLException"); } // retrieve it refLocal.dependency = instance.cacheBoxDSL.process(argumentCollection=arguments); break; } // logbox injection DSL always available case "logbox" : { refLocal.dependency = instance.logBoxDSL.process(argumentCollection=arguments); break;} // WireBox Internal DSL for models and id case "model" : case "id" : { refLocal.dependency = getModelDSL(argumentCollection=arguments); break; } // provider injection DSL always available case "provider" : { refLocal.dependency = getProviderDSL(argumentCollection=arguments); break; } // wirebox injection DSL always available case "wirebox" : { refLocal.dependency = getWireBoxDSL(argumentCollection=arguments); break;} // java class case "java" : { refLocal.dependency = getJavaDSL(argumentCollection=arguments); break; } // coldfusion type annotation case "bytype" : { refLocal.dependency = getByTypeDSL(argumentCollection=arguments); break; } // No internal DSL's found, then check custom DSL's default : { // If no DSL's found, let's try to use the name as the empty namespace if( NOT find( ":", arguments.definition.dsl ) ){ arguments.definition.dsl = "id:#arguments.definition.dsl#"; refLocal.dependency = getModelDSL(argumentCollection=arguments); } else { WriteLog( file="fb849", application="yes", text="#now()#, listFirst2: #listFirst(arguments.definition.dsl, ':')#" ); WriteLog( file="fb849", application="yes", text="#now()#, DSLNamespace2: #DSLNamespace#" ); WriteLog( file="fb849", application="yes", text="#now()#, arguments.definition.dsl2: #arguments.definition.dsl#" ); var DSLNamespace = listFirst(arguments.definition.dsl,":"); } } } // return only if found if( structKeyExists( refLocal, "dependency" ) ){ return refLocal.dependency; } // was dependency required? If so, then throw exception if( arguments.definition.required ){ WriteLog( file="fb849", application="yes", text="#now()#, DSLException" ); // Logging if( instance.log.canError() ){ instance.log.error("Target: #arguments.targetID# -> DSL Definition: #arguments.definition.toString()# did not produce any resulting dependency"); } // Throw exception as DSL Dependency requested was not located throw(message="The DSL Definition #arguments.definition.toString()# did not produce any resulting dependency", detail="The target requesting the dependency is: '#arguments.targetID#'", type="Builder.DSLDependencyNotFoundException"); } // else return void, no dependency found that was required