filemanager/bkupengine/src/CMMCScBkupStateFactory.cpp
branchRCL_3
changeset 20 491b3ed49290
parent 19 95243422089a
child 21 65326cf895ed
equal deleted inserted replaced
19:95243422089a 20:491b3ed49290
     1 /*
       
     2 * Copyright (c) 2005 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: CMMCScBkupStateFactory implementation
       
    15 *
       
    16 *
       
    17 */
       
    18 
       
    19 #include "CMMCScBkupStateFactory.h"
       
    20 
       
    21 // System includes
       
    22 #include <e32err.h>
       
    23 
       
    24 // User includes
       
    25 #include "MMCScBkupLogger.h"
       
    26 #include "CMMCScBkupStateGetDataOwners.h"
       
    27 #include "CMMCScBkupStateSetPhoneMode.h"
       
    28 #include "CMMCScBkupStateRequestSizeOfBackupData.h"
       
    29 #include "CMMCScBkupStateRequestListOfPublicFiles.h"
       
    30 #include "CMMCScBkupStateGetDataOwnerStatuses.h"
       
    31 #include "CMMCScBkupStateNotifyAllSnapshotsSupplied.h"
       
    32 //
       
    33 #include "CMMCScBkupStateArchiveOpSystemData.h"
       
    34 #include "CMMCScBkupStateArchiveOpDataOwners.h"
       
    35 #include "CMMCScBkupStateArchiveOpPublicDataFiles.h"
       
    36 #include "CMMCScBkupStateArchiveOpActiveData.h"
       
    37 #include "CMMCScBkupStateArchiveOpJavaData.h"
       
    38 #include "CMMCScBkupStateArchiveOpPassiveData.h"
       
    39 #include "CMMCScBkupStateArchiveOpArchiveHeader.h"
       
    40 #include "CMMCScBkupStateArchiveOpArchiveFooter.h"
       
    41 #include "CMMCScBkupStateValidateDiskSpace.h"
       
    42 
       
    43 
       
    44 
       
    45 // ========================= MEMBER FUNCTIONS ================================
       
    46 
       
    47 // ---------------------------------------------------------------------------
       
    48 // CMMCScBkupStateFactory::CMMCScBkupStateFactory()
       
    49 // 
       
    50 // 
       
    51 // ---------------------------------------------------------------------------
       
    52 CMMCScBkupStateFactory::CMMCScBkupStateFactory()
       
    53     {
       
    54     }
       
    55 
       
    56 // ---------------------------------------------------------------------------
       
    57 // CMMCScBkupStateFactory::FactoryByOperationTypeLC()
       
    58 // 
       
    59 // 
       
    60 // ---------------------------------------------------------------------------
       
    61 CMMCScBkupStateFactory* CMMCScBkupStateFactory::FactoryByOperationTypeLC( TMMCScBkupOperationType aOperationType )
       
    62     {
       
    63     CMMCScBkupStateFactory* factory = NULL;
       
    64     //
       
    65     switch(aOperationType)
       
    66         {
       
    67     case EMMCScBkupOperationTypeFullBackup:
       
    68         factory = CMMCScBkupStateFactoryBackup::NewL();
       
    69         break;
       
    70     case EMMCScBkupOperationTypeFullRestore:
       
    71         factory = CMMCScBkupStateFactoryRestore::NewL();
       
    72         break;
       
    73     case EMMCScBkupOperationTypePartialBackup:
       
    74     case EMMCScBkupOperationTypePartialRestore:
       
    75     default:
       
    76         __ASSERT_ALWAYS(EFalse, User::Invariant());
       
    77         break;
       
    78         }
       
    79     //
       
    80     CleanupStack::PushL(factory);
       
    81     return factory;
       
    82     }
       
    83 
       
    84 
       
    85 
       
    86 
       
    87 
       
    88 
       
    89 
       
    90 
       
    91 
       
    92 
       
    93 
       
    94 
       
    95 
       
    96 // ========================= MEMBER FUNCTIONS ================================
       
    97 
       
    98 // ---------------------------------------------------------------------------
       
    99 // CMMCScBkupStateFactoryBackup::CMMCScBkupStateFactoryBackup()
       
   100 // 
       
   101 // 
       
   102 // ---------------------------------------------------------------------------
       
   103 CMMCScBkupStateFactoryBackup::CMMCScBkupStateFactoryBackup()
       
   104     {
       
   105     }
       
   106 
       
   107 // ---------------------------------------------------------------------------
       
   108 // CMMCScBkupStateFactoryBackup::NewL()
       
   109 // 
       
   110 // 
       
   111 // ---------------------------------------------------------------------------
       
   112 CMMCScBkupStateFactoryBackup* CMMCScBkupStateFactoryBackup::NewL()
       
   113     {
       
   114     CMMCScBkupStateFactoryBackup* self = new(ELeave) CMMCScBkupStateFactoryBackup();
       
   115     return self;
       
   116     }
       
   117 
       
   118 
       
   119 // ---------------------------------------------------------------------------
       
   120 // CMMCScBkupStateFactoryBackup::GetStateLC()
       
   121 // 
       
   122 // 
       
   123 // ---------------------------------------------------------------------------
       
   124 CMMCScBkupState* CMMCScBkupStateFactoryBackup::GetStateLC( TMMCScBkupStateId aRequiredType, MMMCScBkupDriver& aDriver )
       
   125     {
       
   126     CMMCScBkupState* state = NULL;
       
   127     //
       
   128     switch(aRequiredType.iUid)
       
   129         {
       
   130     case KMMCScBkupStateIdValueArchiveOpArchiveHeader:
       
   131         state = CMMCScBkupStateArchiveOpArchiveHeader::NewL( aDriver );
       
   132         break;
       
   133     case KMMCScBkupStateIdValueGetDataOwners:
       
   134         state = CMMCScBkupStateGetDataOwners::NewL( aDriver );
       
   135         break;
       
   136     case KMMCScBkupStateIdValueSetPhoneMode:
       
   137         state = CMMCScBkupStateSetPhoneMode::NewL( aDriver );
       
   138         break;
       
   139     case KMMCScBkupStateIdValueNotifyAllSnapshotsSupplied:
       
   140         state = CMMCScBkupStateNotifyAllSnapshotsSupplied::NewL( aDriver );
       
   141         break;
       
   142     case KMMCScBkupStateIdValueRequestSizeOfBackupData:
       
   143         state = CMMCScBkupStateRequestSizeOfBackupData::NewL( aDriver );
       
   144         break;
       
   145     case KMMCScBkupStateIdValueArchiveOpDataOwners:
       
   146         state = CMMCScBkupStateArchiveOpDataOwners::NewL( aDriver );
       
   147         break;
       
   148     case KMMCScBkupStateIdValueRequestListOfPublicFiles:
       
   149         state = CMMCScBkupStateRequestListOfPublicFiles::NewL( aDriver );
       
   150         break;
       
   151     case KMMCScBkupStateIdValueArchiveOpPublicDataFiles:
       
   152         state = CMMCScBkupStateArchiveOpPublicDataFiles::NewL( aDriver );
       
   153         break;
       
   154     case KMMCScBkupStateIdValueArchiveOpSystemData:
       
   155         state = CMMCScBkupStateArchiveOpSystemData::NewL( aDriver );
       
   156         break;
       
   157     case KMMCScBkupStateIdValueArchiveOpJavaData:
       
   158         state = CMMCScBkupStateArchiveOpJavaData::NewL( aDriver );
       
   159         break;
       
   160     case KMMCScBkupStateIdValueGetDataOwnerStatuses:
       
   161         state = CMMCScBkupStateGetDataOwnerStatuses::NewL( aDriver );
       
   162         break;
       
   163     case KMMCScBkupStateIdValueArchiveOpActiveData:
       
   164         state = CMMCScBkupStateArchiveOpActiveData::NewL( aDriver );
       
   165         break;
       
   166     case KMMCScBkupStateIdValueArchiveOpPassiveData:
       
   167         state = CMMCScBkupStateArchiveOpPassiveData::NewL( aDriver );
       
   168         break;
       
   169     case KMMCScBkupStateIdValueArchiveOpArchiveFooter:
       
   170         state = CMMCScBkupStateArchiveOpArchiveFooter::NewL( aDriver );
       
   171         break;
       
   172     case KMMCScBkupStateIdValueValidateDiskSpace:
       
   173         state = CMMCScBkupStateValidateDiskSpace::NewL( aDriver );
       
   174         break;
       
   175     default:
       
   176     case KMMCScBkupStateIdValueSupplyDataSnapshots:
       
   177         ASSERT( EFalse );
       
   178         User::Leave(KErrNotSupported);
       
   179         break;
       
   180         }
       
   181     //
       
   182     CleanupStack::PushL(state);
       
   183     return state;
       
   184     }
       
   185 
       
   186 
       
   187 
       
   188 
       
   189 
       
   190 
       
   191 
       
   192 
       
   193 
       
   194 
       
   195 
       
   196 
       
   197 
       
   198 
       
   199 
       
   200 
       
   201 
       
   202 
       
   203 
       
   204 
       
   205 
       
   206 
       
   207 
       
   208 
       
   209 
       
   210 
       
   211 
       
   212 
       
   213 // ========================= MEMBER FUNCTIONS ================================
       
   214 
       
   215 // ---------------------------------------------------------------------------
       
   216 // CMMCScBkupStateFactoryRestore::CMMCScBkupStateFactoryRestore()
       
   217 // 
       
   218 // 
       
   219 // ---------------------------------------------------------------------------
       
   220 CMMCScBkupStateFactoryRestore::CMMCScBkupStateFactoryRestore()
       
   221     {
       
   222     }
       
   223 
       
   224 // ---------------------------------------------------------------------------
       
   225 // CMMCScBkupStateFactoryRestore::NewL()
       
   226 // 
       
   227 // 
       
   228 // ---------------------------------------------------------------------------
       
   229 CMMCScBkupStateFactoryRestore* CMMCScBkupStateFactoryRestore::NewL()
       
   230     {
       
   231     CMMCScBkupStateFactoryRestore* self = new(ELeave) CMMCScBkupStateFactoryRestore();
       
   232     return self;
       
   233     }
       
   234 
       
   235 
       
   236 // ---------------------------------------------------------------------------
       
   237 // CMMCScBkupStateFactoryRestore::GetStateLC()
       
   238 // 
       
   239 // 
       
   240 // ---------------------------------------------------------------------------
       
   241 CMMCScBkupState* CMMCScBkupStateFactoryRestore::GetStateLC( TMMCScBkupStateId aRequiredType, MMMCScBkupDriver& aDriver )
       
   242     {
       
   243     CMMCScBkupState* state = NULL;
       
   244     //
       
   245     switch(aRequiredType.iUid)
       
   246         {
       
   247     case KMMCScBkupStateIdValueArchiveOpArchiveHeader:
       
   248         state = CMMCScBkupStateArchiveOpArchiveHeader::NewL( aDriver );
       
   249         break;
       
   250     case KMMCScBkupStateIdValueArchiveOpArchiveFooter:
       
   251         state = CMMCScBkupStateArchiveOpArchiveFooter::NewL( aDriver );
       
   252         break;
       
   253     case KMMCScBkupStateIdValueArchiveOpDataOwners:
       
   254         state = CMMCScBkupStateArchiveOpDataOwners::NewL( aDriver );
       
   255         break;
       
   256     case KMMCScBkupStateIdValueSetPhoneMode:
       
   257         state = CMMCScBkupStateSetPhoneMode::NewL( aDriver );
       
   258         break;
       
   259     case KMMCScBkupStateIdValueArchiveOpSystemData:
       
   260         state = CMMCScBkupStateArchiveOpSystemData::NewL( aDriver );
       
   261         break;
       
   262     case KMMCScBkupStateIdValueNotifyAllSnapshotsSupplied:
       
   263         state = CMMCScBkupStateNotifyAllSnapshotsSupplied::NewL( aDriver );
       
   264         break;
       
   265     case KMMCScBkupStateIdValueArchiveOpJavaData:
       
   266         state = CMMCScBkupStateArchiveOpJavaData::NewL( aDriver );
       
   267         break;
       
   268     case KMMCScBkupStateIdValueArchiveOpPassiveData:
       
   269         state = CMMCScBkupStateArchiveOpPassiveData::NewL( aDriver );
       
   270         break;
       
   271     case KMMCScBkupStateIdValueGetDataOwnerStatuses:
       
   272         state = CMMCScBkupStateGetDataOwnerStatuses::NewL( aDriver );
       
   273         break;
       
   274     case KMMCScBkupStateIdValueArchiveOpActiveData:
       
   275         state = CMMCScBkupStateArchiveOpActiveData::NewL( aDriver );
       
   276         break;
       
   277     case KMMCScBkupStateIdValueArchiveOpPublicDataFiles:
       
   278         state = CMMCScBkupStateArchiveOpPublicDataFiles::NewL( aDriver );
       
   279         break;
       
   280     case KMMCScBkupStateIdValueValidateDiskSpace:
       
   281         state = CMMCScBkupStateValidateDiskSpace::NewL( aDriver );
       
   282         break;
       
   283     default:
       
   284         ASSERT( EFalse );
       
   285         User::Leave(KErrNotSupported);
       
   286         break;
       
   287         }
       
   288     //
       
   289     CleanupStack::PushL(state);
       
   290     return state;
       
   291     }
       
   292 
       
   293 
       
   294 
       
   295 
       
   296 
       
   297 
       
   298 
       
   299 
       
   300 
       
   301 
       
   302 
       
   303 
       
   304 
       
   305 
       
   306 
       
   307 
       
   308 
       
   309 
       
   310 
       
   311 
       
   312 
       
   313 
       
   314 
       
   315 
       
   316 
       
   317 
       
   318 
       
   319 
       
   320 
       
   321 
       
   322 
       
   323 
       
   324 
       
   325 
       
   326 
       
   327 
       
   328 
       
   329 
       
   330 
       
   331 
       
   332