wiki:Develop/Module Initialization

Module Initialization

or: How request parameter/variables are handled in Corinis.

Corinis handles parameter transparent in the modules.data classes.

Entry Point: The core class

The core class takes the request parameter from the browser (Request object) and pushes all parameter (post/get/multi-part) in the corinis.modules.core.Requests class, which holds all parameter for this page display.

Loading the module

A module is normally loaded using corinis.Core.getModule(ModuleClass?). This function does in order:

  • checks if the module is already instanced (caches the module)
  • loads the module if not already
  • returns the module

The module initialization

When a new module object is being created corinis uses following method:

  • set global variables (like request/response/context/core...)
  • call the init method (passing the configuration part from the corinis.xml):
    • initialize all data-view classes and put them in the dataViews arraylist
  • calls reinit:
  • takes all data-view classes and calls updateRequestParams which updates the class variables based on the request parameter:
    • if the request parameter is found for a variable it is set, if not the function variablenameDefault() of the data class is being called which should return a default value for the variable
    • after the parameters are set dataview.postInit() is being called to do some post-initialization stuff

Where to do what

default parameter: create a public datatype variablenameDefault() which will be called if no other value is being passed setting information that should not be changed: use the postInit()