javamanager/javabackup/midp2backup_usif/src.s60/apparcbackuputil.h
branchRCL_3
changeset 83 26b2b12093af
parent 77 7cee158cb8cd
child 84 0553e2305d00
equal deleted inserted replaced
77:7cee158cb8cd 83:26b2b12093af
     1 /*
       
     2 * Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  Header file for CAppArcBackupUtil class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef APPARCBACKUPUTIL_H
       
    20 #define APPARCBACKUPUTIL_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <apgcli.h>
       
    24 #include <apadef.h>
       
    25 
       
    26 #include "javastorage.h"
       
    27 #include "javastorageentry.h"
       
    28 #include "javastoragenames.h"
       
    29 
       
    30 namespace java
       
    31 {
       
    32 namespace backup
       
    33 {
       
    34 
       
    35 /**
       
    36  *  CAppArcBackupUtil class is handling AppArc registrations during backup
       
    37  *  and restore of Java Domain.
       
    38  */
       
    39 class CAppArcBackupUtil : public CBase
       
    40 {
       
    41 
       
    42 public:
       
    43 
       
    44     /**
       
    45      * Instantiates an object of this type
       
    46      */
       
    47     static CAppArcBackupUtil* NewL(RFs& aFs);
       
    48 
       
    49     ~CAppArcBackupUtil();
       
    50 
       
    51     /**
       
    52      * This method registers applications to AppArc during restore.
       
    53      *
       
    54      * @param restoreIconPtr the buffer which contains the Uid and the
       
    55      *        icon file to be restored
       
    56      * @param aDrive current drive to be restored
       
    57      */
       
    58     void RegisterAppL(TPtr8& aRestoreIconPtr, TDriveNumber& aDrive);
       
    59 
       
    60     /**
       
    61      * This method deregisters leftover applications from AppArc during
       
    62      * restore.
       
    63      * @param aDrive current drive to be restored
       
    64      */
       
    65     void DeregisterAppsL(TDriveNumber aDrive);
       
    66 
       
    67     /**
       
    68      * This method builds an array of the registered apps in AppArc.
       
    69      *
       
    70      * @param [out] aUidArray array of Midlet uids
       
    71      * @param aDrive current drive to be backed up
       
    72      */
       
    73     void GetMidletsFromAppArcL(RArray<TUid>& aUidArray, TDriveNumber aDrive);
       
    74 
       
    75     /**
       
    76      * This method looks up the icon filename of the given midlet
       
    77      *
       
    78      * @param aUid Uid of Midlet
       
    79      * @param [out] aFullFilename filename of icon file
       
    80      */
       
    81     void GetIconFilename(TUid aUid, HBufC*& aFullFilename);
       
    82 
       
    83     /**
       
    84      * This method gets the number of MIDlet icons registered to AppArc
       
    85      * restore.
       
    86      *
       
    87      * @return iNumberOfIcons
       
    88      */
       
    89     TInt NumberOfIcons();
       
    90 
       
    91     /**
       
    92      * Gets the number of icons defined for a midlet from AppArc
       
    93      *
       
    94      * @param aUid Midlet Id
       
    95      * @param [out] aIconCount number of icons defined for the midlet
       
    96      */
       
    97     void NumberOfOwnDefinedIcons(TUid aUid, TInt& aIconCount);
       
    98 
       
    99     /**
       
   100      * Gets an entry from Java Storage for the midlet uid specified
       
   101      *
       
   102      * @param midletUid Uid of the midlet
       
   103      *
       
   104      * @return returns the entry of the midlet
       
   105      */
       
   106     java::storage::JavaStorageApplicationEntry_t StorageEntryL(const TUid& aMidletUID);
       
   107 
       
   108     /**
       
   109      * Gets the Drive of the midlet suite for the specified UID
       
   110      *
       
   111      * @param packageID the ID of the application package
       
   112      *
       
   113      * @return returns the drive number of the application package
       
   114      */
       
   115 
       
   116     TDriveNumber GetDrivefromStorageL(std::wstring& aPackageID);
       
   117 
       
   118     /**
       
   119      * Gets the group name of the midlet for the pecified UID
       
   120      *
       
   121      * @param aUid the UID of the midlet
       
   122      *
       
   123      * @return returns the group name of the midlet
       
   124      */
       
   125 
       
   126     TApaAppGroupName GetMidletGroupName(TUid aUid);
       
   127 
       
   128 private:
       
   129 
       
   130     CAppArcBackupUtil();
       
   131 
       
   132     void ConstructL(RFs& aFs);
       
   133 
       
   134     /**
       
   135      * Checks if midlet is already registered to AppArc.
       
   136      *
       
   137      * @param aUid Uid of Midlet
       
   138      * @return ETrue if midlet is already registered to AppArc
       
   139      */
       
   140     TBool CheckIfAlreadyRegisteredL(TInt& aUid);
       
   141 
       
   142     /**
       
   143      * Gets the drive of the Midlet based on the path
       
   144      *
       
   145      * @param aPath Full path of Midlet
       
   146      * @param [out] aDrive the drive where the midlet is registered to
       
   147      */
       
   148     void GetDriveOfApp(TFileName aPath, TInt& aDrive);
       
   149 
       
   150     /**
       
   151      * Gets the index of the midlet in its midlet suite
       
   152      *
       
   153      * @param aMidletSuiteEntry Midlet suite
       
   154      * @param aUid Midlet Id
       
   155      * @return index of midlet in the suite
       
   156      */
       
   157     //TInt MidletIndexL( CJavaRegistrySuiteEntry &aMidletSuiteEntry,
       
   158     //                   TUid aUid );
       
   159 
       
   160 
       
   161 private: // data
       
   162 
       
   163     /**
       
   164      * File session
       
   165      * Not own.
       
   166      */
       
   167     RFs iFs;
       
   168 
       
   169     /**
       
   170      * Number of MIDlet icons registered to AppArc
       
   171      * Own.
       
   172      */
       
   173     TInt iNumberOfIcons;
       
   174 
       
   175     /**
       
   176      * ApparcSession
       
   177      * Own.
       
   178      */
       
   179     RApaLsSession iApparcServer;
       
   180 
       
   181 };
       
   182 
       
   183 } //namespace backup
       
   184 } //namespace java
       
   185 
       
   186 #endif // APPARCBACKUPUTIL_H