applicationmanagement/server/inc/amstorage.h
author hgs
Fri, 06 Aug 2010 18:56:37 +0530
changeset 52 6e38e48ee756
parent 47 d316aecb87fd
permissions -rw-r--r--
201031
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
47
d316aecb87fd 201025_02
hgs
parents:
diff changeset
     1
/*
d316aecb87fd 201025_02
hgs
parents:
diff changeset
     2
 * Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). 
d316aecb87fd 201025_02
hgs
parents:
diff changeset
     3
 * All rights reserved.
d316aecb87fd 201025_02
hgs
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
d316aecb87fd 201025_02
hgs
parents:
diff changeset
     5
 * under the terms of "Eclipse Public License v1.0"
d316aecb87fd 201025_02
hgs
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
d316aecb87fd 201025_02
hgs
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
d316aecb87fd 201025_02
hgs
parents:
diff changeset
     8
 *
d316aecb87fd 201025_02
hgs
parents:
diff changeset
     9
 * Initial Contributors:
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    11
 *
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    12
 * Contributors:
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    13
 *
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    14
 * Description: Implementation of applicationmanagement components
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    15
 *
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    16
 */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    17
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    18
#ifndef __AMDSTORAGE_H__
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    19
#define __AMDSTORAGE_H__
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    20
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    21
#include <e32base.h>
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    22
#include <ssl.h>
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    23
#include <s32mem.h>
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    24
#include "ApplicationManagementCommon.h"
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    25
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    26
class CRepository;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    27
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    28
namespace NApplicationManagement
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    29
    {
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    30
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    31
    class CDeploymentComponent;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    32
    class CAMAppHideUtil;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    33
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    34
    class RComponentIdArray : public RArray<TUint32>
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    35
        {
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    36
public:
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    37
        void SetListL(const TDesC8& aChilds);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    38
        void GetListLC(HBufC8 *& aChilds, TInt &aLength);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    39
        void RemoveByValue(TUint32 aValue);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    40
        };
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    41
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    42
    typedef TPckgBuf<TCertInfo> TCertInfoPckg;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    43
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    44
    class RCertArray : public RPointerArray<TCertInfoPckg>
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    45
        {
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    46
public:
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    47
        void ExternalizeL(RWriteStream& aStream) const;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    48
        void InternalizeL(RReadStream& aStream);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    49
        TInt FindByValue(const TCertInfoPckg &aPckg);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    50
        };
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    51
    /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    52
     *  Factory class to Data component creation
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    53
     */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    54
    class CDeliveryComponentStorage : public CBase
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    55
        {
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    56
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    57
         * Constructor
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    58
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    59
        CDeliveryComponentStorage();
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    60
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    61
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    62
         * 2nd phase constructor. Loads compontns
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    63
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    64
        void ConstructL();
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    65
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    66
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    67
         * Saves the state to disk
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    68
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    69
        void PersistStateL();
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    70
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    71
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    72
         * Loads components from disk
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    73
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    74
        void LoadComponentsL();
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    75
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    76
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    77
         * Creates and returns next free deployment component id
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    78
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    79
        TInt NextKey();
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    80
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    81
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    82
         * Loads certificate array
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    83
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    84
        void LoadCertsL();
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    85
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    86
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    87
         * Saves and closes certificate array
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    88
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    89
        void CloseCertificatesL();
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    90
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    91
public:
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    92
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    93
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    94
         * Creates new storage object and constructs it
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    95
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    96
        static CDeliveryComponentStorage* NewL();
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    97
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    98
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
    99
         * Creates new storage object and constructs it, leaving it
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   100
         * on the cleanup stack
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   101
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   102
        static CDeliveryComponentStorage* NewLC();
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   103
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   104
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   105
         * Destructor
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   106
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   107
        virtual ~CDeliveryComponentStorage();
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   108
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   109
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   110
         * GetComponentIds Returns the const id array of component ids.
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   111
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   112
        const RComponentIdArray &GetComponentIds() const;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   113
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   114
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   115
         * Places all those component's ids in array who have possibly changed
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   116
         * state and no StateChangedL for that id called afterwards.
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   117
         * @param aArray array to hold the ids
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   118
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   119
        void GetStateChangeComponentIdsL(RComponentIdArray &aArray);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   120
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   121
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   122
         * StateChangedL Confirms that state change has been acknowledged by user
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   123
         * @param aInternalId The id whose state change is confirmed.
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   124
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   125
        void StateChangedL(TUint32 aInternalId);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   126
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   127
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   128
         * Creates new deployment component object having given state and user id
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   129
         * and constructs it. Optionally component may have owning certificate.
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   130
         * @param aState the state of to-be-created component
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   131
         * @param aUserId the user id of to-be-created component
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   132
         * @param aCertInfo the certificate of the owner of to-be-created component
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   133
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   134
        CDeploymentComponent *NewComponentL(
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   135
                const TDeploymentComponentState &aState,
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   136
                const TDCUserId &aUserId, const TCertInfo *aCertInfo = NULL);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   137
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   138
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   139
         * DeliverL makes the given component ot delivered state
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   140
         * @param aComponent the component that'll be delivered
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   141
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   142
        void DeliverL(CDeploymentComponent &aComponent);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   143
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   144
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   145
         * UpdateL updates the given component permanently
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   146
         * @param aComponent the component that'll be persisted
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   147
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   148
        void UpdateL(const CDeploymentComponent &aComponent);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   149
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   150
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   151
         * RemoveL Removes the deployment component having given id. The related object
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   152
         * will be invalid after call.
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   153
         * @param aInternalId the to-be-removed component's id
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   154
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   155
        void RemoveL(TUint32 aInternalId);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   156
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   157
        /**
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   158
         * InstalledL updates the given component state 
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   159
         * @param aComponent the component that'll be persisted
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   160
         */
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   161
        void InstalledL(CDeploymentComponent &aComponent);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   162
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   163
    //Update Deplyoment Components State variable
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   164
	void SetDeploymentComponentState(CDeploymentComponent &aComponent,TDeploymentComponentState aState);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   165
        CDeploymentComponent &ComponentL(TUint32 aInternalId);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   166
        void ActivateL(CDeploymentComponent &aComponent);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   167
        void DeactivateL(CDeploymentComponent &aComponent);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   168
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   169
        void CheckForDuplicateNodesInDeployedL(
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   170
                CDeploymentComponent &aComponent);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   171
        HBufC8* IntToDes8LC(const TInt aLuid);
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   172
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   173
        const RCertArray &Certificates() const
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   174
            {
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   175
            return iCertificates;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   176
            }
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   177
protected:
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   178
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   179
        CDeploymentComponent *LoadComponentL(TInt aInternalId,
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   180
                const TDesC8 &aBuffer) const;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   181
private:
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   182
        CRepository *iRepository;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   183
        RPointerArray<CDeploymentComponent> iComponents;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   184
        RComponentIdArray iComponentIds;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   185
        TInt iNextId;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   186
        RCertArray iCertificates;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   187
        CAMAppHideUtil *iHidder;
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   188
        };
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   189
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   190
    }
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   191
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   192
#endif __AMDELIVERYCOMPSTORAGE_H__
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   193
d316aecb87fd 201025_02
hgs
parents:
diff changeset
   194
//  End of File