This chapter provides information on the constraints that the Specification imposes on the implementation of Controller functionality.
The chapter focus is a Controller functions performed on application instance. To make the Controller implementation requirements stated in the chapter clearer, we illustrated each function-related statement with a sample scenario of how the function can be implemented.
Starting APS 1.1 an application instance comprises services. Services are an application functions or features that are delivered to end-user. Application may provide independent services as well as nested ones. Independent services are, so called, application 'root' services. Application must contain a 'root' service. A 'root' service may declare a number of child services. Each application service may be provisioned a number of times. Operations on services instances are performed within application instance.
The following table lists operations available in APS. Operations that can be performed on application instance or on service instances within installed application are marked with "X" in respective column.
Operation |
Application |
Service |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Important Points
One should pay attention to the issues below during implementing Controller functionality.
Archive content processing
Application may require a special processing of application archive content prior to its actual provisioning. Such requirements are declared with application/content element in the package metadata. For details, refer to the 5.1.16 Content Delivery Methods section of the Specification.
Services handling
Since an application instance comprises services the following information is specified for each service individually:
Child services may refer to requirements and settings of their parent one or declare their own.
All mentioned operations are performed on each application service individually. Operations on child services are performed within their parent one. Some application services can be provisioned automatically without a user involvement using settings default values. Whether service is to be provisioned automatically or not completely depends on Controller implementation.
Scripts handling
Usually, application package contains configuration scripts for each application service declared. Scripts should be located at the /scripts/ folder in the package root. The Controller must invoke respective script when performing any operation on application service, as defined by the Specification in section 5.3.2. Configuration Script. A configuration script may be used for provisioning, configuring, upgrading, removing, enabling and disabling application services.
A configuration script invocation means that the Controller runs the script with a particular interpreter in a specific environment where all the necessary data is presented in a form of environment variables. The Controller must choose the interpreters basing on the information about programming language in which each script is written. This info is provided by the "//script-language" element in the package metadata defined by the Specification in section 5.3.2. Configuration Script. Binary executable scripts are allowed and declared with "//binary-executable" element.
The Controller must always pass to the configuration script all the information about the application it could get and transform to environment variables for every script invocation, no matter what the invocation purpose is. The environment variables passed to configuration scripts are regulated by the Specification in section 5.3.2.2. Environment Variables. For better understanding what environment variables must be created by a Controller and then passed to application configuration script, refer to the Appendix. Sample APP-META.xml.
An application may additionally contain scripts that serve different from configuration one purposes, for example settings verification, resource usage reporting, application license installation, backing application up.
The details of Controller behavior specific for invoking scripts during a particular operation are considered further in the chapter.