javamanager/javabackup/midp2backup/src.s60/mediaidupdater.h
branchRCL_3
changeset 60 6c158198356e
child 83 26b2b12093af
equal deleted inserted replaced
59:e5618cc85d74 60:6c158198356e
       
     1 /*
       
     2 * Copyright (c) 2010 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: MediaIdUpdater
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MEDIAIDUPDATER_H
       
    20 #define MEDIAIDUPDATER_H
       
    21 
       
    22 #include <string>
       
    23 #include <set>
       
    24 
       
    25 namespace java
       
    26 {
       
    27 namespace storage
       
    28 {
       
    29     class JavaStorage;
       
    30 }
       
    31 namespace backup
       
    32 {
       
    33 
       
    34 /**
       
    35 * MediaIdUpdater is responsible for ensuring that java storage contains
       
    36 * valid media ids after restore.
       
    37 * Media id may change in following situations:
       
    38 *   - memory card is formatted between backup and restore
       
    39 *   - another memory card is used during restore than originally
       
    40 */
       
    41 
       
    42 class MediaIdUpdater
       
    43 {
       
    44 public:
       
    45     MediaIdUpdater();
       
    46     virtual ~MediaIdUpdater();
       
    47 
       
    48     /**
       
    49     * Updates media ids to valid values if needed
       
    50     * Note: this method must be called after java storage is restored
       
    51     */
       
    52     virtual void update();
       
    53 
       
    54 protected:
       
    55     virtual std::set<std::wstring> getPresentMediaIds();
       
    56     virtual std::set<std::wstring> getPresentRemovableDriveMediaIds();
       
    57     virtual std::set<std::wstring> removePresentMediaIds(const std::set<std::wstring>& aStorageIds,
       
    58                                                          const std::set<std::wstring>& aPresentIds);
       
    59     virtual bool isMediaIdUpdateNeeded(const std::set<std::wstring>& aInvalidIds,
       
    60                                        const std::set<std::wstring>& aValidIds);
       
    61     virtual std::set<std::wstring> getMediaIdsFromStorage();
       
    62     virtual void updateMediaIds(const std::set<std::wstring>& aInvalidIds,
       
    63                                 const std::set<std::wstring>& aValidIds);
       
    64 
       
    65     virtual void open();
       
    66     virtual void close();
       
    67 
       
    68     java::storage::JavaStorage* mStorage;
       
    69 };
       
    70 
       
    71 } // namespace backup
       
    72 } // namespace java
       
    73 
       
    74 #endif // MEDIAIDUPDATER_H