reactor.config

Class config

The config object is used by Reactor to encapsulate configuration settings.  It is either created automatically by Reactor when the ReactorFactory is instantiated or it is manually created and passed into the ReactorFactory or this configuration can be managed by an IOC container such as ColdSpring.

Methods

init()

Description

The init() method is the pseudo-constructor for the config component.  This method configures and returns the config component.

Syntax

reactor.config.config = init(pathToConfigXml)

 

Argument

Required

Type

Description

pathToConfigXml

Yes

String

This is a relative or absolute path to a reactor XML configuration file.

 

getObjectConfig()

Description

The getObjectConfig() method returns the XML configuration information for a specific database object.  If the object is not configured a default configuration is returned.

 

This method is only intended for use by Reactor.  This method may change or be removed in future versions of Reactor.

Syntax

string = getObjectConfig(alias)

 

Argument

Required

Type

Description

alias

Yes

String

The alias of the object to get the configuration XML for.

setDsn()

Description

The setDsn() method sets the ColdFusion datasource that Reactor will use to access data.

Syntax

setDsn(alias)

 

Argument

Required

Type

Description

alias

Yes

String

The datasource to use.

getDsn()

Description

The getDsn() method gets the ColdFusion datasource that Reactor will use to access data.

Syntax

string = getDsn()

setType()

Description

The setType() method sets the type of database that Reactor is working with.  

Syntax

setType(type)

 

Argument

Required

Type

Description

type

Yes

String

The type of database being used.  Options are:

  • mssql - Microsoft SQL Server 2000 and 2005.

  • mysql - MySQL 5

  • mysql4 - MySQL 4

  • postgresql - PostgreSQL 8

  • db2 - IBM DB2

  • oracle - Oracle 9i and 10g

  • oraclerdb - Oracle RDB (this is not officially supported)

getType()

Description

The getType() method gets the type of database that Reactor is working with.

Syntax

string = getType()

setMapping()

Description

The setMapping() method sets the location where Reactor-generated files will be written.  Although this method is "setMapping" this does not need to be a ColdFusion mapping, it can also be a relative path from the application's webroot.

 

For example, if my application's webroot is in "c:\inetpub\myApp" then I could specify "/data" for "c:\inetpub\myApp\data".  Alternativly "/data" could be a mapping to another directory outside of the webroot.

Syntax

setMapping(mapping)

 

Argument

Required

Type

Description

mapping

Yes

String

The relative path or mapping to the directory where reactor will write generated files.

getMapping()

Description

The getMapping() method gets the location where Reactor writes generated files.

Syntax

string = getMapping()

getMappingObjectStem()

Description

The getMappingObjectStem() method translates the mapping named (set by setMapping()) to the root portion of a package name.

 

This method is only intended for use by Reactor.  This method may change or be removed in future versions of Reactor.

Syntax

string = getMappingObjectStem()

setMode()

Description

The setMode() method sets the circumstances under which Reactor will generate files.

Syntax

setMode(mode)

 

Argument

Required

Type

Description

mode

Yes

String

The mode reactor is in.  Options are:

  • always - Reactor always recreates project files. This is the slowest setting and is used primarily for development of the Reactor framework.

  • development - Reactor only regenerates project files when the database object or the Reactor XML configuration has changed. This is a faster setting than always and is used primarily for development of applications which use Reactor.

  • production - Reactor never regenerates project files when they already exist. This is a fastest setting and is used in production applications.

 

Note: Custom files are never regenerated when they already exist.

getMode()

Description

The getMode() method gets the mode Reactor is in.

Syntax

string = getMode()

setProject()

Description

The setProject() method sets the name of the project Reactor is being used in.  This is akin to the application name used in the <cfapplication> tag.  For a given application this name should never be changed once it's set.  Reactor hard codes this name into the custom objects to specify the location of project files.  If this changes all of the custom objects need to be manually updated or deleted and regenerated.

Syntax

setProject(project)

 

Argument

Required

Type

Description

project

Yes

String

The name of the project.

getProject()

Description

The getProject() method gets the project name.

Syntax

string = getProject()

setUsername()

Description

The setUsername() method sets the username that Reactor uses when querying the database.  This setting is not required if your datasource does not require it.

Syntax

setUsername(username)

 

Argument

Required

Type

Description

username

Yes

String

The DSN username to use.

getUsername()

Description

The getUsername() method gets the DSN username.

Syntax

string = getUsername()

setPassword()

Description

The setPassword() method sets the password that Reactor uses when querying the database.  This setting is not required if your datasource does not require it.

Syntax

setPassword(password)

 

Argument

Required

Type

Description

password

Yes

String

The DSN password to use.

getPassword()

Description

The getPassword() method gets the DSN password.

Syntax

string = getPassword()