The Symbian OS (779886), страница 58
Текст из файла (страница 58)
Additional discovery of non-read-only internal drivesoccurs when a drive is added or removed and when a secure plug-in isadded to or removed from a writable drive.Persistence modelThe Symbian OS persistence model is based on the Store architecture,which defines abstractions of streams and stores.A stream is an abstract interface that translates between internal andexternal object representations, that is, between bit layouts in RAM andbit layouts saved onto storage media or sent over a network.
As well asencryption and decryption streams, four alternative stream implementations are provided, suited for different underlying storage media:• fixed-size memory streams• variable-size memory streams• file streams• store streams.A store is an abstract interface that allows a network of streams tobe manipulated, including Externalize and Internalize operations, whichallow complex data structures (e.g. whole documents or databases) to bestored or restored from external media or from a network.As well as secure stores (which provide encryption and decryption) andsupporting store dictionaries (used to locate the various streams inside astore), the Store architecture provides alternative implementations suitedfor different underlying storage media or uses:• stores using RAM as the underlying storage media (for example, usedas undo buffers by some applications)264THE BASE SERVICES LAYER• stores using files as underlying storage media, either direct file storesused by ‘file-based applications’, which keep all their data in RAMwhen running (in other words, which create and manipulate conventional documents), or permanent file stores used by applications thatonly part-load their data (for example, database applications)• stores that can be embedded into other stores thus allowing documentembedding to create compound documents (e.g.
pictures in a textdocument)Streams and stores provide the native, object-oriented persistencemodel for Symbian OS. Both the DBMS relational database interface andthe Central Repository are implemented on top of store mechanisms.DBMSThe DBMS component defines a general relational-database-access APIand provides implementations either for small client-side databases orfor client–server-based multiple-client implementations. Client–serverdatabases are stored in files. Client-side databases can either be a wholefile or a single file stream (enabling multiple single stream databases toreside in a single file).Databases can be manipulated either through a native API or a subsetof SQL.
Basic database functions are supported, including table creation,manipulation and deletion, database queries and transactions.From Symbian OS v8, where required, DBMS supports securityaccess-control policies for databases, including shared-access policies.For system-supplied databases, it allows additional finer-grained policiesto be specified for named tables within a database (for databases createdwithin the DBMS private data-cage).Central repositoryThe Central Repository provides a single persistent store for global settingsas well as a notification mechanism allowing clients to register to benotified when specific settings change.The Central Repository is designed as a collection of repositories,where a repository is a collection of settings.
A setting is representedby a data value (a 32-bit integer, a real number, a byte-array or a textstring). Repositories are created from a definition file based on a standardtemplate and may be compacted into a binary format. Each repository hasan owner and is required to declare an access-control policy, which is setin the initialization file and cannot thereafter be changed. Access controlmay be specified at the level of the whole repository, for individualsettings or for ranges of settings, and may include settings which have notyet been created.ARCHITECTURE265Depending on access control, individual settings may be created,searched for, have their values set, or deleted.
Range operations aresupported and a notification registration mechanism is provided allowingclients to register interest in settings changes (including creation anddeletion). ‘After-market’ repositories (e.g., for user- or network-installedapplications) are supported by the Application Installer. Backup, restoreand caching of repositories is also supported. Access to repository settingsis restricted based on the capabilities of the client making an accessrequest together with the repository security policy.In general, settings replace the use of INI files to store application andsystem defaults and other information, for example default file names,locale settings and user preferences.
Similarly, settings replace the useof the Comms Database for storing communications-specific defaultsand settings, although the Comms Database interface is preserved forcompatibility.The earliest releases of Symbian OS included a Registry, but it wasremoved (as it was not portable) in Symbian OS v6 and replaced bysolutions based on INI files and the Comms database.
In Symbian OSv8, the Central Repository was introduced to provide more efficient andconsistent settings management.Other Services and UtilitiesThe Base Services layer contains a number of additional frameworks,libraries, utilities and servers.Application UtilitiesThe Application Utilities, known to developers as the Basic Application Framework Library (BAFL), provide an assortment of utility classesorganized as a single library DLL:• resource-file handling including loading and reading of legacy formats(before Symbian OS v7) and Unicode-compressed and Unicodeand-dictionary-compressed formats (since Symbian OS v7), includingrobust reading classes able to handle corrupt resource files• file utilities, including file finding based on file type as defined by UIDand file matching to select between files based on the current locale• string pools, a storage mechanism allowing for fast string comparisons• dynamic arrays for descriptors, supporting mixed 8-bit and 16-bitdescriptors• incremental text-matching comparing two text buffers (reading leftto-right)266THE BASE SERVICES LAYER• support for showing localized names of ‘user-showable’ plug-ins• clipboard copy–paste support implemented as a direct file store withstream dictionary, allowing applications to retrieve clipboard data byUID• system sounds for messages, events, errors and so on, specified byUID• minimal support for spreadsheet-style ‘cell’ and ‘range’ data types• legacy change notifier (derived from active objects) wrapping theRChangeNotifier for system environment changes relating to time,locale, power and thread death.Character Encoding and Conversion Framework and Plug-insThe Character Encoding and Conversion Framework provides an API forconverting text between Unicode and other character sets based on anextensible converter plug-in architecture.In Symbian OS v9, conversion is supported for a variety of ASCIIformats (including common ISO codepages), UTF-7 encodings (includingShift-JIS and JIS) and UTF-8 encodings.
Conversion is performed byspecifying the Unicode character set of interest (for conversion to or from)and then requesting the conversion.As well as text conversion, text utilities are provided to managecharacter sets (create character-set arrays, find the character-set UIDfrom the character set name and vice versa) and to detect character setsautomatically based on sample texts.XML Framework and Parser Plug-insThe XML Framework provides an extensible framework for XML parsingbased on a parsing model similar to SAX 2.0, into which custom parserimplementation plug-ins (as well as validator, DTD and auto-correctionplug-ins) can be loaded. Default plug-ins are provided for non-validatedparsing of XML 1.0 and for WAP Binary XML (WBXML).Parsers are selected based on a document’s MIME type and othercriteria supplied by clients when using the framework.
The parser classdefines methods that parse XML data from descriptors (all in one go orincrementally) and from files. Internally within the parser, text is stored inUTF-8 format to ensure preservation of extended characters.The WBXML parser plug-in can be extended to support additionaldocument types by providing WBXML token-to-string translation tables(‘String Dictionaries’). Default tables are supplied for SyncML, WML andService Indication.The design goal for the framework is to provide a single, standard,platform implementation of a flexible and capable XML parser to replaceARCHITECTURE267the various task-specific and ad hoc parsers provided locally in the system.The framework also provides sufficient extensibility for likely future uses(including generating capability).So-called ‘processor’ plug-ins (for example, validators and autocorrectors) may be chained with parsers to provide multiple processingstages.String Dictionaries are implemented using string pools that makestring comparison almost instantaneous (at the expense of string creation;however, this supports parsing cases where string constants are knownat compile time particularly well, as is the case where documents followstandard DTDs such as SyncML, SMIL or WML).Media Device Framework and Plug-insThe Media Device Framework provides hardware-abstraction interfacesfor audio and video accelerators to the Multimedia Framework (seeChapter 8) and its clients.
Typically, accelerators are hardware devices(codecs) but they may also be software emulations. The framework definesAPIs for sound, video, MIDI, and ASR (Automatic Speech Recognition)accelerators, and the architecture for loading the lower-level adaptorplug-ins (DevSound, DevVideo, DevMIDI, and DevASR; see Chapter 11).A client utility API for speaker-independent speech recognition is alsosupplied as a plug-in and is available to any client wanting to interface toASR hardware (or software emulations).The framework also includes a policy server that manages access tothe underlying audio and video hardware, deciding which clients canaccess the hardware and when.
Licensees can customize access policies.The Media Device Framework evolved from the earlier Symbian OSv6 and Symbian OS v7 MediaServer. Previously, Multimedia Frameworkcontroller plug-ins were able to directly interface to audio and videocodecs via adaptor plug-ins. By defining a standard interface betweencontrollers and adaptors, the Media Device Framework enables portableadaptors to be developed to support specific accelerator hardware. Theframework has evolved significantly over subsequent releases comparedwith its first implementations, which supported only audio.Cryptography LibraryThe Cryptography Library provides system-level support for a widerange of non-RSA cryptographic algorithms including symmetric andasymmetric ciphers, hash functions and a cryptographic strong randomnumber generator.