Neptune 1.0 Beta 1 Documentation: Configure Components

Neptune Information

Download from RIA Forge

Configure Components

The Neptune Framework comes with its own dependency injection engine for managing components. The component definitions are stored in XML in the /_config/components.cfm files.

Programs register components here on installation. You can also modify the file manually as needed.

Each "component" element refers to a CFC component. The "name" attribute indicates the name of the Application variable into which the component will be loaded. So, if a component has a name attribute of "Fred", it will be saved as "Application.Fred".

The "path" attribute is the path to the component as it would be entered into CFOBJECT, CreateObject, or CFINVOKE.

Each component element can also have zero or more "argument" elements. These correspond to arguments passed into the "init" method of that component when initializing it (components created here must all have an "init" method for initialization).

Each argument must have a "name" attribute that corresponds to the name of the argument in the "init" method. It must also have one of the following three attributes:

The framework will load the components in the correct order to allow any components to be created before any components that depend on them - and throw an error for circular dependencies.

You can reload all components be appending ?refresh=true to the URL of any request (You can change the name of this variable in (/_config/invoke.cfm).

You can also refresh only one component by refreshing the name of the component. For example to refresh the component named "Fred", you could use ?refresh=Fred in the URL. The framework would then refresh the Fred component as well as any other components that depended directly or indirectly on Fred.

Example:

<site>
	<components>
		<component name="Manager" path="com.sebtools.Manager">
			<argument name="datasource" arg="datasource" />
			<argument name="UploadPath" arg="UploadPath" />
			<argument name="UploadURL" arg="UploadURL" />
		</component>
		<component name="SessionMgr" path="com.sebtools.SessionMgr">
			<argument name="scope" arg="SessionScope" />
		</component>
		<component name="Security" path="admin.admins.model.Security">
			<argument name="SessionMgr" />
			<argument name="Manager" />
		</component>
	</components>
	<postactions>
	</postactions>
</site>