|
1 <?xml version="1.0" encoding="utf-8"?> |
|
2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. --> |
|
3 <!-- This component and the accompanying materials are made available under the terms of the License |
|
4 "Eclipse Public License v1.0" which accompanies this distribution, |
|
5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". --> |
|
6 <!-- Initial Contributors: |
|
7 Nokia Corporation - initial contribution. |
|
8 Contributors: |
|
9 --> |
|
10 <!DOCTYPE concept |
|
11 PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd"> |
|
12 <concept xml:lang="en" id="GUID-8BFC185E-91FD-5E04-A26C-728B06F31FDD-GENID-1-7-1-23-1-1-4-1-3-1-6-1-6-1"><title>Creating Transfer Types</title><shortdesc>To transfer data between the Backup Engine and the backup server, a particular type of <apiname>conn::CSBGenericTransferType</apiname> must be created. </shortdesc><prolog><metadata><keywords/></metadata></prolog><conbody><section><title>Introduction</title> <p>The <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-FB671D02-0F15-396F-9FB7-EE3E9372093C"><apiname>conn::CSBEClient</apiname></xref> uses <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-27BF6AEB-72A0-3E39-9598-AB97BE2569FC"><apiname>conn::CSBGenericTransferType</apiname></xref> to request (for backup) or supply (for restore) data. One of the following three derived classes must be created to transfer data. </p> <ul><li id="GUID-9002670C-20FB-5FCA-BB11-BAA96FC591A8"><p> <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-6921D016-99BB-3CF0-B77C-CEF652A6D16B"><apiname>conn::CSBSIDTransferType</apiname></xref> transfers data of the owner whose type is <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-A592A578-6E32-36C8-A2CE-590E99173AF8"><apiname>conn::ESIDDerivedType</apiname></xref>. Data owners of this type are the common applications or servers built into the ROM. </p> <p>You can specify the creation of passive data, active data or snapshot data transfer type by passing a <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-55127967-CF91-3AEF-8304-DB60B287036F"><apiname>conn::TTransferDataType</apiname></xref> parameter value to the <codeph>CSBSIDTransferType::NewL()</codeph> function. For example, passing <codeph>EActiveSnapshotData</codeph> to <codeph>CSBSIDTransferType:NewL()</codeph> creates an active snapshot transfer type. </p> </li> <li id="GUID-550A62AA-0E27-5DD0-B014-3498CFDEDDEA"><p> <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-EB313AA2-302E-352F-B1A4-E60DAFBEBCFB"><apiname>conn::CSBPackageTransferType</apiname></xref> transfers data of the owner whose type is <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-A68EF3B1-2DF6-3787-83E0-F72CE16E785D"><apiname>conn::EPackageDerivedType</apiname></xref>. Data owners of this type are usually installed through SIS files. Installing a package may install may install several applications (data owners). Each package is identified by a package ID while each data owner is identified by a package ID, a package name and an SID. </p> <p>Packages are often installed to a system drive, their data and snapshots are referred to as system data and system data snapshots. </p> </li> <li id="GUID-03178C8B-DFD8-5094-BFA6-65DB923E77BC"><p> <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-A655F770-18F9-3F43-ADAB-9048EF14A5EC"><apiname>conn::CSBJavaId</apiname></xref> transfers data of the owner whose type is <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-BCB77CBF-1B06-38E1-96C1-FF3CFCA5B734"><apiname>conn::EJavaDerivedType</apiname></xref>. Data owners of this type are Java applications. </p> </li> </ul> </section> <section id="GUID-8BFC185E-91FD-5E04-A26C-728B06F31FDD-GENID-1-7-1-23-1-1-4-1-3-1-6-1-6-1-3-2"><title>Procedure</title> <p>Create an array of a particular type, for example passive data for all data owners. Then go through the array to create the transfer types. </p> <p>The following example shows how to create the <xref href="GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2.dita#GUID-169BB4E2-5B0E-3719-A7B8-A3C0AAA602E2/GUID-EB313AA2-302E-352F-B1A4-E60DAFBEBCFB"><apiname>conn::CSBPackageTransferType</apiname></xref>. You can further specify to create the data or snapshots. </p> <codeblock id="GUID-1D28813F-25CA-5169-8FC9-88FDA081DDD5" xml:space="preserve">/** |
|
13 Each data owner in iDataOwners is a CDataOwnerInfo object, the following creates |
|
14 CSBGenericTransferTypes based on the TPackageDataType passed. |
|
15 @param aTransferTypes - Array of package transfer types. |
|
16 @param aPkgDataType - system data or system data snapshot. |
|
17 */ |
|
18 |
|
19 void::GeneratePIDTransferTypesL( |
|
20 RPointerArray<CSBGenericTransferType>& aTransferTypes, |
|
21 TPackageDataType aPkgDataType) |
|
22 { |
|
23 |
|
24 aTransferTypes.ResetAndDestroy(); |
|
25 TUid id; |
|
26 |
|
27 //need array to avoid duplications |
|
28 RArray<TUid> uidArray; |
|
29 CleanupClosePushL(uidArray); |
|
30 |
|
31 //One transfer type is created for each drive |
|
32 //on which the data owner has data. |
|
33 TInt length = iDriveList.Length(); |
|
34 for (TInt driveCount = 0; driveCount < length; driveCount++) |
|
35 { |
|
36 if (iDriveList[driveCount]) |
|
37 { |
|
38 TInt count = iDataOwners.Count(); |
|
39 for (TInt i = 0; i < count; i++) |
|
40 { |
|
41 switch (iDataOwners[i]->Identifier().DerivedTypeL()) |
|
42 { |
|
43 case EPackageDerivedType: |
|
44 if (iDataOwners[i]->CommonSettings() & EHasSystemFiles) |
|
45 { |
|
46 //Create CSBPackageId for each data owner in the package |
|
47 CSBPackageId* pkgId = |
|
48 CSBPackageId::NewL(&(iDataOwners[i]->Identifier())); |
|
49 CleanupStack::PushL(pkgId); |
|
50 |
|
51 id = pkgId->PackageIdL(); |
|
52 if (uidArray.Find(id) == KErrNotFound) |
|
53 { |
|
54 |
|
55 //Create the package transfer type based on the |
|
56 //aPkgDataType parameter value passed in, |
|
57 //system data or snapshot. |
|
58 CSBPackageTransferType* idType = |
|
59 CSBPackageTransferType::NewL( |
|
60 id, |
|
61 TDriveNumber(driveCount), |
|
62 aPkgDataType |
|
63 ); |
|
64 CleanupStack::PushL(idType); |
|
65 aTransferTypes.AppendL(idType); |
|
66 CleanupStack::Pop(idType); |
|
67 |
|
68 //add to uid array |
|
69 uidArray.AppendL(id); |
|
70 } |
|
71 CleanupStack::PopAndDestroy(pkgId); |
|
72 } //if |
|
73 break; |
|
74 } // switch |
|
75 } //for |
|
76 } //if |
|
77 } //for |
|
78 |
|
79 CleanupStack::PopAndDestroy(&uidArray); |
|
80 } |
|
81 </codeblock> </section> </conbody><related-links><link href="GUID-0BD22FDB-1A5C-56AA-A7FC-BD2271B2F928.dita"><linktext>Writing a Backup Engine Client |
|
82 (CSBEClient)</linktext> </link> </related-links></concept> |