7.4. Publishing models and CGI mapping

Models and composite publishing is done by EBox::Model::ModelManager and EBox::Model::CompositeManager classes respectively. They are Singleton classes, both follows the same logic. Once the instance is created, it sets up the models or composite by searching for implementation of the interfaces EBox::Model::ModelProvider and EBox::Model::CompositeProvider among the eBox modules using modInstancesOfType from Global singleton class. Thus every instanced model and composite may be found in their managers.

As you may notice, write a CGI for every model is not required anymore since there are general CGI to complete these tasks. Thus when a CGI is not found when the user asks for it by entering an URL, a look up inside the model and composite manager is done. The URL to map must follow one these patterns:

Model: /ebox/CGI/$moduleName/(View|Controller)/$modelName
$moduleName

The module which the model belongs to, for instance, Objects module

"View" or "Controller"

Determine which kind of CGI must be called, both are explained in Section 7.3.

$modelName

The model name, this name must match with the tableName attribute set at the table definition.

Composite: /ebox/CGI/$moduleName/Composite/$compositeName[/$actionName]
$moduleName

The module which the composite belongs to, for instance, Events module

$compositeName

The composite name, its value must match with the name attribute set at the composite definition.

$actionName

This optional part of the URL is used to determine if the CGI to call is the View one, when no action name is provided, or the Controller one, when the action name is determined, the action to perform is given to the controller at the creation time.

Two examples from the previous patterns could be: /ebox/CGI/Objects/View/ObjectTable to show the objects stored in eBox and /ebox/CGI/Events/Composite/ConfigurationComposite/changeView to show the event configuration tables within a HTML divisor.

Regarding to submodels, the CGI mapping is done by setting the directory on HTTP GET request as a parameter. By doing so, it is possible to know from where to get the data from. For instance, to view the members from the object whose identifier is obje9972 the View CGI URL must follow this pattern /ebox/CGI/Objects/View/MemberTable?directory=objectTable/keys/obje9972/members&backview=/ebox/Object/View/MemberTable . The backview parameter is currently not implemented but its behaviour should follow the back action button from traditional web browsers.