• No results found

ADOBE AIR. Working with Data in AIR. David Tucker

N/A
N/A
Protected

Academic year: 2021

Share "ADOBE AIR. Working with Data in AIR. David Tucker"

Copied!
42
0
0

Loading.... (view fulltext now)

Full text

(1)

Working with Data in AIR

David Tucker

(2)

Software Engineer II, Universal Mind

Adobe Community Expert

Lead Author, Adobe AIR 1.5 Cookbook

Podcaster, Weekly RIA RoundUp at InsideRIA

Author, AIR for Flash Developers at Lynda.com

(3)

Explaining the background for a beginner

Showing intermediate level examples

Providing advanced tips for production applications

How I Will Be

(4)
(5)

Encrypted Local Store

(6)

Encrypted Local Store

Local File System

(7)

Encrypted Local Store

Local File System

Embedded SQLite Database

(8)

Encrypted Local Store

Local File System

Embedded SQLite Database

Online/Offline Sync with LCDS (time permitting)

(9)

The encrypted local store provides

secure storage for binary data which can be retrieved via a string key. It utilizes the native operating system encryption store (such as Keychain on the Mac or DPAPI on Windows) to secure data with 128-bit encryption. Data in the Encrypted Local Store is accessible

only from your AIR application.

(10)

flash.data.EncryptedLocalStore - The class that handles all interaction with the

Encrypted Local Store has four static methods for working with its data

getItem(name:String):ByteArray

removeItem(name:String):void

reset():void

setItem(name:String, data:ByteArray, stronglyBound:Boolean = false):void

(11)

Code Sample: Encrypted

Local Store

(12)
(13)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(14)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(15)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(16)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(17)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(18)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(19)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(20)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(21)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(22)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(23)

0 2 4 6 8 10 12 14 16 18 20 100 KB 256 KB 512 KB 1 MB 10 MB

Encrypted Local Store Performance Analysis

(24)

AIR does allow you to work with multiple

threads using the Asynchronous API's for certain pieces of functionality:

Encrypted Local Store - No Async API

Local File System - Sync and Async API

SQLite Database - Sync and Async API You cannot utilize multiple threads outside of these Asynchronous API's.

Asynchronous vs.

(25)
(26)

flash.filesystem.File - The class that contains a reference to a file system object (either file or directory).

flash.filesystem.FileStream - This class can read binary data into and out of a file on the filesystem.

flash.filesystem.FileMode - A class of

constants that defines the mode in which a file is opened.

API Dictionary: File

System

(27)

open( file:File, fileMode:String ):void

openAsync( file:File, fileMode:String ):void

Two Ways to Open a

File

(28)

Code Example: Image

Cache

(29)

Serialization and

IExternalizable

With the local file system, you are not

limited to just storing binary data from files, you can also store complex object graphs by having your model implement IExternalizable.

(30)

Vista will not allow you to copy, update, or delete any files that exist in the application directory. Because of this, always utilize the application storage directory for storing

application data.

Utilize the constants defined in

flash.filesystem.File to help preserve cross-platform compatibility. Utilize the url

property when possible.

(31)

Embedded SQLite

Database

(32)

It can be very helpful to have an SQLite administration tool:

SQLite Admin AIR Application

SQLite Manager Firefox Extension

SQLite Database Browser

(33)

flash.data.SQLConnection - The actual

connection to a database stored either as a file or in memory

flash.data.SQLStatement - The class that contains an SQL statement that will be executed on the database

flash.data.SQLResult - The class that holds the result set for a given query.

(34)

Code Sample: SQLite

Database

(35)

AIR 1.5 added support for encrypted databases

Database must be encrypted when created

The encryption key can be changed using the reencrypt method

(36)

You will need to use a library that will allow you to generate the required binary key for the encrypted database. Two common

options are as3corelib and as3crypto.

as3corelib

as3crypto

Generating Encryption

Keys

(37)

Code Sample: Encrypted

Database

(38)

Each statement is in a transaction by default, so batch commands should be

wrapped in a transaction for performance.

When multiple SELECT queries need to be run simultaneously, utilize connection

pooling.

(39)

There are two promising solutions for

simplifying interaction with the SQLite database in AIR.

Flex ORM - Provides a metadata-based

framework for defining the database model from the application model.

DAO-Ext - Automates the implementation of the DAO pattern in your application.

(40)

LiveCycle Data Services provides an enterprise solution for synchronizing data between the server and an occasionally connected AIR application.

Data Synchronization in AIR with LCDS - John C. Bland II at InsideRIA

(41)
(42)

The Weekly RIA RoundUp Podcast at

InsideRIA covers both Flex and AIR news as well as the rest of the RIA landscape.

References

Related documents

Ohio found added K is needed for corn and alfalfa on soils testing as high as 400 pounds of available K per acre (Ohio Bu.. Im- balance of nutrients places plants under stress

In an Order 18 dated June 14, 2013, the MTCC dismissed the case insofar as respondents were concerned 19 for failure of petitioners and their counsel to appear

(as%ofGDP) Povertygapusing $2/day (as%ofGDP) Impact? Brazil BolsaFamilia (transfer) 0.4 0.6 Povertygapof thosereached wentdownby 12%200105

In grain marketing, this counterparty risk is the risk that grain elevators may not deliver grain in the physical markets, as specified by the futures contract, or they may not

The findings of the depth-interviews show that from the 14 variables identified in the literature, 7 variables appear to influence the customer experience when searching

It is absolutely certain, without further elaboration, that the revitalization and improvement of the competitiveness of the process, product, and (economic) participants in the

An IFA 401(k) enables plan participants to optimize their retirement investing with a platform that includes: • Low-cost, passively managed portfolios of institutional index funds..

System requirements Supported languages Features in AIR 1.5 Installing Adobe AIR Uninstalling Adobe AIR Installing AIR applications Known issues and limitations Adobe AIR SDK..