Application Packaging Standard

Last updated 18-Mar-2019

Meta Declaration

In the APP-META.xml file, you must define a navigation tree for the provider control panel (PCP) where providers can manage their offers. Also, you must declare the new offers service in the metadata.

../../../../_images/offer-step-model.png ../../../../_images/offer-step-meta-b.png ../../../../_images/offer-step-provision.png ../../../../_images/offer-step-presentation.png ../../../../_images/offer-step-deploy.png ../../../../_images/offer-step-provisioning.png

Services

The resource model contains an additional APS types called offer. It requires a declaration of the corresponding service called offers. In the service declaration, you need to specify a source file that contains the APS type definition and an executable file that defines the service management (provisioning) logic. In a case of using the APS PHP framework on your endpoint host, the best way is to define both parts in one PHP file.

Continue Your Demo Project

This section continues the demo project started in the previous step.

Declare Navigation Tree

In the project workspace, edit the APP-META.xml file using the Eclipse, IDEA, or a text editor:

  • Declare a navigation tree plugged into the PCP, id="pcp". In this project, only one tab named Offers will be created. Its initial content is defined by the item whose ID will be offers.
  • In the navigation tree, declare the cloud variable representing the application root resource of type http://aps-standard.org/samples/offer1p/cloud/1.0.
  • The top most view element will be implemented by the offers.html file, which name corresponds to the view ID - offers. This view will enable users to call the other views.
  • The offer-new view will be implemented by the offer-new.html file and used for creating a new offer. It declares two navigation controls (buttons): cancel and submit.
  • The offer-edit view will be implemented by the offer-edit.html file and used for editing offer parameters. It declares two navigation controls: cancel and submit.
  • In the offer-edit view, declare a variable offer, based on the http://aps-standard.org/samples/offer1p/offer/1.0 APS type. It will represent the offer opened for editing. Show its name property in the label by using the following form for the label: Offer {offer.name}. This makes the second word in the label dynamic, that is it wil be the same as the name property of the offer variable.

After respective modifications, the declaration of new navigation tree in the APP-META.xml file will look as follows:

<navigation id="pcp" label="Offer Management">
   <var type-id="http://aps-standard.org/samples/offer1p/cloud/1.0" name="cloud" />
   <plugs-to id="http://www.aps-standard.org/ui/application" />
   <item id="offers" label="Offer Management">
      <view id="offers" label="Offers">
         <view id="offer-new" label="New Offer">
            <controls>
               <cancel />
               <submit />
            </controls>
         </view>
         <view id="offer-edit" label="Offer {offer.name}">
            <controls>
               <cancel />
               <submit />
            </controls>
            <var type-id="http://aps-standard.org/samples/offer1p/offer/1.0"
                  name="offer" />
         </view>
      </view>
   </item>
</navigation>

In the existing CCP tree, add the select(offer) RQL filter to the vps variable. This allows getting the JSON representation of the offer linked with the selected for editing VPS:

<var type-id="http://aps-standard.org/samples/offer1p/vps/1.0" name="vps"
      filter="select(offer)"/>

Declare New Service

Declare the new offers service and in the <code> element specify that the APS type will be declared in the offers.php script.

<service id="offers">
   <code engine="php" path="scripts/offers.php"></code>
   <presentation>
      <name>VPS Offers</name>
      <summary>Service profiles for the cloud virtual private servers</summary>
   </presentation>
</service>

Conclusion

The project file APP-META.xml you have created is similar to the respective file in the sample package.