ncdengine/engine/transport/inc/catalogshttpsessionimpl.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:  
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CATALOGSHTTPSESSION_H
       
    20 #define C_CATALOGSHTTPSESSION_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "catalogshttpsession.h"
       
    24 
       
    25 class CCatalogsHttpDownloadManager;
       
    26 class CCatalogsHttpTransactionManager;
       
    27 class CCatalogsTransport;
       
    28 class MCatalogsHttpSessionManager;
       
    29 class CCatalogsHttpConfig;
       
    30 class CCatalogsHttpConnectionManager;
       
    31 class CCatalogsConnectionEventSink;
       
    32 
       
    33 /**
       
    34 * HTTP session implementation
       
    35 */
       
    36 class CCatalogsHttpSession : public CBase, 
       
    37     public MCatalogsHttpSession
       
    38     {
       
    39 public: // Constructors and destructor
       
    40 
       
    41     /**
       
    42     * Creator
       
    43     *
       
    44     * @param aSessionId Session id
       
    45     * @param aOwner Owner object
       
    46     * @return A new HTTP session
       
    47     */
       
    48     static CCatalogsHttpSession* NewL( 
       
    49         TInt32 aSessionId,
       
    50         CCatalogsTransport& aOwner, 
       
    51         MCatalogsHttpSessionManager& aSessionManager,
       
    52         TBool aCleanupSession );
       
    53     
       
    54     /**
       
    55     * Destructor
       
    56     */
       
    57     virtual ~CCatalogsHttpSession();
       
    58     
       
    59 
       
    60 public: // MCatalogsHttpSession
       
    61     
       
    62     /**
       
    63     * @see MCatalogsHttpSession::AddRef()
       
    64     */        
       
    65     TInt AddRef();		
       
    66     
       
    67     /**
       
    68     * @see MCatalogsHttpSession::Release()
       
    69     */        
       
    70     TInt Release();
       
    71       
       
    72     /**
       
    73     * @see MCatalogsHttpSession::RefCount()
       
    74     */                
       
    75     TInt RefCount() const;   
       
    76 
       
    77     /**
       
    78     * Returns session ID
       
    79     *
       
    80     * @return Session ID
       
    81     */
       
    82     TInt32 SessionId() const;
       
    83     
       
    84     
       
    85     /**
       
    86     * Returns the type of the session.
       
    87     *
       
    88     * This value is the same is the interface ID used to create the
       
    89     * session
       
    90     *
       
    91     * @return Session type
       
    92     */
       
    93     TInt SessionType() const;        
       
    94 
       
    95 public:
       
    96 
       
    97     /**
       
    98     * Creates a new download operation
       
    99     * 
       
   100     * @param aUrl URL to download
       
   101     * @param aObserver Observer for the download
       
   102     * @param aStart If true, download is started automatically. Otherwise
       
   103     * the caller must start it explicitly. Default: true
       
   104     * 
       
   105     * @return A new download operation
       
   106     */
       
   107     MCatalogsHttpOperation* CreateDownloadL( const TDesC16& aUrl, 
       
   108         TBool aStart, MCatalogsHttpObserver* aObserver );
       
   109 
       
   110     MCatalogsHttpOperation* CreateDownloadL( const TDesC8& aUrl, 
       
   111         TBool aStart, MCatalogsHttpObserver* aObserver );
       
   112 
       
   113 
       
   114     /**
       
   115     * Creates a new transaction operation
       
   116     * 
       
   117     * @param aUrl Destination URL
       
   118     * @param aObserver Observer for the transaction
       
   119     *
       
   120     * @return A new transaction operation
       
   121     */
       
   122     MCatalogsHttpOperation* CreateTransactionL( const TDesC16& aUrl, 
       
   123         MCatalogsHttpObserver* aObserver );
       
   124 
       
   125     MCatalogsHttpOperation* CreateTransactionL( const TDesC8& aUrl, 
       
   126         MCatalogsHttpObserver* aObserver );
       
   127 
       
   128 
       
   129     MCatalogsHttpOperation* CreateDlTransactionL( const TDesC8& aUrl,
       
   130         MCatalogsHttpObserver& aObserver,
       
   131         const CCatalogsHttpConfig& aConfig );
       
   132 
       
   133    /**
       
   134     * Download getter. 
       
   135     *
       
   136     * Returns the download that matches the id or NULL
       
   137     * @param aId Download ID
       
   138     * @return Download or NULL
       
   139     */
       
   140     MCatalogsHttpOperation* Download( 
       
   141         const TCatalogsTransportOperationId& aId ) const;
       
   142 
       
   143 
       
   144     /**
       
   145     * Transaction getter. 
       
   146     *
       
   147     * Returns the transaction that matches the id or NULL
       
   148     * @param aId Transaction ID
       
   149     * @return Transaction or NULL
       
   150     */            
       
   151     MCatalogsHttpOperation* Transaction( 
       
   152         const TCatalogsTransportOperationId& aId ) const;
       
   153 
       
   154 
       
   155     /**
       
   156     * Returns an array of current downloads. 
       
   157     *
       
   158     * @return Array of downloads
       
   159     * @note Doesn't show downloads that were completed during the time
       
   160     * the client was not running
       
   161     */
       
   162     const RCatalogsHttpOperationArray& 
       
   163         CurrentDownloads() const;
       
   164     
       
   165     
       
   166     /**
       
   167      * Returns an array of downloads restored from the previous
       
   168      * session.
       
   169      *
       
   170      * @return Array of downloads
       
   171      */
       
   172     const RCatalogsHttpOperationArray&
       
   173         RestoredDownloads() const;
       
   174 
       
   175 
       
   176     /**
       
   177      * @see MCatalogsHttpSession::MoveRestoredDlToCurrentDls()
       
   178      */
       
   179     TInt MoveRestoredDlToCurrentDls( 
       
   180         MCatalogsHttpOperation& aDownload );
       
   181     
       
   182     
       
   183     /**
       
   184     * Returns an array of current transactions.
       
   185     *
       
   186     * @return Array of transactions
       
   187     */        
       
   188     const RCatalogsHttpOperationArray& 
       
   189         CurrentTransactions() const;
       
   190 
       
   191 
       
   192 
       
   193     /**
       
   194     * Cancels all current transactions, downloads and uploads
       
   195     * and closes all connections opened by this session
       
   196     */        
       
   197     void CancelAllOperations();
       
   198 
       
   199 
       
   200     /**
       
   201      * 
       
   202      */        
       
   203     void NotifyCancelAllOperations();
       
   204     
       
   205 
       
   206     /**
       
   207     * Cancels all current downloads. 
       
   208     */
       
   209     void CancelAllDownloads();
       
   210     
       
   211     
       
   212     /**
       
   213     * Cancels all current transactions
       
   214     */
       
   215     void CancelAllTransactions();        
       
   216     
       
   217     
       
   218     /**
       
   219      * @see MCatalogsHttpSession::DeleteRestoredDownloads()
       
   220      */
       
   221     void DeleteRestoredDownloads();
       
   222     
       
   223     /**
       
   224     * Returns the current default configuration for transactions.
       
   225     *
       
   226     * The changes made to the configuration will affect the next
       
   227     * new transaction operation.
       
   228     *
       
   229     * @return Transaction configuration
       
   230     */
       
   231     MCatalogsHttpConfig& DefaultTransactionConfig() const;
       
   232 
       
   233 
       
   234     /**
       
   235     * Returns the current default configuration for downloads.
       
   236     *
       
   237     * The changes made to the configuration will affect the next
       
   238     * new download operation.
       
   239     *
       
   240     * @return Download configuration
       
   241     */        
       
   242     MCatalogsHttpConfig& DefaultDownloadConfig() const;
       
   243        
       
   244 
       
   245     /**
       
   246      * @see MCatalogsHttpSession::SetDefaultConnectionMethod
       
   247      */
       
   248     void SetDefaultConnectionMethod( const TCatalogsConnectionMethod& aMethod );    
       
   249     
       
   250     
       
   251     /**
       
   252      * @see MCatalogsHttpSession::ConnectionManager()
       
   253      */
       
   254     CCatalogsHttpConnectionManager& ConnectionManager();           
       
   255 
       
   256 
       
   257     /**
       
   258      * @see MCatalogsHttpSession::SetOptions()
       
   259      */
       
   260     void SetOptions( TUint32 aOptions );
       
   261     
       
   262 public: // 
       
   263 
       
   264     void SetOwner( CCatalogsTransport* aOwner );
       
   265     
       
   266     void ReportConnectionStatus( TBool aActive );
       
   267     
       
   268 private:
       
   269 
       
   270     CCatalogsHttpSession( TInt32 aSessionId, CCatalogsTransport& aOwner,
       
   271         MCatalogsHttpSessionManager& aSessionManager );
       
   272         
       
   273     void ConstructL( MCatalogsHttpSessionManager& aManager, 
       
   274         TBool aCleanupSession );
       
   275 
       
   276 private:
       
   277         
       
   278     CCatalogsTransport* iOwner;
       
   279     MCatalogsHttpSessionManager& iSessionManager;
       
   280     TInt32 iSessionId;
       
   281     CCatalogsHttpDownloadManager* iDownloadMgr;
       
   282     CCatalogsHttpTransactionManager* iTransactionMgr;    
       
   283     TInt iRefCount;    
       
   284     CCatalogsHttpConnectionManager* iConnectionMgr;
       
   285     CCatalogsConnectionEventSink* iConnectionEventSink;
       
   286     };
       
   287 
       
   288 #endif // C_CATALOGSHTTPSESSION_H