javamanager/javaregistry/client/inc/writeablejavaregistryentry.h
branchRCL_3
changeset 14 04becd199f91
equal deleted inserted replaced
13:f5050f1da672 14:04becd199f91
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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:  writeablejavaregistryentry definition
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef WRITEABLEJAVAREGISTRYENTRY_H
       
    20 #define WRITEABLEJAVAREGISTRYENTRY_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <f32file.h>
       
    25 #include "javaregistryentrytype.h"
       
    26 #include "javaattribute.h"
       
    27 #include "javastorage.h"
       
    28 
       
    29 using namespace Java;
       
    30 
       
    31 namespace Java
       
    32 {
       
    33 namespace Manager
       
    34 {
       
    35 namespace Registry
       
    36 {
       
    37 // FORWARD DECLARATION
       
    38 class CJavaProperty;
       
    39 
       
    40 // CLASS DECLARATION
       
    41 /**
       
    42  * This class provides the Internal API for entries in JavaRegistry.
       
    43  * It supports common attributes only.
       
    44  *
       
    45  * @lib javaregistryclient.lib
       
    46  * @since S60 v3.2
       
    47  */
       
    48 class CWriteableJavaRegistryEntry : public CBase
       
    49 {
       
    50 public:
       
    51 
       
    52     /**
       
    53      * CWriteableJavaRegistryEntry::CWriteableJavaRegistryEntry
       
    54      * constructor.
       
    55      *
       
    56      * @since S60 v3.2
       
    57      * @param aEntry application entry attributes.
       
    58      * @param aType application entry type.
       
    59      */
       
    60     CWriteableJavaRegistryEntry(
       
    61         java::storage::JavaStorageApplicationEntry_t& aEntry,
       
    62         TJavaRegistryEntryType aType);
       
    63 
       
    64     // destructor
       
    65     /**
       
    66      * CWriteableJavaRegistryEntry::~CWriteableJavaRegistryEntry destructor
       
    67      *
       
    68      * @since S60 v3.2
       
    69      */
       
    70     IMPORT_C virtual ~CWriteableJavaRegistryEntry();
       
    71 
       
    72     // general methods
       
    73     /**
       
    74      * CWriteableJavaRegistryEntry::Uid method gets the Uid of
       
    75      * this registry entry.
       
    76      *
       
    77      * @since S60 v3.2
       
    78      * @return A TUid object.
       
    79      */
       
    80     IMPORT_C TUid Uid() const;
       
    81 
       
    82 
       
    83     /**
       
    84      * Gets the name of the entity (midlet, suite, etc.) this entry
       
    85      * represents.
       
    86      *
       
    87      * @since S60 v3.2
       
    88      * @return Name of the entity this entry represents.
       
    89      *         Default value if not set: KNullDesC.
       
    90      */
       
    91     IMPORT_C const TDesC& Name() const;
       
    92 
       
    93 
       
    94     /**
       
    95      * CWriteableJavaRegistryEntry::Type method gets the type of this
       
    96      * registry entry. Enumeration TJavaRegistryEntryType defines
       
    97      * the currently possible options. Mandatory property.
       
    98      *
       
    99      * @since S60 v3.2
       
   100      * @return Type of this registry entry.
       
   101      */
       
   102     IMPORT_C TJavaRegistryEntryType Type() const;
       
   103 
       
   104 
       
   105     /**
       
   106      * CWriteableJavaRegistryEntry::Drive method gets the letter
       
   107      * of drive where the install package has been installed.
       
   108      *
       
   109      * @since S60 v3.2
       
   110      * @return Letter of drive where the install package has been
       
   111      *         installed.
       
   112      *         Default value if not set: EDriveC.
       
   113      */
       
   114     IMPORT_C TDriveNumber Drive() const;
       
   115 
       
   116 
       
   117     /**
       
   118      * CWriteableJavaRegistryEntry::NumberOfCertificateChains method
       
   119      * returns the number of certificate chains of this Java application.
       
   120      *
       
   121      * @since S60 v3.2
       
   122      * @return Number of certificate chains.
       
   123      */
       
   124     IMPORT_C TInt NumberOfCertificateChains() const;
       
   125 
       
   126 
       
   127     /**
       
   128      * CWriteableJavaRegistryEntry::CertificateChain method returns the
       
   129      * n-th certificate chain of this Java application.
       
   130      *
       
   131      * @since S60 v3.2
       
   132      * @param aIndex Index of the certificate chain to be retrieved.
       
   133      * @return N-th certificate chain
       
   134      *         Default value if not set: KNullDesC.
       
   135      */
       
   136     IMPORT_C const TDesC8& CertificateChain(TInt aIndex) const;
       
   137 
       
   138 
       
   139     /**
       
   140      * Returns the content id of the entity this entry represents.
       
   141      * The content id can be used to check if a DRM protected entity
       
   142      * has enough right to be launched or not.
       
   143      * The method can also be used to check if the entity is DRM
       
   144      * protected or not.
       
   145      *
       
   146      * @since S60 v3.2
       
   147      * @return Content id of the entity this entry represent or
       
   148      *          KNullDesC if the entity is not DRM protected.
       
   149      */
       
   150     IMPORT_C const TDesC& DrmContentId() const;
       
   151 
       
   152     /**
       
   153      * CWriteableJavaRegistryEntry::Attribute method gets the
       
   154      * additional attribute.
       
   155      *
       
   156      * @since S60 v5.0
       
   157      * @param aName The name the searched attribute.
       
   158      * @return MJavaAttribute poiter to instance, which contain attribute.
       
   159      * If attribute doesn't exist return NULL.
       
   160      */
       
   161     IMPORT_C virtual const MJavaAttribute* AttributeL(const TDesC& aName) const;
       
   162 
       
   163     /**
       
   164      * CWriteableJavaRegistryEntry::Attributes method gets the
       
   165      * additional attributes array.
       
   166      *
       
   167      * @since S60 v5.0
       
   168      * @return RPointerArray& with all additional attributes.
       
   169      */
       
   170     IMPORT_C virtual const RPointerArray<MJavaAttribute>& AttributesL() const;
       
   171 
       
   172 protected:
       
   173 
       
   174     /**
       
   175      * 2nd phase constructor. Used by the subclasses.
       
   176      * The function may leave with one of the system-wide error codes.
       
   177      *
       
   178      * @since S60 v3.2
       
   179      * @param aType The type to be setted.
       
   180      */
       
   181     IMPORT_C void ConstructL(TJavaRegistryEntryType aType);
       
   182 
       
   183     /**
       
   184      * Read attribute value from entry. Value is left empty if no value exists.
       
   185      *
       
   186      * @param aEntry application entry.
       
   187      * @param aName attribute name to read value.
       
   188      * @param[out] aValue to be populated.
       
   189      */
       
   190     void EntryAttributeValue(
       
   191         const java::storage::JavaStorageApplicationEntry_t& aEntry,
       
   192         const std::wstring& aName,
       
   193         std::wstring& aValue) const;
       
   194 
       
   195     /**
       
   196      * Read application suite entry from JavaStorage. Entry is read based
       
   197      * on its uid.
       
   198      *
       
   199      * @param aUid uid used to identify application suite entry.
       
   200      * @param aTableName table where entry is read.
       
   201      * @param[out] aSuiteEntry to be populated.
       
   202      */
       
   203     void StorageEntry(
       
   204         const java::util::Uid& aUid,
       
   205         const std::string& aTableName,
       
   206         java::storage::JavaStorageApplicationEntry_t& aSuiteEntry) const;
       
   207 
       
   208 
       
   209 protected: // Data
       
   210     java::storage::JavaStorageApplicationEntry_t iEntry;
       
   211 
       
   212 private:
       
   213     /**
       
   214      * CJavaRegistryEntry::readAttributes method gets the
       
   215      * array of additional attributes.
       
   216      *
       
   217      * @param aUid identifying attributes.
       
   218      * @param[out] aAttributes entry attributes.
       
   219      */
       
   220     void ReadAttributesL(const std::wstring& aUid,
       
   221                          java::storage::JavaStorageApplicationList_t& aAttributes) const;
       
   222 
       
   223     void PopulateCertChains() const;
       
   224 
       
   225 private: // Data
       
   226     mutable HBufC16* iName;
       
   227     mutable HBufC16* iDrmContentId;
       
   228     TJavaRegistryEntryType iType;
       
   229     mutable RPointerArray<MJavaAttribute> iAttributes;
       
   230     mutable RPointerArray<HBufC8> iCertificates;
       
   231 
       
   232 };
       
   233 
       
   234 } // namespace Registry
       
   235 } // namespace Manager
       
   236 } // namespace Java
       
   237 
       
   238 
       
   239 #endif // WRITEABLEJAVAREGISTRYENTRY_H
       
   240 
       
   241 // End of File