ncdengine/provider/server/inc/ncdnodeuricontentimpl.h
changeset 0 ba25891c3a9e
equal deleted inserted replaced
-1:000000000000 0:ba25891c3a9e
       
     1 /*
       
     2 * Copyright (c) 2006 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:   Contains CNcdNodeuriContent class
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_NCDNODEURICONTENT_H
       
    20 #define C_NCDNODEURICONTENT_H
       
    21 
       
    22 
       
    23 // For streams
       
    24 #include <s32mem.h>
       
    25 
       
    26 #include "catalogscommunicable.h"
       
    27 #include "ncdstoragedataitem.h"
       
    28 #include "ncdnodeclassids.h"
       
    29 
       
    30 
       
    31 class MNcdPreminetProtocolDownload;
       
    32 class MNcdPurchaseDetails;
       
    33 
       
    34 /**
       
    35  *  This server side class contains the data and the functionality
       
    36  *  that the proxy objects will use to internalize itself.
       
    37  *
       
    38  *  This object should be added to the session. So, it will be usable
       
    39  *  in the proxy side by using the handle gotten during addition. 
       
    40  *  The handle is used to identify to what object the proxy directs 
       
    41  *  the function call.  When objects are added to sessions, 
       
    42  *  multiple handles may be gotten for the same object if addition is 
       
    43  *  done multiple times.
       
    44  *
       
    45  *  @lib ?library
       
    46  *  @since S60 ?S60_version *** for example, S60 v3.0
       
    47  */
       
    48 class CNcdNodeUriContent : public CCatalogsCommunicable,
       
    49                            public MNcdStorageDataItem
       
    50     {
       
    51 
       
    52 public:
       
    53     /**
       
    54      * NewL
       
    55      *
       
    56      * @return CNcdNodeUriContent* Pointer to the created object 
       
    57      * of this class.
       
    58      */
       
    59     static CNcdNodeUriContent* NewL();
       
    60 
       
    61     /**
       
    62      * NewLC
       
    63      *
       
    64      * @return CNcdNodeUriContent* Pointer to the created object 
       
    65      * of this class.
       
    66      */
       
    67     static CNcdNodeUriContent* NewLC();
       
    68 
       
    69 
       
    70     /**
       
    71      * Destructor
       
    72      *
       
    73      * @note Because this is CCatalogsCommunicable function the
       
    74      * session that owns this object should delete this class object.
       
    75      * So, instead of directly deleting this object from some other
       
    76      * class. Close-method should be used instead.
       
    77      */
       
    78     virtual ~CNcdNodeUriContent();
       
    79 
       
    80 
       
    81     /**
       
    82      * Retrieves the data type that informs what class the data is for.
       
    83      * By checking the data type information, an InternalizeL function
       
    84      * of a right class can be called when the object data is set
       
    85      * from the storage.
       
    86      * The data type may be decided and set in a object that creates this 
       
    87      * class object.
       
    88      *
       
    89      * @return NcdNodeClassIds::TNcdNodeClassId Describes the data type. 
       
    90      */
       
    91     NcdNodeClassIds::TNcdNodeClassId ClassId() const;
       
    92 
       
    93 
       
    94     /**
       
    95      * This function is called when the owner of this object
       
    96      * wants to internalize the content according to the data
       
    97      * that has been received from the parser.
       
    98      * 
       
    99      * @param aData The data is set in the protocol parser and can
       
   100      * be used to initialize this class object.
       
   101      */
       
   102     //void InternalizeL( MNcdPreminetProtocolDownload& aData );
       
   103    
       
   104    
       
   105     /**
       
   106      * Internalization from purchase details
       
   107      */
       
   108     TBool InternalizeL( const MNcdPurchaseDetails& aDetails );
       
   109     
       
   110     
       
   111     /**
       
   112      * Content URI
       
   113      */
       
   114     const TDesC& Uri() const;
       
   115     
       
   116     
       
   117 public: // MNcdStorageDataItem 
       
   118 
       
   119     // These functions are used to get the data from and to insert the data
       
   120     // into the database using by the given stream.
       
   121 
       
   122     /**
       
   123      * @see MNcdStorageDataItem::ExternalizeL
       
   124      */
       
   125     virtual void ExternalizeL( RWriteStream& aStream );
       
   126 
       
   127 
       
   128     /**
       
   129      * @see MNcdStorageDataItem::InternalizeL
       
   130      */
       
   131     virtual void InternalizeL( RReadStream& aStream );
       
   132 
       
   133 
       
   134 public: // CCatalogsCommunicable
       
   135 
       
   136     /**
       
   137      * @see CCatalogsCommunicable::ReceiveMessage
       
   138      */
       
   139     virtual void ReceiveMessage( MCatalogsBaseMessage* aMessage,
       
   140                                  TInt aFunctionNumber );
       
   141 
       
   142     /**
       
   143      * @see CCatalogsCommunicable::CounterPartLost
       
   144      */
       
   145     virtual void CounterPartLost( const MCatalogsSession& aSession );
       
   146 
       
   147 
       
   148 protected:
       
   149 
       
   150     /**
       
   151      * Constructor
       
   152      * @param aClassId Identifies this class. 
       
   153      * Is set in the NewLC function 
       
   154      */
       
   155     CNcdNodeUriContent( NcdNodeClassIds::TNcdNodeClassId aClassId );
       
   156 
       
   157     /**
       
   158      * ConstructL
       
   159      */
       
   160     virtual void ConstructL();
       
   161     
       
   162 
       
   163     // These functions are called from the ReceiveMessage when
       
   164     // the given function id has matched to the function.
       
   165 
       
   166     /**
       
   167      * This function is called when the proxy wants to get the
       
   168      * data from the serverside. This function calls the
       
   169      * InternalizeDataForRequestL which may be overloaded in the
       
   170      * child classes
       
   171      * @param aMessage Contains data from the proxy and can be used
       
   172      * to send data back to proxy
       
   173      */
       
   174     void InternalizeRequestL( MCatalogsBaseMessage& aMessage );
       
   175         
       
   176     /**
       
   177      * This function writes the object data to the stream. 
       
   178      * The stream content will be sent to the proxy that requested the data.
       
   179      * Child classes should add their own data after this parent data.
       
   180      * @param aStream The data content of this class object will be written
       
   181      * into this stream.
       
   182      */
       
   183     virtual void ExternalizeDataForRequestL( RWriteStream& aStream );
       
   184 
       
   185     /**
       
   186      * This function is called from the proxy side. When the proxy
       
   187      * is deleted.
       
   188      * @param aMessage Contains data from the proxy and can be used
       
   189      * to send data back to proxy
       
   190      */
       
   191     void ReleaseRequest( MCatalogsBaseMessage& aMessage ) const;
       
   192 
       
   193 
       
   194 private:
       
   195 
       
   196     // Prevent these two if they are not implemented
       
   197     CNcdNodeUriContent( const CNcdNodeUriContent& aObject );
       
   198     CNcdNodeUriContent& operator =( const CNcdNodeUriContent& aObject );
       
   199 
       
   200 
       
   201 private: // data
       
   202     
       
   203     // The class id identifies this class. The id may be used to identify
       
   204     // what kind of class object is created when data is gotten from the db.
       
   205     NcdNodeClassIds::TNcdNodeClassId iClassId;
       
   206 
       
   207     // The message is set when ReceiveMessage is called. The message
       
   208     // is used in the CounterPartLost-function that informs the message
       
   209     // if the session has been lost.
       
   210     MCatalogsBaseMessage* iMessage;
       
   211 
       
   212     HBufC* iUriContent;
       
   213     
       
   214     // Time that the data pointed by the uri is valid in minutes. This
       
   215     // value is counted from the time that the validity is sent to
       
   216     // the client.
       
   217     TInt iValidityDelta;
       
   218     };
       
   219     
       
   220 #endif // C_NCDNODEURICONTENT_H