Profiling is the process of mapping a recognised useragent into a set of profiles in a 1:n mapping i.e <common-name>:<profile-set>. A profile is referred to by a unique character string. The term "useragent" is intended to be interpretted in as loose a way as possible. A "useragent" can be whatever you want it to be - a browser type, a message type etc. Basically, a "useragent" is anything that can be profiled!
A profile might typically be a classification of useragent based on a useragent characteristic e.g. the useragent supports JPEG images. A profile can be any characteristic you choose. Other examples might be based on the size of the device display (i.e "Large", "Medium", "Small"), the prefered type of markup ("HTML", "WML"), whether or not the browser supports CSS, the types of media support, the types of integrated devices (phone etc) and anything else you can think of.
A useragent is a "member" of a profile. Therefore, as you can imagine, multiple useragents may share "membership" of a given profile - they are all "members" of the profile.
Tinak is distributed with a default Device Profiling solution. If this solution does not cover the requirements of your project see Implementing a Device Profile Store.
Default Device Profile Store
As the name prefix "Default" might suggest, Tinak does not need to be configured in any way to use the Default Device Profile Store - it uses it by "default".
The Default Device Profile Store is initialised by an XML object called the Default Device Profiling Module. This module in an XML representation of the default Profile Store.
Module DTD
The module DTD can be viewed as a reference here.
Module Elements
The module root element is the device-profiles element. The device-profiles element contains one or more device-profile elements. The device-profile element defines one profile by declaring a name for the profile and listing all of the profile members i.e. all of the useragents that are members of that profile.
Attribute |
Description |
Required |
|---|---|---|
name |
The name of the profile. The name used to refer to the profile. |
Yes |
list |
The list of profile members. The list of useragents (by Common name) and profiles that are members of the profile. |
Yes |
Module Configuration
The Default Device Profiling Module is loaded by Tinak from a URL defined in the webapp deployment descriptor as described in the J2EE Deployment section. The profiling data in this module will need to be configured by the Tinak user.
An Example Module
A sample module can be referenced here.
Implementing a Device Profile Store
The Default Device Profile Store is very simplistic. You may need/wish to implement a more advanced Profile Store e.g. one based on open standards such as the Composite Capability/Preference Profiles (CC/PP) or UAProf standards. These standards can be reviewed on the W3C website.
Device Profiling in Tinak is implemented through the following set of interfaces:
- ProfileConfigDigester: Implementations of this interface are responsible for "digesting" the profile store data stream. This process would include creating the associated ProfileStore implementation instance and adding ProfileSet instances to the ProfileStore.
- ProfileStore: Implementations of this interface are responsible for storing instances of the associated ProfileSet and providing a lookup of these instances by useragent (device) name. This interface represents the Profile Store.
- ProfileSet: Implementations of this interface are responsible for storing all the profiles for a single useragent. In other words, it stores a useragent profile membership list for a single useragent. Each implementation instance is associated with a useragent and provides a mechanism for checking if the useragent is a member of a given profile.
As an example, the Default Device Profile Store is implemented through the following set of classes:
Once a new profile store is implemented, the webapp needs to be configured to use it. This is done by adding the classes to the webapp classpath and configuring the Servlet (or ServletContext) to "digest" the associated profile store data stream by using the new ProfileConfigDigester implementation. This is done by configuring the webapp's web.xml as follows:
<servlet> <servlet-name>aservlet</servlet-name> <servlet-class>org.milyn.some.AServlet</servlet-class> <init-param> <param-name>DeviceProfileDigester</param-name> <param-value>class-name</param-value> </init-param> </servlet>
or,
<context-param> <param-name>DeviceProfileDigester</param-name> <param-value>class-name</param-value> </context-param>