Symbian3/SDK/Source/GUID-8A7B837D-4069-5364-A596-686EEBAE351D.dita
changeset 13 48780e181b38
parent 8 ae94777fff8f
equal deleted inserted replaced
12:80ef3a206772 13:48780e181b38
     7     Nokia Corporation - initial contribution.
     7     Nokia Corporation - initial contribution.
     8 Contributors: 
     8 Contributors: 
     9 -->
     9 -->
    10 <!DOCTYPE concept
    10 <!DOCTYPE concept
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    11   PUBLIC "-//OASIS//DTD DITA Concept//EN" "concept.dtd">
    12 <concept xml:lang="en" id="GUID-8A7B837D-4069-5364-A596-686EEBAE351D"><title>Plug-In Framework Overview</title><prolog><metadata><keywords/></metadata></prolog><conbody><p>The Plug-in (ECom) framework is a generic framework that provides a single mechanism to register and discover plug-ins and load an appropriate plug-in. </p> <section><title>Purpose</title> <p>In early versions of Symbian platform, plug-ins were provided by <xref href="GUID-6482956D-C3A3-5B68-A37F-4250C85B0D82.dita">polymorphic interface DLLs</xref>. All the frameworks within the Symbian platform that needed to use plug-ins had to provide their own mechanisms for the clients to discover and instantiate the implementations. This resulted in duplication of functionality. </p> <p>The Plug-In framework is intended to provide a common and system-wide mechanism for instantiating a dynamically determined component. </p> <p>Three distinct users of the plug-in framework are: </p> <ul><li id="GUID-B72B2ED5-545F-54BA-89F3-9F014A17D9D8"><p>Framework or Application designers </p> <p>These users need to understand interface definition design and platform security implications. </p> </li> <li id="GUID-F0961823-257F-553D-B58E-8061ECA03FCD"><p>Plug-in writers </p> <p>These users need to understand interface implementation, DLL creation and platform security implementation issue. </p> </li> <li id="GUID-939853D9-4C52-5C6E-9804-E0594DE2B152"><p>Plug-in users </p> <p>These users need to understand that the plug-in framework helps in selecting the plug-in but sometimes may need to specify which implementation the framework should choose. </p> </li> </ul> </section> <section><title>Required background</title> <p> <b>Run-time Binding</b>: This is called dynamic binding or late binding. The linking of a routine or object is performed during runtime based on the requirements. </p> <p> <b>DLL (Dynamic Link Library)</b>: Is a piece of code (a library) that is linked to a program at runtime rather than during the build process. The code inside a DLL can be shared by several clients at the same time without being duplicated in the mobile memory. </p> <p>In addition , the user should be aware of the<xref href="GUID-9E4D75C0-D797-5541-8E52-3C6D154CC74A.dita"> Platform Security Considerations</xref> of the plug-in framework architecture. </p> </section> <section><title>Key concepts and terms</title> <dl><dlentry><dt> Plug-in</dt> <dd><p>In computing, a plug-in(extension) consists of a computer program that interacts with a host application(a web browser or an email client) to provide a very specific function on demand. </p> <p>Applications support plugins to: </p> <ul><li id="GUID-E5F6B556-5957-50CE-9309-1013335A3911"><p>Enable third-party developers to create capabilities to extend an application. </p> </li> <li id="GUID-F882F8D5-A744-5079-9A15-DC5DD166C8BC"><p>Reduce the size of an application. </p> </li> <li id="GUID-6FC7254E-3CCF-58A2-810A-0B750CA178D5"><p>Separate source code from an application. </p> </li> </ul> </dd> </dlentry> <dlentry><dt>Plug-in System</dt> <dd><p>A client wishes to access a plug-in. The plug-in details are known only at run-time. The general characteristics of the plug-in are defined in an interface. Multiple variants of the plug-in can co-exist. </p> <p>The four clearly-defined roles of a plug-in system are: </p> <ul><li id="GUID-30A0D998-79B7-5039-B4B7-602C6C74F08B"><p>The <b>Client</b> that wishes to access services. </p> </li> <li id="GUID-8ED5CDA4-F17A-5BB2-A657-76ECE561844A"><p>The <b>Interface Definition</b> that defines how to request services. </p> </li> <li id="GUID-C371204A-5D56-52B9-AD55-D69BCCA5812B"><p>The <b>Interface Implementation/Plug-in </b> that provides the required processing. </p> </li> <li id="GUID-E89C937D-0DA1-5CDD-BDFC-6F4E3FD40FD2"><p>The <b>Framework</b> that provides the clients with the required access to the implementations. </p> </li> </ul> <p>The relationships can be represented as follows: </p> <fig id="GUID-47C384EC-4F9E-55EA-B50B-7DAD9E990865"><title>
    12 <concept id="GUID-8A7B837D-4069-5364-A596-686EEBAE351D" xml:lang="en"><title>Plug-In Framework Overview</title><prolog><metadata><keywords/></metadata></prolog><conbody>
    13                   Plug-in relationships 
    13 <p>The Plug-in (ECom) framework is a generic framework that provides
    14                 </title> <image href="GUID-CBD78250-3EF4-5DF0-B356-19996E15BBBD_d0e172711_href.png" placement="inline"/></fig> <p>The instantiation mechanism is responsible for providing the services that identify, and load the correct implementation at run-time. </p> </dd> </dlentry> <dlentry><dt> Interface</dt> <dd><p>Is an abstraction that an entity provides of itself to the outside. This separates the methods of external communication from internal operation. It allows internal modification and this modification does not affect the outside entities interaction with the interface. An interface can provide multiple abstractions. </p> </dd> </dlentry> <dlentry><dt> Interface API / Interface Definition</dt> <dd><p>Is a template for an interface implementation. </p> </dd> </dlentry> <dlentry><dt>Interface Client/Client</dt> <dd><p>Is an application that uses the interface definition. </p> </dd> </dlentry> <dlentry><dt>Interface Implementation Collection</dt> <dd><p>Is a collection of interface implementations/plug-ins. </p> </dd> </dlentry> <dlentry><dt>Registry</dt> <dd><p>Is a collection of plug-ins registered with the framework. </p> </dd> </dlentry> </dl> </section> <section><title>Architecture</title> <p>The plug-in framework employs the client server architecture. The client session is a singleton per process thread. </p> <fig id="GUID-7B34EF3B-5C56-5CA8-ABC0-60AB4F5652A1"><title>
    14 a single mechanism to register and discover plug-ins and load an appropriate
    15              Plug-in framework architecture 
    15 plug-in. </p>
    16           </title> <image href="GUID-2E3A91F9-5538-5E23-8D23-CE97B677A668_d0e172781_href.jpg" placement="inline"/></fig> <p>The functional components of the plug-in framework are: </p> <ul><li id="GUID-57437172-8AE4-5355-8776-E14C3298A6A1"><p>The <b> Client /Interface Client</b> that invokes the available services via the interface definition. </p> </li> <li id="GUID-807D6C07-9202-549D-9250-17806FBE1C40"><p>The <b>Server / Framework</b> controls access to a registry of available implementations that is used for interface implementation resolution and loading. </p> <p>The server facilitates: </p> <ul><li id="GUID-5A87C3FF-3576-5EAD-BD49-E2B498A09340"><p>Addition and removal of interface implementations. </p> <p>The addition, removal or modifications to an implementation is notified to the server. The server updates the changes in the registry. </p> </li> <li id="GUID-7D2957EE-C6BF-5687-84AA-A44C1EFBFD42"><p>Search/Access mechanisms. </p> <p>The registry data is maintained as a hierarchical arrangement of implementations. The complete data is scanned and matching interface implementation list is produced as a result of search. </p> </li> <li id="GUID-B44DA453-D953-515C-8B6C-D6F315CD03BD"><p>Resolution mechanisms. </p> <p>The best fit implementation from the resultant search is identified. </p> </li> <li id="GUID-1ABE83FD-E2DE-5A72-BBEA-F6F216961C9D"><p>Load control. </p> <p>Controls access to a single instance of the available implementations. The implementation identification information is used to load the appropriate collection. </p> </li> </ul> </li> </ul> </section> <section><title>APIs</title> <table id="GUID-1B7014F2-7210-554B-BE78-35560FF68FE0"><tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/><thead><row><entry>API</entry> <entry>Description</entry> </row> </thead> <tbody><row><entry><p> <xref href="GUID-1344F049-81C4-3D17-AF46-8B5584680ADB.dita"><apiname>REComSession</apiname></xref>  </p> </entry> <entry><p>Resolves, instantiates, and destroys interface class implementations requested by the plug-in framework clients. </p> </entry> </row> </tbody> </tgroup> </table> </section> <section><title>Typical uses</title> <p>The plug-in framework allows: </p> <ul><li id="GUID-593D6FAD-EF95-53E8-B4C2-A60EF4A9DB1A"><p>Framework developers to write interface definitions and extend interfaces. </p> </li> <li id="GUID-DD0929A4-F9E4-5B70-8D3D-7D5697A09C27"><p>Plug-in writer to implement the interfaces. </p> </li> <li id="GUID-272F59F3-8EF6-58C4-9F61-9532D1D0EC46"><p>Plug-in user to use the interfaces. </p> </li> </ul> </section> </conbody><related-links><link href="GUID-41D80358-473F-5B50-A09A-4F5601EAC4A9.dita"><linktext>Framework Developer Tutorials</linktext> </link> <link href="GUID-57F29787-B425-53EA-9DB4-372B77543584.dita"><linktext>Plug-in Writer's Tutorials</linktext> </link> <link href="GUID-DE9CB4F7-5129-5450-A6D6-9B0BA253FC81.dita"><linktext>Plug-in User's Tutorials</linktext> </link> </related-links></concept>
    16 <section id="GUID-495BDDE0-C473-47F1-9FC2-AB73B96FD19F"><title>Purpose</title> <p>In early versions of Symbian platform,
       
    17 plug-ins were provided by polymorphic interface DLLs.
       
    18 All the frameworks within the Symbian platform that needed to use
       
    19 plug-ins had to provide their own mechanisms for the clients to discover
       
    20 and instantiate the implementations. This resulted in duplication
       
    21 of functionality. </p> <p>The Plug-In framework is intended to provide
       
    22 a common and system-wide mechanism for instantiating a dynamically
       
    23 determined component. </p> <p>Three distinct users of the plug-in
       
    24 framework are: </p> <ul>
       
    25 <li id="GUID-B72B2ED5-545F-54BA-89F3-9F014A17D9D8"><p>Framework or
       
    26 Application designers </p> <p>These users need to understand interface
       
    27 definition design and platform security implications. </p> </li>
       
    28 <li id="GUID-F0961823-257F-553D-B58E-8061ECA03FCD"><p>Plug-in writers </p> <p>These users need to understand interface implementation, DLL
       
    29 creation and platform security implementation issue. </p> </li>
       
    30 <li id="GUID-939853D9-4C52-5C6E-9804-E0594DE2B152"><p>Plug-in users </p> <p>These users need to understand that the plug-in framework helps
       
    31 in selecting the plug-in but sometimes may need to specify which implementation
       
    32 the framework should choose. </p> </li>
       
    33 </ul> </section>
       
    34 <section id="GUID-7AECE2EC-36C4-4225-A55F-02E9030CAEF4"><title>Required background</title> <p> <b>Run-time Binding</b>: This is called dynamic binding or late binding. The linking of
       
    35 a routine or object is performed during runtime based on the requirements. </p> <p> <b>DLL (Dynamic Link Library)</b>: Is a piece of code (a library)
       
    36 that is linked to a program at runtime rather than during the build
       
    37 process. The code inside a DLL can be shared by several clients at
       
    38 the same time without being duplicated in the mobile memory. </p> <p>In addition , the user should be aware of the<xref href="GUID-9E4D75C0-D797-5541-8E52-3C6D154CC74A.dita"> Platform Security
       
    39 Considerations</xref> of the plug-in framework architecture. </p> </section>
       
    40 <section id="GUID-4848DB3A-356F-4E82-8DD6-8E71D0392B70"><title>Key concepts and terms</title> <dl>
       
    41 <dlentry>
       
    42 <dt> Plug-in</dt>
       
    43 <dd><p>In computing, a plug-in(extension) consists of a computer program
       
    44 that interacts with a host application(a web browser or an email client)
       
    45 to provide a very specific function on demand. </p> <p>Applications
       
    46 support plugins to: </p> <ul>
       
    47 <li id="GUID-E5F6B556-5957-50CE-9309-1013335A3911"><p>Enable third-party
       
    48 developers to create capabilities to extend an application. </p> </li>
       
    49 <li id="GUID-F882F8D5-A744-5079-9A15-DC5DD166C8BC"><p>Reduce the size
       
    50 of an application. </p> </li>
       
    51 <li id="GUID-6FC7254E-3CCF-58A2-810A-0B750CA178D5"><p>Separate source
       
    52 code from an application. </p> </li>
       
    53 </ul> </dd>
       
    54 </dlentry>
       
    55 <dlentry>
       
    56 <dt>Plug-in System</dt>
       
    57 <dd><p>A client wishes to access a plug-in. The plug-in details are
       
    58 known only at run-time. The general characteristics of the plug-in
       
    59 are defined in an interface. Multiple variants of the plug-in can
       
    60 co-exist. </p> <p>The four clearly-defined roles of a plug-in system
       
    61 are: </p> <ul>
       
    62 <li id="GUID-30A0D998-79B7-5039-B4B7-602C6C74F08B"><p>The <b>Client</b> that wishes to access services. </p> </li>
       
    63 <li id="GUID-8ED5CDA4-F17A-5BB2-A657-76ECE561844A"><p>The <b>Interface
       
    64 Definition</b> that defines how to request services. </p> </li>
       
    65 <li id="GUID-C371204A-5D56-52B9-AD55-D69BCCA5812B"><p>The <b>Interface
       
    66 Implementation/Plug-in </b> that provides the required processing. </p> </li>
       
    67 <li id="GUID-E89C937D-0DA1-5CDD-BDFC-6F4E3FD40FD2"><p>The <b>Framework</b> that provides the clients with the required access to the implementations. </p> </li>
       
    68 </ul> <p>The relationships can be represented as follows: </p> <fig id="GUID-47C384EC-4F9E-55EA-B50B-7DAD9E990865">
       
    69 <title>                   Plug-in relationships                  </title>
       
    70 <image href="GUID-CBD78250-3EF4-5DF0-B356-19996E15BBBD_d0e177724_href.png" placement="inline"/>
       
    71 </fig> <p>The instantiation mechanism is responsible for providing
       
    72 the services that identify, and load the correct implementation at
       
    73 run-time. </p> </dd>
       
    74 </dlentry>
       
    75 <dlentry>
       
    76 <dt> Interface</dt>
       
    77 <dd><p>Is an abstraction that an entity provides of itself to the
       
    78 outside. This separates the methods of external communication from
       
    79 internal operation. It allows internal modification and this modification
       
    80 does not affect the outside entities interaction with the interface.
       
    81 An interface can provide multiple abstractions. </p> </dd>
       
    82 </dlentry>
       
    83 <dlentry>
       
    84 <dt> Interface API / Interface Definition</dt>
       
    85 <dd><p>Is a template for an interface implementation. </p> </dd>
       
    86 </dlentry>
       
    87 <dlentry>
       
    88 <dt>Interface Client/Client</dt>
       
    89 <dd><p>Is an application that uses the interface definition. </p> </dd>
       
    90 </dlentry>
       
    91 <dlentry>
       
    92 <dt>Interface Implementation Collection</dt>
       
    93 <dd><p>Is a collection of interface implementations/plug-ins. </p> </dd>
       
    94 </dlentry>
       
    95 <dlentry>
       
    96 <dt>Registry</dt>
       
    97 <dd><p>Is a collection of plug-ins registered with the framework. </p> </dd>
       
    98 </dlentry>
       
    99 </dl> </section>
       
   100 <section id="GUID-861B53D9-1928-45FB-97D0-D3DBCB31EC4F"><title>Architecture</title> <p>The plug-in framework employs
       
   101 the client server architecture. The client session is a singleton
       
   102 per process thread. </p> <fig id="GUID-7B34EF3B-5C56-5CA8-ABC0-60AB4F5652A1">
       
   103 <title>              Plug-in framework architecture            </title>
       
   104 <image href="GUID-2E3A91F9-5538-5E23-8D23-CE97B677A668_d0e177801_href.jpg" placement="inline"/>
       
   105 </fig> <p>The functional components of the plug-in framework are: </p> <ul>
       
   106 <li id="GUID-57437172-8AE4-5355-8776-E14C3298A6A1"><p>The <b> Client
       
   107 /Interface Client</b> that invokes the available services via the
       
   108 interface definition. </p> </li>
       
   109 <li id="GUID-807D6C07-9202-549D-9250-17806FBE1C40"><p>The <b>Server
       
   110 / Framework</b> controls access to a registry of available implementations
       
   111 that is used for interface implementation resolution and loading. </p> <p>The server facilitates: </p> <ul>
       
   112 <li id="GUID-5A87C3FF-3576-5EAD-BD49-E2B498A09340"><p>Addition and
       
   113 removal of interface implementations. </p> <p>The addition, removal
       
   114 or modifications to an implementation is notified to the server. The
       
   115 server updates the changes in the registry. </p> </li>
       
   116 <li id="GUID-7D2957EE-C6BF-5687-84AA-A44C1EFBFD42"><p>Search/Access
       
   117 mechanisms. </p> <p>The registry data is maintained as a hierarchical
       
   118 arrangement of implementations. The complete data is scanned and matching
       
   119 interface implementation list is produced as a result of search. </p> </li>
       
   120 <li id="GUID-B44DA453-D953-515C-8B6C-D6F315CD03BD"><p>Resolution mechanisms. </p> <p>The best fit implementation from the resultant search is identified. </p> </li>
       
   121 <li id="GUID-1ABE83FD-E2DE-5A72-BBEA-F6F216961C9D"><p>Load control. </p> <p>Controls access to a single instance of the available implementations.
       
   122 The implementation identification information is used to load the
       
   123 appropriate collection. </p> </li>
       
   124 </ul> </li>
       
   125 </ul> </section>
       
   126 <section id="GUID-D9E09CF7-97F8-44F9-9557-63C1E84BD43A"><title>APIs</title> <table id="GUID-1B7014F2-7210-554B-BE78-35560FF68FE0">
       
   127 <tgroup cols="2"><colspec colname="col0"/><colspec colname="col1"/>
       
   128 <thead>
       
   129 <row>
       
   130 <entry>API</entry>
       
   131 <entry>Description</entry>
       
   132 </row>
       
   133 </thead>
       
   134 <tbody>
       
   135 <row>
       
   136 <entry><p> <xref href="GUID-1344F049-81C4-3D17-AF46-8B5584680ADB.dita"><apiname>REComSession</apiname></xref>  </p> </entry>
       
   137 <entry><p>Resolves, instantiates, and destroys interface class implementations
       
   138 requested by the plug-in framework clients. </p> </entry>
       
   139 </row>
       
   140 </tbody>
       
   141 </tgroup>
       
   142 </table> </section>
       
   143 <section id="GUID-6B41C7BF-CF5C-47FF-9EC8-C23CBFE0D0AF"><title>Typical uses</title> <p>The plug-in framework allows: </p> <ul>
       
   144 <li id="GUID-593D6FAD-EF95-53E8-B4C2-A60EF4A9DB1A"><p>Framework developers
       
   145 to write interface definitions and extend interfaces. </p> </li>
       
   146 <li id="GUID-DD0929A4-F9E4-5B70-8D3D-7D5697A09C27"><p>Plug-in writer
       
   147 to implement the interfaces. </p> </li>
       
   148 <li id="GUID-272F59F3-8EF6-58C4-9F61-9532D1D0EC46"><p>Plug-in user
       
   149 to use the interfaces. </p> </li>
       
   150 </ul> </section>
       
   151 </conbody><related-links>
       
   152 <link href="GUID-41D80358-473F-5B50-A09A-4F5601EAC4A9.dita"><linktext>Framework
       
   153 Developer Tutorials</linktext></link>
       
   154 <link href="GUID-57F29787-B425-53EA-9DB4-372B77543584.dita"><linktext>Plug-in
       
   155 Writer's Tutorials</linktext></link>
       
   156 <link href="GUID-DE9CB4F7-5129-5450-A6D6-9B0BA253FC81.dita"><linktext>Plug-in
       
   157 User's Tutorials</linktext></link>
       
   158 </related-links></concept>