The application descriptor is inspired by the Web Application Manifest concept introduced by the W3C. The application descriptor provides a central, machine-readable and easy-to-access location for storing metadata associated with an application or application component.
The data is stored in json format in the manifest.json file with attributes in different namespaces. It contains, for example, the app ID, the version, the data sources used, along with the required SAPUI5 components and SAPUI5 libraries. The existence of the manifest.json file must be declared in the component metadata. The developer creates the manifest.json file and it is then delivered as part of the application archive. After delivery, the file is read-only.
The application descriptor consists of three parts: the sap.app, sap.ui and sap.ui5 namespaces. The sap.app namespace contributes the following application-specific attributes:
id (mandatory): Unique identifier of the app; must correspond to the component ID/namespace
type: Possible values are application or component
version: Application version
ach: Application component hierarchy
dataSources: For example OData services with a unique key or alias, and specifying the URI, type and settings, such as the odataVersion
The sap.ui namespace contributes the following UI-specific attribute:
technology: Specifies the UI technology; value is UI5
The sap.ui5 namespace is basically aligned with the previous component metadata and contributes the following SAPUI5-specific attributes for the application descriptor:
dependencies: Specifies the external dependencies, such as libraries or components. The SAPUI5 core loads these dependencies before the component is initialized. You can use everything that is referenced here in your component code right from the start. Specify the external dependencies that are loaded by the SAPUI5 core during the initialization phase of the component and used afterwards, such as libraries or components:
minUI5Version: Minimum version of SAPUI5 that your component requires; this information helps you make sure that the features of the SAPUI5 runtime version of the component are available. As SAPUI5 does not currently enforce use of the correct version, the minUI5Version is used for information purposes only.
libs: ID (namespace) of the libraries that the SAPUI5 core should load for use in the component
components: ID (namespace) of the components that the SAPUI5 core should load for use in your component
The component declares the existence of the application descriptor by specifying manifest: "json" in the component metadata. Setting this flag makes the component load the manifest.json file and read the relevant entries for SAPUI5. This metadata is used to define the dependencies that need to be loaded in order to start the component. The following code snippet shows how to add the manifest link:
sap.ui.core.UIComponent.extend("sap.samples.Component", { metadata : { manifest: "json" } }
At runtime, the manifest content can be accessed from the component via the component metadata:
// get the component jQuery.sap.require("sap.samples.Component"); var oComponent = sap.samples.Component; // getting complete manifest from component metadata oComponent.getMetadata().getManifest(); //or getting a namespace oComponent.getMetadata().getManifestEntry("sap.app");