Referencing policies in XDIME markup

There are certain guidelines that should be followed when referencing different types of policies in XDIME markup.

When policies are referenced in XDIME markup elements, the policy name must be preceded by a forward slash and must be followed by the policy file type extension. The following table shows examples of how to reference the Multi-Channel Server policies that can be created with Mobile Portal Toolkit.

Table 1. Multi-Channel Server policies and code examples
Policy Type Example
Audio Component
<realaudio name="/my-audio.mauc" />
where my-audio is the audio component policy name.
Layout and Theme
<canvas layoutName="/standard-layout.mlyt" theme="/standard-theme.mthm">
where standard-layout is the layout policy name and standard-theme is the theme policy name.
Image Component
<img src="/stars.mimg"/>
where stars is the image component policy name
Text Component
<xfform name="form1"  action="test.jsp" prompt="{/my-text.mtxt}"/>
where my-text is the text component policy name.
Rollover Image Component
<menuitem text="help" href="http://www.ibm.com" rolloverImage="/my-rollover-image.mrlv"/>
where my-rollover-image is the rollover image component policy name.
Chart Component
<chart pane="pane" name="/my-chart.mcht" />
where my-chart is the chart component policy name.
Link Component
<a href="{/my_link.mlnk}">some Link</a>
where my_link is the link component policy name.
Script Component
<script src="{/my-script.mscr}"/>
where my-script is the script component policy name.

The following table shows the complete list of policy file extensions.

Policy Type File Extension
Asset Groups .mgrp
Audio Components .mauc
Chart Components .mcht
Image Components .mimg
Link Components .mlnk
Rollover Image Components .mrlv
Script Components .mscr
Text Components .mtxt
Layouts .mlyt
Themes .mthm
Devices .mdpr

If a portlet references a policy in its project, then it can reference the policies using the style shown in the previous table. A policy is in the portlet's project if the policy file is in the mcs-policies directory of the portlet's WAR directory. The XDIME aggregator code can also reference policies in its project (the default project) in the same way.

If a portlet needs to reference a policy in a global policy project, it must reference it as shown in the following example:
<canvas layoutName="mcsi:policy('<user-friendly-project-name>', '/standard-layout.mlyt')" type="portlet">
where <user-friendly-project-name> is the user friendly project name for the global policy project and standard-layout is a layout policy in that project.
Note: See the Global policy projects topic for more information on the user-friendly project names.
If a portlet needs to reference a policy in the XDIME aggregator's global policy project, it must reference the policy as shown in the following example:
<canvas layoutName="mcsi:policy('default', '/aggregator-layout.mlyt')" type="portlet">
where aggregator-layout is a layout policy in the default (aggregator) project.
Note: It is possible for portlets to reference aggregator policies but this is not a recommended approach. The only exception is the theme policy. IBM® Mobile Portal Accelerator defines a single theme policy that is part of the default project and used by the aggregator and that is inherited by portlets.



Terms of use
(C) Copyright IBM Corporation 2012. All Rights Reserved.