contentpublishingsrv/contentharvester/contentharvesterserver/inc/contentharvesterserver.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) 2007 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:  Content Harvester Server - implemenration of CServer2 
       
    15  *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CONTENTHARVESTERSERVER_H
       
    20 #define C_CONTENTHARVESTERSERVER_H
       
    21 
       
    22 #include <eikenv.h>
       
    23 #include <eikappui.h>
       
    24 #include "contentharvesterpanic.h"
       
    25 
       
    26 class CContentHarvesterEngine;
       
    27 
       
    28 // CONSTANTS
       
    29 
       
    30 // FORWARD DECLARATIONS
       
    31 
       
    32 // CLASS DECLARATION
       
    33 
       
    34 /**
       
    35  *  CP Active Data Server container.
       
    36  *  Provides interface for CP Active Data Server maintanace purposes.
       
    37  *
       
    38  *  @lib ???.lib
       
    39  *  @since Series 60 3.1
       
    40  */
       
    41 class CContentHarvesterServer : public CServer2
       
    42     {
       
    43     /**
       
    44      *  EIkonEnv for the server process.
       
    45      *
       
    46      *  @lib ???.lib
       
    47      *  @since Series 60 3.1
       
    48      */
       
    49     class CContentHarvesterEikonEnv : public CEikonEnv
       
    50         {
       
    51 public:
       
    52         void DestroyEnvironment();
       
    53         void ConstructL();
       
    54         };
       
    55 
       
    56     /**
       
    57      *  EikAppUi for the server process.
       
    58      *
       
    59      *  @lib ???.lib
       
    60      *  @since Series 60 3.1
       
    61      */
       
    62     class CContentHarvesterAppUi : public CEikAppUi
       
    63         {
       
    64 public:
       
    65         ~CContentHarvesterAppUi();
       
    66         void ConstructL();
       
    67         };
       
    68 
       
    69 public:
       
    70     // Constructors and destructor
       
    71 
       
    72     /**
       
    73      * Two-phased constructor.
       
    74      */
       
    75     static CContentHarvesterServer* NewLC();
       
    76 
       
    77     /**
       
    78      * Destructor.
       
    79      */
       
    80     virtual ~CContentHarvesterServer();
       
    81 
       
    82 public:
       
    83     // New functions        
       
    84 
       
    85     /**
       
    86      * Return the reference to the engine.
       
    87      * @return engine reference
       
    88      */
       
    89     CContentHarvesterEngine& Engine();
       
    90 
       
    91     /**
       
    92      * Stops server.
       
    93      */
       
    94     void Stop();
       
    95 
       
    96     /**
       
    97      * First stage startup for the server thread. 
       
    98      * @return return KErrNone or panics thread
       
    99      */
       
   100     static TInt ThreadFunction();
       
   101 
       
   102     /**
       
   103      * Panic client. 
       
   104      * @param aMessage RMessage2
       
   105      * @param aPanic panic code
       
   106      */
       
   107     static void PanicClient( const RMessage2& aMessage,
       
   108         TContentHarvesterPanic aPanic );
       
   109 
       
   110 protected:
       
   111     // From CActive
       
   112     /**
       
   113      * Process any errors.
       
   114      * @param aError the leave code reported
       
   115      * @return return KErrNone if leave is handled
       
   116      */
       
   117     TInt RunError( TInt aError );
       
   118 
       
   119 private:
       
   120     // New methods
       
   121 
       
   122     /**
       
   123      * Constructs the server. 
       
   124      * @param aPriority CServer2 input parameter
       
   125      */
       
   126     CContentHarvesterServer( TInt aPriority );
       
   127 
       
   128     /**
       
   129      * Perform the second phase construction of a CContentHarvesterServer object.
       
   130      */
       
   131     void ConstructL();
       
   132 
       
   133     /**
       
   134      * Panic the server. 
       
   135      * @param param aPanic the panic code
       
   136      * @return a updateId of container
       
   137      */
       
   138     static void PanicServer( TContentHarvesterPanic aPanic );
       
   139 
       
   140     /**
       
   141      * Second stage startup for the server thread.
       
   142      */
       
   143     static void ThreadFunctionL();
       
   144 
       
   145 private:
       
   146     // From CServer2
       
   147 
       
   148     /**
       
   149      * Create a time server session, and return a pointer to the created object.
       
   150      * @param aVersion the client version 
       
   151      * @param aMessage RMessage2 
       
   152      * @return pointer to new session
       
   153      */
       
   154     CSession2* NewSessionL( const TVersion& aVersion,
       
   155         const RMessage2& aMessage ) const;
       
   156 
       
   157 private:
       
   158 
       
   159     /**
       
   160      * instance of engine, where the whole logic is implemented	
       
   161      * Own.
       
   162      */
       
   163     CContentHarvesterEngine* iEngine;
       
   164 
       
   165     };
       
   166 
       
   167 #endif // C_CONTENTHARVESTERSERVER_H