Creating Application Package Metadata File

The application package metadata file (called APP-META.xml) contains all information about application package. The XML presentation of the metadata is described by the RELAX NG schema (available at http://apsstandard.com/r/doc/package-format-specification-1.0/basic.rnc). Some schema elements are defined by aspects. It means that you must use aspects when adding the elements.

For details on metadata elements, refer to the 4.3. Metadata Descriptor, 4.4. Requirements and 4.5. URL mapping sections of the Specification.

For a sample of typical metadata file, refer to the Appendix A.

To create a metadata file, follow these steps:

1. Create file APP-META.xml in the package root directory and add the following elements and their attributes according to the 4.3. Metadata Descriptor section of the Specification.

Important: APP-META.xml content is recommended to be in UTF-8 encoding.

2. Add the technologies requirements of application and application package scripts according to technology-specific aspects. The aspects describing qualified technologies are found in the 6.0 Common Aspects section of the Specification. For details on the XML presentation of an application requirement, refer to the 4.4. Requirements section of the Specification.

For instance, if your application uses the PHP scripting language, and PHP version must be 5.0 or later, you should refer to the PHP aspect (see the 6.1. PHP aspect section of the Specification), read how the version requirement should be described in the metadata file (see the 6.1.1.1. Version requirement type of the Specification), and add the following child element to the requirements element: <php:version min="5.0"/>. The metadata fragment describing the requirement looks as follows:

 

<requirements xmlns:php="http://apstandard.com/ns/1/php">
    <php:version min="5.0"/>
</requirements>

 

If the code of your application is encrypted, for example, with ionCube, you need to declare the necessity of using ionCube Loader. To do so, add the following child element to the requirements element: <php:extension>ionCube Loader</php:extension>. The metadata fragment describing the requirements will look in this case as follows:

<requirements xmlns:php="http://apstandard.com/ns/1/php">
    <php:version min="5.0"/>
    <php:extension>ionCube Loader</php:extension>
</requirements>

 

3. Add URL mapping declarations according to the 4.5. URL Mapping section of the Specification.

URL mapping defines how to handle a request for a specific URL pertaining to the application. Some technologies require permission mappings for files or directories to be set. For instance, your application uses a PHP script located in the htdocs/core directory. The script is expected to write some data to a file located in the htdocs/tmp directory. Then the metadata file should contain the following info:

PHP is a qualified technology. Instructions on how to describe PHP handlers are found in the 6.1.2. URL handlers section. Instructions on how to describe PHP scripts permissions are found in the 6.1.3. Permissions section. Basing on these two sections and the XML presentation of the mapping element, the following fragment is to be added to the metadata file:

 

  <mapping url="/core" path="htdocs/core" xmlns:php="http://apstandard.com/ns/1/php">
    <php:handler>
        <php:extension>php</php:extension>
    </php:handler>
  </mapping>
 
  <mapping url="/tmp" path="htdocs/tmp" xmlns:php="http://apstandard.com/ns/1/php">
    <php:permissions writable="true"/>
  </mapping>

 

Note: Structure defined by URL mapping can differ from physical structure of an application instance.

For instance, the package with the mentioned above mapping declarations is instantiated to the http://www.example.com. The requests to http://www.example.com/core are handled by PHP scripts in the htdocs/core directory of the site. If the first mapping element had url="/php" argument, then the requests to http://www.example.com/php were handled by PHP scripts in the htdocs/core directory.