MyMobileWeb Certification Part II


Published on

MyMobileWeb Basic Development

Published in: Business, Technology, Education
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

MyMobileWeb Certification Part II

  1. 1. MyMobileWeb “Authoring adaptive Mobile Web Applications with MyMobileWeb” FIT-350405-2007-1 FIT-350401-2006-2
  2. 2. Part II MyMobileWeb Basic Development
  3. 3. Contents <ul><li>Introduction and concepts </li></ul><ul><li>High Level Execution Architecture </li></ul><ul><li>Authoring your user interface </li></ul><ul><ul><li>IDEAL Language 1.1 </li></ul></ul><ul><ul><li>User Interface Components </li></ul></ul><ul><ul><li>Styles </li></ul></ul><ul><ul><li>Data binding </li></ul></ul><ul><ul><li>Multiple Layouts </li></ul></ul><ul><ul><li>Selection </li></ul></ul><ul><li>Client-Server Interaction </li></ul><ul><ul><li>Java-Based Event Handlers </li></ul></ul><ul><ul><li>Defining the server-side behaviour using SCXML </li></ul></ul><ul><ul><ul><li>Cool URIs </li></ul></ul></ul><ul><li>Defining client-side behaviour using XML Events </li></ul><ul><li>Configuration & Deployment </li></ul>
  4. 4. Introduction <ul><li>MyMobileWeb is an open source platform that simplifies the development of mobile web applications and portals </li></ul><ul><ul><li>A low-cost platform (no license fees). LGPL v 3.0 </li></ul></ul><ul><ul><li>A modular product, open-standards-based </li></ul></ul><ul><ul><ul><li>Other open sources technologies are used ( Device Information Simple API , Batik, Xerces, Xalan,…) </li></ul></ul></ul><ul><ul><li>All-Java product that only requires a minimal Servlet/JSP container (Tomcat for example) </li></ul></ul><ul><li>Provides different modules which cover all the basic requirements that must meet a complete and integrated mobile solution, hiding all the complexity related to dealing with multiple delivery contexts </li></ul><ul><li>Includes experimental modules related to the exploitation of semantics in a mobile environment </li></ul><ul><li>Applicability </li></ul><ul><ul><li>dotMobi applications and portals </li></ul></ul><ul><ul><li>Mobile solutions intended to work in an uncontrolled environment (multiple devices) </li></ul></ul><ul><ul><li>Creation of mobile content channels based on JSR-170-based CMS or RSS </li></ul></ul><ul><ul><li>Offline / online mobile solutions (not covered in this course) </li></ul></ul>
  5. 5. Vision <ul><li>Mobile Web development should be driven by a “Channel Model” based on Service Oriented Architectures (SOA) </li></ul><ul><ul><li>Applications publish business services that can be invoked from different channels: traditional Web Channel and Mobility Channel </li></ul></ul><ul><ul><li>Services are independent of the channel and need not to be duplicated </li></ul></ul><ul><ul><li>Mobile Channel is different than Web Channel (in general) </li></ul></ul><ul><ul><ul><li>Markup transcodification is an anti-pattern </li></ul></ul></ul><ul><ul><ul><li>It has different views and navigation schema </li></ul></ul></ul><ul><ul><ul><li>Both channels can be integrated in the same server and CMS but they are essentially different </li></ul></ul></ul><ul><ul><ul><li>Aligned with the dotMobi vision </li></ul></ul></ul><ul><ul><li>Typically a mobility channel only addresses a small percentage of functionality </li></ul></ul><ul><ul><li>Mobile Channel is composed by </li></ul></ul><ul><ul><ul><li>Information that users want to access while they are on the move </li></ul></ul></ul><ul><ul><ul><li>Information that people want all the time </li></ul></ul></ul><ul><li>RAD of MultiChannel and MultiDevice Services (Reduction of time & budget and common development skills) </li></ul>
  6. 6. Main Features <ul><li>“ Flexible authoring style that consists in to design once for all kind of delivery contexts, in addition to, when needed, a combination of adaptation policies and / or customized variants of few resources for specific delivery contexts” </li></ul><ul><li>Differential aspects against competitors </li></ul><ul><ul><li>High performance architecture (no markup transcodification) </li></ul></ul><ul><ul><li>Automatic code generation for local (Javascript-based) and server-side validations </li></ul></ul><ul><ul><li>Smart Literal Management (literal redefinition) </li></ul></ul><ul><ul><li>Extensible mobile visual & AJAX controls </li></ul></ul><ul><ul><li>Intelligent management of paging for each visual control </li></ul></ul><ul><ul><li>Integrated with JSR-170 -based CMS & Alfresco </li></ul></ul><ul><ul><li>Available Image Transcoding (with OMA-STI and Alembik ) </li></ul></ul><ul><ul><li>Media Set & Content Selection </li></ul></ul><ul><ul><li>Exploiting the Delivery Context (integrated with Device Information Simple API , Device clustering) </li></ul></ul><ul><ul><li>Being aware geolocation, screen orientation changes & context </li></ul></ul>
  7. 7. Preliminary Concepts (I) <ul><li>Presentation Operation (OP) </li></ul><ul><ul><li>A set of presentations (views) plus their flow supporting an use case </li></ul></ul><ul><li>Presentation Pseudo-Operation </li></ul><ul><ul><li>POs that exit in all applications (platform-managed) </li></ul></ul><ul><ul><ul><li>E.g. Login  entry point to the application (if any) </li></ul></ul></ul><ul><li>Presentation or view </li></ul><ul><ul><li>Set of visual controls grouped in containers, allowing user interaction (specified in XML format) </li></ul></ul><ul><li>Data binding </li></ul><ul><ul><li>Technology that makes possible to automatically associate an element of data with a visual control and vice versa </li></ul></ul><ul><li>Expression Language (EL) </li></ul><ul><ul><li>Enables data referencing using dotted notation, delivery context functions, convenience functions, … </li></ul></ul>
  8. 8. Preliminary Concepts (II) <ul><li>Application Operation (OA) </li></ul><ul><ul><li>A business-logic-related operation (e.g. querying the data of a company so the result is created in the context </li></ul></ul><ul><li>Context </li></ul><ul><ul><li>Hierarchical Data Store. It contains the data used by the application. </li></ul></ul><ul><ul><li>Context Levels: request, presentation, OP, session and application (compatibles with JavaServlet context levels) </li></ul></ul><ul><li>Flow / Dialogue Manager </li></ul><ul><ul><li>It is responsible of deciding what actions to execute in response to an event caused by the user in his device (AOs execution or navigate to a new presentation) </li></ul></ul><ul><li>Delivery Context Management </li></ul><ul><ul><li>Recognizes the user's device / web browser and find out their capabilities </li></ul></ul>
  9. 9. Preliminary Concepts (III) <ul><li>Style Manager </li></ul><ul><ul><li>Determines which are the properties associated with each UI component, according to what is specified by the developer and to the technology and family of the destination device for which the presentation is generated </li></ul></ul><ul><li>Validator </li></ul><ul><ul><li>Implements the logic needed to automatically carry out the unitary validation according to what is specified by the developer at design time (locally & remotely) </li></ul></ul><ul><li>Messages Manager </li></ul><ul><ul><li>It shows messages in different languages which can be parameterized with context data </li></ul></ul><ul><li>Literal Manager </li></ul><ul><ul><li>It shows application literals in the appropriate language and it is possible to redefine literals by device families </li></ul></ul>
  10. 10. Preliminary Concepts (IV) <ul><li>Content Manager </li></ul><ul><ul><li>It is in charge of finding the best resource for a specific delivery context, such as images, audios or videos </li></ul></ul><ul><li>Code Generator </li></ul><ul><ul><li>Generates the code for the presentations specified by the developer at design time </li></ul></ul><ul><ul><ul><li>XML  JSP + Script code for validation + Mapping and validation meta-information XML files </li></ul></ul></ul><ul><li>Literal Extractor </li></ul><ul><ul><li>Extract application literals to be translated </li></ul></ul><ul><ul><li>This component enables the development in the native language of each programmer without the need to handle literal identifiers </li></ul></ul>
  11. 11. High Level Execution Architecture (I)
  12. 12. High Level Execution Architecture (II) <ul><li>At the device side, when a user interaction causes an event to be treated at the server side, it is sent an HTTP request which contains: </li></ul><ul><ul><li>the identifier of the visual control that raised the event. </li></ul></ul><ul><ul><li>the event identifier. </li></ul></ul><ul><ul><li>data that might have been entered by the user. </li></ul></ul><ul><li>At the server side, the Delivery Context Management recognizes the device and retrieves all property values if it has not been done previously </li></ul><ul><li>The request is initially processed by the MyMobileWeb Server Platform. Then, data is validated, and if validations are ok, data items are stored in the context. The context is a container that holds all the model data items, and it is structured hierarchically in different scopes (application, session, use case, view, etc.). </li></ul>
  13. 13. High Level Execution Architecture (III) <ul><li>There are two kind of events sent from the device: </li></ul><ul><ul><li>Application-specific events </li></ul></ul><ul><ul><ul><li>They have to do with the functionality of the application and are treated by specific handlers (well-known Java classes or SCXML) provided by programmers </li></ul></ul></ul><ul><ul><li>MyMobileWeb-specific events </li></ul></ul><ul><ul><ul><li>Handled automatically by MyMobileWeb, so application developers need not to worry about them (e.g. a next page event is raised when the user is paginating over the contents of a table) </li></ul></ul></ul><ul><li>Application-specific event handlers decide on how to process an incoming request </li></ul><ul><ul><li>Typically they will call application operations (AOs) to get more data to be put into the model and, finally, a redirection to the next view (identified by a logical name) will be made </li></ul></ul><ul><ul><ul><li>At this point, MyMobileWeb will be responsible of locating the appropriate JSP page according to the delivery context </li></ul></ul></ul><ul><ul><ul><ul><li>This JSP page will render the presentation and will resolve all the data and content bindings with the help of runtime libraries. </li></ul></ul></ul></ul>
  14. 14. IDEAL Language 1.1 (I) <ul><li>Traditional user interface are insufficient for supporting the new generation service front-ends </li></ul><ul><ul><li>Oriented to specific platforms, devices or modalities </li></ul></ul><ul><ul><ul><li>Normally a PC device and GUI modality (big screen mouse & keyboard) </li></ul></ul></ul><ul><ul><li>Imperative, platform and language-driven development style </li></ul></ul><ul><ul><ul><li>UI designers cannot fully concentrate on the real application requirements </li></ul></ul></ul><ul><li>Developers often don’t understand the difference between </li></ul><ul><ul><li>Authoring formats </li></ul></ul><ul><ul><ul><li>A format intended for humans that provides as many abstraction levels as possible </li></ul></ul></ul><ul><ul><li>Delivery formats </li></ul></ul><ul><ul><ul><li>A format to be interpreted directly by the client platform (the web browser, for example) </li></ul></ul></ul><ul><ul><li>HTML 4 / 5, CSS, etc are delivery formats </li></ul></ul><ul><ul><ul><li>Unfortunately in many occasions are used as authoring formats </li></ul></ul></ul>
  15. 15. IDEAL Language 1.1 (II) <ul><li>IDEAL is an Authoring Format easy-to-be learned by typical Web Authors for creating applications / content on the Ubiquitous Web </li></ul><ul><ul><li>Simple things should be easy (80%) </li></ul></ul><ul><ul><li>Complex things should be possible (20%) </li></ul></ul><ul><li>IDEAL v 1.1 is designed to deal with the problem of creating web applications that adapt to multiple Delivery Contexts </li></ul><ul><ul><li>Based on simple containers and UI Components </li></ul></ul><ul><ul><li>Prepared to be used mainly over the Java Platform </li></ul></ul><ul><ul><li>CSS is used for guiding the adaptation process </li></ul></ul><ul><li>We are designing the new generation of the IDEAL Language v 2.0 </li></ul><ul><ul><li>Modularization, extensibility (at the language and at the toolkit level), reusing markup, CSS cannot be sufficient to deal with adaptation policies,... </li></ul></ul>
  16. 16. Containers <ul><li>UI Components need to be grouped into containers. IDEAL v1.1 provides tow types of containers: </li></ul><ul><ul><li>Div includes UI components (container nesting is not allowed). The layout can be horizontal , grid or vertical </li></ul></ul><ul><ul><ul><li>It can be paginated if it has too many (for a given delivery context) child controls inside it </li></ul></ul></ul><ul><ul><ul><li>In that case the perceivable units by the user will be a set of screens chained by means of an interaction wizard </li></ul></ul></ul><ul><ul><li>Section allows to switch between different subscreens, similar to 'tabs' in desktop applications (includes div containers) </li></ul></ul><ul><ul><ul><li>There are different rendering options for a section container: multiple cards in WML, anchors in XHTML-MP, link to each subscreen, etc. </li></ul></ul></ul><ul><li>IDEAL v1.1 also provides mechanisms for reusing fragments of user interface definition markup between different presentations </li></ul><ul><ul><li>The include tag is typically used for navigation bars </li></ul></ul>
  17. 17. User Interface Components (I) <ul><li>Label </li></ul><ul><ul><li>It can contain any text and it’s used for labeling anything in an authored unit </li></ul></ul><ul><li>Entryfield </li></ul><ul><ul><li>This is an input field in which the user can enter any text </li></ul></ul><ul><ul><li>Developers can specify validations (required, datatype,…) </li></ul></ul><ul><li>Link </li></ul><ul><ul><li>This is a hyperlink that can be optionally decorated with an image </li></ul></ul><ul><li>Separators ( br & hr ) </li></ul><ul><ul><li>Line break & horizontal rule respectively </li></ul></ul><ul><li>Select </li></ul><ul><ul><li>Allows the selection of one ore more values from a list which can be rendered as a combobox , radio buttons , checkbox , menu , etc. It depends on the style properties and the delivery context </li></ul></ul>
  18. 18. User Interface Components (II) <ul><li>Menu </li></ul><ul><ul><li>It allows the selection of one between several items and, after that, an event is raised </li></ul></ul><ul><ul><li>Menus can be rendered in different ways such as a list of links, a combobox sensitive to changes, clickable images,… </li></ul></ul><ul><ul><li>Menu items could be decorated with an image or even be numbered with direct access through access keys </li></ul></ul><ul><ul><li>MyMobileWeb takes care of the pagination of the menu (if needed) </li></ul></ul><ul><li>ChainedMenu </li></ul><ul><ul><li>It is a set of depending menus, i.e. the items of one menu depends on the value(s) selected in previous menus </li></ul></ul><ul><ul><li>A chained menu is rendered as a wizard in mobile phones and as a set of combos (popup lists) in PDAs </li></ul></ul><ul><li>Submit </li></ul><ul><ul><li>This control triggers an update of the model. When the user activates the control all the data in the current form on screen is posted to the server, starting the process of model (the context) updating, checking validations </li></ul></ul>
  19. 19. User Interface Components (III) <ul><li>Action </li></ul><ul><ul><li>It’s a control to request something from the UI but no context updating occurs. Depending on the delivery context and the device it can be rendered as a button, as a link,… </li></ul></ul><ul><li>Reset </li></ul><ul><ul><li>Reset the fields of your form </li></ul></ul><ul><li>Image </li></ul><ul><ul><li>A control that displays a tiny picture in the screen which can be defined as value of src or resourceid attribute </li></ul></ul><ul><li>List </li></ul><ul><ul><li>Represents data in list mode. Each list item can be decorated using an image or an index number. Lists are paginated automatically according to the delivery context </li></ul></ul><ul><li>Textarea </li></ul><ul><ul><li>It is an area of free text (possibly with multiple lines) which can be readonly or disabled </li></ul></ul>
  20. 20. User Interface Components (IV) <ul><li>Table </li></ul><ul><ul><li>Represents data in tabular mode and each column can be clickable or not depending on the style settings </li></ul></ul><ul><ul><li>Tables are automatically paginated if needed. </li></ul></ul><ul><ul><li>An interesting feature is that programmers can specify the visualization of more or less columns depending on the target delivery context </li></ul></ul><ul><li>Object </li></ul><ul><ul><li>It allows to put any multimedia object in a view. It has similar semantics than the 'object' tag in (X)HTML </li></ul></ul><ul><li>Upload </li></ul><ul><ul><li>It allows the user to upload files through Web o WAP from a desktop browser or mobile device to the server </li></ul></ul><ul><li>Timefield </li></ul><ul><ul><li>It represents an input field that accepts time as input (hours, minutes, seconds). </li></ul></ul><ul><ul><li>It is parameterized by means of a mask </li></ul></ul>
  21. 21. User Interface Components (V) <ul><li>Datefield </li></ul><ul><ul><li>It is an input field that accepts a date as input. </li></ul></ul><ul><ul><li>Depending on the delivery context it can be rendered as a calendar, as a set of input fields or as a wizard </li></ul></ul><ul><li>Phonebookadder </li></ul><ul><ul><li>A visual component to add telephone number to my phone book. This control is an abstraction for developers that have not to worry about the different URL formats for specifying a phone book adder </li></ul></ul><ul><li>TelephoneCaller </li></ul><ul><ul><li>A visual component to trigger a phone call from a user interface page </li></ul></ul><ul><ul><li>This control is an abstraction for developers that have not to worry about the different URL formats for specifying a call </li></ul></ul>
  22. 22. Styling (I) <ul><li>MyMobileWeb has adopted CSS style sheets as the mechanism for specifying presentation aspects (look and feel, etc.) with respect to visual controls, validations (required or not, number mask, max & min length,…) </li></ul><ul><ul><li>Each XML presentation file might be linked to one or more style sheets which must follow the CSS syntax </li></ul></ul><ul><ul><li>The properties and selectors that can be used are those specified in W-CSS plus some specific extensions defined by MyMobileWeb </li></ul></ul><ul><li>MyMobileWeb fully supports the cascading pattern for applying style sheets </li></ul><ul><ul><li>For instance, developers can specify a default style sheet that will apply to all the XML authored units. </li></ul></ul><ul><ul><li>Moreover, MyMobileWeb provides default CSS files that are applied when no style is specified by programmers </li></ul></ul><ul><li>From a device independence perspective, the most important point is the style overriding feature </li></ul><ul><ul><li>Using this feature a developer can change specific style properties of an authored unit depending on the delivery context. </li></ul></ul><ul><ul><li>For example, if a developer realizes that a background color is not readable on a device, she can easily change it for one another more suitable, by means of style overriding and without needing to change anything in the XML authored unit </li></ul></ul>
  23. 23. Styling (II) <ul><li>CSSs are stored in a directory which has as much subdirectories as redefinitions per markup technology or family of devices </li></ul><ul><ul><li>Multi-Device CSS are stored into generic directory </li></ul></ul>
  24. 24. Data Binding <ul><li>All UI Components are ready to perform automatic binding on both directions </li></ul><ul><ul><li>Context  UI Component  Context </li></ul></ul><ul><li>Binding attributes </li></ul><ul><ul><li>bind : contains the EL that addresses the datum at server side that will be automatically updated with user’s input </li></ul></ul><ul><ul><li>optionsbind : contains the EL that addresses the data at server side containing the items to be displayed by a UI component </li></ul></ul><ul><ul><li>validationtype : Indicates the type of validation associated with a Ui component (integer, string, date ...) </li></ul></ul><ul><ul><li>bindingtype : Indicates the type of the datum on which user’s input will be stored (Default coincides with validationtype ) </li></ul></ul><ul><ul><li>beantype : Indicates the type of object which will be the container of user’s input ( Map by default) </li></ul></ul>
  25. 25. <ul><li>Each UI component can define an optionsbind attribute with the EL that references its context data </li></ul><ul><ul><li>Excepting entryfield where bind and optionsbind are the same </li></ul></ul><ul><ul><li>member attributes can be declared to specify the data member for each sub-element </li></ul></ul><ul><li>E.g. each column of a table </li></ul><ul><li>It is developer’s responsibility to leave in context, under the corresponding key, the data to which each control is bound to </li></ul><ul><ul><li>Before requesting the presentation </li></ul></ul><ul><li>It is platform’s responsibility to take data from the context to render each control </li></ul><ul><li>MyMobileWeb doesn’t force to use default classes or data structures to perform automatic binding </li></ul>Data Binding – Context  Control (I)
  26. 26. <ul><li>This example is based on table control </li></ul><ul><li>Several options for optionsbind attribute </li></ul><ul><ul><li>Array of Java </li></ul></ul><ul><ul><li>List of List </li></ul></ul><ul><ul><li>List of Map’s </li></ul></ul><ul><ul><li>Any object that implements CollectionData interface </li></ul></ul><ul><li>Member attributes </li></ul><ul><ul><li>keymember: it is the key which is posted to server when one row is selected </li></ul></ul><ul><ul><li>member: it is the key which is posted to server when one row is selected </li></ul></ul><ul><li>The value of member attribute can be pointed by name or position inside of an Array </li></ul><ul><li>Rows will be automatically paginated by MyMobileWeb (if needed) </li></ul>DB – Context  Control – Example (I)
  27. 27. DB – Context  Control – Example (II)
  28. 28. DB – Context  Control – Example (III) <ul><li>Optionsbind attribute as List of Map’s </li></ul>
  29. 29. <ul><li>Once satisfied the validation stage, data from the mobile terminal should be stored in the context at the place specified by the attribute bind </li></ul><ul><ul><li>By default the data will become part of the context of PO, except that the EL specifies otherwise </li></ul></ul><ul><ul><ul><li>E.g.: ${sessionScope.data1} </li></ul></ul></ul><ul><ul><ul><ul><li>The data will be stored in the session context </li></ul></ul></ul></ul><ul><li>The mappings are made by means of the files *_meta.xml (generated automatically) </li></ul><ul><li>By default data are stored in the context with the type of validation specified (default String ) </li></ul><ul><ul><li>If you want to store data in a type different from the validation type, then you must specify the attribute bindingtype </li></ul></ul><ul><ul><li>The Java simple types can be stored by wrapping or using classes Holder provided by the platform </li></ul></ul>Data Binding – Control  Context (I)
  30. 30. <ul><li>The controls that generate more than one data (such as select multiple) are mapped directly to a Java type List containing so many objects of validation type specified as the number of data generated by the control </li></ul><ul><li>If the EL bind expression refers to a composite item, for example, ${data1.data2} , it is needed to search in context for 'data1' and establish the value in property 'data2' from 'data1 </li></ul><ul><ul><li>If you can not find 'data1' an object of class specified by beantype will be instantiate, to store in context, in the key 'data1‘ and assign value on 'data2' </li></ul></ul><ul><ul><li>If no beantype attribute is specified, then a Map will be instantiate and it will be added a key ‘data2” with the correspondent value </li></ul></ul>Data Binding – Control  Context (II)
  31. 31. DB – Control  Context – Example (I)
  32. 32. DB – Control  Context – Example (II)
  33. 33. Multiple Layouts (I) <ul><li>For achieving device independence, the layout of containers need to be specified using CSS properties </li></ul><ul><ul><li>Using this method and the style overriding techniques provided by MyMobileWeb, a developer can alternate multiple layouts depending on different families of devices, tiny mobile phones, smartphones, PDAs, etc. </li></ul></ul><ul><li>For example, in a PDA a designer would like to see a grid layout, because she has plenty of screen space whereas in a tiny mobile phone she would like to see a vertical layout </li></ul><ul><ul><li>Using MyMobileWeb, this can be achieved easily without duplicating any code and without additional effort by the developer </li></ul></ul>
  34. 34. Multiple Layouts (II)
  35. 35. Selection <ul><li>The expr attribute is used to determine whether or not the UI Component appears in the target delivery context ( display attribute is deprecated ) </li></ul><ul><ul><li>Using data on context </li></ul></ul><ul><ul><ul><li>expr=&quot;total gt 100&quot; </li></ul></ul></ul><ul><ul><li>User language </li></ul></ul><ul><ul><ul><li>expr=&quot;_MYMW_LANG == 'es_ES'&quot; </li></ul></ul></ul><ul><ul><li>Device belongs to the abstract family </li></ul></ul><ul><ul><ul><li>expr=&quot;dcn:belongsTo('PdaDevice') or dcn:belongsTo('PcDevice')&quot; </li></ul></ul></ul><ul><ul><li>Property values </li></ul></ul><ul><ul><ul><li>expr=&quot;propertyValue('fileUploadSupport‘)” </li></ul></ul></ul><ul><ul><ul><li>expr=&quot;ddr:propertyValue ('scriptSupport')['ecmascript-MP']&quot; </li></ul></ul></ul>
  36. 36. Client-Server Interaction <ul><li>The generated pages always point to the same URL (corresponding to invoke the servlet DriverHTTP ), carrying at every moment the identifier of the visual control of the event that caused the output to the server </li></ul><ul><ul><li>If the event may have associated parameters are also sent </li></ul></ul><ul><ul><ul><li>E.g. the column of a table clicked </li></ul></ul></ul><ul><li>Additionally, the HTTP request contains data about the visual controls of the presentation </li></ul><ul><li>These data are properly identified in order to make the automatic binding </li></ul><ul><li>URLs are generated by the URLManager component, which takes into account whether the device supports cookies or not or even whether or not supports HTTPS </li></ul><ul><li>In each URL introduces two parameters control </li></ul><ul><ul><li>_t  Timestamp to avoid caching in browsers </li></ul></ul><ul><ul><li>_s  Token sequence that solves the problem of button 'Back' browsers </li></ul></ul>
  37. 37. Client-Server Interaction (new Session) Request Set context variables of Platform as Language, Token Sequence, ... Call Login PO Execute Profile Manager (user profile on context) and Session Initializer Login OK Recognize Device (Device instance on context) No Yes Call first application PO Device Execute Login Manager
  38. 38. Client-Server Interaction (Session OK) Control + Event + Data + Sequence Data Validation Update Context Delegate Flow Engine Sequence OK Navigate Current View Validation OK Navigate Error View Specific Event No No Yes Yes No Yes Handle Device
  39. 39. Application Initializer (I) <ul><li>Applications could specify an initializer class which will be automatically invoked by the framework only once </li></ul><ul><li>This class can be used to initialize any type of component used internally by the application: pool, stubs, reading configuration files,... </li></ul><ul><li>The Initializer must be a class that implements the ApplInitializer interface </li></ul><ul><li>The specification of initializer implementation is optional </li></ul><ul><li>Configuration example ( MyMobileWeb.Global.xml ) </li></ul>
  40. 40. Application Initializer (II) <ul><li>Reading application configuration file </li></ul>
  41. 41. Session Initializer (I) <ul><li>Initializer shall be in charge of executing session initialization (by each new session) </li></ul><ul><li>Context variables used internally by each session </li></ul><ul><li>It must implement SessionInitializer interface </li></ul><ul><li>Session Initializer is optional </li></ul><ul><li>Configuration example ( MyMobileWeb.Global.xml ) </li></ul>
  42. 42. Session Initializer (II) <ul><li>The “terminalWAP” variable is true when the preferred markup is wml_1 </li></ul>
  43. 43. Login Manager (I) <ul><li>MyMobileWeb provides different Login Manager (several authentication mechanism) </li></ul><ul><li>Login Manager must implement ILoginManager interface </li></ul><ul><ul><li>getLogin() </li></ul></ul><ul><ul><li>getPass() </li></ul></ul><ul><ul><li>login(user,pass) </li></ul></ul><ul><li>Platform provides several mechanism which can be used by the application directly or inherit from them, example: </li></ul><ul><ul><li>NoLogin to be specified by an application that doesn’t require a login page </li></ul></ul><ul><ul><li>RemoteUserLogin when the authentication is resolved using a RemoteUser mechanism </li></ul></ul><ul><ul><li>CustomLogin takes user and password from the HTTP request </li></ul></ul><ul><ul><li>CustomLoginLDAP derived form CustomLogin and performs the user validation against an LDAP Server </li></ul></ul><ul><li>Configuration example ( MyMobileWeb.Global.xml ) </li></ul>
  44. 44. Login Manager (II) <ul><li>My Login Manager extends CustomLogin Class </li></ul>
  45. 45. Profile Manager (I) <ul><li>It is responsible of calculating the profile of the user each time it creates a new user session </li></ul><ul><li>Applications must implement the interface IProfileManager , which publishes a single method that allows the application to return the object that represents the user's profile </li></ul><ul><li>The user profile is stored in the session context and is available at any time using the utility class ContextUtil </li></ul><ul><li>Configuration example ( MyMobileWeb.Global.xml ) </li></ul>
  46. 46. Profile Manager (II) <ul><li>Login Manager example and JavaBean that stores the user profile </li></ul>
  47. 47. Automatic Validations <ul><li>Data sent from the presentations of mobile device are not stored in the context until unitary validations (automatic) has been passed </li></ul><ul><li>The validations can be local (resolved in scripting language) or remote resolved using the validation information in the * _meta.xml files </li></ul><ul><li>The validations are performed following several stages </li></ul><ul><ul><li>Compulsory validations </li></ul></ul><ul><ul><li>Format validations </li></ul></ul><ul><ul><li>Type and range validations </li></ul></ul><ul><li>If the unitary validations fails, it is generated an error message in the user language </li></ul><ul><ul><li>When the validations is local, the script code automatically generated is executed </li></ul></ul><ul><ul><ul><li>The multilanguage has been solved including the suitable script file </li></ul></ul></ul><ul><li>It is possible to incorporate specific validations of the application on script code </li></ul><ul><ul><li>Extensible and open mechanism </li></ul></ul>
  48. 48. MVC Framework Flow Definition <ul><li>The design of the presentation layer and its grouping in POs and presentations determines the flow specification </li></ul><ul><li>The flow consist of </li></ul><ul><ul><li>PO Welcome (o ptional )  PO Login (o ptional )  First Application PO  ...  PO N ...  Logout </li></ul></ul><ul><li>The Flow Engine is a component that depending on the control and event fired by the user at the terminal, the PO, presentation and context data (state in the server side) decides what actions must execute </li></ul><ul><ul><li>These actions will end by sending a new page to the user's terminal </li></ul></ul><ul><ul><li>There are events that are automatically managed by the framework </li></ul></ul><ul><ul><ul><li>Pagination, Welcome, Login, Back message .... </li></ul></ul></ul><ul><ul><li>It is a component that any application can develop freely implementing a Java interface automatically invoked by the framework. </li></ul></ul><ul><ul><ul><li>MyMobileWeb provides two flow engines: </li></ul></ul></ul><ul><ul><ul><ul><li>Java-Based Event Handlers (methods of Java classes) </li></ul></ul></ul></ul><ul><ul><ul><ul><li>SCXML </li></ul></ul></ul></ul>
  49. 49. Flow engine based on handlers events <ul><li>It is a flow engine that invokes methods of events handlers classes implemented by the developer of the application </li></ul><ul><ul><li>They have the form </li></ul></ul><ul><ul><ul><li><controlId_event(RequestData,IActionExecutor)> </li></ul></ul></ul><ul><ul><li>For example, if you would like to respond to onclick event of a control link with id ‘m1', you would write a method called </li></ul></ul><ul><ul><li>RequestData giving access to data of the current request (context, etc.) </li></ul></ul><ul><ul><li>IActionExecutor provides methods for implementing actions </li></ul></ul><ul><li>Handler classes are placed in a base package (configurable) following a hierarchical structure determined by the POs </li></ul>
  50. 50. Event Handler <ul><li><Handler_Package_Base>.DefaultEventHandler </li></ul><ul><ul><li>Global Handler of the application </li></ul></ul><ul><ul><li>E.g. a control 'Home' which always go to the first presentation of PO </li></ul></ul><ul><li><Handler_Package_Base>.<PO_Name>.<PO_Name>EventHandler </li></ul><ul><ul><li>Handler for a whole PO </li></ul></ul><ul><ul><li>If you want that in a whole PO certain events are managed in the same way regardless of the presentation </li></ul></ul><ul><ul><li>onInitOP() method to put the code that enables the entry to the PO </li></ul></ul><ul><li>Handler_Package_Base.<PO_Name>.<Presentation_Name>EventHandler </li></ul><ul><ul><li>Presentation Handler </li></ul></ul><ul><li>For a control and event, the search order of the handlers goes from the most specific (within the presentation handler that has the control), to the most generic (the default handler) </li></ul><ul><ul><li>If at the end the event handler could not be located, it will go to the presentation that had been showed previously </li></ul></ul>
  51. 51. Example - Handlers Hierarchy
  52. 52. Handlers: Action <ul><li>When the handlers are invoked the data from the screen that caused the output to the server has been validated and established in the context (in the location specified by the bindings) </li></ul><ul><li>The code of the managers access to the context data and decide what action execute </li></ul><ul><ul><li>Invoke an AO </li></ul></ul><ul><ul><ul><li>Defined in the XML of AOs configuration </li></ul></ul></ul><ul><ul><li>Call another PO (last action) </li></ul></ul><ul><ul><ul><li>The call to another PO leads to destruction of all PO the context data of PO except those who decide to preserve or mapping </li></ul></ul></ul><ul><ul><li>Show a presentation (last action) </li></ul></ul><ul><ul><ul><li>The identifier of the presentation coincides with the name of the XML file that defines it, without extension </li></ul></ul></ul><ul><ul><li>Show a message (last action) </li></ul></ul><ul><ul><ul><li>Typically defined in the messages file </li></ul></ul></ul><ul><li>When entering a new PO onInitOP() method of the called PO is automatically invoked </li></ul>
  53. 53. Example – Event Handlers <ul><li>PO Handler Example </li></ul>
  54. 54. Application Operations (I) <ul><li>They are defined by an XML file, which indicates the class that implements such AO ( OAConfing.xml File) </li></ul><ul><li>It is ensures that for every AO there is only one instance in the entire application simultaneously accessed both by N threads </li></ul><ul><li>The AO must implement the ApplicationOperation interface </li></ul><ul><ul><li>Init, executed only once in the whole application </li></ul></ul><ul><ul><li>Execute , where it is the AO code </li></ul></ul><ul><ul><ul><li>It receives as parameter the context </li></ul></ul></ul><ul><ul><ul><li>The AO takes data from the context and stores data in it </li></ul></ul></ul>
  55. 55. Application Operations (II) <ul><li>Select_OA implements an application operation that stores data for select control </li></ul>
  56. 56. SCXML <ul><li>XML-based flow definitions with SCXML </li></ul><ul><ul><li>General-purpose state-machine language. </li></ul></ul><ul><ul><li>W3C Working Draft : (May 2008) </li></ul></ul><ul><ul><li>Commons SCXML Impl : http:// / </li></ul></ul><ul><ul><ul><li>MyMobileWeb currently uses commons SCXML 0.8 </li></ul></ul></ul><ul><ul><ul><li>Based on the Working Draft published on 21 February 2007 </li></ul></ul></ul><ul><ul><ul><ul><li> </li></ul></ul></ul></ul>
  57. 57. SCXML – Why to choose it <ul><li>Advantages against Java-Based event handlers </li></ul><ul><ul><li>Standards-based, avoids dependency on proprietary flow modeling mechanisms. </li></ul></ul><ul><ul><li>Easy to read, maintain and evolve. </li></ul></ul><ul><ul><li>Possibility to design the state machine with graphical tools. </li></ul></ul><ul><ul><li>Flexibility. </li></ul></ul>
  58. 58. SCXML – Language - Core Elements <ul><li>Core Elements : <scxml>, <state>, <transition>, <initial>, <onentry>, <onexit> </li></ul><ul><ul><li>Other Elements : <parallel>, <history>, <final> </li></ul></ul><ul><li>Executable Content : <event>, <if>, <elseif>, <else>, <log> </li></ul><ul><li>Custom Actions </li></ul><ul><ul><li>mymw:executeOA : Allows the user to invoke an Application Operation (OA) </li></ul></ul><ul><ul><li>mymw:invokeMethod : Allows the user to invoke a specific method in a concrete Java class. </li></ul></ul><ul><ul><li>mymw:logout : This action allows the user to perform the typical MyMobileWeb logout. </li></ul></ul><ul><ul><li>mymw:propagateOpVars : This action allows the user to specify what context variables will be propagated to the next OP context, and also new possible parameters. </li></ul></ul><ul><ul><li>mymw:showMessage : This action allows the user to show a message to the user. </li></ul></ul>
  59. 59. SCXML – Configuration <ul><li>MyMobileWeb.Global.xml </li></ul><ul><li>Flow is defined in a file MyMobileWeb.Flow.xml </li></ul>
  60. 60. SCXML – Basic Example (I)
  61. 61. SCXML – Basic Example (II)
  62. 62. SCXML – Elements – scxml <ul><li>It is the top-level root element. </li></ul><ul><li>Must define an initial state ( initialstate ) </li></ul><ul><li>Must define MyMW namespace ( xmlns:mymw ) to use custom actions </li></ul>
  63. 63. SCXML – Elements – initial <ul><li>This element represents the default initial state for a complex state with sequential substates. </li></ul>
  64. 64. SCXML – Elements – state <ul><li>Represents a state within the state machine. </li></ul><ul><ul><li>id attribute: The value of the  id  attribute will depend on the kind of state. This naming convention could change in a future. </li></ul></ul><ul><ul><ul><li>OP State: “ N ame O p” </li></ul></ul></ul><ul><ul><ul><li>Presentation State: “ N ameOp _n amePresentation” </li></ul></ul></ul><ul><ul><ul><li>Generic State: “ g enericState” </li></ul></ul></ul><ul><ul><li>src attribute: The value of the  src  attribute will be a relative (to the Flow_Base_URL) path containing material to be inserted into this state </li></ul></ul><ul><ul><ul><li>http://localhost:8080/MyApplication/flows/FirstOp/Flow.xml . </li></ul></ul></ul>
  65. 65. SCXML – Elements – transition <ul><li>Transitions between states are triggered by events </li></ul><ul><ul><li>event attribute : MyMW Control + “_” + MyMW Event Identifier </li></ul></ul><ul><ul><li>cond attribute : Any MyMobileWeb boolean EL </li></ul></ul><ul><ul><li>target attribute : Target state </li></ul></ul>
  66. 66. SCXML – Elements – onentry <ul><li>Executed when the state machine enters a state </li></ul>
  67. 67. SCXML – Elements – onexit <ul><li>Executed when the state machine leaves a state </li></ul>
  68. 68. SCXML – Custom Actions mymw:executeOA <ul><li>mymw:executeOA : Allows the user to invoke an Application Operation (OA) </li></ul>
  69. 69. SCXML – Custom Actions mymw:invokeMethod <ul><li>mymw:invokeMethod : Allows the user to invoke a specific method in a concrete Java class. </li></ul>
  70. 70. SCXML – Custom Actions mymw:logout <ul><li>mymw:logout : This action allows the user to perform the typical MyMobileWeb logout. </li></ul><ul><li>Makes the navigation flow to restart </li></ul>
  71. 71. SCXML – Custom Actions mymw:propagateOpVars <ul><li>mymw:propagateOpVars : This action allows the user to specify what context variables will be propagated to the next OP context, and also new possible parameters. </li></ul>
  72. 72. SCXML – Custom Actions mymw:showMessage <ul><li>mymw:showMessage : This action allows the user to show a message to the user. </li></ul>
  73. 73. SCXML - Cool URI <ul><li>A clean, elegant URL scheme is an important detail in a high-quality Web application. Maybe the most interesting arguments on why URLs should be clean and usable are: </li></ul><ul><ul><li>Ability to bookmark and remember individual pages. </li></ul></ul><ul><ul><li>SEO related stuff: allow crawlers (e.g. Googlebot) to index the website, better URI naming… </li></ul></ul><ul><li>Since MyMW version 3.4.1, the new SCXML Flow Manager defines: </li></ul><ul><ul><li>A new event ( onrequest ) </li></ul></ul><ul><ul><li>A function to define matching conditions for the requested URI against regular expressions. </li></ul></ul><ul><li>See Cool URIs don’t change (by Tim Berners-Lee) </li></ul><ul><ul><li> </li></ul></ul>
  74. 74. SCXML - Cool URI Example <ul><li>Define the mappings in MyMobileWeb.Flow.xml </li></ul><ul><li>Use them in your own presentations </li></ul>
  75. 75. SCXML - Cool URI Restrictions <ul><li>Cool URIs MUST start with /app </li></ul><ul><li>It is mandatory to define a generic “waiting” state because the application is not always going to start with the same PO. </li></ul>
  76. 76. Defining behaviour using XML Events <ul><li>IDEAL v1.1 includes the Listener element of XML Events ( W3C Recommendation 14 October 2003 ) </li></ul><ul><ul><li>MyMobileWeb implements the target and observer attributes as xsd:IDREFS instead of xsd:IDREF </li></ul></ul><ul><li>Developers can define behaviour using the Listener element and the script tag </li></ul><ul><ul><li>This behaviour is define by means of Javascript code </li></ul></ul><ul><li>If you want to use a listener element you should use the XML namespace identifier </li></ul><ul><li>Listener element is a child of head tag </li></ul><ul><ul><li>Important: handler attribute does not need Javascript prefix </li></ul></ul><ul><ul><ul><li>handler=“javascript: toggleColor()” </li></ul></ul></ul>
  77. 77. XML Events – DOM Events Types <ul><li>Complete list of event types: </li></ul><ul><ul><li> </li></ul></ul><ul><li>MyMobileWeb implements all previous event types expect types related to notification of any changes to the structure of a document (DOMNodeRemoved, DOMNodeInserted, etc…) </li></ul>
  78. 78. XML Events – Example – Change Type
  79. 79. Application Configuration – Step I <ul><li>Point of entry to the mobility platform ( DriverHTTP Servlet, web.xml ) </li></ul><ul><li>Must be defined the configuration directory ( web.xml ) </li></ul>
  80. 80. Application Configuration – Step II <ul><li>LOG4J relative path is configured in MyMobileWeb.Global.xml </li></ul><ul><li>Define traces parameters ( logs/traces.xml ) </li></ul>
  81. 81. Application Configuration – Step III <ul><li>General Properties are configured in MyMobileWeb.Global.xml </li></ul><ul><ul><li>Login_Manager and initializers </li></ul></ul><ul><ul><li>First_Application_OP : first application PO </li></ul></ul><ul><ul><li>Context_Name: context name of the application </li></ul></ul><ul><ul><li>OA_Descriptor_File: AOs descriptor path </li></ul></ul><ul><ul><li>File with application specific configurations (if needed) </li></ul></ul>
  82. 82. Application Configuration – Step IV <ul><li>Delivery Context Management 3.4.1 </li></ul><ul><ul><li>View </li></ul></ul>
  83. 83. DeployTools Configuration – Generator I <ul><li>Basic configuration of an application used to perform the transformations ( MyMobileWeb.CodeGen.xml ) </li></ul><ul><li>Several execution modes </li></ul><ul><ul><li>Command line </li></ul></ul><ul><ul><li>Windows and Unix shell scripts provided by MyMobileWeb </li></ul></ul><ul><ul><li>ANT Build Tool ( http:// /) and build.xml file </li></ul></ul>
  84. 84. DeployTools Configuration – Generator II <ul><li>The parameters that the Generator can receive are: </li></ul><ul><ul><li>Directory with the configuration file (relative or absolute path) </li></ul></ul><ul><ul><ul><li>By default is named config and it is optional </li></ul></ul></ul><ul><ul><li>Application specification, POs and/or presentations to generate </li></ul></ul><ul><ul><ul><li>/<Applicattion_Name> </li></ul></ul></ul><ul><ul><ul><li>/<Applicattion_Name>/<PO_Name> </li></ul></ul></ul><ul><ul><ul><li>/<Applicattion_Name>/<PO_Name>/<Pres_Name> </li></ul></ul></ul><ul><ul><li>Examples </li></ul></ul><ul><ul><ul><li>java org.morfeo.tidmobile.transform.Generator /SalesForce </li></ul></ul></ul><ul><ul><ul><li>java org.morfeo.tidmobile.transform.Generator /SalesForce/Login/login </li></ul></ul></ul>
  85. 85. DeployTools Configuration – Generator III <ul><li>LOG4J Configuration ( MyMobileWeb.CodeGen.xml ) </li></ul><ul><ul><li>LOG4J path is configured in LOG4J_Config </li></ul></ul><ul><ul><li>Define trace parameters ( logs/traces.xml ) </li></ul></ul>
  86. 86. DeployTools Configuration – Extractor I <ul><li>Basic configuration of an application used to perform the extractions ( MyMobileWeb.LiteralExtractor.xml ) </li></ul><ul><li>Several execution modes </li></ul><ul><ul><li>Command line </li></ul></ul><ul><ul><li>Windows and Unix shell scripts provided by MyMobileWeb </li></ul></ul><ul><ul><li>ANT Build Tool ( http:// /) and build.xml file </li></ul></ul>
  87. 87. DeployTools Configuration – Extractor II <ul><li>The parameters that the Extractor can receive are: </li></ul><ul><ul><li>Directory with the configuration file (relative or absolute path) </li></ul></ul><ul><ul><ul><li>By default is named config and it is optional </li></ul></ul></ul><ul><ul><li>Application(s) specification </li></ul></ul><ul><ul><ul><li>/<Applicattion_Name> </li></ul></ul></ul><ul><ul><li>Examples: </li></ul></ul><ul><ul><ul><li>java org.morfeo.tidmobile.transform.Extractor /SalesForce </li></ul></ul></ul><ul><ul><ul><li>java org.morfeo.tidmobile.transform.Extractor /SalesForce /MyApplication </li></ul></ul></ul>
  88. 88. DeployTools Configuration – Extractor III <ul><li>LOG4J Configuration ( MyMobileWeb.CodeGen.xml ) </li></ul><ul><ul><li>LOG4J path is configured in LOG4J_Config </li></ul></ul><ul><ul><li>Define trace parameters ( logs/traces.xml ) </li></ul></ul>
  89. 89. Consortium