Plugins:IOC

<< Back to Dashboard

Contents

Exploring the IOC Plugin

Overview

An Inversion Of Control plugin that interfaces with ColdSpring and LightWire. You can also read the appropriate framework integration guides below:

This guide mostly deals with the agnostic capabilities of the IOC plugin.

getIOCFramework

Gets the IoC Framework string used: lightwire or coldspring

Returns

  • This function returns string

setCOLDSPRING_FACTORY

Set the instantiation path for ColdSpring.

Returns

  • This function returns void

Arguments

Key Type Required Default Description
COLDSPRING_FACTORY string Yes --- The instantiation path for coldspring

Examples

getPlugin("IOC").setColdspring_Factory("shared.frameworks.coldspring.beans.DefaultXmlBeanFactory");

setIOCFramework

Set the IoC Framework used: lightwire or coldspring

Returns

  • This function returns void

Arguments

Key Type Required Default Description
IOCFramework string Yes ---

Examples

getPlugin("IOC").setIOCFramework("coldspring");

reloadDefinitionFile

Reloads the IoC factory with the Definition File or Object

Returns

  • This function returns void

Examples

getPlugin("IOC").reloadDefinitionFile();

setIOCDefinitionFile

Set the definition file configured for this plugin

Returns

  • This function returns void

Arguments

Key Type Required Default Description
IOCDefinitionFile string Yes --- The relative or absolute location of the coldspring main xml file.

Examples

getPlugin("IOC").setIOCDefinitionFile('/app/config/services.xml');

getBean

Get a Bean from the loaded object factory

Returns

  • This function returns any

Arguments

Key Type Required Default Description
beanName string Yes --- The bean name to retrieve from the object factory

Examples

var userService = getPlugin("IOC").getBean('userService');

getExpandedIOCDefinitionFile

Get the full expanded path of the configuration file, only used for coldspring

Returns

  • This function returns string

getIOCDefinitionFile

Get the definition file configured for this plugin

Returns

  • This function returns string

getIoCFactory

Returns the IoC Factory in use.

Returns

  • This function returns any

Examples

// Get a direct reference to coldspring
if( getPlugin("IOC").getIOCFactory().containsBean('hellOBean') ){

}

configure

Configure or Re-Configure the IoC Plugin. Loads the chosen IoC Factory and configures it for usage

Returns

  • This function returns void

Examples

// re-configure the ioc factory
getPlugin("IOC").getIOCFactory().configure();

// build a new ioc factory
var blogIOC = getPlugin(name="IOC",newInstance=true);
blogIOC.setIOCFramework('coldspring');
blogIOC.setDefinitionFile('/config/blog.xml');
blogIOC.configure();

setIoCFactory

Override and set the IoCFactory the plugin will interface with

Returns

  • This function returns void

Arguments

Key Type Required Default Description
IoCFactory any Yes ---

setLIGHTWIRE_FACTORY

Set the instantiation path for LightWire

Returns

  • This function returns void

Arguments

Key Type Required Default Description
LIGHTWIRE_FACTORY string Yes --- This is the instantiation path for lightwire

Examples

getPlugin("IOC").setLIGHTWIRE_FACTORY("shared.frameworks.lightwire.LightWire");

 
Download in other Formats:
markup Markup | pdf PDF | html HTML | word Word

comments Comments (0)


ColdBox Book

book