javamanager/javaregistry/legacy/installedappsregistry/inc/installedappsregistry.h
changeset 21 2a9601315dfc
equal deleted inserted replaced
18:e8e63152f320 21:2a9601315dfc
       
     1 /*
       
     2 * Copyright (c) 2002-2003 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:  Definition of the CInstalledAppsRegistry class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef INSTALLEDAPPSREGISTRY_H
       
    20 #define INSTALLEDAPPSREGISTRY_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 
       
    24 #include <e32base.h>
       
    25 
       
    26 #include "minstalledappsregistry.h"
       
    27 #include "javaregistry.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 
       
    31 class CInstalledAppsRegistryEntry;
       
    32 
       
    33 // CLASS DECLARATIONS
       
    34 
       
    35 /**
       
    36 * The server side implementation of the installed apps registry. It
       
    37 * inherits from MInstalledAppsRegistry to implement read-only operations
       
    38 * when accessed through an MInstalledAppsRegistry type. In addition,
       
    39 * it also implements operations to modify the registry (for the server only).
       
    40 * See CInstalledAppsRegistryEntry for a description of each entry.
       
    41 *
       
    42 * This object is privately derived from CBase so that clients are
       
    43 * disallowed from destroying the object via a CBase pointer. To push
       
    44 * onto the cleanup stack, use CleanupReleasePushL.
       
    45 */
       
    46 class CInstalledAppsRegistry : private CBase, public MInstalledAppsRegistry
       
    47 {
       
    48 public:
       
    49     /**
       
    50     * Returns a CInstalledAppsRegistry object. Note that only a single
       
    51     * instance is ever created. If one already exists, NewL will return
       
    52     * the existing one.
       
    53     * @return The object created.
       
    54     */
       
    55     IMPORT_C static CInstalledAppsRegistry* NewL();
       
    56 
       
    57 public: // API available to the server
       
    58     /**
       
    59     * Adds a new entry into the registry and permanent storage.
       
    60     * @param aEntry    The entry which is to be added.
       
    61     */
       
    62     IMPORT_C void AddEntryL(const CInstalledAppsRegistryEntry& aEntry);
       
    63 
       
    64     /**
       
    65     * Deletes an entry from the registry with a given UID.
       
    66     * @param aUid  The UID of the entry to be deleted.
       
    67     * @return      Symbian OS return code. KErrNone if successful,
       
    68     *              KErrAccessDenied if the entry resides in ROM, KErrNotFound
       
    69     *              if the entry was not found in the registry.
       
    70     */
       
    71     IMPORT_C TInt DeleteEntry(const TUid& aUid);
       
    72 
       
    73     /**
       
    74     * Returns an array of UIDs whose entries use a given filename.
       
    75     * @param aFileName    The filename to be used to search the entries.
       
    76     * @param[out] aUids   An array of UIDs which is populated.
       
    77     */
       
    78     IMPORT_C void AppsUsingFileL(const TDesC& aFileName,
       
    79                                  RArray<TUid>& aUids) const;
       
    80 
       
    81     /**
       
    82     * Given a list of files, it returns an array of arrays of UIDs which
       
    83     * indicate which UIDs which which files
       
    84     * @param aFiles    The list of files queries
       
    85     * @param aUids     An array of arrays of UIDs. For each file, the same
       
    86     *                  index into a files is used as the primary index into
       
    87     *                  the second array. The second array contains a list of
       
    88     *                  UIDs for that particular file.
       
    89     */
       
    90     IMPORT_C void AppsUsingFilesL(const RPointerArray<HBufC>& aFiles,
       
    91                                   RPointerArray<RArray<TUid> >& aUids) const;
       
    92 
       
    93     /**
       
    94     * Returns a list of UIDs whose entries are corrupt. This allows
       
    95     * for recovery in case an entry has become corrupted.
       
    96     * @param aUidArray    The list of UIDs returned.
       
    97     * @return             Symbian OS error code. ONLY will leave if unable to
       
    98     *                     populate the array or we have run out of memory.
       
    99     */
       
   100     IMPORT_C void CorruptUidsL(RArray<TUid>& aUidArray) const;
       
   101 
       
   102     /**
       
   103     * Given a UID, return a list of UIDs which are dependent on this package.
       
   104     * A being "Dependent" on B means that either B is in A's dependency list
       
   105     * or B is in A's EmbeddedPackage list.
       
   106     * @param aUid               The UID to search for dependents.
       
   107     * @param[out] aDependents   The returned list of dependents.
       
   108     */
       
   109     IMPORT_C void DependentsL(TUid aUid, RArray<TUid>& aDependents) const;
       
   110 
       
   111     /**
       
   112     * Returns a writeable entry - This mirrors the EntryL API call but
       
   113     * returns an entry which can be modified. Before the entry can be
       
   114     * written, the DeleteEntry API must be called, and then the AddEntry
       
   115     * @param aUid.
       
   116     * @return    A pointer to the CInstalledAppsRegistryEntry object.
       
   117     */
       
   118     IMPORT_C CInstalledAppsRegistryEntry* WriteableEntryLC
       
   119     (const TUid& aUid) const;
       
   120     IMPORT_C CInstalledAppsRegistryEntry* WriteableEntryL
       
   121     (const TUid& aUid) const;
       
   122     IMPORT_C CInstalledAppsRegistryEntry* WriteableEntryLC
       
   123     (TLanguage aLang,
       
   124      const TDesC& aPackage,
       
   125      const TDesC& aVendor) const;
       
   126     IMPORT_C CInstalledAppsRegistryEntry* WriteableEntryL
       
   127     (TLanguage aLang,
       
   128      const TDesC& aPackage,
       
   129      const TDesC& aVendor) const;
       
   130 
       
   131 public: // From MInstalledAppsRegistry
       
   132 
       
   133     /**
       
   134     * @see MInstalledAppsRegistry.
       
   135     */
       
   136     virtual void Release();
       
   137 
       
   138     /**
       
   139     * @see MInstalledAppsRegistry.
       
   140     */
       
   141     virtual void InstalledUidsL(RArray<TUid>& aUidArray) const;
       
   142 
       
   143     /**
       
   144     * @see MInstalledAppsRegistry.
       
   145     */
       
   146     virtual TBool EntryPresentL(const TUid& aUid) const;
       
   147 
       
   148     /**
       
   149     * @see MInstalledAppsRegistry.
       
   150     */
       
   151     virtual MInstalledAppsRegistryEntry* EntryLC(const TUid& aUid) const;
       
   152 
       
   153     /**
       
   154     * @see MInstalledAppsRegistry.
       
   155     */
       
   156     virtual MInstalledAppsRegistryEntry* EntryLC
       
   157     (TLanguage aLang,
       
   158      const TDesC& aPackage,
       
   159      const TDesC& aVendor) const;
       
   160 
       
   161     /**
       
   162     * @see MInstalledAppsRegistry.
       
   163     */
       
   164     virtual MInstalledAppsRegistryEntry* EntryL(const TUid& aUid) const;
       
   165 
       
   166     /**
       
   167     * @see MInstalledAppsRegistry.
       
   168     */
       
   169     virtual MInstalledAppsRegistryEntry* EntryL
       
   170     (TLanguage aLang,
       
   171      const TDesC& aPackage,
       
   172      const TDesC& aVendor) const;
       
   173 
       
   174     /**
       
   175     * @see MInstalledAppsRegistry.
       
   176     */
       
   177     virtual HBufC8* GetSystemPropertyL(TUid aPropertyId) const;
       
   178 
       
   179 private:
       
   180     // Constructors and destructors
       
   181     /**
       
   182     * Default constructor.
       
   183     */
       
   184     CInstalledAppsRegistry();
       
   185 
       
   186     /**
       
   187     * Second-phase constructor.
       
   188     */
       
   189     void ConstructL();
       
   190 
       
   191     /**
       
   192     * Destructor.
       
   193     */
       
   194     virtual ~CInstalledAppsRegistry();
       
   195 
       
   196 private:
       
   197     // The reference count of this object. It is destroyed when
       
   198     // it gets decremented to 0
       
   199     TInt iRefCount;
       
   200     Java::CJavaRegistry* iRegistry;
       
   201 
       
   202 };
       
   203 
       
   204 #endif // INSTALLEDAPPSREGISTRY_H