Add-on System » History » Version 10
Hans-Martin Haase, 08/18/2015 04:17 PM
Start implementation details.
1 | 4 | Hans-Martin Haase | {{toc}} |
---|---|---|---|
2 | |||
3 | 1 | Dirk Petrautzki | h1. Add-on System |
4 | 4 | Hans-Martin Haase | |
5 | On this wiki page you'll find detailed information about the add-on development like the different kinds of add-ons and how they are enabled to communicate with core application. |
||
6 | |||
7 | h2. Definition of Add-on in the Open eCard context |
||
8 | |||
9 | _Add-on_ is the generic term for a component that enhances the functionality of the Open eCard App. |
||
10 | |||
11 | _Extensions_ are independent from the context. Moreover, they are included directly into the user interface and can be executed by the user. For instance, an add-on that provides a PIN change functionality for smart cards is classified as an _extension_. |
||
12 | |||
13 | _Plug-ins_ depend on the context in which the user uses the application. Performing an authentication to a service using a particular smart card, for instance, requires a _plug-in_ which is capable of providing such functionality. Subsequently, _plug-ins_ require a communication with bindings to interact with external applications and services. Furthermore, we distinguish between IFD, SAL, and application plug-ins. |
||
14 | |||
15 | h2. Add-on Types |
||
16 | |||
17 | h3. IFD Plug-ins |
||
18 | |||
19 | 8 | Hans-Martin Haase | An IFD Plug-in represents a protocol which is used to extend the IFD. The protocol implementation may enable the IFD to perform a special user authentication method or establish a secure channel between a card and card reader to protect the communication from being eavesdropped. Each protocol must have a unique identifier in form of a URI. The URI must be associated with the actual implementation as described in the [[Add-on System#IFD protocol implementation details|IFD protocol implementation details]]. In addition, each protocol plug-in must implement the IFD Protocol Interface and must define protocol-specific _AuthenticationProtocolData_ used in the _EstablishChannel_ call and corresponding response message. An example for an IFD Plugin is the Password Authenticated Connection Establishment (PACE) protocol which is executed by the IFD. It is included as integrated add-on in the Open eCard App. |
20 | 5 | Hans-Martin Haase | |
21 | 4 | Hans-Martin Haase | h3. SAL Plug-ins |
22 | |||
23 | 5 | Hans-Martin Haase | The SAL provides generic interfaces to common smart card services like Crypto services or differential identity services. The SAL can be extended by plug-ins, which provide implementations of protocols for the Crypto Services and the Differential Identity Services as required for the use of specific signature cards and electronic identity cards for example. The plugin concept is quite similar to the one used for the IFD. There is also an unique identifier necessary in the protocol implementation but an SAL protocol may have multiple steps and allows the definition more sophisticated user interfaces including a sequence of interaction steps to represent information dialogues and general user consents. For example the already included Extended Access Control (EAC) protocol is one of this kind. The protocol is used while authentication process with German eID card. |
24 | |||
25 | |||
26 | 4 | Hans-Martin Haase | h3. Application Plug-ins |
27 | |||
28 | 5 | Hans-Martin Haase | Application plug-ins provide a mechanism to add additional functionality to the eID application with which external applications can communicate. Depending on the type of the underlying binding, this could be a browser, a PKCS#11 module or even a remote application. Protocol bindings realize the connection to the external world. While a broad variety of transport protocols could be supported, the most obvious choices are HTTP and SOAP, |
29 | 6 | Hans-Martin Haase | as they are stipulated by for example. Given the properties of the activation mechanism, HTTP and SOAP, as well as similar transport protocols, the abstract requirements for a protocol binding are given as follows: A protocol binding must support |
30 | 5 | Hans-Martin Haase | |
31 | # a request-response semantic, |
||
32 | # a mapping mechanism to identify the appropriate plug-in for a request, |
||
33 | # messages comprising a body, named parameters and attachments, |
||
34 | # an error delivery mechanism, and |
||
35 | # a redirect semantic. |
||
36 | |||
37 | 4 | Hans-Martin Haase | h3. Application Extensions |
38 | |||
39 | 5 | Hans-Martin Haase | Extensions enhance – similar to plug-ins – the basic eID platform and provide additional functionality, but they do not depend on the context in which the eID application is used. Further, extensions are included into the user interface and can be started directly by the user. Similar to application plug-ins, the _AppExtensionAction_ interface contains an execute function. However, this function does not have any parameters nor does it have a result. Therefore, it cannot be used with a binding and only be triggered manually. |
40 | |||
41 | |||
42 | 4 | Hans-Martin Haase | h2. Architecture of an Add-on package |
43 | |||
44 | h3. General architecture |
||
45 | |||
46 | 7 | Hans-Martin Haase | An Add-on package is an Java archive (JAR) file which bundles all requires resources like libraries etc. The recognition in the base application is done with via an add-on manifest file located in the _META-INF_ directory. The manifest file has to have the name _addon.xml_ else the archive is not recognized as add-on. This file describes the data model of the add-on you'll find it below. The data model is an XML structure containing general information such as the name, the textual description and configuration entries for changeable settings of the add-on. Furthermore actions are contained which represent the different add-on types from above. The settings are stored in an add-on specific directory and are loaded as Java Properties by the ad-on framework. |
47 | |||
48 | p=. !{width:70%; height:70%}description.png(Add-on manifest data model in UML)! |
||
49 | |||
50 | 4 | Hans-Martin Haase | h3. The Add-on Manifest |
51 | 7 | Hans-Martin Haase | |
52 | This section shows all possible entries for an add-on manifest file and explain there meaning. The manifest is more or less divided into two parts the first one states the general information about the add-on and the second one contains the description of the add-on classes and configuration. So lets start with the general information section. |
||
53 | |||
54 | <pre> |
||
55 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
||
56 | <AddonSpecification> |
||
57 | <ID>123</ID> |
||
58 | <Version>1.0-SNAPSHOT</Version> |
||
59 | <License>WTFPL</License> |
||
60 | <LicenseText xml:lang="EN"> |
||
61 | <![CDATA[<center><b>DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE</b> |
||
62 | <br><br> |
||
63 | Version 2, December 2004 |
||
64 | <br><br> |
||
65 | Copyright (C) 2004 Sam Hocevar <sam@hocevar.net> |
||
66 | </center> |
||
67 | <br><br> |
||
68 | Everyone is permitted to copy and distribute verbatim or modified |
||
69 | copies of this license document, and changing it is allowed as long |
||
70 | as the name is changed. |
||
71 | <br><br> |
||
72 | DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE |
||
73 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION |
||
74 | <br><br> |
||
75 | 0. You just DO WHAT THE FUCK YOU WANT TO.]]> |
||
76 | </LicenseText> |
||
77 | <LocalizedName xml:lang="DE">DummyAddon</LocalizedName> |
||
78 | <LocalizedName xml:lang="EN">DummyAddon</LocalizedName> |
||
79 | <LocalizedDescription xml:lang="EN">Dummy addon which prints some text to standard output and log file.</LocalizedDescription> |
||
80 | <LocalizedDescription xml:lang="DE">Dummy Addon, das nur etwas Text auf der Standardausgabe ausgibt und in die Logdatei schreibt.</LocalizedDescription> |
||
81 | <About xml:lang="EN"> |
||
82 | <![CDATA[About: |
||
83 | |||
84 | This plugin is just for testing purpose of the Open eCard Addons about dialog. It follows some dummy text to check formatting and wrapping. Lorem ipsum dolor |
||
85 | sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et |
||
86 | 10 | Hans-Martin Haase | accusam et justo duo dolores et ea rebum.]]> |
87 | 7 | Hans-Martin Haase | </About> |
88 | <Logo>DummyLogo.gif</Logo> |
||
89 | <ConfigDescription> |
||
90 | <Entries> |
||
91 | <EnumListEntry> |
||
92 | <Key>Animal_key</Key> |
||
93 | <Value>Dog</Value> |
||
94 | <Value>Cat</Value> |
||
95 | <Value>Mouse</Value> |
||
96 | <Value>Elephant</Value> |
||
97 | <Value>Donkey</Value> |
||
98 | <LocalizedName xml:lang="DE">Tier-ConfigurationEntry</LocalizedName> |
||
99 | <LocalizedName xml:lang="EN">Animal configuration entry</LocalizedName> |
||
100 | <LocalizedDescription xml:lang="DE">Beschreibung des Tier-ConfigurationEntry</LocalizedDescription> |
||
101 | <LocalizedDescription xml:lang="EN">Description of the animal configuration entry</LocalizedDescription> |
||
102 | </EnumListEntry> |
||
103 | <EnumEntry> |
||
104 | <Key>Kitchen_key</Key> |
||
105 | <Value>Spoon</Value> |
||
106 | <Value>Fork</Value> |
||
107 | <Value>Knife</Value> |
||
108 | <Value>Cup</Value> |
||
109 | <Value>Mug</Value> |
||
110 | <LocalizedName xml:lang="DE">Küchen-ConfigurationEntry</LocalizedName> |
||
111 | <LocalizedName xml:lang="EN">Kitchen configuration entry</LocalizedName> |
||
112 | <LocalizedDescription xml:lang="DE">Beschreibung des Küchen-ConfigurationEntry</LocalizedDescription> |
||
113 | <LocalizedDescription xml:lang="EN">Description of the Kitchen configuation entry</LocalizedDescription> |
||
114 | </EnumEntry> |
||
115 | </Entries> |
||
116 | </ConfigDescription> |
||
117 | [...] |
||
118 | </AddonSpecification> |
||
119 | </pre> |
||
120 | |||
121 | As you can see the manifest starts with the @<AddonSpecification>@ tag which covers the complete description. Every add-on requires at least the elements @<ID>@, @<Version>@, @<License>@, @<Logo>@ and a @<ConfigDescription>@ which are explained below. |
||
122 | |||
123 | 9 | Hans-Martin Haase | |@<ID>@ |A unique identifier for the add-on package. | |
124 | |@<Version>@ |The version number of the add-on. This number is used to select an add-on in case there are several versions available. | |
||
125 | |@<License>@ |This element is expected to contain the name of the license of the add-on. For instance _LGPL Version 3_ or _Proprietary_ are such names but in case of a custom or proprietary license you should state the text of the license in the optional element @<LicenseText>@ field. | |
||
126 | |@<Logo>@ |This element states a name of a logo file contained in the add-on package. This logo is displayed in the GUI in case there are configuration options for your add-on. | |
||
127 | |@<ConfigDescription>@ |The element is used to state configuration entries which are used by all parts of the addon. For complete description of the @<ConfigDescription>@ see the next section. If there are no such configuration entries the element may be set to empty witht the element tag @<ConfigDescription/>@. A detailed description of this element is available [[Add-on System#Types available in the configuration|here]]. | |
||
128 | 7 | Hans-Martin Haase | |
129 | The optional elements of this first section are @<LicenseText>@, @<LocalizedName>@, @<LocalizedDescription>@ and @<About>@. |
||
130 | 1 | Dirk Petrautzki | |
131 | 9 | Hans-Martin Haase | |@<About>@ |Localized string containing the typical information state in an about dialog. The elements may appear several times for different languages. | |
132 | |@<LicenseText>@ |Localized string containing the license text of the add-on. The element may appear several times for different languages. | |
||
133 | |@<LocalizedDescription>@ |Localized string containing a description of the add-on. The element may appear several times for different languages. | |
||
134 | |@<LocalizedName>@ |Localized string containing the name of the add-on. The element may appear several times for different languages. | |
||
135 | 1 | Dirk Petrautzki | |
136 | *Note:* The elements @<About>@ and @<LicenseText>@ may contain a @CDATA@ block containing basic HTML code to format the text. This feature heavily depends on the UI implementation. For example the richclient which uses the Swing Framework supports just HTML in version 3.2. Other gui implementations may support higher versions and so more tags. |
||
137 | 7 | Hans-Martin Haase | |
138 | 8 | Hans-Martin Haase | |
139 | 9 | Hans-Martin Haase | Now we have the general part of the add-on so let's go on with the second part. The second part contains the descriptions of the available actions which have to appear in the following order @<BindingActions>@, @<ApplicationActions>@, @<IFDActions>@ and @<SALActions>@. |
140 | |||
141 | * *BindingActions* contain the descriptions of Application Plugin |
||
142 | * *ApplicationActions* contain the descriptions of Application Extensions |
||
143 | * *IFDActions* contain the descriptions of IFD Plugins |
||
144 | * *SALActions* contain the descriptions of SAL Plugins |
||
145 | |||
146 | Every *Actions element may contain zero or more elements which describe the actions. An example of the second part is below but note there don't have to be all actions available it's just an example non relevant actions do not have to appear or may be stated as empty. |
||
147 | |||
148 | 1 | Dirk Petrautzki | <pre> |
149 | <AddonSpecification> |
||
150 | [...] |
||
151 | 9 | Hans-Martin Haase | <BindingActions> |
152 | <AppPluginSpecification> |
||
153 | <ClassName>package.path.to.my.class</ClassName> |
||
154 | <LoadOnStartup>true</LoadOnStartup> |
||
155 | <LocalizedName xml:lang="EN">Test class</LocalizedName> |
||
156 | <LocalizedDescription xml:lang="EN">Test descriptions</LocalizedDescription> |
||
157 | <ResourceName>/test</ResourceName> |
||
158 | <ConfigDescription/> |
||
159 | <Parameters> |
||
160 | <Name>Foo</Name> |
||
161 | <Value>Bar</Value> |
||
162 | </Parameters> |
||
163 | <Body> |
||
164 | <MimeType>text/html</MimeType> |
||
165 | <Node><![CDATA[<html><head></head><body>test</body></html>]]></Node> |
||
166 | </Body> |
||
167 | <Attachments> |
||
168 | <MimeType>application/octet-stream</MimeType> |
||
169 | <Name>signature.asc</Name> |
||
170 | </Attachments> |
||
171 | </AppPluginSpecification> |
||
172 | </BindingActions> |
||
173 | 1 | Dirk Petrautzki | <ApplicationActions> |
174 | <AppExtensionSpecification> |
||
175 | <ID>123</ID> |
||
176 | <ClassName>org.openecard.addon.openecarddummyaddon.DummyAddonStep</ClassName> |
||
177 | 7 | Hans-Martin Haase | <LoadOnStartup>true</LoadOnStartup> |
178 | <LocalizedName xml:lang="DE">Test-ExtensionAction</LocalizedName> |
||
179 | <LocalizedName xml:lang="EN">Test extension action</LocalizedName> |
||
180 | <LocalizedDescription xml:lang="DE">Testbeschreibung</LocalizedDescription> |
||
181 | <LocalizedDescription xml:lang="EN">test description</LocalizedDescription> |
||
182 | <ConfigDescription> |
||
183 | <Entries> |
||
184 | <EnumEntry> |
||
185 | <Key>Foo</Key> |
||
186 | <Value>bar</Value> |
||
187 | <LocalizedName xml:lang="DE">Test-ConfigurationEntry</LocalizedName> |
||
188 | <LocalizedName xml:lang="EN">Test configuration entry</LocalizedName> |
||
189 | <LocalizedDescription xml:lang="DE">Testbeschreibung</LocalizedDescription> |
||
190 | <LocalizedDescription xml:lang="EN">test description</LocalizedDescription> |
||
191 | </EnumEntry> |
||
192 | </Entries> |
||
193 | </ConfigDescription> |
||
194 | </AppExtensionSpecification> |
||
195 | </ApplicationActions> |
||
196 | 9 | Hans-Martin Haase | <IFDActions> |
197 | <ProtocolPluginSpecification> |
||
198 | <URI>urn:uri:1.2.3</URI> |
||
199 | <ClassName>package.path.to.protocol.class</ClassName> |
||
200 | <LoadOnStartup>false</LoadOnStartup> |
||
201 | <LocalizedName xml:lang="EN">Test Protocol</LocalizedName> |
||
202 | <LocalizedDescription xml:lang="EN">Description of test protocol</LocalizedDescription> |
||
203 | <ConfigDescription/> |
||
204 | </ProtocolPluginSpecification> |
||
205 | </IFDActions> |
||
206 | <SALActions/> |
||
207 | 7 | Hans-Martin Haase | </AddonSpecification> |
208 | </pre> |
||
209 | |||
210 | 9 | Hans-Martin Haase | An entry for the SALActions is omitted in example because the definition is the same in XML both are _ProtocolPluginSpecifications_. As you may have noticed there are entries in every specification which are the same. They are discussed following and after that the elements which are not unique for a specification are clarified. |
211 | 7 | Hans-Martin Haase | |
212 | 9 | Hans-Martin Haase | |@<ClassName>@|States the name of the class which implements the the interface specific for the action. The field is required in an valid description.| |
213 | |@<LoadOnStartup>@|States whether the add-on shall be initialized on start of the core application. The element is not required and defaults to *false* if it is not given. | |
||
214 | |@<LocalizedName>@|States the name of the action. The elements is optional and may appear several times for different languages.| |
||
215 | |@<LocalizedDescription>@|Here you may provide an optional description of what the action does. The number of this element is not limited so several languages can be supported.| |
||
216 | |@<ConfigDescription>@|Description of the configuration options which are changeable by the user. The element is required but it may be empty. A detail discussion about this element is in an extra section [[Add-on System#Types available in the configuration|here]].| |
||
217 | 7 | Hans-Martin Haase | |
218 | 9 | Hans-Martin Haase | *Application Plugin specific elements* |
219 | |@<Parameter>@|| |
||
220 | |@<ResourceName>@|Name of the resource where the action shall be available. The default address of the HTTP Binding is http://localhost:24727/ the resourece name needs to be relativ to this address. E.g. the integrated status add-on is available unter http://localhost:24727/getStatus.| |
||
221 | |@<Body>@|| |
||
222 | 1 | Dirk Petrautzki | |@<Attachment>@|| |
223 | 9 | Hans-Martin Haase | |
224 | 7 | Hans-Martin Haase | *Application Extension specific elements* |
225 | 9 | Hans-Martin Haase | |@<ID>@|A unique ID for the action which is used to query the add-on in the registry. The element is required.| |
226 | |||
227 | 7 | Hans-Martin Haase | *Protocol plugin specific elements* |
228 | 9 | Hans-Martin Haase | Both, SAL and IFD plugin, are represented by an protocol plugin. |
229 | 10 | Hans-Martin Haase | |@<URI>@|An unique uri which represents the plugin. The selection of the protocol is performed by the evaluation of this element. The element is required.| |
230 | 7 | Hans-Martin Haase | |
231 | |||
232 | 9 | Hans-Martin Haase | h3. Types available in the configuration |
233 | 7 | Hans-Martin Haase | |
234 | 1 | Dirk Petrautzki | The _ConfigDescription_ element used in the actions and in the general description of the add-on represent always configuration options which are changeable by the user. Configuration entries which are not connected with a user decision should be placed into a separate configuration. This means every entry in the _ConfigDescription_ has an representation as an UI element so the support of an entry type depends on the UI implementation. The Swing implementation implements all options the other GUI implementations are currently not complete. |
235 | 9 | Hans-Martin Haase | _ConfigDescription_ elements may contain the following entry types: EnumEntry, EnumListEntry, FileEntry, FileListEntry, ScalarEntry and ScalarListEntry. They are mapped to the following UI elements: |
236 | 1 | Dirk Petrautzki | |
237 | 9 | Hans-Martin Haase | |EnumEntry|The localized name is displayed as label (fallback key name) and the values are represented as checkboxes.| |
238 | 4 | Hans-Martin Haase | |EnumListEntry|A list with fixed size containing the values. The UI element is an drop down box.| |
239 | 9 | Hans-Martin Haase | |FileEntry|A entry which allows the user to select a file. A file selection dialog represents the entry.| |
240 | 1 | Dirk Petrautzki | |FileListEntry|Dynamic list of _FileEntry_'s which are displayed as multiple file selection dialogs.| |
241 | 9 | Hans-Martin Haase | |ScalarEntry|The representation depends on the type of the scalar. Availble types are BOOLEAN, BIGDECIMAL, BIGINTEGER and STRING. The BOOLEAN type is represented by a single checkbox, the BIGDECIMAL and BIGINTEGER are represented by text field with a spin button and the STRING type is displayed as single text field.| |
242 | 10 | Hans-Martin Haase | |ScalarListEntry|The element represents a dynamic list of _ScalarEntry_'s restricted to the types BIGDECIMAL, BIGINTEGER and STRING.| |
243 | 1 | Dirk Petrautzki | |
244 | 10 | Hans-Martin Haase | *NOTE*: Descriptions of the GUI representation is taken from the Swing GUI other GUI implementations may use other objects. |
245 | 1 | Dirk Petrautzki | |
246 | |||
247 | h2. Add-on Implementation |
||
248 | |||
249 | 10 | Hans-Martin Haase | The implementation of an add-on depends always on the type of the add-on but there are also similarities between them. The specific interfaces of the add-ons are displayed following. |
250 | 1 | Dirk Petrautzki | |
251 | 10 | Hans-Martin Haase | |=.!AppPlugin.png!|=.!IFDInterface.png!| |
252 | |=.!SALInterface.png!|=.!AppExtension.png!| |
||
253 | 9 | Hans-Martin Haase | |
254 | 10 | Hans-Martin Haase | As you can see every add-on interface extends the LivecycleTrait which provides the functions @init(Context ctx)@ and @destroy()@ which mark the beginning and the end of an add-on. The @init(Context ctx)@ method is call on the initialization and provides access to core components via the @Context@ object. The accessible core components are: AddonManager, Dispatcher, EventManager, EventHandler, UserConsent, CardRecognition and some other elements for informational use. |
255 | |||
256 | h3. Application extension implementation details |
||
257 | |||
258 | h3. Application plugin implementation details |
||
259 | |||
260 | |||
261 | h3. IFD protocol implementation details |
||
262 | |||
263 | h3. SAL protocol implementation details |
||
264 | 1 | Dirk Petrautzki | This section describes the add-on system from the perspective of a developer. |
265 | The implementation of the add-on system is located in the maven module with the group Id *org.openecard* and the artifact Id *addon*. |
||
266 | All classes are in a sub namespace of *org.openecard.addon*. The module is divided into the following five packages: |
||
267 | * *org.openecard.addon* |
||
268 | In this package are the main classes of the add-on system, for example the AddonManager or the different AddonRegistries. |
||
269 | * *org.openecard.addon.bind* |
||
270 | This package includes all classes representing the interface between an addon and a specific binding. That is to say, here are the classes needed to convert a specific request, for example a HTTP request that arrives via the localhost binding, into a generic request, which is independent from binding and vice versa for the response. |
||
271 | * *org.openecard.addon.ifd* |
||
272 | 2 | Dirk Petrautzki | In here are the classes that specify the interface for an IFD protocol and the factory to instantiate such a protocol. |
273 | * *org.openecard.addon.manifest* |
||
274 | This package accumulates all classes needed to convert (automatically) between the XML represantation of the add-on description and it's java object pendants. |
||
275 | * *org.openecard.addon.sal* |
||
276 | In here are the classes that specify the interface for an SAL protocol and the factory to instantiate such a protocol. |
||
277 | |||
278 | h1. Types of add-ons |
||
279 | |||
280 | In the context of Open eCard App, the terms add-on, plug-in and extension are defined as follows. |
||
281 | |||
282 | Add-on is the generic term for a component that enhances the functionality of the Open eCard App. |
||
283 | |||
284 | Extensions are independent from the context. Moreover, they are included directly into |
||
285 | the user interface and can be executed by the user. For instance, an add-on that provides a |
||
286 | 1 | Dirk Petrautzki | PIN change functionality for smart cards is classified as an extension. |
287 | |||
288 | Plug-ins depend on the context in which the user uses the application. Performing |
||
289 | an authentication to a service using a particular smart card, for instance, requires a plug-in |
||
290 | which is capable of providing such functionality. Subsequently, plug-ins require a communication |
||
291 | with bindings to interact with external applications and services. Furthermore, |
||
292 | we distinguish between IFD, SAL, and application plug-ins. |
||
293 | |||
294 | h1. Add-on development |
||
295 | |||
296 | This section describes the steps to take when developing an add-on. |
||
297 | As first step a new XML file called *Addon.xml* in the *META-INF* directory of the project should be created and the fields that describe the general part of the add-ons can already be filled. |
||
298 | An example file for a PIN Management addon could look like this: |
||
299 | <pre> |
||
300 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
||
301 | <AddonBundleDescription> |
||
302 | <ID>PIN-Plugin</ID> |
||
303 | <Version>1.0</Version> |
||
304 | <About /> |
||
305 | <License /> |
||
306 | <LocalizedName xml:lang="DE">PIN Verwaltung</LocalizedName> |
||
307 | <LocalizedDescription xml:lang="DE">Verwaltung von PIN/ PUK und gegebenenfalls anderen Geheimnissen der Chipkarte. |
||
308 | </LocalizedDescription> |
||
309 | <LocalizedName xml:lang="EN">PIN Management</LocalizedName> |
||
310 | <LocalizedDescription xml:lang="EN">Management of PIN/ PUK and possibly other secrets of the smart-card.</LocalizedDescription> |
||
311 | <Logo>images/logo.png</Logo> |
||
312 | <ConfigDescription /> |
||
313 | <BindingActions /> |
||
314 | 2 | Dirk Petrautzki | <ApplicationActions /> |
315 | <IFDActions /> |
||
316 | <SALActions /> |
||
317 | </AddonBundleDescription> |
||
318 | </pre> |
||
319 | As can be seen, some fields can be localized. That fields are: *LocalizedName*, *LocalizedDescription* and *About* |
||
320 | The next step is to think about what actions should be offerd by the add-on and of what type these actions are. |
||
321 | For the PIN management example there are two actions. An action to change a PIN and a second action to unblock a PIN. |
||
322 | These actions are not of type *ProtocolPlugin* nor *AppPluginAction*, but of type *AppExtensionAction*, as they expand the function of the Open eCard App independent from a context. |
||
323 | This means two classes implementing the *AppExtensionAction* interface need to be added to the project and the two AppExtensionActionDescription that belong to them need to be added to the XML description. |
||
324 | Assume we are working in the org.openecard.plugins.pinplugin namespace and the two actions are called ChangePINAction and UnblockPINAction, the resulting XML would now look similar to this: |
||
325 | <pre> |
||
326 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> |
||
327 | <AddonBundleDescription> |
||
328 | <ID>PIN-Plugin</ID> |
||
329 | <Version>1.0</Version> |
||
330 | <About /> |
||
331 | <License /> |
||
332 | <LocalizedName xml:lang="DE">PIN Verwaltung</LocalizedName> |
||
333 | <LocalizedDescription xml:lang="DE">Verwaltung von PIN/ PUK und gegebenenfalls anderen Geheimnissen der Chipkarte. |
||
334 | </LocalizedDescription> |
||
335 | <LocalizedName xml:lang="EN">PIN Management</LocalizedName> |
||
336 | <LocalizedDescription xml:lang="EN">Management of PIN/ PUK and possibly other secrets of the smart-card.</LocalizedDescription> |
||
337 | <Logo>images/pin-management.png</Logo> |
||
338 | <ConfigDescription /> |
||
339 | <BindingActions /> |
||
340 | <ApplicationActions> |
||
341 | <AppExtensionActionDescription> |
||
342 | <ID>ChangePINAction</ID> |
||
343 | <ClassName>org.openecard.plugins.pinplugin.ChangePINAction</ClassName> |
||
344 | <LocalizedName xml:lang="DE">PIN ändern</LocalizedName> |
||
345 | <LocalizedDescription xml:lang="DE">Mit dieser Aktion können Sie ihre PIN ändern.</LocalizedDescription> |
||
346 | <LocalizedName xml:lang="EN">Change PIN</LocalizedName> |
||
347 | <LocalizedDescription xml:lang="EN">With this action you can change your PIN.</LocalizedDescription> |
||
348 | <ConfigDescription /> |
||
349 | </AppExtensionActionDescription> |
||
350 | <AppExtensionActionDescription> |
||
351 | <ID>UnblockPINAction</ID> |
||
352 | <ClassName>org.openecard.plugins.pinplugin.UnblockPINAction</ClassName> |
||
353 | <LocalizedName xml:lang="DE">PIN entsperren</LocalizedName> |
||
354 | <LocalizedDescription xml:lang="DE">Mit dieser Aktion können Sie ihre PIN entsperren.</LocalizedDescription> |
||
355 | <LocalizedName xml:lang="EN">Unblock PIN</LocalizedName> |
||
356 | 3 | Dirk Petrautzki | <LocalizedDescription xml:lang="EN">With this action you can unblock your PIN.</LocalizedDescription> |
357 | <ConfigDescription /> |
||
358 | </AppExtensionActionDescription> |
||
359 | </ApplicationActions> |
||
360 | <IFDActions /> |
||
361 | <SALActions /> |
||
362 | </AddonBundleDescription> |
||
363 | </pre> |
||
364 | |||
365 | For the actual implementation part of the add-on, the following has to be considered. |
||
366 | 1 | Dirk Petrautzki | The actions need to implement the AppExtensionAction interface, which itself extends the FactoryBaseType interface. |
367 | Altogether, three functions are to be implemented: |
||
368 | * void execute(); |
||
369 | the actual logic of the action, in this case the PIN change, will take place here |
||
370 | * void init(Context context) throws FactoryInitializationException; |
||
371 | initialization of the action; the given Context allows access to components of the Open eCard App like UserConsent or Dispatcher |
||
372 | * void destroy(); |
||
373 | closing resources and further cleanup. |