Symbian3/PDK/Source/GUID-E10A3336-9C4C-59A5-B94F-6CECA92FFB9F.dita
changeset 1 25a17d01db0c
child 3 46218c8b8afa
equal deleted inserted replaced
0:89d6a7a84779 1:25a17d01db0c
       
     1 <?xml version="1.0" encoding="utf-8"?>
       
     2 <!-- Copyright (c) 2007-2010 Nokia Corporation and/or its subsidiary(-ies) All rights reserved. -->
       
     3 <!-- This component and the accompanying materials are made available under the terms of the License 
       
     4 "Eclipse Public License v1.0" which accompanies this distribution, 
       
     5 and is available at the URL "http://www.eclipse.org/legal/epl-v10.html". -->
       
     6 <!-- Initial Contributors:
       
     7     Nokia Corporation - initial contribution.
       
     8 Contributors: 
       
     9 -->
       
    10 <!DOCTYPE task
       
    11   PUBLIC "-//OASIS//DTD DITA Task//EN" "task.dtd">
       
    12 <task id="GUID-E10A3336-9C4C-59A5-B94F-6CECA92FFB9F" xml:lang="en"><title>Providing
       
    13 a Custom Resolver </title><shortdesc>The plug-in framework has a default resolver that selects an appropriate
       
    14 implementation to suit the client requests. If the algorithm used by the custom
       
    15 resolver is inappropriate, an interface definition can provide its own custom
       
    16 resolver. </shortdesc><prolog><metadata><keywords/></metadata></prolog><taskbody>
       
    17 <context><p>Custom resolvers are interface implementations that implement
       
    18 the <xref href="GUID-38D97F70-383E-3950-B052-CB56965B0B48.dita"><apiname>CResolver</apiname></xref> interface. They are instantiated by the framework
       
    19 in response to the <xref href="GUID-1344F049-81C4-3D17-AF46-8B5584680ADB.dita#GUID-1344F049-81C4-3D17-AF46-8B5584680ADB/GUID-C7F147AC-6D77-3169-AAB4-B27262B4333B"><apiname>REComSession::CreateImplementationL()</apiname></xref> calls
       
    20 that specify to use a particular custom resolver. Custom resolvers must confirm
       
    21 to other aspects of interface implementations, including providing registration
       
    22 resource information, and publishing its UID and factory function in an implementation
       
    23 proxy table. </p><note> Additionally, in order to be trusted by ECom, the
       
    24 plug-in must have the ProtServ capability set in the project file. </note><p>A
       
    25 custom resolver class must derive from <xref href="GUID-38D97F70-383E-3950-B052-CB56965B0B48.dita"><apiname>CResolver</apiname></xref>.
       
    26 The derived class must implement the following inherited functions: </p> </context>
       
    27 <steps id="GUID-B8CC6618-FF31-5E9E-9C74-EE029F6A4A6F">
       
    28 <step id="GUID-81A902BA-C325-556A-ACE4-1E945DD82731"><cmd/>
       
    29 <info>Implement a factory function that takes an <xref href="GUID-C6201A47-85A9-365C-9B28-48243FA6ACD0.dita"><apiname>MPublicRegistry</apiname></xref> object
       
    30 as input. <xref href="GUID-C6201A47-85A9-365C-9B28-48243FA6ACD0.dita"><apiname>MPublicRegistry</apiname></xref> provides the resolver with the
       
    31 list of the implementations registered with the plug-in framework that meet
       
    32 the requirements of the specified interface. </info>
       
    33 </step>
       
    34 <step id="GUID-39F2C21F-C917-5D40-B6AE-61CF1C8852E7"><cmd/>
       
    35 <info>Implement the <xref href="GUID-38D97F70-383E-3950-B052-CB56965B0B48.dita#GUID-38D97F70-383E-3950-B052-CB56965B0B48/GUID-948455C3-D565-3D6E-ABD0-18E23C4D2C40"><apiname>CResolver::IdentifyImplementationL()</apiname></xref> function
       
    36 that takes the UID of the interface for which an implementation is requested.
       
    37 The resolver uses the resolution parameters and returns the UID of the best-fit
       
    38 implementation. The best-fit algorithm is specific to each custom resolver. </info>
       
    39 <info> <xref href="GUID-38D97F70-383E-3950-B052-CB56965B0B48.dita#GUID-38D97F70-383E-3950-B052-CB56965B0B48/GUID-948455C3-D565-3D6E-ABD0-18E23C4D2C40"><apiname>CResolver::IdentifyImplementationL()</apiname></xref> returns a list
       
    40 of all matching implementations. </info>
       
    41 </step>
       
    42 <step id="GUID-3642618B-17BD-594F-8C0B-0985AC3B087F"><cmd/>
       
    43 <info>Implement the <xref href="GUID-38D97F70-383E-3950-B052-CB56965B0B48.dita#GUID-38D97F70-383E-3950-B052-CB56965B0B48/GUID-5FDD82E1-9538-3393-A892-44D577EC4090"><apiname>CResolver::ListAllL()</apiname></xref> function. </info>
       
    44 </step>
       
    45 </steps>
       
    46 <example id="GUID-E1354F45-99FB-5509-B9E4-9E0B9E44C6F3"><title>Custom resolver
       
    47 example</title> <p>The following code depicts a sample customer resolver. </p> <codeblock id="GUID-552AC3FB-730E-54A6-91EC-EB5A6A65C0B1" xml:space="preserve">class CExampleResolver : public CResolver
       
    48     {
       
    49 public:
       
    50     // Factory function: 
       
    51     static CExampleResolver* NewL(MPublicRegistry&amp; aRegistry);
       
    52     ~CExampleResolver();
       
    53 
       
    54     // Implement IdentifyImplementationL()
       
    55     TUid IdentifyImplementationL(TUid aInterfaceUid, 
       
    56     const TEComResolverParams&amp; aParameters) const;
       
    57 
       
    58 // Implement ListAllL
       
    59 
       
    60     RImplInfoArray* ListAllL(TUid aInterfaceUid, 
       
    61     const TEComResolverParams&amp; aParameters) const;</codeblock> <p>The
       
    62 following code shows a sample standard registration resource required by a
       
    63 custom resolver. </p> <codeblock id="GUID-D4072E8E-DB0A-5B3B-ACC5-078F1C3FD83A" xml:space="preserve">RESOURCE REGISTRY_INFO theInfo
       
    64     {
       
    65     dll_uid = 0x10009DB3;
       
    66     interfaces = 
       
    67         {
       
    68         INTERFACE_INFO
       
    69  // interface_uid value is always 0x10009D90. 
       
    70             {
       
    71             interface_uid = 0x10009D90;
       
    72             implementations = 
       
    73                 {
       
    74                 IMPLEMENTATION_INFO
       
    75                     {
       
    76 // uid value is specific to individual resolvers
       
    77                     implementation_uid = 0x10009DB4;
       
    78 
       
    79                     version_no = 1;
       
    80 // unused fields
       
    81                     display_name = "";
       
    82                     default_data = "";
       
    83                     opaque_data = "";
       
    84                     }
       
    85                 };
       
    86             }
       
    87         };
       
    88     }</codeblock> </example>
       
    89 </taskbody></task>