The Record Store (2009.12.25) Frank Ducrest. The Record Store 2 The Record Store provides persistence of data between MIDlet runs not quite a DBMS API.

Slides:



Advertisements
Similar presentations
Section 2.5 Single-Linked Lists. A linked list is useful for inserting and removing at arbitrary locations The ArrayList is limited because its add and.
Advertisements

Sequence of characters Generalized form Expresses Pattern of strings in a Generalized notation.
Java ME persistence made easy! by Thiago Rossato Thiago Moreira.
Software Engineering Implementation Lecture 3 ASPI8-4 Anders P. Ravn, Feb 2004.
The Singleton Pattern II Recursive Linked Structures.
Problem Solving 5 Using Java API for Searching and Sorting Applications ICS-201 Introduction to Computing II Semester 071.
Java Card Technology Ch07: Applet Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Computer Science & Engineering.
5/17/ Programming Constructs... There are several types of programming constructs in JAVA. - If-else construct or ternary operator - while - do-while.
Cosc 4730 Blackberry: Record Store & SQLite. Introduction RecordStore – Comes from JavaME, MIDP 1.0 On some phone who where you may not have a filesystem.
Developing an Application with J2ME Technology Scott Palmer, Nat Panchee, Judy Sullivan, Karen Thabet, Sten Westgard.
CSC 160 Practice Final Review. Question 1 class A { public void blah() { System.out.println("a"); } class B extends A { public void blah() { System.out.println("b");
Developing J2ME Applications Mobile and Wireless Networks.
List Interface CS java.util.List Interface and its Implementers CS340 2.
Persistent Storage  Record Stores  mini databases – represent data as byte records  Record Management System (RMS) API  Files and Directories  FileConnection.
Detecting Changes  ItemStateListener interface – detect changes in internal state of an Item  new selection made in a ChoiceGroup  adjusted value of.
An Introduction to the Java ME Project Jens A Andersson.
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
Abstract Data Types (ADTs) and data structures: terminology and definitions A type is a collection of values. For example, the boolean type consists of.
Grouping objects Collections and iterators. Main concepts to be covered Collections Loops Iterators.
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
Software testing techniques Software testing techniques Mutation testing Presentation on the seminar Kaunas University of Technology.
BlackBerry Persistent Storage Models Persistent Storage APIs and Record Management System.
Variables and Data Types.  Variable: Portion of memory for storing a determined value.  Could be numerical, could be character or sequence of characters.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Copyright Curt Hill Variables What are they? Why do we need them?
Programming Handheld and Mobile devices 1 Programming of Handheld and Mobile Devices Lecture 8 CDC andJ2ME Rob Pooley
모바일 자바 프로그래밍 MIDP RMS Ps lab 오민경. MIDP RMS  RMS (Record Management System)  MIDP 에서 정의하는 영속성을 지닌 자체 데이터 저장 공간  Record Store 의 집합으로 구성된 아주 간단한 데이터베이스.
Mark Fontenot CSE Honors Principles of Computer Science I Note Set 15.
Unit Testing Part 2: Drivers and Stubs
A: A: double “4” A: “34” 4.
CS 180 Recitation 7 Arrays. Used to store similar values or objects. An array is an indexed collection of data values of the same type. Arrays are the.
MIDP Database Programming Using RMS: Jingwu He Csc 3360.
M180: Data Structures & Algorithms in Java Stacks Arab Open University 1.
COMP Inheritance and Polymorphism Yi Hong June 09, 2015.
CSE403: MIDlets and Ant1 MIDlets and Ant April 3, 2003 Shane Cantrell Zach Crisman.
Access to Remote Data ( ) Frank Ducrest.
Information and Computer Sciences University of Hawaii, Manoa
Java- I/O, SMS etc N Amanquah.
CSC111 Quick Revision.
5/9/2018 Advanced Unit Testing David Rabinowitz.
EECE 310: Software Engineering
Single-Linked Lists.
JAVA MULTIPLE CHOICE QUESTION.
Lecture 14 Throwing Custom Exceptions
Big-O notation Linked lists
Stacks.
Mutation testing Julius Purvinis IFM-0/2.
University of Central Florida COP 3330 Object Oriented Programming
CSS 430: Operating Systems - Process Synchronization
Extract Subclass, Extract Superclass and Extract Hierarchy
Computer Science II Exam 1 Review.
Review Operation Bingo
null, true, and false are also reserved.
An Introduction to Java – Part I, language basics
COMPUTER 2430 Object Oriented Programming and Data Structures I
JavaScript Reserved Words
Shane Cantrell Zach Crisman
Stacks Abstract Data Types (ADTs) Stacks
Java for Mobile Devices
Collections Framework
PreAP Computer Science Review Quiz 08
Focus of the Course Object-Oriented Software Development
Module 2 - Part 1 Variables, Assignment, and Data Types
Building Java Programs
Chap 2. Identifiers, Keywords, and Types
CSC Java Programming, Spring, 2012
Agenda Types and identifiers Practice Assignment Keywords in Java
LCC 6310 Computation as an Expressive Medium
A type is a collection of values
The Queue ADT Definition A queue is a restricted list, where all additions occur at one end, the rear, and all removals occur at the other end, the front.
Presentation transcript:

The Record Store ( ) Frank Ducrest

The Record Store 2 The Record Store provides persistence of data between MIDlet runs not quite a DBMS API is Package javax.microedition.rms store – data collection that ➢ contains records ➢ may be private to the MIDlet ➢ may be shared with other MIDlets ➢ persists between runs of the MIDlet ➢ schema must be known to be read from or written to ➢ named as part of MIDlet suite

The Record Store 3 Record each record in a store has a unique index (ID) starting at 1 removing a record does not recycle the index (ID), just sets data to null

The Record Store 4 Opening / Creating a Record Store static RecordStore openRecordStore(String recordStoreName, boolean createIfNecessary) creating if it doesn't exist RecordStore rs = RecordStore.openRecordStore(“MyStore”, true); failing if it doesn't exist RecordStore rs = RecordStore.openRecordStore(“MyStore”, false);

The Record Store 5 Closing a Record Store void closeRecordStore() example: rs.closeRecordStore(); Deleting a Record Store static void deleteRecordStore(String recordStoreName) example: RecordStore.deleteRecordStore(“MyStore”);

The Record Store 6 Adding a Record to a Store int addRecord(byte[ ] data, int offset, int numBytes) Reading a Record from a Store byte[ ] getRecord(int recordId)

The Record Store 7 Example Using a Record Store import javax.microedition.midlet.*; import javax.microedition.rms.*; public class RecordStoreExampleMidlet extends MIDlet { private void putNameInStore(String name) { try { RecordStore.deleteRecordStore("MyStore"); }catch (Exception e) { } try { byte[] b = name.getBytes(); RecordStore rs = RecordStore.openRecordStore("MyStore", true); rs.addRecord(b, 0, b.length); rs.closeRecordStore(); } catch (Exception e) {} }

The Record Store 8 Example Using a Record Store (continued) private String getNameFromStore() { String name = null; try { RecordStore rs = RecordStore.openRecordStore("MyStore", false); byte[] b = rs.getRecord(1); name = new String(b); rs.closeRecordStore(); } catch (Exception e) {} return name; }

The Record Store 9 Example Using a Record Store (continued) public void startApp() { String name = getNameFromStore(); System.out.println("Last Name in Store: " + name); if (name == null) putNameInStore("Sam"); else if (name.equalsIgnoreCase("Sam")) putNameInStore("Sue"); else if (name.equalsIgnoreCase("Sue")) putNameInStore("Tom"); else if (name.equalsIgnoreCase("Tom")) putNameInStore("George"); destroyApp(true); notifyDestroyed(); } public void pauseApp() {} public void destroyApp(boolean unconditional) {} }

The Record Store 10 Example Using a Record Store (continued) output from 6 consecutive executions: Last Name in Store: null Last Name in Store: Sam Last Name in Store: Sue Last Name in Store: Tom Last Name in Store: George