contextframework/cfw/inc/cfoperationpluginservices/cfoperationpluginmanager.h
changeset 0 2e3d3ce01487
equal deleted inserted replaced
-1:000000000000 0:2e3d3ce01487
       
     1 /*
       
     2 * Copyright (c) 2007-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:  CFContextSourceManager class declaration.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef C_CFOPERATIONPLUGINMANAGER_H
       
    21 #define C_CFOPERATIONPLUGINMANAGER_H
       
    22 
       
    23 #include "cfecompluginmanager.h"
       
    24 #include "cfpluginoperation.h"
       
    25 #include "cfstarterobserver.h"
       
    26 #include "cfoperationplugin.h"
       
    27 #include "cfstateobserver.h"
       
    28 
       
    29 class CCFOperationPlugIn;
       
    30 class MCFOperationServices;
       
    31 class TCFOperationPluginInfo;
       
    32 class CImplementationInformation;
       
    33 class MCFScriptEngineInterface;
       
    34 
       
    35 /**
       
    36  *  Operation plug-in manager.
       
    37  *
       
    38  *  Operation plug-in manager is responsible for loading all the
       
    39  *  operation plug-ins that are currently installed.
       
    40  *
       
    41  *  @lib cfscriptengine.lib
       
    42  *  @since S60 4.0
       
    43  */
       
    44 NONSHARABLE_CLASS( CCFOperationPluginManager ) : public CCFEComPluginManager,
       
    45     public MCFPlugInOperation,
       
    46     public MCFStarterObserver,
       
    47     public MCFStateObserver
       
    48     {
       
    49     public:
       
    50 
       
    51         // Two phased constrcutors
       
    52         IMPORT_C static CCFOperationPluginManager* NewL(
       
    53             MCFScriptEngineInterface& aScriptEngine );
       
    54         IMPORT_C static CCFOperationPluginManager* NewLC(
       
    55             MCFScriptEngineInterface& aScriptEngine );
       
    56 
       
    57         // Destructor
       
    58         IMPORT_C virtual ~CCFOperationPluginManager();
       
    59 
       
    60     public: // From MCFPlugInOperation
       
    61 
       
    62         /**
       
    63         * Parses a xml node and returns a pointer to CCFScriptRoot instance.
       
    64         * @since S60 5.0
       
    65         * @param aParent is the parsed parent node for the aNode.
       
    66         * @param aNode is the node to be parsed.
       
    67         * @param aOperationServices is the operation services reference to be
       
    68         *   used by the new script root node.
       
    69         * @param aUid Implementation uid of the provider.
       
    70         * @return a ptr to CCFScriptRoot instance parsed from the given node,
       
    71         *   note that the ownership is transferred to the caller. Returns NULL
       
    72         *   if the node cannot be parsed.
       
    73         */
       
    74         CCFScriptRoot* ParseScriptRootL( CCFOperationNode* aParent,
       
    75                 CMDXMLNode& aNode,
       
    76                 MCFOperationServices& aOperationServices,
       
    77                 TUid& aUid );
       
    78 
       
    79         /**
       
    80         * Parse DOM-node into an operation node.
       
    81         *
       
    82         * @since S60 5.0
       
    83         * @param aParent Parent node.
       
    84         * @param aDOMNode DOM-node to be parsed.
       
    85         * @param aOperationServices Operation services instance to be used
       
    86         *   by the new operation node.
       
    87         * @param aUid Implementation uid of the provider.
       
    88         * @return Pointer to Operation node. The ownership of the node is
       
    89         *   transferred to the caller. NULL must be returned, if the DOM-node
       
    90         *   cannot be parsed.
       
    91         */
       
    92         CCFOperationNode* ParseL( CCFOperationNode* aParent,
       
    93             CMDXMLNode& aDOMNode,
       
    94             MCFOperationServices& aOperationServices,
       
    95             TUid& aUid );
       
    96 
       
    97     public: // From base classes
       
    98 
       
    99         // from MCFStateObserver
       
   100         void UpdatePlugInsL();
       
   101 
       
   102     private: // From base classes
       
   103 
       
   104         // @see MCFInitialize
       
   105         void InitializePhaseL( CCFPhaseBase::TCFPhaseId aPhase );
       
   106         
       
   107         // @see MCFStarterObserver
       
   108         void SetEventHandler( MCFStarterEventHandler& /*aEventHandler*/ );
       
   109 
       
   110     private:
       
   111 
       
   112         CCFOperationPluginManager( MCFScriptEngineInterface& aScriptEngine );
       
   113         void ConstructL();
       
   114 
       
   115     private: // New methods
       
   116 
       
   117         // Loads and initialized plug-in
       
   118     	CCFOperationPlugIn* CreateAndInitializePlugInL(
       
   119             const TUid& aImplementationUid,
       
   120             TOperationPluginInitParams& aParams );
       
   121 
       
   122         // Init starting phase
       
   123         void InitDeviceStartingPhaseL();
       
   124 
       
   125         // Init loading plugins phase
       
   126         void InitLoadingPluginsPhaseL();
       
   127 
       
   128         // Loads plug-ins and appends it into array
       
   129         void LoadPluginL( CImplementationInformation& aImplInfo );
       
   130 
       
   131         // Releases operation plug-in
       
   132         void ReleasePlugIn( CCFOperationPlugIn*& aPlugIn );
       
   133 
       
   134         // Finalizes node parsing
       
   135         CCFOperationNode* DoParseL( CCFOperationNode* aParent,
       
   136             CMDXMLNode& aDOMNode,
       
   137             MCFOperationServices& aOperationServices,
       
   138             TUid& aUid );
       
   139 
       
   140         // Finalizes script root parsing
       
   141         CCFScriptRoot* DoParseScriptRootL( CCFOperationNode* aParent,
       
   142             CMDXMLNode& aDOMNode,
       
   143             MCFOperationServices& aOperationServices,
       
   144             TUid& aUid );
       
   145 
       
   146     private: // data
       
   147 
       
   148         // Own: Context source plugin info array
       
   149         RArray<TCFOperationPluginInfo> iPlugIns;
       
   150 
       
   151         // Ref: Reference to script engine
       
   152         MCFScriptEngineInterface& iScriptEngine;
       
   153     };
       
   154 
       
   155 #endif