javamanager/javaregistry/legacy/installedappsregistry/inc/MInstalledAppsRegistry.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 MInstalledAppsRegistry.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef MINSTALLEDAPPSREGISTRY_H
       
    20 #define MINSTALLEDAPPSREGISTRY_H
       
    21 
       
    22 // INCLUDE FILES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <appversion.h>
       
    26 
       
    27 #include "installtypes.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 
       
    31 class MInstalledAppsRegistryEntry;
       
    32 
       
    33 // CLASS DECLARATIONS
       
    34 
       
    35 /**
       
    36 * The registry of installed applications. This registry allows read access
       
    37 * to entries. Each entry is defined by class MInstalledAppsRegistryEntry.
       
    38 *
       
    39 * The client implementation marshals the requests to the server. Access
       
    40 * is only read only. The server implementation allows additionally for
       
    41 * write access.
       
    42 */
       
    43 class MInstalledAppsRegistry
       
    44 {
       
    45 public:
       
    46     /**
       
    47     * Release destroys this object (or removes the reference to
       
    48     * a reference counted implementation).
       
    49     */
       
    50     virtual void Release() = 0;
       
    51 
       
    52     /**
       
    53     * Returns an array of installed UIDs. The array is supplied by the client
       
    54     * which is then populated. There is no guarantee about the order in which
       
    55     * the uids are put in the array.
       
    56     * @param aUidArray The array object to be populated. This array should be
       
    57     * empty before passing it in. The result is undefined if the array is
       
    58     * not empty.
       
    59     */
       
    60     virtual void InstalledUidsL(RArray<TUid>& aUidArray) const = 0;
       
    61 
       
    62     /**
       
    63     * API call to check if an entry with the given UID is present in the
       
    64     * registry.
       
    65     * @param aUid The UID to query.
       
    66     * @return ETrue if there exists an entry present with the given UID,
       
    67     *         EFalse otherwise.
       
    68     */
       
    69     virtual TBool EntryPresentL(const TUid& aUid) const = 0;
       
    70 
       
    71     /**
       
    72     * Returns an entry from the registry whose UID is equal to aUid
       
    73     * @param aUid The UID of the entry to be found.
       
    74     * @return A pointer to the entry. Note that ownership of this object
       
    75     *         is transferred to the calling client and is therefore
       
    76     *         required to destroy it. The pointer is guarenteed to be
       
    77     *         non-NULL.
       
    78     */
       
    79     virtual MInstalledAppsRegistryEntry* EntryLC
       
    80     (const TUid& aUid) const = 0;
       
    81     virtual MInstalledAppsRegistryEntry* EntryL
       
    82     (const TUid& aUid) const = 0;
       
    83 
       
    84     /**
       
    85     * Returns an entry from the registry with a given package name and
       
    86     * vendor name for a given language.
       
    87     * @return A pointer to the entry. Note that ownership of this object
       
    88     *         is transferred to the calling client and is therefore
       
    89     *         required to destroy it. The pointer is guarenteed to be
       
    90     *         non-NULL.
       
    91     */
       
    92     virtual MInstalledAppsRegistryEntry* EntryLC
       
    93     (TLanguage aLang,
       
    94      const TDesC& aPackage,
       
    95      const TDesC& aVendor) const = 0;
       
    96     virtual MInstalledAppsRegistryEntry* EntryL
       
    97     (TLanguage aLang,
       
    98      const TDesC& aPackage,
       
    99      const TDesC& aVendor) const = 0;
       
   100 
       
   101     /**
       
   102     * Returns the system property given by the UID. Leaves with KErrNotFound
       
   103     * if the property was not found.
       
   104     * @param aPropertyId The UID of the given property.
       
   105     * @return The value - ownership of the buffer is transferred to client.
       
   106     */
       
   107     virtual HBufC8* GetSystemPropertyL(TUid aPropertyId) const = 0;
       
   108 
       
   109     /**
       
   110     * Function to create a registry. This returns a server registry or client
       
   111     * registry, depending on which library is linked
       
   112     */
       
   113     IMPORT_C static MInstalledAppsRegistry* CreateL();
       
   114 
       
   115 protected:
       
   116     // Forces client to use the Release method
       
   117     inline virtual ~MInstalledAppsRegistry();
       
   118 };
       
   119 
       
   120 
       
   121 /**
       
   122 * An entry of an installed application. These entries created and retrieved
       
   123 * using the MInstalledAppsRegistry API.
       
   124 *
       
   125 * Each entry is keyed by a UID, and contains various fields and parameters.
       
   126 * It also contains a list of files which make up the application, and
       
   127 * a list of languages the application supports.
       
   128 */
       
   129 class MInstalledAppsRegistryEntry
       
   130 {
       
   131 public:
       
   132     /**
       
   133     * Release destroys this object (or removes the reference to
       
   134     * a reference counted implementation)
       
   135     */
       
   136     virtual void Release() = 0;
       
   137 
       
   138     // API attribute getters - synchronous
       
   139     virtual TUid UidL() const = 0;
       
   140     virtual TAppVersion VersionL() const = 0;
       
   141     virtual TChar DriveL() const = 0;
       
   142     virtual TInstallType TypeL() const = 0;
       
   143 
       
   144     /**
       
   145     * Given a language, return the package name. If the language is not
       
   146     * found, it will leave with KErrNotFound.
       
   147     * @param aLanguage Language of the package.
       
   148     * @return The returned package name in the given language.
       
   149     */
       
   150     virtual const TDesC& PackageNameL(TLanguage aLanguage) const = 0;
       
   151 
       
   152     /**
       
   153     * Given a language, return the vendor name. If the language is not found,
       
   154     * it will leave with KErrNotFound.
       
   155     * @param aLanguage Language of the package.
       
   156     * @return The returned vendor name
       
   157     */
       
   158     virtual const TDesC& VendorNameL(TLanguage aLanguage) const = 0;
       
   159 
       
   160     /**
       
   161     * Populates a client owned array with the list of languages.
       
   162     * @param[out] aLangArray List of supported languages.
       
   163     */
       
   164     virtual void LanguagesL(RArray<TLanguage>& aLangArray) const = 0;
       
   165 
       
   166     /**
       
   167     * Returns whether or not a particular language is supported.
       
   168     * @param aLanguage Language support to check.
       
   169     */
       
   170     virtual TBool LanguageSupportedL(TLanguage aLanguage) const = 0;
       
   171 
       
   172     /**
       
   173     * Populates the input array with the list of files used by the
       
   174     * application - synchronous.
       
   175     * @param[out] aFileArray The array to be populated.
       
   176     */
       
   177     virtual void ListFilesL(RPointerArray<HBufC>& aFileArray) const = 0;
       
   178 
       
   179     /**
       
   180     * Given a filename (with a full path specifier), this function
       
   181     * returns whether or not this application uses the file.
       
   182     * @param aFileName Name of the file to check.
       
   183     * @return ETrue if the specified file is used by this application,
       
   184     * EFalse otherwise.
       
   185     */
       
   186     virtual TBool UsesFileL(const TDesC& aFileName) const = 0;
       
   187 
       
   188     /**
       
   189     * Populates the input array with the list of directories "owned" by the
       
   190     * application.
       
   191     * @param[out] aDirArray The array to be populated.
       
   192     */
       
   193     virtual void ListDirectoriesL
       
   194     (RPointerArray<HBufC>& aDirArray) const = 0;
       
   195 
       
   196     /**
       
   197     * Returns the number of certificate chains.
       
   198     */
       
   199     virtual TInt NumberOfCertificateChainsL() const = 0;
       
   200 
       
   201     /**
       
   202     * Returns the n-th chain.
       
   203     */
       
   204     virtual const TDesC8& CertificateChainL(TInt aChain) const = 0;
       
   205 
       
   206     /**
       
   207     * Returns the size in bytes used by the installed application.
       
   208     * The size is computed dynamically by adding the size of the files owned
       
   209     * by this entry. If a file is not found (it may be on an absent removable
       
   210     * media) its size is considered to be 0. Entries may own directories,
       
   211     * in this case all the files in these directories are considered to be
       
   212     * owned and are included in the computation.
       
   213     */
       
   214     virtual TInt SizeL() const = 0;
       
   215 
       
   216     /**
       
   217     * Given a file extension, return a single filename with that
       
   218     * extension. Leaves if not found. It is generally used to find
       
   219     * a .jad or .jar file location in the registry.
       
   220     * @param aExtension The extension to search for (eg ".app").
       
   221     * @param aFileName The returned file name with the extension.
       
   222     */
       
   223     virtual void FindFileWithExtL(const TDesC& aExtension,
       
   224                                   TFileName& aFileName) const = 0;
       
   225 
       
   226     /**
       
   227     * Returns a boolean which indicates whether or not this entry is
       
   228     * located in ROM. An entry located in ROM cannot be uninstalled.
       
   229     * @return ETrue if located in ROM, EFalse otherwise.
       
   230     */
       
   231     virtual TBool IsInRomL() const = 0;
       
   232 
       
   233     /**
       
   234     * Returns property of the entry keyed by the supplied UID. Leaves with
       
   235     * KErrNotFound if the property was not found in the entry.
       
   236     * @param aPropertyId The UID of the given property.
       
   237     * @return The value - ownership of the buffer is transferred to client.
       
   238     */
       
   239     virtual HBufC8* GetPropertyL(TUid aPropertyId) const = 0;
       
   240 
       
   241     /**
       
   242     * Populates the array parameter with the list of Apparc registration
       
   243     * file "ID"-s.
       
   244     * @param aApparcIdentifiersArray The array to be populated.
       
   245     */
       
   246     virtual void ListApparcIdentifiersL
       
   247     (RPointerArray<HBufC>& aApparcIdentifiersArray) const = 0;
       
   248 
       
   249 protected:
       
   250     inline virtual ~MInstalledAppsRegistryEntry();
       
   251 };
       
   252 
       
   253 #include <swi/minstalledappsregistry.inl>
       
   254 
       
   255 #endif // MINSTALLEDAPPSREGISTRY_H