feature

With Interchange 5.3.0, Interchange supports so-called "features". The whole purpose of the new "Feature" facility is to allow easy installation of new capabilities to Interchange.

Interchange already has the convention of "extensions" which allow you to put together features to add to Interchange. But the installation is manual, and requires good docs to make it easily installable for end-users. Also, many features require access to the global configuration. There's also another problem at sight, namely that of feature creep, since everything was just being added to the "standard" catalog.

The basic mechanism is simple: Inside "feature" modules, there are three special kinds of files, called by extensions .global, .init and .uninstall. (In the included quickpoll feature, these are named quickpoll.global and quickpoll.init).

If a file has the extension .global, it is added to the global configuration. The included quickpoll feature, for example, adds the quickpoll ActionMap, and two usertags: poll-answer and ascii-graph.

If a file has the extension .init, it is run once — the first time the target catalog is accessed. Again, in the quickpoll example, it is used to add mv_metadata entries and a couple of sample polls.

All other files in the directory are catalog configuration (quickpoll.catalog.cfg for a concrete example). It could have also been broken up into say, files quickpoll.sql and quickpoll_answer.sql.

All subdirectories contain files which are copied to the catalog directory with the same relative path. In this case, ICROOT/features/quickpoll/templates/components/quickpoll would go to CATROOT/templates/components/quickpoll.

The .init file, when run, sends its output to ConfDir/init/FEATURE/FEATURE.init (and that would be etc/init/quickpoll/quickpoll.init for the concrete example.) Once it is run, the existence of the file prevents it being run again.

Uninstall files, those with the .uninstall extension, are ITL files that can perform any uninstall functions, and they run with temporary AllowGlobal access to allow dropping of tables, unlinking of files, etc.

Automated uninstall features include removing any files installed as a part of the feature -- providing they have not changed. If the file was edited and is not identical to the originally installed file, then it is left there and a warning issued. Uninstall creates file ConfDir/init/FEATURE/uninstall to note the uninstall, and which prevents the Init process from happening again (assuming Interchange has not been restarted since the feature installation).

The uninstall routine is called with the [uninstall_feature] tag.

[Caution]Caution

The catalog user must remove the Feature directive from their catalog.cfg before running [uninstall_feature], otherwise the Feature will be re-installed the next time Interchange is restarted!

Also, there is a short window where a SQL table, if dropped as a part of the uninstall procedure, could be re-instantiated based on the existence of the configuration in memory. It is recommended that if [uninstall_feature] is called, a [reconfig] tag is called shortly thereafter to reduce this possibility to a minimum.

DocBook! Interchange!