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