Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CHAPTER 2 THEORETICAL BACKGROUND Theoretical background will discuss about the theories that are needed in developing this client-mobile chat application. Starting with the definition of mobile instant messaging, the discussion is continued by the explanation of technology and methodology that are used within the development and modeling tools for designing the application. 2.1 Mobile Instant Messaging Instant Messaging (usually called IM) application is an application that provides online, real-time communication using typed text messages between two or more people who are connected to the Internet [1]. With the IM application, people can communicate with their colleagues who are available in their contact list. Available means that the person you want to chat with is also online; and only when the other person or party is online, we can chat or communicate with them. The contact list contains all contacts (usually by email address) that are online and offline. To be able to do such things, each person or each computer must have client software connected to a server, which enables connection to the IM services (for example: AOL Instant Messenger, Google Talk, Jabber, Yahoo! Talk, etc). One can also connect to an instant messaging service with a multiprotocol instant messaging application, which allows one IM client to connect to multiple IM networks [2]. 7 8 With the development of technology, people demand more accessibility and mobility. These issues apply to the need of communication as well. They demand information exchange and communication to be accessed anywhere and anytime. To further enhance the IM mobility, the Mobile IM services are developed. By using the mobile instant messaging service, users can install their IM clients in their own mobile communication device, such as mobile phones, PDA, and smart phones. For the IM application to be used in a mobile device, the IM applications need to be downloaded first into the device in order to chat within IM services from the mobile device. To connect to the servers, the mobile devices use their GPRS or 3G connection for the access to Internet connection. After it is connected, then the users can log in using their own private account to go online and start communicating. Instant messaging supports collaborative work. Collaborative work is work undertaken as part of a group activity towards some shared goal or has some common purpose. Through collaborative working people are united to work together, share ideas, makes decision as a team. Unlike other communication means that only provide peer to peer communication, with the use of instant messaging, person can chat with several people at the same time anywhere and anytime [3]. 2.2 Internet Internet is a massive electronic and telecommunications network connecting the computers of businesses, consumers, government agencies, schools and other 9 organizations worldwide, which exchanges information seamlessly using open, nonproprietary standards and protocols [1]. 2.2.1 Internet Structure The structure of Internet can be viewed as a global mesh of different networks and networks levels as shown in this following figure: Figure 2.1 Internet Structure Internet is a hierarchy made up of stub networks, mid- level networks and Internet backbone. Moreover, if it is examined closer, this complex architecture consists of servers, gateways, routers, and the numerous communications lines connecting them [4]. 2.2.2 Internet Provider Everyone can connect to this universal marketplace of ideas and products through the Internet Service Provider (ISP) or an online service provider, such as the Microsoft Network (MSN) or America Online (AOL). Both ISPs and online service providers are the vendors that provide a pipeline to the Internet (usually through a connection to a regional network and, through that connection, to the Internet backbone). As a group, these providers are businesses with the equipment and technology needed to provide 10 high-speed access to the Internet over communications lines such as T1. Some of these providers are national or international companies, such as MCI and AOL. Others are small organizations that provide access to individual cities or relatively small geographic regions [4]. 2.2.3 Internet Services Several Internet services that are widely used are [4]: E- mail Through internet, electronic text message can be sent from one person to one or many other people wherever and whenever they want to. Internet users can communicate with anyone (their family, friends, strangers, and even Internet sites) who can be addressed by the familiar standard address: username@location. Instant messaging Instant messaging, as has been defined above allows two people or more to perform real- time communication through Instant Messaging application that is connected using Internet. Web Search engine Through internet, computer users may able to use search engines like Google, AltaVista, and Yahoo through keyword-driven Internet research. It provides instant access to a vast and diverse amount of online information. 11 2.2.4 Language on Internet English is the common language for the communication on the Internet, 30 % of web visitors ask for it. The other most-requested languages on the World Wide Web are Chinese 14 %, Japanese 8%, Spanish 8%, German 5%, and French 5% [5]. In addition, the world’s Internet users are based in Asia 36 %, Europe 29% and North America 21 % [6]. 2.2.5 Internet Access There are several methods to access the Internet: Dial- up Dial- up access is a form of Internet access that allow clients to connect to Internet using standard 56k modem in their computer and telephone line to dials a phone number provided by Internet Service Provider (ISP). A standard 56k modem can theoretically transfer 56 Kilobits of data a second. Dial up connection is widely available and can be very economic, however it is very slow compared to other connection types [7]. Broadband Broadband is a high speed Internet access. In general, any connection to the customer exceeding 200 Kbit/s is considered as broadband Internet. Several examples of popular broadband technologies are DSL and cable mode. Broadband service provides higher speed of data transmission and less delay in transmission compare to dial- up service [8]. Wi-Fi 12 Wi-Fi (Wireless-Fidelity) is a WLAN (Wireless Local Area Network) that provides wireless high-speed data connections between mobile data devices such as laptops, PDAs or phones and nearby Wi-Fi access points which is called as WiFi Hotspots [9]. Cell phones Mobile phones can connect to the network or Internet under various providers. Through cell phone you can connect to Internet using technologies called GPRS. The discussion of GPRS itself will be talked about later on in this chapter. 2.2.6 GPRS GPRS, or General Packet Radio Service, is a standard for wireless (mobile) communication for GSM (Global System for Mobile Communication) or mobile phones users, based on Internet protocol to enhance 2G phones by enabling them to send and received data anywhere, anytime [10]. GPRS, which supports a wide range of bandwidths, is an efficient use of limited bandwidth and is particularly suited for sending and receiving small bursts of data, such as e-mail and Web browsing, as well as large volumes of data [11]. With throughput rates of up from 32 to 48 kilobits per second, users have a similar access speed as a dial- up modem, but with the convenience of being able to connect from anywhere. GPRS customers enjoy advanced, feature-ric h data services such as color Internet browsing, email on the move, and powerful visual communications such as video streaming, multimedia messages and location-based services [10]. 13 GPRS uses the existing GSM (Global System for Mobile Communication) network to transmit and receive TCP/IP based data to and from GPRS mobile devices. Private IP addresses are dynamically assigned within the network to mobile devices. Later on, an Access Point Names (APN) provides a gateway route to other networks such as the Internet, WAP services or private corporate networks. Firewalls typically reside at the APN to isolate the public and private networks [12]. The benefits of GPRS are elaborated below [12]: Efficient GPRS mobile devices only use the GSM network when data is transferred. The GSM connection can be shared with many users, resulting in efficient use of the network. Fast GPRS speed is up to 5 times faster than GSM. It offers maximum data rates of 56 Kbps (down) and 14.4 Kbps (up), however because it is a shared network the actual data rates are potentially lower. Payment based on data usage Payment for this connectivity is based on the amount of data which is transferred, not based on time 14 2.3 Technology The technologies used in this project are Wildfire for the server, XMPP as the protocol, J2ME Platform, Symbian OS and S60 platform. 2.3.1 Wildfire In order for the IM client applications to connect to other IM servers, a Jabber (or XMPP) server is needed. What we will use in the implementation of the IM clients is the Wildfire Server which is already running and functioning. Wildfire is an enterprise instant messaging (EIM) server written using Java language, licensed under the Open Source GPL (General Public License) and also licensed commercially (dual- licensed). It uses the leading open protocol for instant messaging, XMPP (also called Jabber) [13]. 2.3.2 XMPP XMPP the abbreviation of Extensible Messaging and Presence Protocol is an IETF’s (Internet Engineering Task Force) formalization of XML streaming protocol for near real-time information exchange and extended to be used for instant messaging and presence. It was developed within the Jabber open source community in 1999 [14]. It provides a generalized framework for changing XML data from one entity to another but its main purpose is to help building instant messaging and presence applications [15]. Presence is the ability to check the status of other users, whether they are online and available. 15 XMPP is implemented as protocol in many instant-messaging applications such as Jabber instant messaging, Adium, iChat, Google Talk! ,etc [16]. Some main XMPP protocol specifications and XMPP extensions that are widely used today are described in the following [14]: RFC 3920 -- XMPP: Core The core protocols for XML streaming, including strong authentication, channel encryption, and internationalized addressing. RFC 3921 -- XMPP: Instant Messaging and Presence It is used for instant messaging, contact lists, presence, and privacy blocking. RFC 3923 -- End-to-End Signing and Object Encryption for the XMPP It describes end-to-end signing and encryption. XEP-0030 -- Service Discovery It is a robust protocol for determining other entities’ features on an XMPP network. XEP-0115 -- Entity Capabilities It is a real-time profile of XEP-0030 for advertising capability changes via presence. XEP-0004 -- Data Forms It describes forms-handling via XMPP. XEP-0045 -- Multi-User Chat It is a set of protocols for managing multi- user chat rooms with stronger security. XEP-0096 -- File Transfer It is a protocol for exchanging files between XMPP entities. 16 XEP-0071 -- XHTML-IM It is used for exchanging XHTML- formatted messages between XMPP entities. XEP-0124 -- HTTP Binding It is a binding of XMPP to HTTP rather than TCP, mainly used for devices that cannot maintain persistent TCP connections to a server. XEP-0060 -- Publish-Subscribe It is a generalized framework for publish-subscribe functionality, mainly used to deploy content syndication, extended presence, and event notification services. The base protocol is specified in RFC 3920 and RFC 3921 while XEP series which is an XMPP Extension Protocol consist of XMPP extensions that were not required by RFC 2779. 2.3.2.1 RFC (Request for Commands) RFC are documentation of technical and organizational notes about the Internet. They cover many aspects of computer networking including protocols, mechanisms, procedures and best practices in use on the Internet. Each RFC document has a unique serial number and once the serial number has been issued and published RFC document can not be modified [17]. The following sections will describe more about RFC 3920 and 3921. 2.3.2.1.1 RFC 3920 XMPP is usually implemented in client server architecture where TCP connection is utilized by client to be able to use XMPP accesses to a server and used by server to 17 communicate with each other. The overview of XMPP includes server, client, gateway and network [18]: Server - Server has responsibility to manage the exchanging of XML stream to and from authorized clients, servers and other entities, to route appropriatelyaddressed XML stanzas among entities over XML streams and to store the client’s data e.g. the contact list of XMPP-based instant messaging and presence application. Client - Client will connect to a server and utilize the functionality provided by server by using XMPP. Each authorized client will have Jabber Identifier (JID) that contains a set of node identifier, domain identifier and resource identifier in order (e.g. aaa@domain/work). The recommended port for connections between a client and a server is 5222, as registered with the IANA. Gateway - A gateway is special-purpose server-side which functions to translate XMPP into foreign messaging system protocol and vice versa. Some examples of gateways are SMTP (gateways for email), IRC (gateways for Internet Relay Chat), etc. Network - System consists of servers that inter-communicate because each server is identified by a network address and server-to-server communications are a straightforward extension of the client-to-server protocol. 18 2.3.2.1.2 RFC 3921 This RFC describe the extensions to the core features of XMPP that provide basic functionality of an instant messaging (IM) and presence application. The requirements of basic IM and presence application include: Exchange message with other users Exchange presence information with other users Manage subscriptions to and from other users Manage items in a contact list (roster) Block communications to or from specific other users Other than core server requirements, an instant messaging and presence server should support presence broadcast on behalf of clients, presence subscriptions, roster storage and manipulation, privacy lists, and IM-specific routing and delivery rule while the client should support presence subscription, roster management, and privacy lists [19]. 2.3.2.2 XML XML is a markup language for documents containing structured information. Structured information contains both content (words, pictures, etc) and some indication of what role that content plays (for example, content in a section heading has a different meaning from content in a footnote, which means something different than content in a figure caption or content in a database table, etc.). Almost all documents have some structure. A markup language is a mechanism to identify structures in a document. The XML specification defines a standard way to add markup to documents [20]. 19 XML specifies neither semantics nor a tag set. In fact XML is really a meta- language for describing markup languages. In other words, XML provides a facility to define tags and the structural relationships between them. Since there's no predefined tag set, there can't be any preconceived semantics. All of the semantics of an XML document will either be defined by the applications that process them or by stylesheets. 2.3.2.3 Jabber Jabber, created and developed by Jeremie Miller since 1998, is an open-source instant messaging platform which uses XML-based protocols (XMPP) to provide the standard functionality that is expected from an instant- messaging system, such as peer-to-peer chat, group chat, and the ability to subscribe to other user’s presence [21]. Jabber has some features that make it easier for development: 1. Decentralization [22] Independent servers can run without depending on a master server. Developer can build up their own code to build such a server, where user accounts can be secured, backed up and scaled up as needed 2. Open Standards [22] Jabber protocol is free, open, public and documented. Jabber uses XMPP protocol specifications, such as RFC 3920 and RFC 3921, which does not required any royalty to implement and the development is not restricted to a single vendor. 3. Proven [22] 20 Jabber technologies have been used since 1998. Lots of developers work on Jabber technologies because multiple implementations of Jabber's standards exist for clients, servers, components, and code libraries, with the backing of large companies such as Sun Microsystems and Google. 4. Security Security is achieved via SASL (Simple Authentication and Security Layer) and TLS (Transport Layer Security) that has been provided from the XMPP specification (protocol level) [22]. SASL is a framework that supports authentication and data security as well as data integrity and data confidentiality, in Internet protocols. TLS is a security services implemented as a set of protocols that rely on TCP [23]. 5. Flexibility and Extensibility Developer can implement custom functionalities on top of Jabber’s protocols. For example, network management, collaboration tools, file sharing and remote systems monitoring. Additionally, developers can use XML namespaces to define new message types [22]. Furthermore, Jabber uses sockets rather than HTTP for variety of reasons. First of all, it is “closer to the bare metal” than HTTP. It means that TCP connection does not require that addresses look like URLs as HTTP does. Second, it can be easier to safely tunnel through firewalls with straight TCP/IP. Finally, the dynamics of a bi-directional communication can be handled better with persistent TCP connection than stateless HTTP connection. Persistence means that stateful knowledge of the conversation can be maintained for the full course of the interchange. Therefore, there is no need to embed cookies in constructed HTML pages [24]. 21 2.3.2.3.1 Jabber Architecture Figure 2.2 Jabber Architecture Jabber employs client-server architecture, instead of peer-to-peer. Thus, there is no direct communication between the clients and each client will be connected to one Jabber server, which listens on TCP port 5222. When two Jabber clients wish for delivering a message, the message would be passed through (minimum) one Jabber server. If both clients are on different domain, the message wo uld be passed from one Jabber server to another Jabber server, afterwards the message will be sent to the desired client [25]. The exclusivity of Jabber protocol is its modular server and simple client [25]: 1. Jabber Server Jabber Server is responsible for providing the following set of services: Handles client connection and communicating directly with Jabber client Communicate with other Jabber Servers to give clients homed on other servers seamless access to clients homed on this server 22 Acting as a “plugin manager” to manage and pass messages between components loaded with the server. Jabber Server is constructed with standards, allowing flexibility and variety in use. It handles functionalities of IM, such as registration, authentication, presence and contact list (roster). 2. Simple Client Jabber client should be able to do tasks, such as: Communicate with one Jabber server over TCP socket Capable of parsing and interpreting XML stanzas Understand a small set of core Jabber XML messages types 2.3.2.3.2 How Jabber Works Within the Jabber network, there are many different entities that need to communicate with each other. To differentiate among them, Jabber ID is used. Each Jabber Identifier contains a set of ordered elements in the formed of a domain, node, and resource in the following format: [node@]domain[/resource]. The Domain Identifier represents the Jabber server to which the entity connects. Node Identifier represents users while Resource Identifier identifies specific objects that belong to a user, such as devices or locations [26]. How Jabber works is reflected through the message delivery process. For instance, Juliet wants to chat with Romeo. Juliet has an account on the capulet.com server 23 ([email protected]) and Romeo has an account on the montague.net server ([email protected]). The message delivery processes are as follow: 1. Juliet’s Jabber client send the message to capulet.com Jabber server 2. The capulet.com Jabber server opens connection to montague.net Jabber server. 3. Juliet’s message is routed to the montague.net Jabber server. a. If capulet.com server is blocked on montague.net server, the message is dropped. b. If Romeo is not online, the message is stored for later delivery. 4. The Jabber server at montague.net delivers the message to Romeo’s Jabber client. Juliet capulet.com montague.net Romeo Figure 2.3 How Jabber Works Jabber handles the problems of clients running on different operating system, multiple servers, and communication channel between the servers [26]. 2.3.3 Java Java is an object-oriented programming language developed by Sun Microsystems in the early 1990s. It is a collection of technology used to create and run an application in standalone computer or in the network [27]. It was started as a project called “Oak” by James Gosling in June 1991. Gosling’s goals were to implement a virtual machine and a language that had a familiar C/C++ style of notation. The first public implementation was Java 1.0 in 1995. Java is easily become popular. Later on, Java 2 was created. It is the new versions which had multiple configurations built for different types of platform [28]. 24 One of its characteristic is platform independence, means that programs written in the Java language must run similarly on any supported hardware/operating-system platform. One should be able to write a program once, compile it once, and run it anywhere or known as “Write Once, Run Anywhere (WORA”) [28]. Java code goes through two stages: compilation and interpretation phase. In compilation phase, java source code (.java files) will be translated into an intermediate language called Java bytecode (.class file). The resulting bytecode then ready to be interpreted or executed using Java Virtual Machine (JVM) [29]. Figure 2.4 Java code goes through two stages: compilation and interpretation 2.3.3.1 Java Platform Java platform is a bundle of related programs or platform from Sun Microsystems which allow for developing and running programs written in the Java programming language. The platform is not specific to any one processor or operating system, but rather, an execution engine (called a virtual machine) and a compiler with a set of standard libraries are implemented for various hardware and operating systems so that Java programs can run identically on all of them [30]. Java platform is made of three significant components 25 which are Java compilers and tools, Java Virtual Machine (JVM) and Java API (Application Programming Interface) [29]. 2.3.3.2 Feature of Java With the advent new versions of Java called Java 2, features of Java can be grouped into three editions which are: J2SE (Java 2 Standard Edition) It is the original edition which consists of API needed to build a Java Application or applet [31]. It is designed to run on desktop and workstation computers [32]. J2EE (Java 2 Enterprise Edition) [31]. It is an embellished version of J2SE which is used to accommodate n-tier architecture. It contains API to build application for multi-tier architecture. J2ME (Java 2 Micro Edition) It contains API used to creating application for small computing devices, one with limited memory, display and processing power [32]. Various editions of Java suit different hardware platforms as can be seen in the figure below [29]: 26 Figure 2.5 The different editions of Java suit different hardware platform The figure shows three virtual machines in use for different environment. Hotspot VM is the default virtual machine supplied by Sun for executing the full-scale version of Java where CVM (Compact Virtual Machine) and KVM (Kilobyte Virtual Machine) are smaller virtual machine designed to run on micro devices. KVM will be described in more detail later on in this chapter. 2.3.4 J2ME J2ME, designed by Sun Microsystems, is a collection of Java APIs for the development of software for resource-constrained devices such as PDAs, cell phones and other consumer appliances. It is created as a replacement for the similar technology called PersonalJava. J2ME has become a popular option fo r creating application such as games, instant messaging, etc for cell phones, as they can be emulated on a PC during the development stage and easily uploaded to the pho ne [32]. 27 2.3.4.1 J2ME Architecture J2ME is a collection of specifications that define a set of platforms, each of which is suitable for a subset of the total collection of consumer devices that fall within its scope. The subset of the full Java programming environment for a particular device is defined by one or more profiles, which extend the basic capabilities of a configuration [33]. The architecture begins with the host Operating System (OS) as the base followed by the virtual machine (VM) in which it will be either the JVM for systems complying with CDC configuration or KVM for systems complying with CLDC configuration. On the top of virtual machine, there will be configuration layer in which it will take one of two forms: CDC or CLDC. Exist on the topmost layer is profile. There are seven defined profiles that can be chosen based on the configuration. The figure below shows the generic architecture of J2ME [32]. Figure 2.6 General Architecture 28 2.3.4.2 Configuration Sun introduces the configuration to support the broad range of products that fit within the scope of J2ME. A configuration is a specification that defines the software environment for a range of devices defined by a set of characteristics that the specification relies on, usually suc h thing as: the types and amount of memory available, the processor type and speed, the type of network connection available to the device [33]. It arranges the similarity among the device so that it can be used as an equivalence measurement among them. For example: a bicycle lamp will be designed perfectly and appropriately so that it can be used in any types of bicycle [27]. Configuration is closely tied to a Java Virtual Machine. In fact, a configuration specifies three basic elements [34]: A set of Java programming language feature A set of Java Virtual Machine feature A set of supported Java libraries and APIs. J2ME defines two types of configuration which are CDC (Connected Device Configuration) and CLDC (Connected Limited Device Configuration). 2.3.4.2.1 CDC This type of configuration is designed for devices with faster processor, more memory, and greater network bandwidth [33]. The characteristic of devices as defined by this configuration are memory 2MB or more, processor 32-bit architecture, and Network connectivity with high and possibly persistent bandwidth [32]. Example of devices include digital set-top boxes, home appliances, navigation systems, point-of-sale terminals, and smart phones, high-end PDA, web telephones [31]. 29 2.3.4.2.2 CLDC CLDC is a configuration intended for micro devices. It is designed for devices with intermittent network connections, small processors and limited memory [35]. Examples of devices include pagers, mobile phones, personal digital assistants, dedicated terminals, handheld consumer devices with between 128KB and 512KB of memory [31]. It is the type of configuration that will be used in this thesis. It is developed as part of Java Community Process (JSR-30). CLDC configuration affects many aspects of Java development and delivery which include: target device characteristic, the security model, application management, language differences, JVM differences, included class libraries [29]. 2.3.4.2.2.1 Target device characteristic The characteristics of devices as defined by this configuration are [29]: Memory: 160 KB – 512 KB devoted to Java Platform (minimum 128 K for running Java application). Processor: 16 or 32 bit. Restricted user interface. Low power consumption, typically battery powered. Using network connectivity, usually wireless with low bandwidth and intermittent access. 30 2.3.4.2.2.2 Security Model The J2SE’s existing security model was too large to fit within the constraint of CLDC target platform. It need to be simplified otherwise it alone would likely have exceeded the available memory. The CLDC security model has two main sections [29]: Virtual machine security Virtual machine security layer is aimed to protect the underlying device from any damage executable code might cause. A bytecode verification process essentially validates class- file bytecode, ensuring the correctness for execution. The most significant result of this process is the protection it offers again the execution of invalid instructions. The J2SE’s standard bytecode verification process requires about 50 KB of code space and up to 100 KB of heap, in which this will consume all the memory available for Java on macro device. The resulting verification implementation within CLDC’s virtual machine only requires 10 KB of binary code and 100 bytes of run-time memory. This could happen due to the removal of iterative dataflow algorithm from the in- memory verification process. As the impact, pre- verification process needs to be performed to prepare code for execution on the KVM. The result of this process is the insertion of additional attributes into the class file. Application security CLDC incorporates a simplified security model based on the concept of sandbox. The term sandbox means that Java code can only correlate within the boundaries of small, controlled environment. Figure below shows that your Java code has restricted what’s available in the sandbox environment. CLDC provides an access 31 to core classes (the base classes that make up the installed API on the device) while protecting the underlying device. Figure 2.7 The Java sandbox 2.3.4.2.2.3 Application Management Managing application on micro devices is different compare to ones on typical PCs. Mostly on typical mobile device, users have limited amount of application space in which to store their favorite programs. To manage these applications, the device should provide basic ability to review the installed application, launch an application and delete it if the users want to. CLDC does not implement the form of application manager however it implement simple menu-based tools to browse and launch programs [29]. 2.3.4.2.2.4 Language differences There are three main areas that distinguish the Java Language for CLDC versus that defined in the Java Language Specification: Floating-point math 32 CLDC implementation of Java language does not support floating-point math. It is because the typical micro device does not have special hardware for handling float point numbers [32]. Finalization In order to improve performances and reduce the overall requirements, CLDC does not support an automatic object finalization callback called finalize() method. When using J2SE this method will be called before the garbage collector frees the object. This finalize method is used to free resources when an object is about to be trashed by the garbage collector. Sinc e this method is not available while using CDLC, you need to rely on your own application flow to carry out an appropriate resource cleanup process [29]. Error Handling Only a limited set of error handling exceptions are supported. The reasons are twofold [32]: The exception handling in J2SE is quite comprehensive however a significant demand on the system occurs as the matching price. Embedded systems will provide their own internal error handling. A simple solution for the most serious of errors is to perform a reset of the device. The exception classes supported in the CLDC are listed in the next section. 2.3.4.2.2.5 KVM CLDC devices do not use JVM, instead it use a stripped-down version of JVM called KJava Virtual Machine (KVM). The K in KVM originates from the fact that this virtual 33 machine will run in only a few tens of kilobytes of memory. This virtual machine was designed to handle the consideration of resource constrained devices. It requires only 40 and 80 KB of memory and only 20 – 40 KB of dynamic memory (heap). It can run on 16 bit processor clocked at only 25 MHz [32]. The primary features that are not available as part of the KVM and its included libraries are [29]: Weak references. It is used to keep a reference to an object that will still be garbage collected. Reflection. Reflection is the Java feature to inspect the code being executed at runtime. The KVM does not support reflection in any form, means that no accesses to features that inherit their functionality from the reflection core such as JVMDI (Java Virtual Machine Debugging Interface). RMI (Remote Method Invocation), object serialization and the profiling toolset. Thread groups and daemon threads- advanced thread control (rarely used) The JNI (Java Native Interface). It is used to write your own native methods, which is not appropriate for sandbox development User-defined class loaders. It is used to reconfigure or replace the class- loading mechanism with a user-supplied one. 34 2.3.4.2.2.6 Included class libraries Not all the classes available in J2SE exist in J2ME. The list of the available classes can be seen in [29]. 2.3.4.3 Profile. A profile is an extension to a Configuration. It consists of Java classes that enable implementation of features for either a particular small computing device or for a class of small computing devices. Seven profiles have been defined: The Foundation Profile It is used with the CDC configuration. It includes the entire core Java classes and become the basis for nearly all other CDC profiles [33]. The Game Profile It is used with the CDC configuration and provides platform for developing game applications on CDC devices [31]. The Mobile Information Device Profile (MIDP) It is used with the CLDC configuration and contains classes that provide local storage, a user interface, and networking capabilities to an application that runs on a mobile computing device [31]. The PDAProfile (PDAP) It is used with the CLDC configuration and provides a more sophisticated user interface library and a Java-based API for accessing useful features of the host operating system. PDA Profile is similar to MIDP, but it is aimed at PDAs that have better screens and more memory than cell phones [33]. 35 The Personal Profile. It is used with the CDC configuration and adds basic user interface functionality to the Foundation Profile [33]. It provides classes to implement a sophisticated user interface, which is a user interface that is capable of displaying multiple windows at a time [31]. The Personal Basis Profile It is similar to Personal Profile in which it is used with the CDC configuration and the Foundation Profile. However the difference is Personal Basis Profile provide classes to implement a simple user interface, which is a user interface that is capable of displaying one window at a time [31]. The RMI Profile It is also used with the CDC configuration and the Foundation Profile. It provides Remote Method Invocation classes to the core classes contained in the Foundation Profile [31]. Among these profiles, MIDP is the one suitable for the purpose of this thesis. MIDP will be discussed in more detailed on the next section. 2.3.4.4 MIDP MIDP is a version of the Java pla tform based on CLDC and KVM that is aimed to be used for mobile information devices with the limited display and storage facilities such as mobile phones and entry- level PDAs. For that reason, it provides a relatively simple user interface and basic networking based on HTTP 1.1. MIDP is the best known of the J2ME profiles because it is the basis for Wireless Java [33]. MIDP provides direction for the 36 base environment provided by CLDC allowing the vertical integration that makes the Java runtime environment applicable to these devices. MIDP specification has been revised under JSR 118 where Symbian is one of the contributors to the JSR 118 expert group [32]. MIDP sets target characteristics that Micro Information Devices should meet. There are both hardware and software specification [29]: Target hardware environment The recommended minimum MIDP device characteristics are: Table 2.1 MIDP Hardware Requirement Display Input Types Memory Networking 96 x 54 pixels with 1 bit of color with an aspect ratio (pixel shape) of approximately 1 to 1 One-handed keyboard or keypad (like one on typical phone) Two-handed QWERTY keyboard (resembling a PC keyboard) Touch screen 128KB of non-volatile memory for MIDP components 8KB of non- volatile memory for application- generated persistent data 32 KB of volatile memory for the Java heap (run-time memory) Two-way wireless, possibly intermittent, connectivity Usually quite limited bandwidth Target software environment The software that controls Micro Information Devices are also vary significantly in both functionality and power. Due to this variety, MIDP specifications mandate some basic systems software capabilities: Table 2.2 Software Environment Memory Networking Graphics Input Access to a form of non-volatile memory (for store things like user name ) Sufficient networking operations to facilitate the communications elements of MIDP API Ability to display some form of bitmapped graphics A mechanism to capture and provide feedback on user input 37 Kernel Basic operational operating system kernel capable of handling interrupts exceptions and some form of process scheduling. MIDP has some core functionalities which are: Mobile User Interface (LCDUI) MIDP provides a set of standard components to aid the creation of portable, intuitive user interfaces. These classes reduce the development time and also reduce the size of the final application [35]. MIDP User Interface API consists of high- level API and low- level API. Low- level API is based on the Canvas abstract class while high- level API such as Alert, Form, List and TextBox are extension from Screen abstract class [27]. Multimedia and Game Functionality MIDP enable developers to create game and other entertainment content for mobile devices. A set of low- level AP Is allows the developer to take control of the screen at pixel level. Graphics can be animated and user input can be captured. The addition of Game API as part of MIDP 2.0 allow developer to adds gamespecific control over animation with its framework implementation managing sprites, collision detection, layers and tiled layers [35]. Extensive Connectivity MIDP provides interfaces for communication over http, https, datagrams, sockets and serial ports. It also support supports the SMS capabilities of GSM and CDMA networks through the optional Wireless Messaging API (WMA). Communication with third parties can also be created using an event-based networking model. 38 MIDP supports a server push model based upon a push registry which keeps track of registered third party inbound communications from the network [35]. Over-the-Air Provisioning Deployment and updating of applications over-the-air now falls within the MIDP specification (although MIDP 1.0 did not officially encapsulate an over-the-air provisioning (OTA) definition, it did recommend a practice that was adopted as an addendum to the original specification and has now been made a part of the MIDP 2.0 specification). How applications are discovered, installed and removed on MIDP devices has therefore been standardized and defined [35]. Persistent storage MIDP implements a simple record-based database management system. The data will remain present across multiple invocations of a MIDlet (explain later on in this chapter). The platform is responsible for making its best effort to maintain the integrity of the data throughout normal use of the device, including rebooting and battery changes. The record stores will be removed if the associated MIDlet suite is removed [35]. End-to-End security With greater network connectivity and the nature of common application installation methods, a robust security model has been specified. HTTPS leverages existing standards such SSL and WTLS and enables the transmission of encrypted data. Security domains are used to identify trusted and untrusted MIDlets. By default, all applications are untrusted and are prevented from 39 accessing any privileged functionality. Access can be gained by signing the MIDlet to specific domains defined on the device [35]. Currently there are two versions of MIDP: MIDP 1.0 and MIDP 2.0. MIDP 2.0 is the version that will be used in this thesis. The new feature added to MIDP 2.0 is API for multimedia. With MIDP 2.0 tone, tone sequence, and WAV file can be played without the availability of Mobile Media API (MMAPI). The following table will show the specification of MIDP 2.0 [27]. Table 2.3 MIDP 2.0 Specification Specification Display Display depth Aspect ratio Input types Memory MIDP 2.0 96 x 54 1 bit Approximately 1 : 1 Keyboard and touch screen 256 KB non-volatile memory for MIDP component 8 KB non-volatile memory for persistence data created by the application 128KB volatile memory for JRE Networking Two-ways, wireless J2ME’s javax.microedition.lcdui library (that javax.microedition.midlet is not javax.microedition.rms inherited javax.microedition.lcdui.game from J2SE’s javax.microedition.media library) javax.microedition.pki Multimedia Able to play multimedia file (audio and video) MIDP 2.0 addresses two types of wireless data networks [36]: Circuit-switched Data (CSD) network or session-based network 40 It assigns a user a radio channel, which it dedicates to the connection until the data transfer is done. During the data exchange, the channel cannot be used for anything else. It is usually billed on a time basis, like voice transmissions. The GSM cellular phone network is a circuit-switched data network. Packet-switched Data (PSD) In packet-switched data transmission, the data exchange is broken up into small fixed length packets. Packets from several different data exchanges, each from different users, can be sent in time slots of the same radio channel. The packets are mixed during transmission and reassembled in the correct order by the recipients. It is usually billed by the amount of data sent thus packet-switched networks are cheaper for data transfer. GPRS and 3G are examples of packetswitched technologies. 2.3.4.4.1 MIDlet (MIDP Application) MIDlet is a Java program written to be executed on a Micro Information Devices. MIDP allows the execution of multiple MIDlets. MIDlet is a part of javax.microedition. midlet.MIDlet defined in MIDP. Each MIDlet has a descriptor file called the JAD file, which allows the application management software on the device to identify what it is about to install prior to installation [35]. MIDlet runs in an execution environment within the Java VM that provides a well-defined lifecycle controlled via methods of the MIDlet class. A MIDlet can also use methods in the MIDlet class to obtain services from its environment, and it must use only the APIs defined in the MIDP specification if it is to be device-portable [33]. 41 There are some rules of MIDlet regarding its run-time environment. Device’s built- in application manager is responsible to start the MIDlet. An application has access to only the following resources [29]: o All files contained within the application’s JAR file. JAR file should contain all the classes required to run the application along with all resources such as image files, user data. o The contents of the MIDlet descriptor file o Classes made available as part of the CLDC and MIDP libraries. 2.3.4.4.1.1 MIDlet States The application management software (AMS) has role to manage the MIDlet. The AMS is a part of the device’s operating e nvironment and guides the MIDlet through its various states during the execution process. Once a MIDlet has been instantiated, it resides in one of three possible states. A state is designed to ensure that the behavior of an application is consistent with the expectations of the end-users and device manufacturer [35]. The three MIDlet’s states are [35]: Paused The MIDlet has been initialized, but is in a dormant state. When a well-written MIDlet is paused, it should generally release any shared resources. Active The MIDlet is running. 42 Destroyed The MIDlet has released all resources and terminated. The javax.microedition.midlet.MIDlet abstract class defines three lifecycle methods related to the three possible states stated above, which are: pauseApp() to indicate to the MIDlet that it should enter the PAUSED state (releasing all shared resources and becoming passive), startApp() to signal to the MIDlet that it has moved from the PAUSED to the ACTIVE state, and destroyApp() to indicate to the MIDlet that it should enter the DESTROYED state all persistent and state data should be saved and all resources should be released ). A MIDlet must have a public default constructor, a constructor that requires no arguments, and all of the methods above. The skeleton MIDlet class might look like this [33]: public class MyMidlet extends Midlet { // optional constructor MyMidlet( ) {} protected void startApp( ) throws MIDletStateChangedException { } protected void pauseApp( ) { } protected void startApp( boolean unconditional) throws MIDletStateChangedException { } } 43 2.3.4.4.1.2 MIDlet Lifecycle The various states of the MIDlet show how the AMS and the MIDlet interface combine to form the lifecycle of the MIDlet [35]: At the first time, the AMS creates a new instance of a MIDlet. A public default constructor is called and the application is put into the Paused state. The application will be put into the Destroyed state if any exception is thrown during this phase, however if no exception is thrown the application is scheduled for execution at some later time. To move the MIDlet into Active state, the AMS calls startApp(). At this point, the MIDlet itself will acquire any resources it needs and begin executing Once the application is running (it is on the Active state), the MIDlet can move to two other states: o The MIDlet can move to Paused state by calling the pauseApp() method from the AMS. o The MIDlet can move to the Destroyed state when the user of the AMS decides to end the application or the AMS may have decided that a higher priority process needs to claim the resources being used by the MIDlet. The following figure shows the state transition diagram of MIDlet lifecycle. 44 Figure 2.8 MIDlet life cycle 2.3.4.4.2 MIDlet Suites MIDlet applications are designed to run on a mobile device and to share data and resources. This is accomplished by placing Midlets into a suite. The suites consist of a Java archive (JAR) file and a Java application descriptor (JAD) file. The JAR file contains the packed MIDlets and additional resources, such as images or text files, whereas the JAD file contains the MIDlet suite ‘advertising’ information [37]. It is illustrated like the following figure taken from [29]: Figure 2.9 MIDlet suites 45 2.3.4.4.2.1 JAD The MIDlet suite is advertised through the JAD file. The JAD file is optional for the MIDlet suite developer. The JAD file has an extension .jad and is of the MIME (multipurpose Internet mail extension) type text/vnd.sun.j2me.app-descriptor’. The MIME type is relevant for web server to recognize the file. The JAD file provides information about the JAR contents through specific MIDlet attributes [37]. 2.3.4.4.2.2 JAR JAR file contains the class files, resource files, and a manifest describing the contents of the JAR file. The manifest provides information about the JAR contents through specific midlet attributes. The content of the JAR manifest is the same as that of the JAD file, including mandatory and optional attributes. The MIDlet-Name, MIDlet-Version, and MIDlet-Vendor values must match the information provided in the JAD file. In the case of a mismatch, the JAR file will be rejected [37]. 2.3.5 Symbian OS Symbian OS is an operating system designed for mobile devices. It is produced by Symbian Ltd and associated with user interface framework, application engines, wireless communication, and data services enablers [37]. The core of the Symbian OS consists of the base (microkernel and device drivers), middleware (system servers, security, and application framework), and communications 46 (telephony, messaging, and personal area networking). This core remains common to different devices supporting Symbian OS. Naturally, when Symbian OS is fitted to a new hardware the base needs to be changed (base porting), but this does not affect the upper layers. This provides interoperability, simplifying developing applications for several different devices and decreasing the costs of making different kind of devices [37]. The structure of Symbian OS v6.1 for Series 60 Platform is shown in the figure below [37]: Figure 2.10 Structure of Symbian OS There are some major platforms for Symbian OS which are: Nokia Series 60, Nokia Series 80 and UIQ. Only S60 platform will be discussed here 47 2.3.6 S60 Platform This platform is designed for smartphones that have small displays (176×208 pixel). Smartphones is referred to power fully- featured modern phones with large colour screens (4096 colors or more.). The Series 60 Platform 1.0 (built on Symbian OS v6.1) provides the communication technologies needed in smartphones such as: e- mail (with POP3, IMAP4, SMTP), WAP 1.2.1 stack, SyncML 1.0.1, MMS, Bluetooth, GPRS, and, naturally, all the other necessary protocols supported by Symbian OS v6.1. The list of applications provided with the platform includes a phonebook, calendar, notepad, photo album, clock, calculator, composer (for creating ringing tones), e- mail client, SMS and MMS clients, as well as the telephone application. The user input is performed with the basic phones key [37]. Phones that use the Series 60 user interface include the Nokia 6600, 7610, 6630, 3230, etc. Nokia also licenses the Series 60 user interface to other manufacturers [38]. 2.3.7 Connection The networking in J2ME has to be very flexible to support a variety of devices and has to be very device specific at the same time. To meet these challenges, CLDC introduced the Generic Connection framework. The idea of the Generic Connection framework is to define the abstractions of the networking and file I/O as general as possible to support a broad range of handheld devices, and leave the actual implementations of these abstractions to individual device manufacturers. These abstractions are defined as Java interfaces. The device manufacturers choose which one to implement in their MIDP based on the actual device capabilities [37]. 48 There is 1 class ContentConnection, (Connector) and DatagramConnection, 7 connection interfaces InputConnection, (Connection, OutputConnection, StreamConnection, and StreamConnectionNotifier) defined in the Generic Connection framework. They can be found in the javax.microedition.io package that comes with J2ME CLDC. The relationships between these interfaces are illustrated in the following diagram [44]: Figure 2.11 Connection The types of connection that will be discussed here are socket connection, datagram connection and HTTP connection. Before it, let’s take a look to the definition of thread and stream. 2.3.7.1 Thread Thread is a way to split the program into two or more simultaneously running tasks. Thread is not a process. Processes are used to group resources together while threads are 49 the entities scheduled for execution on the CPU. It is like a controller of processes. The thread has a program counter that keeps track of which instruction to execute next. It has registers which hold its current working variables and stack which contain the execution history [39]. Through thread, deadlock can be avoided. Deadlock is a condition where each processes in the set is waiting for an event that only another process in the set can cause. Once the thread is initialized, it always associate with object through run () method. If thread is being running, the run () method will be automatically called [27]. 2.3.7.2 Stream Stream is a flow of unknown data size. Stream accepts sequence of character to or from a data transportation process. In Java, stream is able to send or receive byte discretely in which byte is represents character or other data. Java provides stream classes that can be used in J2ME [27]: ByteArrayInput/Output Stream It is used as storage of byte that is used to read or write to or from stream. Data Input/Output Stream It provides application to read or write data types from input or output stream PrintStream It is an extension of OutputStream and provides method to print and show various object and data’s value. 50 2.3.7.3 Socket (TCP/IP) connection Socket connection is the connection that will be applied in this thesis. Socket’s implementation is simple, widely known and universally available. It is often used as the basis for distributed applications invo lving one or more clients talking to a single server, exchanging information using a very basic application- level protocol. Socket Connection use TCP (Transmission Control Protocol), which is a reliable, connection oriented protocol [33]. TCP/IP protocol architecture is a result of protocol research and development conducted on the experimental packet-switched network, ARPANET, funded by the Defense Advanced Research Projects Agency (DARPA). It consists of a large collection of protocols that have been issued as Internet standards by the Internet Architecture Board (IAB). The TCP/IP model organizes the communication task into five independent layers which are physical layer, network access layer, internet layer, transport (host-to-host) layer, application layer. Physical layer covers the physical interface between a data transmission device such as computer, workstation and a transmission medium or network. It is concerned with specifying the characteristics of the transmission medium, the nature of signals, the data rate and related matters. Network access layer is concerned with the exchange of data between an end system such as server, workstation and the network to which it is attached. If two devices are attached to different networks but they want to communicate, Internet Protocol in Internet layer is needed to allow data to traverse multiple interconnected networks. Transport layer provides mechanism for 51 providing reliable data exchange. Application layer contains the logic needed to support various user applications [23]. To further understanding about TCP/IP concept, let’s take a look from the figure below [23]: Figure 2.12 TCP/IP Concept Suppose that a process, associated with port 1 at host A wishes to send a message to another process, associated with port 3 at host B. The process at A hands the message down to TCP with instructions to send it to host B. Next, IP hands the message down to network access layer with instructions to send it to router J (the first hop on the way to B) [23]. 52 2.3.7.4 Datagram connection Datagram connection is concerned with sending and receiving discrete packets of data (called datagrams) without setting up a connection between the sender and the receiver. Datagram and socket connection is different in several ways [33]: Data stream versus message passing Socket sends a continuous stream of data from a sender to a receiver, with no provision for marking record boundaries while datagrams sends data in discrete packets, data sent in one packet is never delivered in the same read as data from another packet. Connection-oriented versus connectionless When a socket is used, connection and all the data flows are created between the sender and receiver thus there is no need to specify where each message is going. On the other hand, datagram does not use connection thus each message is individually addressed. Reliability Stream socket connection is more reliability than datagram connection. Data sent using a stream socket is guaranteed to be delivered to the receiver, unless the intervening network fails. A datagram makes no such promises. 2.3.7.5 HTTP connection HTTP Connection makes use of stream sockets to carry messages between an HTTP client (usually a web browser) and a web server that often (but not always) returns an HTML page to the client. This works well in the desktop environment however problem 53 may arise for the devices for which MIDP is intended. The MIDP user interface components do not provide any support for displaying HTML, so there is no built- in browser capability in a MIDP device [33]. 2.4 Waterfall Model Methodology A methodology is a collection of methods for solving a class of problems and specifies how and when each method should be used. There are several methodologies available to be used suc h as waterfall model, v model, and spiral model. Waterfall model prescribes a sequential execution of the activities where v model is a variation of the waterfall model that introduces levels of abstraction for the activities. Different with those two, spiral model is based on the iterative execution of activities. In my system development process I will implement the waterfall model [40]. The waterfall model, first describe by Royce, is an activity-centered life cycle model that prescribes sequential executions of subsets of the development processes and management processes [40]. The activities include in the waterfall model are [41]: Requirement specification The activities begin by creating a requirement specification for the system. This phase is concerned with identifying the required software functions, performance constraints on the software, and the acceptance criteria of the software. Analysis After the requirement is being specified, the analysis and logical description of the system is made. 54 Design Design consists of architectural design and detailed design. Architectural design involves identifying software components (functions, data stores) and specifying the interconnections among components. Detailed design is concerned with details of “how to”: how to implement the processing algorithm, data structures and interconnections among modules and data structure. Implementation and unit testing The implementation phase involves translation of design specifications into source code, and debugging, documentation and unit testing of the source code while testing involves the testing of functionality of the system. Figure 2.13 Waterfall Model 2.5 Modeling Tools In depicting the solution design in the later chapter, the following modeling tools will be used to further explain the solution. 55 2.5.1 Data Flow Diagram Data flow diagram is a diagram that depicts the flow of data through a system and the work or processing performed by that system. There are three symbols and one connection in DFD [42]: Rounded rectangles: Squares: External Agent Process name . It represents external agents (the boundary of the system) Open-ended boxes: The arrows : . It represents processes or work to be done . It represents data stores . It represents data flows to and from the processes Data flow diagram is different with flow chart which is summarized below Processes on data flow diagrams can operate in parallel while in flow charts processes can be executed only one at a time. Data flow diagrams show the flow of data through the system (the arrow represents paths down which data can flow) while flow charts show the sequence of processes or operations in program (the arrow represents pointer to the next process). Looping and branching are included in flow charts but not in data flow diagrams. Data flow diagrams can show processes that have different timing while this does not happen in flow charts. 2.5.2 Use Case Diagram Use case diagram is a diagram that depicts the interactions between the system and the external systems and the users. The diagram may consist of use cases, actor and the 56 relationship [42]. It models the functionality of system as perceived by outside users, called actors. The actors can be a person, another system, or even an internal system entity such as a timer. Use case itself is a description of a usage of a system from actor’s point of view. The usage accomplishes some action of value for the actor. The set of use cases describes the user requirements for the system. This set also represents everything the user wants the system to accomplish. The goal when writing the use case is to communicate the user requirements as clearly as possible, using the language of the user [43]. 2.5.3 Use Case Narrative Use case narrative is the textual description of the business event and how the users will interact with the system to accomplish task. It includes the following items [5]: Author: the names of the individual who contributed to the writing of the use case. Date: the date the use case was last modified. Use case Name: the use case name represent the goal that the use case is trying to accomplish. Actor: people who participate in the use case to accomplish its goal and primarily benefits from the execution of use case. Pre-condition: a constraint on the state of the system before the use case can be executed. Trigger: the event that initiated the execution of the use case. 57 Typical course of events: normal sequence of activities performed by the actor(s) and the system in order to satisfy the goal of the use case. Alternate course: the documentation of behaviors of the use case if an exception or variation to the typical course occurs. Conclusion: the conclusion specifies when the use case successfully ends. Post condition: constraint on the state of the system after the use case has been successfully executed. Assumption: any assumptions that were made by the creator when documenting the use case. 2.5.4 Activity Diagram Activity Diagram is a diagram that can be used to graphically depict the flow of a business process, the steps of a use case, or the logic of an object behavior (method). It is quite similar to flowcharts, except that this diagram provides a mechanism to depict activities that occur in parallel. Thus, it is very useful to model actions that will be performed when an operation is executing as well as the results of those actions—such as modeling the events that cause windows to be displayed or closed. Activity diagrams are flexible in that they can be used during analysis and design. For each use case, one or more activity diagram is constructed; system analysts use activity diagrams to better understand the flow and sequencing of the use-case steps [42]. 58 The activity diagram consists of file elements [43]: Activity : . It represents the execution of a statement in a procedure or the performance of an activity in a workflow. Transition : Decision : . It shows sequential dependencies. . It represents branches. Synchronization Bars o Fork : It represents forking of control into concurrent activities. o Join : It represents joining concurrent activities into one activity. Swim Lanes : Actor It is used to organize the activities in a model according to responsibility, by grouping together all the activities handled by one business organization.