# Maintenance extensions

Not all maintenance logic can go in the initial application's Maintenance. For instance, how can you retrieve the description of a foreign key whose table does not exist in that application?

An "extension" methodology exists whereby an existing page can have behavior added to it at predetermined plug-in points.

This is done by having a list of maintenance extensions that can be supplied for any given maintenance. At runtime, this list is kept and when a maintenance is initialized, new instances of its extensions are created. These extensions are called after any original maintenance behavior, and in the order of loaded applications. This means that the extensions should have no dependence on what other extensions have run, excepting the original maintenance having run.

To extend a maintenance:

- Create a new maintenance extension class.
- Specify the annotations required for a maintenance extension.
- Code desired logic in appropriate methods (see `AbstractMaintenanceExtension`).
- Generate artifacts.
- Code JUnit tests.
- Run JUnit tests.
- Deploy to runtime.
- Test in runtime.

Parent topic: Extending Maintenance Classes