7 Nokia Corporation - initial contribution. |
7 Nokia Corporation - initial contribution. |
8 Contributors: |
8 Contributors: |
9 --> |
9 --> |
10 <!DOCTYPE concept |
10 <!DOCTYPE concept |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
12 <concept id="GUID-AA5DEEB2-0B13-5FA8-8494-EC2F5C654FEF" xml:lang="en"><title>CentRepExample: |
12 <concept id="GUID-AA5DEEB2-0B13-5FA8-8494-EC2F5C654FEF" xml:lang="en"><title>CentRepExample: Using Central Repository for Persistent Storage</title><shortdesc>This example application demonstrates the usage of Central |
13 Using Central Repository for Persistent Storage</title><shortdesc>This example application demonstrates the usage of Central Repository |
13 Repository API for persistent storage.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
14 API for persistent storage.</shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody> |
14 <section id="GUID-E2129D18-6FBB-55B9-8D79-420EB2CF2401"><title>Description</title> <p>Several Symbian platform components have state and settings information |
15 <section id="GUID-E2129D18-6FBB-55B9-8D79-420EB2CF2401"><title>Description</title> <p>Several |
15 that need to be persistent. There is also a global state that needs |
16 Symbian platform components have state and settings information that need |
16 to persist, for example, default filenames, locale settings, user |
17 to be persistent. There is also a global state that needs to persist, for |
17 preferences. </p> <p>The CentRep example application first registers |
18 example, default filenames, locale settings, user preferences. </p> <p>The |
18 a group of settings with the central repository server. It uses <filepath>E80000AD.txt</filepath>, a UTF-16 format text file to initialise |
19 CentRep example application first registers a group of settings with the central |
19 the repository. This text file contains access control structure and |
20 repository server. It uses <filepath>E80000AD.txt</filepath>, a UTF-16 format |
20 the initial content of the repository. It is recommended to convert |
21 text file to initialise the repository. This text file contains access control |
21 the initialisation text file into a binary file using the central |
22 structure and the initial content of the repository. It is recommended to |
|
23 convert the initialisation text file into a binary file using the central |
|
24 repository converter tool to speed up the execution. </p> <p>The application |
22 repository converter tool to speed up the execution. </p> <p>The application |
25 creates a <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita"><apiname>CRepository</apiname></xref> object using the <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-B8DD1F6F-5A03-30C7-A5B5-51053D9FBDD3"><apiname>CRepository::NewLC()</apiname></xref> method |
23 creates a <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita"><apiname>CRepository</apiname></xref> object using the <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-B8DD1F6F-5A03-30C7-A5B5-51053D9FBDD3"><apiname>CRepository::NewLC()</apiname></xref> method to access a repository using |
26 to access a repository using its UID. It resets the whole repository using <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-BA806B9D-C347-3722-886E-1290A4A0618A"><apiname>CRepository::Reset()</apiname></xref> method |
24 its UID. It resets the whole repository using <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-BA806B9D-C347-3722-886E-1290A4A0618A"><apiname>CRepository::Reset()</apiname></xref> method with the contents in the initialisation file. </p> <p>Each |
27 with the contents in the initialisation file. </p> <p>Each setting stored |
25 setting stored in the repository will have a unique key to identify |
28 in the repository will have a unique key to identify the setting. This unique |
26 the setting. This unique key is used to read and change the setting |
29 key is used to read and change the setting by calling the <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-AB3918A5-BA69-3EE8-89B4-51DD8A899AF5"><apiname>CRepository::Get()</apiname></xref> and <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-114079A1-A8CA-3FE7-8FAD-F5E61453FF6B"><apiname>CRepository::Set()</apiname></xref> methods |
27 by calling the <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-AB3918A5-BA69-3EE8-89B4-51DD8A899AF5"><apiname>CRepository::Get()</apiname></xref> and <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-114079A1-A8CA-3FE7-8FAD-F5E61453FF6B"><apiname>CRepository::Set()</apiname></xref> methods respectively. The application |
30 respectively. The application moves these keys to a different location using <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-4F005B5F-2664-3F7C-848D-B6F93462F2F4"><apiname>CRepository::Move()</apiname></xref> method |
28 moves these keys to a different location using <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-4F005B5F-2664-3F7C-848D-B6F93462F2F4"><apiname>CRepository::Move()</apiname></xref> method and deletes them from their original location. </p> <p>The |
31 and deletes them from their original location. </p> <p>The application also |
29 application also creates another <codeph>CRepository</codeph> object |
32 creates another <codeph>CRepository</codeph> object to demonstrate that, at |
30 to demonstrate that, at any given point a repository cannot be opened |
33 any given point a repository cannot be opened with <i>READ/WRITE</i> access |
31 with <i>READ/WRITE</i> access by more than one client. In such situations, |
34 by more than one client. In such situations, it is recommended to start a |
32 it is recommended to start a transaction before a write operation |
35 transaction before a write operation using <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-1F14EB0C-89CF-3A76-A678-5F6F86F50B32"><apiname>CRepository::StartTransaction()</apiname></xref> method. |
33 using <xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-1F14EB0C-89CF-3A76-A678-5F6F86F50B32"><apiname>CRepository::StartTransaction()</apiname></xref> method. A |
36 A transaction guarantees the consistency and persistence of all values read |
34 transaction guarantees the consistency and persistence of all values |
37 and written during the transaction. </p> <p>Finally, the application requests |
35 read and written during the transaction. </p> <p>Finally, the application |
38 the central repository server to notify any changes to the original settings. </p><p><b>Related |
36 requests the central repository server to notify any changes to the |
39 APIs</b></p><ul> |
37 original settings. </p><p><b>Related APIs</b></p><ul> |
40 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita"><apiname>CRepository</apiname></xref> - Provides access to a repository.</p></li> |
38 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita"><apiname>CRepository</apiname></xref> - Provides access to a repository.</p></li> |
41 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-AB3918A5-BA69-3EE8-89B4-51DD8A899AF5"><apiname>CRepository::Get()</apiname></xref></p></li> |
39 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-AB3918A5-BA69-3EE8-89B4-51DD8A899AF5"><apiname>CRepository::Get()</apiname></xref></p></li> |
42 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-4F005B5F-2664-3F7C-848D-B6F93462F2F4"><apiname>CRepository::Move()</apiname></xref></p></li> |
40 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-4F005B5F-2664-3F7C-848D-B6F93462F2F4"><apiname>CRepository::Move()</apiname></xref></p></li> |
43 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-B8DD1F6F-5A03-30C7-A5B5-51053D9FBDD3"><apiname>CRepository::NewLC()</apiname></xref></p></li> |
41 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-B8DD1F6F-5A03-30C7-A5B5-51053D9FBDD3"><apiname>CRepository::NewLC()</apiname></xref></p></li> |
44 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-BA806B9D-C347-3722-886E-1290A4A0618A"><apiname>CRepository::Reset()</apiname></xref></p></li> |
42 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-BA806B9D-C347-3722-886E-1290A4A0618A"><apiname>CRepository::Reset()</apiname></xref></p></li> |
45 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-114079A1-A8CA-3FE7-8FAD-F5E61453FF6B"><apiname>CRepository::Set()</apiname></xref></p></li> |
43 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-114079A1-A8CA-3FE7-8FAD-F5E61453FF6B"><apiname>CRepository::Set()</apiname></xref></p></li> |
46 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-1F14EB0C-89CF-3A76-A678-5F6F86F50B32"><apiname>CRepository::StartTransaction()</apiname></xref></p></li> |
44 <li><p><xref href="GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78.dita#GUID-DEA618DF-D462-3B3E-A1E1-F21295AAFE78/GUID-1F14EB0C-89CF-3A76-A678-5F6F86F50B32"><apiname>CRepository::StartTransaction()</apiname></xref></p></li> |
47 </ul> </section> |
45 </ul> </section> |
48 <section id="GUID-3B353EAA-5FE4-426B-A0A5-6800CE0BC9E3"><title>Download</title> <p>Click |
46 <section id="GUID-3B353EAA-5FE4-426B-A0A5-6800CE0BC9E3"><title>Download</title> <p>Click on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-e78b3d2c-7205-45ca-abe0-163e33a0fcc3.zip" scope="external">CentRepExample.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-e78b3d2c-7205-45ca-abe0-163e33a0fcc3.html" scope="peer">browse</xref> to view the example code.</p> </section> |
49 on the following link to download the example: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/zips/guid-e78b3d2c-7205-45ca-abe0-163e33a0fcc3.zip" scope="external">CentRepExample.zip</xref></p><p>Click: <xref href="guid-6013a680-57f9-415b-8851-c4fa63356636/guid-e78b3d2c-7205-45ca-abe0-163e33a0fcc3.html" scope="peer">browse</xref> to view the example code.</p> </section> |
47 <section id="GUID-DCCBE8DE-0BBD-5528-A460-E1645116DD4F"><title>Build</title> <p>The Symbian build process describes how to build an application. </p> <p>The <codeph>CentRepExample</codeph> builds an |
50 <section id="GUID-DCCBE8DE-0BBD-5528-A460-E1645116DD4F"><title>Build</title> <p>The <xref href="GUID-3100800B-B2F7-50EF-BD4C-3C345ECCB2A5.dita">Symbian build process</xref> describes |
48 executable called <filepath>CentRepExample.exe</filepath> in the standard |
51 how to build an application. </p> <p>The <codeph>CentRepExample</codeph> builds |
|
52 an executable called <filepath>CentRepExample.exe</filepath> in the standard |
|
53 location (\epoc32\release\winscw\<<i>build_variant</i> > for CodeWarrior). |
49 location (\epoc32\release\winscw\<<i>build_variant</i> > for CodeWarrior). |
54 After launching the executable, depending on the emulator you are using, you |
50 After launching the executable, depending on the emulator you are |
55 may need to task away from the app launcher/shell screen to view the console. </p> </section> |
51 using, you may need to task away from the app launcher/shell screen |
|
52 to view the console. </p> </section> |
56 </conbody></concept> |
53 </conbody></concept> |