MyMobileWeb - DDR-RI Integration
From Morfeo Wiki
Introduction
The MyMobileWeb team is pleased to announce the availability of an implementation of W3C’s DDR Simple API specification, which has been integrated with MyMobileWeb Platform. This implementation is based on WURFL and UAProf data and supports the W3C’s Core Vocabulary and the MyMobileWeb Vocabulary.
You can download the integration MyMobileWeb with the API implementation 0.9.4 now and use it. Please test it and give us feedback and report us possible bugs. The integration is on test period so it's very important your help and collaboration.
The folder structure DeviceBBDD is:
- DeviceBBDD/devinfo - Vocabularies description and data sources mappings files
- DeviceBBDD/wurfl - WURFL data source and abstract families definition
- DeviceBBDD/uaprof - CCPP schemas
Configuration
- The new file MyMobileWeb.DevMng.xml is described below:
<configuration name="root">
<module name="devmgt">
<module name="devinfo">
<!-- Data base directory -->
<property name="data" value="C:/workspace/MyApp/DeviceBBDD" />
<!-- Data sources -->
<property name="sources" value="WURFL,UAPROF" />
<!-- Timeout to calculate the profile (in seconds) -->
<property name="timeout" value="5" />
<!-- Maximum number of attempts to calculate the profile (in seconds) -->
<property name="retry" value="5" />
</module>
<module name="cache">
<property name="refreshInterval" value="1" />
</module>
</module>
</configuration>
Examples
- Simple values (xs:string, xs:nonNegativeInteger, xs:boolean,...)
<Property name="displayWidth" datatype="xs:nonNegativeInteger"
aspects="&ALLASPECTS;" defaultAspect="&DEVICE;"/>
ContextUtil.getUserDeviceCapabilityAsInt(DDRCoreVocabulary.DISPLAY_WIDTH, ctx);
Figure 1.- displayWidth (ddrcv-description.xml) and code Java.
<Property name="displayHeight" datatype="xs:nonNegativeInteger"
aspects="&ALLASPECTS;" defaultAspect="&DEVICE;"/>
Device c = (Device) the_context.getElement("_MYMW_DEVICE");
c.getCapabilityValueAsInt(DDRCoreVocabulary.DISPLAY_HEIGHT);
Figure 2.- displayHeight (ddrcv-description.xml) and code Java.
<Property name="rendersTables" datatype="xs:boolean"
aspects="&WEBBROWSER;" defaultAspect="&WEBBROWSER;"/>
ContextUtil.getUserDeviceCapabilityAsBoolean(MyMobileWebVocabulary.TABLE_SUPPORT, ctx);
Figure 3.- rendersTables (mymw-description.xml) and code Java.
- Enumeration (xs:enumeration)
<Property name="imageFormatSupport" datatype="mymw:imageFormats"
aspects="&WEBBROWSER;" defaultAspect="&WEBBROWSER;"/>
Map imageFormatSupport = ContextUtil.getUserDeviceCapabilityGroupValues(DDRCoreVocabulary.IMAGE_FORMAT_SUPPORT, ctx);
if (imageFormatSupport.containsKey(ImageFormatSupportValues.GIF_87)){
Sysmtem.out.println("GIF is supported");
}
Figure 4.- imageFormatSupport (mymw-description.xml) and code Java.
<Property name="markupSupport" datatype="mymw:markupLanguages" aspects="&WEBBROWSER;" defaultAspect="&WEBBROWSER;" />
public static boolean isHTML4(Context ctx) {
Map markups = ContextUtil.getUserDeviceCapabilityGroupValues(DDRCoreVocabulary.MARKUP_SUPPORT, ctx);
return markups.containsKey(MarkupSupportValues.HTML_40);
}
Figure 5.- markupSupport (ddrcv-description.xml) and code Java.
- Presentation Layer
<mymw:image id="logo" alt="VLDMovil" display="deliveryContext.imageFormatSupport['gif87']"
src="resources/images/logo.gif"/>
Figure 6.- Expression language about delivery context