• Nenhum resultado encontrado

Implementation

No documento HELSINKI UNIVERSITY OF TECHNOLOGY (páginas 55-65)

CHAPTER 5 TV-ANYTIME STANDARDS IMPLEMENTATION

5.4 Usage History

5.4.2 Implementation

46

Also, the action time information associated with each user action is specified in terms of GeneralTime.

The performance of each user's actions is stored into log file in the database for further analysis. There are WebPages available for collecting the usage history information. Fill the user's name; select the observation start time and period, and you will get the UsageHistory XML file.

There are some small simplifications to the usage history description definition.

First, the user should be able to decide, whether his or her usage information is allowed to be collected or not. The default setting is 'not_allowed' [31]. But, in this project, all we have are test users. We need their usage history information for further analysis. Thus, we set the value as 'allowed'. The UserActionHistory description scheme contains multiple lists of actions performed by the user over one or more, no-overlapping observation period [21] [31]. Due to the WebPages layout, we just order one observation period input in this stage.

47

<element name="UserIdentifier" minOccurs="0"/>

<element name="UserActionHistory"

type="mpeg7:UserActionHistoryType" minOccurs="1"

maxOccurs="unbounded"/>

</sequence>

<attribute name="allowCollection" use="true"

default="true"/>

</extension>

</complexContent>

</complexType>

Implementation

Figure 15. UsageHistory UML.

There are four private attributes in this class. Methods set and gets set or get the attributes. Method generateId() will return a unique UsageHistory ID as a String. Method parse() parses an XML file to a UsageHistory object. Method toXml() converts a UsageHistory object to XML file as a string. Method getDocument() reads a XML file as a String and returns the Document object.

2. User Identifier

UserIdentifier Description Scheme

48

<complexType name=" UserIdentifierType">

<complexContent>

<extension base="mpeg7:DSType">

<sequence>

<element name="Name" minOccurs="1"/>

</sequence>

<attribute name="protected" default="false"/>

</extension>

</complexContent>

</complexType>

Implementation

Figure 16. UserIdentifier UML.

There are two private attributes in this class, ‘_protected’ and ‘name’, represent Attribute ‘protected’ and Element ‘Name’, respectively. The functionality of these methods is easy to be understood from their names. Here, I must point out that though in the DS the Name is also an Element, it only contains a simple String value. Hence, there is no need to create an object for it.

3. UserActionHistory

UserActionHistory Description Scheme

<!-- Definition of UserActionHistory DS -->

<complexType name="UserActionHistoryType">

<complexContent>

<extension base="mpeg7:DSType">

49

<sequence>

<element name="ObservationPeriod"

type="mpeg7:TimeType" minOccurs="0" maxOccurs="unbounded"/>

<element name="UserActionList"

type="mpeg7:UserActionListType" minOccurs="1" maxOccours="unbounded"/>

</sequence>

<attribute name="protected" default="false"/>

</extension>

</complexContent>

</complexType>

Implementation

Figure 17. UserActionHistory UML.

In class UserActionHistory, method getObservationPeriods() returns an array of ObservationPeriod object, because there might be more than one observation periods. Method generateId() returns a UserActionHistory ID as a String object.

4. Observation Period

50 ObservationPeriod Description Scheme:

<complexType name="ObservationPeriodType">

<complexContent>

<extension base="mpeg7:DSType">

<sequence>

<element name="TimePoint"

minOccurs="1"/>

<element name="Duration"

minOccurs="1"/>

</sequence>

</extension>

</complexContent>

</complexType>

Implementation

Figure 18. ObservationPeriod UML.

Same as the UserIdentifier object, ObservationPeriod handles the Elements TimePoint and Duration as attribute and sets and gets their values.

5. UserActionList UserActionList DS

<! -- Definition of UserActionList Description Scheme -->

<complexType name="UserActionListType">

<complexContent>

<extension base="mpeg7:DSType">

<sequence minOccurs="0">

51

<element name="ActionType"/>

<element name="UserAction"

minOccurs="0" maxOccurs="unbounded"/>

</sequence>

<attribute name="numOfInstances"

type="nonNegativeInteger" use="optional"/>

</extension>

</complexContent>

</complexType>

Implementation

Figure 19. UserActionList UML.

Class UserActionList sets and gets the values of Attributes and Elements of Element UserActionList. As usual there are method parse() to parse the UserActionList and method toXml() to generate the XML file UserActionList as a String object.

6. ActionType ActionType DS:

<complexType name="ActionType">

52 <complexContent>

<extension base="mpeg7:DSType">

<sequence>

<element name="Name"

minOccurs="1"/>

</sequence>

</extension>

</complexContent>

</complexType>

Implementation

Figure 20. ActionType UML.

Element ActionType is simple, only contains a value. Thus, class ActionType sets and gets this value called ‘name’. Besides these two basic functions, there are parse() and toXml() methods as other classes.

7. User Action UserAction DS

<!-- Definition of UserAction DS -->

<complexType name="UserActionType">

<complexContent>

<extension base="mpeg7:DSType">

<sequence>

<element name="ActionTime"

minOccurs="0">

<complexType>

<sequence>

53

<element name="GeneralTime" type="mpeg7:TimeType" minOccurs="0"/>

</sequence>

</complexType>

</element>

<element name="ProgramIdentifier"

type="mpeg7:UniqueIDType"/>

</sequence>

</extension>

</compelxContent>

</complexType>

Implementation

Figure 21. Database Access Object UML.

Figure 16 shows that the database structure is designed as a Singleton pattern.

The term ‘Dao’ is an abbreviation of Database Access Object. Class LogDao is an abstract class. The upper level class should use this class and calls method LogDao.getUserActions() to get an array of UserAction Objects. Class InformixLogDao which externs abstract class LogDao executed the real database accesses actions. Class InformixLogDao gathers all log records from the database and generates the UserAction object array.

54 Figure 22. UserAction UML.

There are two parse() methods in UserAction class. One parses and UserAction Element to a UserAction object and the other parses a UserAction List to an array of UserAction objects.

8. Program Identifier ProgramIdentifier DS:

<complexType name="ProgramIdentifier">

<complexContent>

<attribute name="organization"/>

<attribute name="type"/>

</complexContent>

</complexType>

Implementation

55 Figure 23. ProgramIdentifier UML.

In this project the attribute ‘type’ is set as the category name of this program.

The attribute ‘organization’ is set as fixed value of ‘MobTV’. The attribute

‘name’ is the name of this program.

9. Action Time ActionTime DS:

<complexType name="ActionTime">

<complexContent>

<sequence>

<element name="GeneralTime"

type="mpeg7:TimeType" minOccurs="0"/>

</sequence>

</complexContent>

</complexType>

Implementation

Figure 24. ActionTime UML.

ActionTime DS shows that it contains an Element GeneralTime. As this element has only value, nothing else, there are no needs to create a new

‘GeneralTime’ object.

56

No documento HELSINKI UNIVERSITY OF TECHNOLOGY (páginas 55-65)

Documentos relacionados