== Requirements subsystem of APS Controller ==

Requiements processing consists of the following stages:

0. APS Controller extracts requirements metainformation
(element sa:requirements) from APP-META.xml

1. Business logic defines the destination context for future APS service
(Aps_Context_Abstract)

1. Aps_Requirements_Solver reduces requiements function to the set of supported
requirements, using information provided by Aps_Context_Abstract

2. The compatible Aps_Requirements, produced by
Aps_Requirements_Solver::getResult() are provided to business logic

3. Business logic either asks user or fills appropriate parameters of the
requirements objects Aps_Requiements::getObjects() [->getResources()]

4.  Business logic updates requirements and resources information with
Aps_Requirements::setObjects(), adding the necessary provision parameters
entered by user or machinery

5. Business logic calls Aps_Requirements_Processor to allocate the neccessary
resources and perform the neccessary configuration of destination context,
according to Aps_Requirements

6.  Aps_Requirements_Processor performs requirement processing for each
individual Aps_Requirement_Abstract in a particular Aps_Context_Abstract.
As a result of this action there are identifiers of resources
created/allocated/used (in Plesk) and set of environment variables values,
that must be used in sequent provision operations.

7. APS Controller saves the produced information in the persistent storage and
proceeds with the rest of provision activities (URL mapping or
configuration script)

== Working with requirements system ==

0. At the first stage requirements of the selected service must be analyzed
in scope of the context. It is performed by Smb_Aps_Model::solveRequirements()

1. If there are compatible requirements configuration, characteristics of
resources can be pre-filled to ease user input by Smb_Aps_Model::setRequirementsParams()

2. Then resulting Smb_Aps_Requirements is passed to page form and is shown to
user. The same object is serialized into hidden input of the form.

3. Upon form submit Smb_Aps_Requirements are extracted from hidden input and
initialized from submitted data.

4. Obtained requirements are checked with Smb_Aps_Model::checkRequirement()

5. If requirements parameters are OK - information is passed to
Smb_Aps_Model::provisionService()