contentpublishingsrv/contentpublishingserver/cpserver/inc/cpnotificationhandler.h
changeset 73 4bc7b118b3df
parent 66 32469d7d46ff
child 80 397d00875918
child 81 5ef31a21fdd5
equal deleted inserted replaced
66:32469d7d46ff 73:4bc7b118b3df
     1 /*
       
     2 * Copyright (c) 2008 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:  Class used by session to handle asynchronous requests
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CPNOTIFICATIONHANDLER_H
       
    20 #define C_CPNOTIFICATIONHANDLER_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32hashtab.h> 
       
    24 
       
    25 class CLiwGenericParamList;
       
    26 class CLiwDefaultList;
       
    27 class CLiwDefaultMap;
       
    28 class CCPLiwMap;
       
    29 
       
    30 /**
       
    31  *  Internal class for handling asynchronous request
       
    32  *  for notifications. Used by server session object.
       
    33  *
       
    34  *  @since S60 v5.0
       
    35  */
       
    36 class CCPNotificationHandler : public CBase
       
    37     {
       
    38 public:
       
    39 
       
    40    /**
       
    41      * Two-phased constructor.
       
    42      */
       
    43     static CCPNotificationHandler* NewL( RPointerArray<CLiwDefaultList>&
       
    44         aNotifications );
       
    45 
       
    46     /**
       
    47      * Two-phased constructor.
       
    48      */
       
    49     static CCPNotificationHandler* NewLC( RPointerArray<CLiwDefaultList>&
       
    50         aNotifications );
       
    51 
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55     virtual ~CCPNotificationHandler();
       
    56 
       
    57     /**
       
    58      * Save message from client and initialize needed members
       
    59      */
       
    60     void SaveMessageL( const RMessage2& aMessage );
       
    61 
       
    62     /**
       
    63      * Adds observer
       
    64      */
       
    65     void AddObserverL( const RMessage2& aMessage );    
       
    66 
       
    67     /**
       
    68      * Removes observer
       
    69      */
       
    70     void RemoveObserverL( const RMessage2& aMessage );      
       
    71     
       
    72     /**
       
    73      * Invoked in order to send notification
       
    74      * @param List of changes to send
       
    75      */
       
    76     void SendNotificationL( CLiwDefaultList* aListOfMaps );
       
    77 
       
    78     /**
       
    79      * Getter
       
    80      * @return pointer to current notification
       
    81      */
       
    82     const CLiwGenericParamList* GetPointerToChangeInfoList();
       
    83 
       
    84     /**  
       
    85      * Resets internal stare
       
    86      */
       
    87     void Reset();
       
    88 
       
    89     /**
       
    90      * Completes iMessage with provided error
       
    91      * @param Error Code
       
    92      */
       
    93     void ErrorComplete( TInt aErrCode );
       
    94 
       
    95 private:
       
    96     
       
    97     /**
       
    98      * C++ default constructor.
       
    99      */
       
   100     CCPNotificationHandler();
       
   101 
       
   102     /**
       
   103      * By default Symbian 2nd phase constructor is private.
       
   104      */
       
   105     void ConstructL( RPointerArray<CLiwDefaultList>& aNotifications );
       
   106 
       
   107     /**
       
   108      * Invoked in order to send notification
       
   109      * @param List of changes to send
       
   110      * @since Series 60 5.0
       
   111      */
       
   112     TBool SendChangeInfoListL( const CLiwDefaultList* aListOfMaps );
       
   113 
       
   114     /**
       
   115      * Compares argument to stored filter
       
   116      * @param aMap Information about change
       
   117      * @param aFilter filter to compare with
       
   118      * @return ETrue if argument matches filter
       
   119      */
       
   120     TBool IsProperForFilterL( const CLiwDefaultMap& aMap, 
       
   121     		const CCPLiwMap& aFilter );
       
   122 
       
   123     /**
       
   124      * Extracts parameter from LIW Map 
       
   125      *
       
   126      * @param aMap Source Map
       
   127      * @param aProperty Key of parameter to extract
       
   128      * @param aResult Target for value
       
   129      */
       
   130     void GetPropertyL( const CLiwDefaultMap& aMap, const TDesC8& aProperty,
       
   131         RBuf& aResult );
       
   132     
       
   133     /**
       
   134      * Checks if IDs are the same
       
   135      *
       
   136      * @param aMap Map with notifications
       
   137      * @param aFilter filter to compare with
       
   138      * @return ETrue if ID are identical
       
   139      */
       
   140     TBool CheckIdL( const CLiwDefaultMap& aMap, const CCPLiwMap& aFilter );
       
   141     
       
   142     /**
       
   143      * Checks if Properties like publisher,content type 
       
   144      * and content id  are the same
       
   145      *
       
   146      * @param aMap Map with notifications
       
   147      * @param aFilter filter to compare with
       
   148      * @return ETrue if Parameters are identical
       
   149      */
       
   150     TBool CheckPropertiesL( const CLiwDefaultMap& aMap, 
       
   151     		const CCPLiwMap& aFilter );
       
   152     
       
   153     /**
       
   154      * Checks if operation types are the same
       
   155      *
       
   156      * @param aMap Map with notifications
       
   157      * @param aFilter filter to compare with
       
   158      * @return ETrue if operation types are the same
       
   159      */
       
   160     TBool CheckOperationTypeL( const CLiwDefaultMap& aMap, 
       
   161     		const CCPLiwMap& aFilter );
       
   162     
       
   163     /**
       
   164      * Checks if registry types are the same
       
   165      *
       
   166      * @param aMap Map with notifications
       
   167      * @param aFilter filter to compare with
       
   168      * @return ETrue if registry types are the same
       
   169      */ 
       
   170     TBool CheckRegistryTypeL( const CLiwDefaultMap& aMap,
       
   171     		const CCPLiwMap& aFilter );
       
   172 
       
   173 private:
       
   174     // data
       
   175 
       
   176     /*
       
   177      * Own.
       
   178      * ETrue if message is ready to send notification
       
   179      */
       
   180     TBool iIsReadyToSend;
       
   181 
       
   182     /*
       
   183      * Own.
       
   184      * List of waiting notifications.
       
   185      */
       
   186     RPointerArray<CLiwDefaultList> iNotifications;
       
   187 
       
   188     /*
       
   189      * Not own.
       
   190      * Message from client
       
   191      */
       
   192     RMessage2 iMessage;
       
   193 
       
   194     /*
       
   195      * Own.
       
   196      * Notification to send.
       
   197      */
       
   198     CLiwGenericParamList* iChangeInfoList;
       
   199 
       
   200     /*
       
   201      * Own.
       
   202      * Filters
       
   203      */
       
   204     RHashMap< TInt32, CCPLiwMap*> iFilters;
       
   205     };
       
   206 
       
   207 #endif // C_CPNOTIFICATIONHANDLER_H