Databases for Mobile Devices Introduction. Overview Different types of data storages Memory management Local database techniques.

Slides:



Advertisements
Similar presentations
MIDP Mobile Information Device Profile Johnny Yau CIS 642 Prof. Insup Lee.
Advertisements

Service Oriented Architecture for Mobile Applications Swarupsingh Baran University of North Carolina Charlotte.
Introduction to Android Mohammad A. Gowayyed CS334-Spring 2014.
J2ME 25 July Overview  What is J2ME?  The CLDC and CDC configurations  MIDP and MIDlets  Development Tools  Demonstrations.
Objectives In this session, you will learn to:
Introduction to push technology © 2009 Research In Motion Limited.
UNDERSTANDING JAVA APIS FOR MOBILE DEVICES v0.01.
Communication Technology Peer Group BLACKBERRY 10: ASKED AND ANSWERED.
The road to reliable, autonomous distributed systems
Technical Architectures
J2ME Web Services Specification.  With the promise to ease interoperability and allow for large scale software collaboration over the Internet by offering.
File Management Systems
© 2009 Research In Motion Limited Advanced Java Application Development for the BlackBerry Smartphone Trainer name Date.
Remote Method Invocation Chin-Chih Chang. Java Remote Object Invocation In Java, the object is serialized before being passed as a parameter to an RMI.
© 2009 Research In Motion Limited Methods of application development for mobile devices.
J2ME Prepared by: - Gaery- Ronny - Alan- Andy. Why Technology for Mobile Devices? The nature of wireless devices is changing Old devices: All the software.
© 2009 Research In Motion Limited Data structures and memory management on mobile devices.
Inter Process Communication:  It is an essential aspect of process management. By allowing processes to communicate with each other: 1.We can synchronize.
V0.01 © 2009 Research In Motion Limited Introduction to Java Application Development for the BlackBerry Smartphone Trainer name Date.
V0.01 © 2009 Research In Motion Limited Understanding Java APIs for Mobile Devices Trainer name Date.
Cosc 4730 Phone Programming in Java An Introduction.
V1.00 © 2009 Research In Motion Limited Introduction to Mobile Device Web Development Trainer name Date.
Implementing ISA Server Caching. Caching Overview ISA Server supports caching as a way to improve the speed of retrieving information from the Internet.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L08 (Chapter 18) Binary I/O.
70-290: MCSE Guide to Managing a Microsoft Windows Server 2003 Environment, Enhanced Chapter 10: Server Administration.
ORACLE APPLICATION SERVER BY PHANINDER SURAPANENI CIS 764.
Overview SAP Basis Functions. SAP Technical Overview Learning Objectives What the Basis system is How does SAP handle a transaction request Differentiating.
Sys Prog & Scripting - HW Univ1 Systems Programming & Scripting Lecture 15: PHP Introduction.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
©Kwan Sai Kit, All Rights Reserved Windows Small Business Server 2003 Features.
@2011 Mihail L. Sichitiu1 Android Introduction Platform Overview.
Java Mobile Application sms,sim,mms and barcode application Presented by Ayedh(SIM and MMS) Asad(SMS and Barcode Application)
Understanding the CORBA Model. What is CORBA?  The Common Object Request Broker Architecture (CORBA) allows distributed applications to interoperate.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
J2ME Presented by May Sayed & Menna Hawash. Outline Introduction “Java Technology” Introduction “What is J2ME?” J2ME Architecture J2ME Core Concepts 
CS 390- Unix Programming Environment CS 390 Unix Programming Environment Topics to be covered: Distributed Computing Fundamentals.
Copyright, 1996 © Dale Carnegie & Associates, Inc. Presented by Hsiuling Hsieh Christine Liu.
PROG Mobile Java Application Development PROG Mobile Java Application Development Memory and Memory Issues Data Storage.
LAB 1CSIS04021 Briefing on Assignment One & RMI Programming February 13, 2007.
Silberschatz, Galvin and Gagne  Operating System Concepts Chapter 3: Operating-System Structures System Components Operating System Services.
SQLite Supported by BlackBerry OS 5.0 Using SQLite.
1 Introduction to Microsoft Windows 2000 Windows 2000 Overview Windows 2000 Architecture Overview Windows 2000 Directory Services Overview Logging On to.
BlackBerry Persistent Storage Models Persistent Storage APIs and Record Management System.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
Copyright © cs-tutorial.com. Overview Introduction Architecture Implementation Evaluation.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Jini Architecture Introduction System Overview An Example.
Assignment of JAVA id : BSSE-F10-M-10-JAVA1 Overview of J2EE/Session 2/Slide 1 of 38.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
CSI 3125, Preliminaries, page 1 SERVLET. CSI 3125, Preliminaries, page 2 SERVLET A servlet is a server-side software program, written in Java code, that.
Lecture 4 Mechanisms & Kernel for NOSs. Mechanisms for Network Operating Systems  Network operating systems provide three basic mechanisms that support.
MCSE Guide to Microsoft Exchange Server 2003 Administration Chapter One Introduction to Exchange Server 2003.
Interstage BPM v11.2 1Copyright © 2010 FUJITSU LIMITED INTERSTAGE BPM ARCHITECTURE BPMS.
Exploring Networked Data and Data Stores Lesson 3.
1 Chapter 2: Operating-System Structures Services Interface provided to users & programmers –System calls (programmer access) –User level access to system.
BLACKBERRY TECHNOLOGY PRESENTED BY SHAIK TABREZ (09J01A1225 )
Antony Edwin Keane Inc Ltd
Advance Computer Programming Market for Java ME The Java ME Platform – Java 2 Micro Edition (J2ME) combines a resource- constrained JVM and a set of Java.
z/Ware 2.0 Technical Overview
Cryptography and Network Security
Wireless Instant Messaging Using J2ME
Introduction Enosis Learning.
CSI 400/500 Operating Systems Spring 2009
Chapter 3: Windows7 Part 4.
Network and Distributed Programming in Java
Introduction Enosis Learning.
Technical Capabilities
Chapter 2: Operating-System Structures
Chapter 2: Operating-System Structures
Presentation transcript:

Databases for Mobile Devices Introduction

Overview Different types of data storages Memory management Local database techniques in BlackBerry devices Data Integrity in persistent storage model Security Techniques in Persistent storage Remote database techniques BlackBerry Gateways

Different Types of Data Storage in BlackBerry There are two types of built-in memory in BlackBerry devices: –Flash Operating system, deployed applications and all persistent data such as PIM data, SMS/MMS messages and s are stored in flash memory persistently. The size of flash memory depends on the device. –SRAM In Static RAM, data persists as long as the device is on. It is used in runtime process, loading applications and objects. It is fast.

Extendable Memory –microSD expandable memory card You can extend the memory of your phone with a microSD card. MicroSD cards are persistent storages in which you can store documents, pictures, music and other media. In order to use microSD card, the device must support expandable memory functionality. The size of card your BlackBerry can support depends on the version of handheld OS software running on your device.

Memory Management The BlackBerry JVM performs memory allocation, garbage collection, memory management and swapping data between memories. Persistent data is stored in flash memory. When you load, execute or update application/ data, it is copied in RAM. Then, it is written back to flash memory. Hence, data is swapped continuously between flash and RAM.

Garbage Collection Garbage collection is handled by JVM. It removes unreferenced objects from RAM. It is only operated when: – JVM faces with a lack of space in RAM and can not allocate objects. –Objects handles are not available –The device is idle –The allocated heap size is exhausted

Optimizing the memory usage As mobile devices are limited in resources such as memory and battery consumption, it is recommended to minimize the memory use by performing the following guidelines: –Help Garbage collector with release resources after use. Set their reference to null after use. –Avoid creating many objects and global variables. Try to reuse objects as much as possible. Having too many objects can cause you run out of memory.

Optimizing the memory usage (Cont.) –Use primitive types such as int rather than objects like Vector, Integer –Reduce object handles. Try to group objects. It reduces the number of object handles

Database Techniques Databases can be accessed either locally or remotely. In local access, persistent storage is located in the mobile devices meaning that data can be stored locally on the device. In remote access, databases are located in the server. They can be access using data access tier or web services.

Local Database Techniques Persistence storages techniques in BlackBerry devices: –BlackBerry Persistent Store Model –MIDP RMS (Record Store Model) –Storing data on the expanable microSD card using File Connection APIs –Relational Model –Access to PIM data

BlackBerry Persistent Store Model BlackBerry Persistent Store Model provides a set of APIs for storing data permanently to flash memory in the BlackBerry device. Using the APIs, you are able to store, retrieve and manipulate data to/from the persistent storage. You are also able to save an entire Java object to memory without doing serialization.

BlackBerry Persistent Store Model (Cont.) The BlackBerry API for persistent store model is in net.rim.device.api.system package. In this model, data is stored as instances of PersistentObject. PersistentObject can be any object that implements the Persistable interface. PersistentStore is a store of persistent objects.

BlackBerry Persistent Store Model (Cont.) There is not a size limit exists on a persistent store. In Week 2, you will learn more details about this model.

Example- Persistent Storage API //This object can be added to PersistentStore class Student implements Persistable private int studentID; private String name; private String address; private String phone; public void setName(String name){ this.name = name; } public String getName(){ return this.name; }

MIDP RMS Model It provides a mechanism for MIDlets to persistently store, then retrieve and manipulate data. It is a Java ME package supported in the BlackBerry device as well. RMS library package is javax.microedition.rms Data is stored in a Record Store.

MIDP RMS Model (Cont.) A Record Store is a collection of persistent records. A record is an array of bytes (byte[]) that can have a different length and type. Each record has a unique identifier called RecordID. It is automatically assigned by an increasing-by-one algorithm. The size limit for a Record Store is 64KB.

MIDP RMS Model (Cont.) Each Record Store maintains a version, an integer number, which is incremented every time that the content of a record store is modified. The device platform is responsible to maintain the integrity of the record stores throughout the platform operations such as reboots, battery change and so on.

MIDP RMS Model (Cont.) All record store operations are atomic and synchronous. So, there will be no data corruption during multiple access to record stores. However, if you develop multi-threads to access record stores, it is your responsibility to synchronize these accesses.

Example- Record Store API String name="Smith"; try{ // To open a record store RecordStore rs = RecordStore.openRecordStore("phone_book", true); // To add a new record to a record store byte[] rec = name.getBytes(); rs.addRecord(rec, 0, rec.length); }catch(RecordStoreException rse) { System.out.println(rse); rse.printStackTrace(); }

Storing Data on MicroSD MicroSD cards are expandable memory storages in which data can be stored permanently. In order to store /access data on the SD card, the Java Me package, javax.microedition.io.file, is used. The package specification is in JSR 75, File Connection API.

Storing Data on MicroSD (Cont.) JSR 75 provides detailed information on the following package: –FileConnection API: A J2ME optional package that give Java-enabled devices access to file systems located on mobile devices –PIM API: A J2ME optional package that give access to PIM (Personal Information Management) data Both APIs are supported in BlackBerry devices as well.

Storing Data on MicroSD (Cont.) The FileConnection API provides: –Interfaces: FileConnection FileSystemListener –Classes: FileSystemRegistry ConnectionClosedException IllegalModeException

Storing Data on MicroSD (Cont.) File Connection API provides access to files or directories resided on either –MicroSD card FileConnection fc = (FileConnection) Connector.open(“file:///SDCard”); -Or – –File systems on BlackBerry devices FileConnection fc = (FileConnection) Connector.open(“file:///Store”);

Example- FileConnection API public void readFile(String filename) throws IOException { //Open a connection to the file FileConnection fc = (FileConnection)Connector.open( "file:///SDCard/BlackBerry/” + filename); if (fc.exists() && fc.fileSize() != 0) { InputStream is = fc.openInputStream(); // Read data from the input stream byte[] data = new byte[256]; int length = 0; while (-1 != (length = is.read(data))) { System.out.println(“The content is ”+ new String(data, 0, length); }

Relational Model Relational model is not supported in the BlackBerry Persistent models either Persistent Store APIs or RMS. It is the responsibility of developers to create an effective relational object model.

Access to PIM Data BlackBerry device Applications can access PIM (or PDAP) data such as contacts, tasks, and calendar. The package net.rim.blackberry.api.pdap supports the required interfaces and classes to access to the PDAP (Personal Digital Assistant Profile) data on the BlackBerry device. Java ME package, javax.microedition.pim, supports PIM data.

Access to PIM Data (Cont.) The APIs in the BlackBerry package, net.rim.blackberry.api.pdap, are controlled API. When you use controlled APIs in your application, your application must be signed using a signature key before deploying the application onto the BlackBerry device.

PIM Class It provides methods for accessing PIM databases on the BlackBerry devices. Invoke PIM.getInstance() to retrieve a PIM object. PIM List –PIM list Provides a list of PIM Items. A PIM item represents a collection of data for PIM data such as a calendar appointment, a contact, a task and so on. –A PIM item stores data in fields.

PIM Class (Cont.) There are three types of PIM lists: –CONTACT_LIST: Represents the contact list type –EVENT_LIST: Represents the event list type –TODO_LIST: Represents the ToDo list type

PIM Class (Cont.) Invoke PIM. openPIMList() to open the specified PIM list. –PIMList openPIMList(int pimListType, int mode, String name) mode indicates that the list is either READ_ONLY or READ_WRITE or WRITE_ONLY

PIM Class (Cont.) The next example demonstrates how to invoke this method. In order to create a contact, you must first create a contact list, then create contacts and add the information to it: –Open a contact list –Create a contact on a contact list –Add contact information to the contact object –Commit the contact object to the BlackBerry PIM database.

Example- PIM Class // Open a contact list and create a contact import javax.microedition.pim.*; import net.rim.blackberry.api.pdap.*; … try { ContactList contactList = (ContactList)PIM.getInstance().openPIMList (PIM.CONTACT_LIST, PIM.WRITE_ONLY); Contact contact = contactList.createContact(); } catch(Exception ex) { }

Data Integrity in persistent storage model Data Integrity is one of the important features in persistent models. It means that data should have consistency in terms of both creating and manipulating data all the time. To maintain the data integrity, partial updates are not done if an error occurs during commit.

Data Integrity in persistent storage model (Cont.) Partial updates occurs when one part of transaction is rolled back without rolling back the other parts. To maintain data integrity, Persistent Store model in BlackBerry supports both commit and rollback. Data Integrity can be compromised when JVM in BlackBerry devices invokes garbage collector due to low memory

Security Techniques in Persistent storage Security techniques in BlackBerry devices are summarized as follows: –Security in application layer: Controlled APIs: –Persistent Storage APIs are controlled API. Applications on the BlackBerry which use these APIs must be digitally signed by RIM. –You can run BlackBerry application that use controlled APIs in the BlackBerry simulators without signing the code.

Security Techniques in Persistent storage (Cont.) –Security in data layer: BlackBerry core applications: –user data stored in BlackBerry core applications can be encrypted locally in flash memory by setting IT policy by administrator. Third party applications: –They should register their data with this encryption service using cryptography APIs. So, before a third party application data commits to flash memory, the encryption service encrypts it with the same key

Remote database techniques You can access remote data sources from the BlackBerry devices. The following presents different ways to access remote databases : –N-tier applications –MDS Applications Web Services

Remote database techniques (Cont.) In order to access data remotely, a distributed (n-tier) architecture is required. There are several ways to implement a n-tier architecture. In the following slide, a 4-tier architecture is described

4-Tier Architecture A 4-tier architecture provides 4 separate layers for each of the following tiers: –Client-tier: mobile devices are considered as client- tier –Server-tier: known as business tier. Business objects, rules and data transformation can be designed in this tier. –Data access tier: Interfaces to access data storages, handling data I/O are designed in this layer. –Data-tier: Databases and data storages are in this tier.

4-Tier Architecture (Cont.) Databases Business TierClient TierData Access TierDatabases HTTP Connection Wireless Network

Remote Access to Data Sources The Server tier in this architecture can be: –An application server : It is a server-side application deployed into the server. It provides the business logic, handles requests, processes and send the response back to the client. –A Web Service It implements SOA (Service-Oriented Architecture) concepts. A client-tier application invokes the web service interfaces, in order to access the Web Service methods.

Remote Access to Data Sources (Cont.) Client-tierServer-tier Database Server Application Web Service

BlackBerry Gateways BlackBerry applications can use HTTP, HTTPS or TCP socket to make a connection over the wireless network. In order to minimize the network connection issues, it is recommended to use one of the three wireless gateways to proxy the connection to the Internet or Intranet.

BlackBerry Gateways (Cont.) In addition to reduce the network connection issues, they let applications have a consistent connectivity. The Gateways are: –BlackBerry Enterprise Server as an Intranet gateway –BlackBerry Internet Service as an Internet gateway –Wireless Service Provider’s Internet gateway

BlackBerry Enterprise Server (BES) Gateway BES is a link between BlackBerry devices, wireless network, and application servers enabling access from BlackBerry devices to the corporate data resided on the corporate intranet. The next slide describes the architecture.

Remote Data Access using BES with MDS service Source:

MDS Applications The BlackBerry Mobile Data System (MDS) is a framework which provides tools to build and deploy BlackBerry Enterprise applications. Before, in order to use corporate applications, customers have to be tied to the corporate server. Now, BES for MDS has separated wireless applications from .

MDS Applications (Cont.) It enables mobile access to applications only. In other words, BES for MDS applications provides you a choice to deploy both wireless and applications or wireless applications only.

MDS Applications (Cont.) BES for MDS applications offers the following features: –Security: IT Policy: It controls the application accesses. End-to-end authenticated connection: It encrypts all data. –Push service to provide real-time data –Centralized administration console –Deploy over-the-air (OTA)

BlackBerry Internet Service (BIS) Gateway BIS is an Internet and service for BlackBerry devices Allows to automatic delivery of messages, and convenient access to Internet content. This service uses RIM push technology allowing real-time access of .