authenticationservices/authenticationserver/source/server/pluginmgr.h
changeset 29 ece3df019add
equal deleted inserted replaced
19:cd501b96611d 29:ece3df019add
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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 the License "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 /**
       
    20  @file
       
    21  @released
       
    22  @internalComponent
       
    23 */
       
    24 #ifndef PLUGINMGR_H
       
    25 #define PLUGINMGR_H
       
    26 
       
    27 #include <authserver/authplugininterface.h>
       
    28 namespace AuthServer 
       
    29 {
       
    30 
       
    31 /**
       
    32  * The plugin manager is responsible for managing the lifetime of plugin DLLs.
       
    33  **/
       
    34 
       
    35 class CPluginMgr : public CBase
       
    36 	{
       
    37 public:
       
    38 	static CPluginMgr* NewL();
       
    39 	static CPluginMgr* NewLC();
       
    40 	
       
    41 	~CPluginMgr();
       
    42 
       
    43 	/**
       
    44 	 * Returns the requested plugin. If the plugin has not yet been loaded
       
    45 	 * then it will be instantiated and cached prior to returning.
       
    46 	 *
       
    47 	 * @param aId the id of the plugin to return.
       
    48 	 *
       
    49 	 * @return the requested plugin
       
    50 	 *
       
    51 	 * @leave KErrAuthServerNoSuchPlugin
       
    52 	 *
       
    53 	 **/
       
    54 	CAuthPluginInterface* PluginL(const TPluginId& aId);
       
    55 
       
    56     /**
       
    57 	 * Returns the list of plugin implementations. The list is cached for use
       
    58 	 * rather than reloading it in multiple places.
       
    59 	 *
       
    60 	 * @return the array of implementation info objects
       
    61 	 *
       
    62 	 **/
       
    63 	const RImplInfoPtrArray& ImplementationsL();
       
    64 	
       
    65 	CAuthPluginInterface* ImplementationL(TInt aIndex);
       
    66 	
       
    67 	/**
       
    68 	 * Forces all plugins to forget their training for id
       
    69 	 *
       
    70 	 * @param aId the id of the identitiy to forget.
       
    71 	 *
       
    72 	 **/
       
    73 	void ForgetIdentityL(TIdentityId aId);
       
    74 	
       
    75 	/**
       
    76 	 * Builds authentication plugins list.
       
    77 	 **/
       
    78 	void BuildAuthPluginsListL();
       
    79 	
       
    80 private:
       
    81 	static TInt PluginCompare(const CAuthPluginInterface& lhs,
       
    82 							  const CAuthPluginInterface& rhs);
       
    83 							  
       
    84 	static TInt FindById(const TPluginId* lhs,
       
    85 						 const CAuthPluginInterface& rhs);
       
    86 						 
       
    87 	static 	TLinearOrder<CAuthPluginInterface> SPluginOrder;
       
    88 	
       
    89 	void ConstructL();
       
    90 	
       
    91 	
       
    92 	/**
       
    93 	 * Forces the plugin manager to free all plugin objects.
       
    94 	 **/
       
    95 	void ReleasePlugins();
       
    96 	
       
    97 	/**
       
    98 	 * Forces the plugin manager to free the implemtation info array and
       
    99 	 * reload it on the next call to Implementations.
       
   100 	 **/
       
   101 	void ReleaseImplInfo();
       
   102 	
       
   103 	/**
       
   104 	 * Creates an implementation of the specified plugin.
       
   105 	 * 
       
   106 	 * @param aId Id of the plugin to be created.
       
   107 	 *	
       
   108 	 * @return the requested plugin
       
   109 	 *	 
       
   110 	 **/
       
   111 	CAuthPluginInterface* CreatePluginImplementationL(const TPluginId &aId);
       
   112 	
       
   113 private:	
       
   114 	mutable RPointerArray<CAuthPluginInterface> iPlugins;
       
   115 	
       
   116 	mutable RImplInfoPtrArray iImplArray;
       
   117 	
       
   118 	/**
       
   119 	 * Maintain a list of plugin destructor keys.
       
   120 	 * This is used to destroy all plugin instances when ReleasePlugins
       
   121 	 * is called.
       
   122 	 * */
       
   123 	mutable RArray<TUid>iPluginDtorUids;
       
   124 	
       
   125     };
       
   126 
       
   127 } //namespace
       
   128 
       
   129 #endif // PLUGINMGR_H