ncdengine/provider/storage/inc/ncdstoragemanager.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef M_NCDSTORAGEMANAGER_H
       
    20 #define M_NCDSTORAGEMANAGER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 
       
    24 class MNcdStorage;
       
    25 class CNcdStorage;
       
    26 class MNcdStorageClient;
       
    27 class RFs;
       
    28 class MDesCArray;
       
    29 
       
    30 /**
       
    31  *  Interface for the storage manager
       
    32  *
       
    33  *  @note UIDs and namespace can, in fact, contain any text that can
       
    34  *  be used in a directory/filename. 
       
    35  *
       
    36  */
       
    37 class MNcdStorageManager 
       
    38     {
       
    39 public: 
       
    40     virtual ~MNcdStorageManager() {}
       
    41 
       
    42 
       
    43     /**
       
    44      * Creates storage if necessary, otherwise returns an existing one
       
    45      *
       
    46      * @param aClientUid  
       
    47      * @param aNamespace
       
    48      * @return Storage    
       
    49      */
       
    50     virtual MNcdStorage& CreateOrGetStorageL( const TDesC& aClientUid,
       
    51         const TDesC& aNamespace ) = 0;
       
    52         
       
    53 
       
    54     /**
       
    55      * Client storage creator
       
    56      *
       
    57      * @param aClientUid Client's UID
       
    58      * @param aNamespace Namespace for the storage
       
    59      * @return A reference to the created storage
       
    60      */
       
    61     virtual MNcdStorage& CreateStorageL( const TDesC& aClientUid, 
       
    62         const TDesC& aNamespace ) = 0;
       
    63 
       
    64 
       
    65     /**
       
    66      * Provider storage getter
       
    67      *
       
    68      * @return Provider's storage
       
    69      */
       
    70     virtual MNcdStorage& ProviderStorageL( const TDesC& aClientUid ) = 0;
       
    71     
       
    72     
       
    73     /**
       
    74      * Client storage getter
       
    75      * 
       
    76      * @param aClientUid Client's UID
       
    77      * @param aNamespace Storage namespace
       
    78      * @return A Reference to the found storage
       
    79      * @throw KErrNotFound if the storage was not found
       
    80      * @throw KErrArgument if either client UID or storage 
       
    81      * namespace were empty
       
    82      */
       
    83     virtual MNcdStorage& StorageL( const TDesC& aClientUid, 
       
    84         const TDesC& aNamespace ) = 0;
       
    85     
       
    86     
       
    87     /**
       
    88      * Lists storage namespaces
       
    89      *
       
    90      * @param aClientUid Client's UID
       
    91      * @return An array of client's namespaces. Ownership is transferred.
       
    92      */
       
    93     virtual MDesCArray* StorageNamespacesLC( 
       
    94         const TDesC& aClientUid ) const = 0;
       
    95 
       
    96     /**
       
    97      * Storage client getter
       
    98      * 
       
    99      * @param aClientUid Client UID
       
   100      * @return Storage client
       
   101      */
       
   102      virtual MNcdStorageClient& StorageClientL( const TDesC& aClientUid ) = 0;
       
   103     
       
   104     
       
   105     /**
       
   106      * Client remover.
       
   107      *
       
   108      * Removes the client and all its storages.
       
   109      * @note Storages are actually deleted from disk.
       
   110      * @note None of the files under the storage can be in use or this will
       
   111      * leave with KErrInUse and leave some of the file intact.
       
   112      *
       
   113      * @param aClientUid Client UID
       
   114      */
       
   115     //virtual void RemoveClientL( const TDesC& aClientUid ) = 0;
       
   116     
       
   117     
       
   118     /**
       
   119      * Client storage remover
       
   120      * 
       
   121      * @param aClientUid Client's UID
       
   122      * @param aNamespace Storage namespace
       
   123      * @throw KErrNotFound if the storage was not found
       
   124      * @throw KErrArgument if either of the parameters was invalid
       
   125      */
       
   126     virtual void RemoveStorageL( const TDesC& aClientUid, 
       
   127         const TDesC& aNamespace ) = 0;
       
   128 
       
   129     
       
   130     /**
       
   131      * Closes client's resources
       
   132      */
       
   133     virtual void CloseClient( const TDesC& aClientUid ) = 0;
       
   134    
       
   135     /**
       
   136      * File session getter
       
   137      *
       
   138      * @return File session used by storages
       
   139      */
       
   140     virtual RFs& FileSession() = 0;
       
   141 };
       
   142 
       
   143 
       
   144 
       
   145 #endif // M_NCDSTORAGEMANAGER_H