-
Notifications
You must be signed in to change notification settings - Fork 8
/
service.namespaces.html
4736 lines (4678 loc) · 600 KB
/
service.namespaces.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>135 Common Namespaces Specification - OSGi Compendium 7</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
<link rel="home" href="toc.html" title="OSGi Compendium" />
<link rel="up" href="toc.html" title="OSGi Compendium" />
<link rel="prev" href="service.subsystem.html" title="134 Subsystem Service Specification" />
<link rel="next" href="service.rest.html" title="137 REST Management Service Specification" />
<meta name="Section-title" content="135 Common Namespaces Specification" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="images/favicon.png" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="css/custom.css" />
<link rel="stylesheet" type="text/css" href="css/github.css" />
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Ubuntu:regular,bold&subset=Latin" /><script type="text/javascript" src="js/highlight.pack.js"></script><script type="text/javascript" src="js/main.js"></script></head>
<body>
<div id="fullbody">
<div id="header">
<div class="menu-top-container"></div>
<div id="shadow-block"><a class="logo" href="index.html"><img src="images/logo.svg" alt="OSGi Alliance Documentation" /><h1>OSGi Compendium Release 7</h1></a></div>
</div>
<div id="mobile-menu-icon">⋮</div>
<div id="column-two">
<div id="content">
<div id="scrollable">
<div class="navheader">
<table width="100%" summary="Navigation header">
<tr>
<td width="20%" align="left"><a accesskey="p" href="service.subsystem.html">Prev</a>
</td>
<th width="60%" align="center"> </th>
<td width="20%" align="right"> <a accesskey="n" href="service.rest.html">Next</a></td>
</tr>
</table>
<hr />
</div>
<div class="chapter">
<div xmlns="" class="titlepage">
<div>
<div>
<h1 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="service.namespaces"></a><span xmlns="" class="number">135</span> Common Namespaces Specification
</h1>
</div>
<div>
<p xmlns="http://www.w3.org/1999/xhtml" class="releaseinfo">Version 1.2</p>
</div>
</div>
</div>
<div class="section">
<div xmlns="" class="titlepage">
<div>
<div>
<h2 xmlns="http://www.w3.org/1999/xhtml" class="title" style="clear: both"><a xmlns="" class="anchor" id="d0e114755"></a><span xmlns="" class="number">135.1</span> Introduction
</h2>
</div>
</div>
</div>
<p>A key aspect of the OSGi general dependency model based on
requirements and capabilities is the concept of a
<span class="emphasis"><em>Namespace</em></span>. A Namespace defines the semantics of a
Requirement-Capability pair. The generic model is defined in the <a xmlns="" class="xref" href="service.namespaces.html#i1777721" title="Resources API Specification">[3] <em>Resources API Specification</em></a>. This section defines a number of Namespaces that are
not part of the <a xmlns="" class="xref" href="introduction.html#intro.core.release" title="1.2.1 OSGi Core Release 7">OSGi Core Release 7</a> specification. Unless an attribute is
specifically overridden, all Namespaces inherit the attributes and
directives of the default Namespace as defined <a xmlns="" class="xref" href="service.namespaces.html#i1777761" title="Framework Namespaces Specification">[4] <em>Framework Namespaces Specification</em></a>.
</p>
<p>Each Namespace is defined with the following items:</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p><span class="emphasis"><em>Name</em></span> - the name of an attribute or
directive
</p>
</li>
<li class="listitem">
<p><span class="emphasis"><em>Kind</em></span> - Defines where the attribute or
directive can be used
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: circle; ">
<li class="listitem">
<p><code class="code">CA</code> - Capability Attribute
</p>
</li>
<li class="listitem">
<p><code class="code">CD</code> - Capability Directive
</p>
</li>
<li class="listitem">
<p><code class="code">RA</code> - Requirement Attribute
</p>
</li>
<li class="listitem">
<p><code class="code">RD</code> - Requirement Directive
</p>
</li>
</ul>
</div>
</li>
<li class="listitem">
<p><span class="emphasis"><em>M/O</em></span> - Mandatory (<code class="code">M</code>) or
Optional (<code class="code">O</code>)
</p>
</li>
<li class="listitem">
<p><span class="emphasis"><em>Type</em></span> - The data type
</p>
</li>
<li class="listitem">
<p><span class="emphasis"><em>Syntax</em></span> - Any syntax rules. The syntax
refers in general to the syntaxes defined in <a xmlns="" class="xref" href="service.namespaces.html#i1777866" title="General Syntax Definitions">[5] <em>General Syntax Definitions</em></a> and <a xmlns="" class="xref" href="service.namespaces.html#i1777884" title="Common Headers">[6] <em>Common Headers</em></a>.
</p>
</li>
</ul>
</div>
<div class="section">
<div xmlns="" class="titlepage">
<div>
<div>
<h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="d0e114828"></a><span xmlns="" class="number">135.1.1</span> Versioning
</h3>
</div>
</div>
</div>
<p>In general, capabilities in a Namespace are versioned using
Semantic Versioning. See <a xmlns="" class="xref" href="service.namespaces.html#service.namespaces-coresemver" title="Semantic Versioning">[7] <em>Semantic Versioning</em></a>. Therefore, a capability will
specify a single version and a requirement will specify a version range.
See <a xmlns="" class="xref" href="service.namespaces.html#service.namespaces-osgi.extender.namespace" title="135.2 osgi.extender Namespace">osgi.extender Namespace</a> for an example.
</p>
<p>For some Namespaces, capabilities are not versioned using Semantic
Versioning. The versioning scheme used in those Namespaces will be
described in the specification for the Namespace.
</p>
</div>
</div>
<div class="section">
<div xmlns="" class="titlepage">
<div>
<div>
<h2 xmlns="http://www.w3.org/1999/xhtml" class="title" style="clear: both"><a xmlns="" class="anchor" id="service.namespaces-osgi.extender.namespace"></a><span xmlns="" class="number">135.2</span> osgi.extender Namespace
</h2>
</div>
</div>
</div>
<p>An <span class="emphasis"><em>Extender</em></span> is a bundle that uses the life
cycle events from another bundle, the <span class="emphasis"><em>extendee</em></span>, to
extend that bundle's functionality when that bundle is active. It can use
metadata (headers, or files inside the extendee) to control its
functionality. Extendees therefore have a dependency on the Extender that
can be modeled with the <code class="code">osgi.extender</code> Namespace. The
definition for this Namespace can be found in the following table and the
<a xmlns="" class="xref" href="service.namespaces.html#org.osgi.namespace.extender.ExtenderNamespace" title="135.8.2 public final class ExtenderNamespace extends Namespace">ExtenderNamespace</a> class.
</p>
<div class="table"><a xmlns="" class="anchor" id="d0e114855"></a><p class="title"><strong>Table <span xmlns="" class="number">135</span>.1 osgi.extender Namespace</strong></p>
<div class="table-contents">
<table summary="osgi.extender Namespace" width="100%" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; ">
<colgroup>
<col />
<col />
<col />
<col />
<col />
<col />
</colgroup>
<thead>
<tr>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Name</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Kind</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">M/O</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Type</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Syntax</th>
<th style="border-bottom: 0.5pt solid ; ">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">osgi.extender</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">CA</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">M</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">String</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">symbolic-name</code></td>
<td style="border-bottom: 0.5pt solid ; ">
<p>A symbolic name for the extender. These names are
defined in their respective specifications and should in general
use the specification top level package name. For example,
<code class="code">org.acme.foo</code>. The OSGi Alliance reserves names that
start with "<code class="code">osgi.</code>".
</p>
</td>
</tr>
<tr>
<td style="border-right: 0.5pt solid ; "><code class="code">version</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">CA</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">M</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">Version</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">version</code></td>
<td style="">
<p>A version. This version must correspond to the
specification of the extender.
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div><br class="table-break" /><p>Specifications for extenders (Blueprint, Declarative Services, etc.)
should specify the values for these attributes. Extenders that provide
such a capability should list the packages that they use in their
specification in the <code class="code">uses</code> directive of that capability to
ensure class space consistency. For example a Declarative Services
implementation could declare its capability with the following manifest
header:
</p><pre xmlns="" class="programlisting"><code>Provide-Capability: osgi.extender;
osgi.extender="osgi.component";
uses:="org.osgi.service.component";
version:Version="1.3"</code></pre><p>A bundle that depends on a Declarative Services implementation
should require such an extender with the following manifest header:
</p><pre xmlns="" class="programlisting"><code>Require-Capability: osgi.extender;
filter:="(&(osgi.extender=osgi.component)(version>=1.3)(!(version>=2.0)))"</code></pre><p>Extenders can extend an extendee bundle even if that bundle does not
require the extender, unless the extender's specification explicitly
forbids this. It is recommended that an extender should only extend a
bundle if one of the following is true:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>The bundle's wiring has a required wire for at least one
<code class="code">osgi.extender</code> capability with the name of the extender
and the first of these required wires is wired to the extender.
</p>
</li>
<li class="listitem">
<p>The bundle's wiring has no required wire for an
<code class="code">osgi.extender</code> capability with the name of the
extender.
</p>
</li>
</ul>
</div>
<p>Otherwise, the extender should not extend the bundle.</p>
<div class="section">
<div xmlns="" class="titlepage">
<div>
<div>
<h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="d0e114952"></a><span xmlns="" class="number">135.2.1</span> Extenders and Framework Hooks
</h3>
</div>
</div>
</div>
<p>The Framework provides a number of hooks that allow groups of
bundles to be scoped. For example, the <span class="emphasis"><em>Subsystem Service
Specification</em></span>. An extender may want to extend the complete
set of bundles installed in the Framework even when extendee bundles are
hidden from the extender. The system bundle context provides a complete
view of the bundles and services available in the Framework even if
Framework hooks are used to scope groups of bundles. The system bundle
context can be used by an extender to track all bundles installed in the
Framework regardless of how Framework hooks are used to scope groups of
bundles. This is useful in scenarios where several scoped groups contain
bundles that require an extender. Instead of requiring an extender to be
installed in each scoped group of bundles, a single extender that uses
the system bundle context to track extendees can be installed to extend
all scoped groups of bundles.
</p>
</div>
</div>
<div class="section">
<div xmlns="" class="titlepage">
<div>
<div>
<h2 xmlns="http://www.w3.org/1999/xhtml" class="title" style="clear: both"><a xmlns="" class="anchor" id="service.namespaces-osgi.contract.namespace"></a><span xmlns="" class="number">135.3</span> osgi.contract Namespace
</h2>
</div>
</div>
</div>
<p>Products or technologies often have a number of related APIs
consisting of a large set of packages. Some IDEs have not optimized for
OSGi and requires work for each imported package. In these development
environments using modularized systems tends to require a significant
amount of manual effort to manage the imported packages.
</p>
<p>The <code class="code">osgi.contract</code> Namespace addresses this IDE
deficiency. It allows a developer to specify a single name and version for
a contract that can then be expanded to a potentially large number of
packages. For example, a developer can then specify a dependency on Java
Enterprise Edition 6 contract that can be provided by an application
server.
</p>
<p>The <code class="code">osgi.contract</code> Namespace provides such a name and
binds it to a set of packages with the uses constraint. The bundle that
declares this contract must then import or export each of the listed
packages with the correct versioning. Such a bundle is called a
<span class="emphasis"><em>contract bundle</em></span>. The contract bundle must ensure that
it is bound to the correct versions of the packages contained within the
contract it is providing. If the contract bundle imports the packages
which are specified as part of the contract then proper matching
attributes must be used to make sure it is bound to the correct versions
of the packages.
</p>
<p>Additionally, the <code class="code">osgi.contract</code> Namespace can be used
in cases where API is defined by parties that do not use Semantic
Versioning. In those cases, the version of the exported package can be
unclear and so it is difficult to specify a meaningful version range for
the package import. In such cases, importing the package
<span class="emphasis"><em>without</em></span> specifying a version range and specifying a
requirement in the <code class="code">osgi.contract</code> Namespace can provide a way
to create portable bundles that use the API. OSGi has defined contract
names for a number of such APIs. See <a xmlns="" class="xref" href="service.namespaces.html#service.namespaces-portable.java.contracts.ref" title="Portable Java Contract Definitions">[2] <em>Portable Java Contract Definitions</em></a> for more
information.
</p>
<p>An <code class="code">osgi.contract</code> capability can then be used in the
following ways:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>IDEs can use the information in the <code class="code">uses</code> directive
to make all those packages available on the build path. In this case
the developer no longer has to specify each package separately.
</p>
</li>
<li class="listitem">
<p>During run time the <code class="code">uses</code> clause is used to enforce
that all packages in the contract form a consistent class
space.
</p>
</li>
</ul>
</div>
<p>The <code class="code">uses</code> directive will make it impossible to get wired
to packages that are not valid for the contract. Since the uses constrains
enforce the consistency, it is in principle not necessary to version the
imported packages on client bundles since only the correctly versioned
packages can be used. Contracts are aggregates and therefore make clients
depend on the whole and all their transitive dependencies, even if the
client only uses a single package of the contract.
</p>
<p>The recommended way of using contracts is to create a contract
bundle that provides the <code class="code">osgi.contract</code> capability and imports
the packages with their required version range. For example:
</p><pre xmlns="" class="programlisting"><code>Provide-Capability: osgi.contract;
osgi.contract=JavaServlet;
version:Version=2.5;
uses:="javax.servlet,javax.servlet.http"
Export-Package:
javax.servlet; version="2.5",
javax.servlet.http; version="2.5"</code></pre><p>A contract may support multiple versions of a named contract. Such a
contract must use a single capability for the contract name that specifies
a list of all the versions that are supported. For example, the
JavaServlet 3.1 contract capability would be specified with the
following:
</p><pre xmlns="" class="programlisting"><code>Provide-Capability: osgi.contract;
osgi.contract=JavaServlet;
version:List<Version>="2.5,3.0,3.1";
uses:=
"javax.servlet,
javax.servlet.annotation,
javax.servlet.descriptor,
javax.servlet.http"
Export-Package:
javax.servlet; version="3.1",
javax.servlet.annotation; version="3.1",
javax.servlet.descriptor; version="3.1",
javax.servlet.http; version="3.1"</code></pre><p>A client bundle that requires the Servlet 2.5 contract can then have
the following manifest:
</p><pre xmlns="" class="programlisting"><code>Require-Capability: osgi.contract;
filter:="(&(osgi.contract=JavaServlet)(version=2.5))",
Import-Package:
javax.servlet, javax.servlet.http</code></pre><p>The client bundle will be constrained by the contract's uses
constraints and automatically gets the correct packages. In this example,
no semantic versioning is used for the contract because the Servlet
Specifications do not use semantic versioning (version 3.0 is backward
compatible with 2.X).
</p>
<p>In this model it is even possible to use the normally not
recommended DynamicImport-Package header with a wild card since also this
header is constrained by the uses constraints. However, using a full
wildcard can also dynamically import packages that are not part of the
contract. To prevent these unwanted dynamic imports, the exporter could
include an attribute on the exports. For example:
</p><pre xmlns="" class="programlisting"><code>Require-Capability: osgi.contract;
filter:="(&(osgi.contract=JavaServlet)(version=2.5))"
DynamicImport-Package:
*;JavaServlet=contract</code></pre><p>However, this model requires the exporter to specify an agreed
attribute. The contract bundle does not require such coordination; it also
allows the package exporters to reside in different and unrelated
bundles.
</p>
<p>The definition of the <code class="code">osgi.contract</code> Namespace is in the
following table and in the <a xmlns="" class="xref" href="service.namespaces.html#org.osgi.namespace.contract.ContractNamespace" title="135.7.2 public final class ContractNamespace extends Namespace">ContractNamespace</a> class. See <a xmlns="" class="xref" href="service.namespaces.html#service.namespaces-portable.java.contracts.ref" title="Portable Java Contract Definitions">[2] <em>Portable Java Contract Definitions</em></a>.
</p>
<div class="table"><a xmlns="" class="anchor" id="d0e115046"></a><p class="title"><strong>Table <span xmlns="" class="number">135</span>.2 osgi.contract Namespace</strong></p>
<div class="table-contents">
<table summary="osgi.contract Namespace" width="100%" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; ">
<colgroup>
<col />
<col />
<col />
<col />
<col />
<col />
</colgroup>
<thead>
<tr>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Name</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Kind</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">M/O</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Type</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Syntax</th>
<th style="border-bottom: 0.5pt solid ; ">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">osgi.contract</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">CA</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">M</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">String</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">symbolic-name</code></td>
<td style="border-bottom: 0.5pt solid ; ">
<p>A symbolic name for the contract.</p>
</td>
</tr>
<tr>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">version</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">CA</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">O</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">Version+</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">version</code></td>
<td style="border-bottom: 0.5pt solid ; ">
<p>A list of versions for the contract. A contract that
supports multiple versions must use a single capability with a
version attribute that lists all versions
supported.
</p>
</td>
</tr>
<tr>
<td style="border-right: 0.5pt solid ; "><code class="code">uses</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">CD</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">O</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">String</code></td>
<td style="border-right: 0.5pt solid ; ">
<p><code class="code">package-name</code></p>
<p><code class="code">( ','
package-name )</code></p>
</td>
<td style="">
<p>For a contract, the standard uses clause is used to
indicate which packages are part of the contract. The imports or
exports of those packages link these packages to a particular
version.
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div><br class="table-break" /><div class="section">
<div xmlns="" class="titlepage">
<div>
<div>
<h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="d0e115132"></a><span xmlns="" class="number">135.3.1</span> Versioning
</h3>
</div>
</div>
</div>
<p>As the <code class="code">osgi.contract</code> Namespace follows the versioning
of the associated contract, capabilities in this Namespace are
<span class="emphasis"><em>not</em></span> semantically versioned. The associated
contracts are often versioned using marketing or other versioning
schemes and therefore the version number cannot be used as an indication
of backwards compatibility.
</p>
<p>As a result, capabilities in the <code class="code">osgi.contract</code>
Namespace use a <span class="emphasis"><em>discrete</em></span> versioning scheme. In such
a versioning scheme, each version is treated as separate without any
implied relation to another version. A capability lists
<span class="emphasis"><em>all</em></span> compatible versions. A requirement only selects
a single version.
</p>
</div>
</div>
<div class="section">
<div xmlns="" class="titlepage">
<div>
<div>
<h2 xmlns="http://www.w3.org/1999/xhtml" class="title" style="clear: both"><a xmlns="" class="anchor" id="service.namespaces-osgi.service.namespace"></a><span xmlns="" class="number">135.4</span> osgi.service Namespace
</h2>
</div>
</div>
</div>
<p>The Service Namespace is intended to be used for:</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Preventing a bundle from resolving if there is not at least one
bundle that potentially can register a specific service.
</p>
</li>
<li class="listitem">
<p>Providing a hint to the provisioning agent that the bundle
requires a given service.
</p>
</li>
<li class="listitem">
<p>Used as template for specifications like Blueprint and
Declarative Services to express their provided and referenced services
in the Repository model, see the <span class="emphasis"><em>Repository Service
Specification</em></span>.
</p>
</li>
</ul>
</div>
<p>A bundle providing this capability indicates that it can register
such a service with at least the given custom attributes as service
properties. At resolve time this is a promise since there is no guarantee
that during runtime the bundle will actually register such a service;
clients must handle this with the normal runtime dependency managers like
Blueprint, Declarative Services, or others.
</p>
<p>See the following table and the <a xmlns="" class="xref" href="service.namespaces.html#org.osgi.namespace.service.ServiceNamespace" title="135.9.2 public final class ServiceNamespace extends Namespace">ServiceNamespace</a> class for this Namespace definition.
</p>
<div class="table"><a xmlns="" class="anchor" id="d0e115178"></a><p class="title"><strong>Table <span xmlns="" class="number">135</span>.3 osgi.service Namespace</strong></p>
<div class="table-contents">
<table summary="osgi.service Namespace" width="100%" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; ">
<colgroup>
<col />
<col />
<col />
<col />
<col />
<col />
</colgroup>
<thead>
<tr>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Name</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Kind</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">M/O</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Type</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Syntax</th>
<th style="border-bottom: 0.5pt solid ; ">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">objectClass</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">CA</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">M</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">
<p><code class="code">List</code></p>
<p><code class="code"><String></code></p>
</td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">
<p><code class="code">qname</code></p>
<p><code class="code">(','
qname)*</code></p>
</td>
<td style="border-bottom: 0.5pt solid ; ">
<p>The fully qualified name of the object class of the
service.
</p>
</td>
</tr>
<tr>
<td style="border-right: 0.5pt solid ; "><code class="code">*</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">CA</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">O</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">*</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">*</code></td>
<td style="">
<p>Custom attributes that will be provided as service
properties if they do not conflict with the service properties
rules and are not private service properties. Private properties
start with a full stop (<code class="code">'.' \u002E</code>).
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div><br class="table-break" /><div class="section">
<div xmlns="" class="titlepage">
<div>
<div>
<h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="d0e115252"></a><span xmlns="" class="number">135.4.1</span> Versioning
</h3>
</div>
</div>
</div>
<p>Capabilities in the <code class="code">osgi.service</code> Namespace are
<span class="emphasis"><em>not</em></span> versioned. The package of a service's object
class is generally versioned and the package can be associated with the
capability via the <code class="code">uses</code> directive.
</p>
</div>
</div>
<div class="section">
<div xmlns="" class="titlepage">
<div>
<div>
<h2 xmlns="http://www.w3.org/1999/xhtml" class="title" style="clear: both"><a xmlns="" class="anchor" id="service.namespaces-osgi.implementation.namespace"></a><span xmlns="" class="number">135.5</span> osgi.implementation Namespace
</h2>
</div>
</div>
</div>
<p>The Implementation Namespace is intended to be used for:</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Preventing a bundle from resolving if there is not at least one
bundle that provides an implementation of the specified specification
or contract.
</p>
</li>
<li class="listitem">
<p>Providing uses constraints to ensure that bundles which require
an implementation of a specification or contract will be wired
appropriately by the framework.
</p>
</li>
<li class="listitem">
<p>Providing a hint to the provisioning agent that the bundle
requires a given specification or contract implementation.
</p>
</li>
<li class="listitem">
<p>Used as a general capability Namespace for specifications or
contracts to express their provided function in the Repository model,
see the <span class="emphasis"><em>Repository Service Specification</em></span>.
</p>
</li>
</ul>
</div>
<p>A bundle providing this capability indicates that it implements a
specification or contract with the specified name and version. For
example, the <span class="emphasis"><em>Asynchronous Service Specification</em></span> would
provide the following capability:
</p><pre xmlns="" class="programlisting"><code>Provide-Capability: osgi.implementation;
osgi.implementation="osgi.async";
version:Version="1.0";
uses:="org.osgi.service.async"</code></pre><p>See the following table and the <a xmlns="" class="xref" href="service.namespaces.html#org.osgi.namespace.implementation.ImplementationNamespace" title="135.10.2 public final class ImplementationNamespace extends Namespace">ImplementationNamespace</a> class for this Namespace definition.
</p>
<div class="table"><a xmlns="" class="anchor" id="d0e115298"></a><p class="title"><strong>Table <span xmlns="" class="number">135</span>.4 osgi.implementation Namespace</strong></p>
<div class="table-contents">
<table summary="osgi.implementation Namespace" width="100%" style="border-collapse: collapse;border-top: 0.5pt solid ; border-bottom: 0.5pt solid ; border-left: 0.5pt solid ; border-right: 0.5pt solid ; ">
<colgroup>
<col />
<col />
<col />
<col />
<col />
<col />
</colgroup>
<thead>
<tr>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Name</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Kind</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">M/O</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Type</th>
<th style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">Syntax</th>
<th style="border-bottom: 0.5pt solid ; ">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">osgi.implementation</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">CA</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">M</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">
<p><code class="code">String</code></p>
</td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">
<p><code class="code">symbolic-name</code></p>
</td>
<td style="border-bottom: 0.5pt solid ; ">
<p>The symbolic name of the specification or contract.
The OSGi Alliance reserves names that start with
"<code class="code">osgi.</code>".
</p>
</td>
</tr>
<tr>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">version</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">CA</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; "><code class="code">M</code></td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">
<p><code class="code">Version</code></p>
</td>
<td style="border-right: 0.5pt solid ; border-bottom: 0.5pt solid ; ">
<p><code class="code">version</code></p>
</td>
<td style="border-bottom: 0.5pt solid ; ">
<p>The version of the implemented specification or
contract.
</p>
</td>
</tr>
<tr>
<td style="border-right: 0.5pt solid ; "><code class="code">*</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">CA</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">O</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">*</code></td>
<td style="border-right: 0.5pt solid ; "><code class="code">*</code></td>
<td style="">
<p>Custom attributes that can be used to further
identify the implementation
</p>
</td>
</tr>
</tbody>
</table>
</div>
</div><br class="table-break" /></div>
<div class="section">
<div xmlns="" class="titlepage">
<div>
<div>
<h2 xmlns="http://www.w3.org/1999/xhtml" class="title" style="clear: both"><a xmlns="" class="anchor" id="service.namespaces-osgi.unresolvable.namespace"></a><span xmlns="" class="number">135.6</span> osgi.unresolvable Namespace
</h2>
</div>
</div>
</div>
<p>The Unresolvable Namespace is intended to be used to mark a bundle
as unresolvable:
</p>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>Preventing the bundle from resolving since it is intended for
compilation use only and is not intended for runtime use.
</p>
</li>
<li class="listitem">
<p>Providing a hint to the provisioning agent that the bundle must
not be included in a provisioning solution.
</p>
</li>
</ul>
</div>
<p>For example, a bundle that must be unresolvable at runtime can
include the following requirement:
</p><pre xmlns="" class="programlisting"><code>Require-Capability: osgi.unresolvable;
filter:="(&(must.not.resolve=*)(!(must.not.resolve=*)))"</code></pre><p>The filter expression in the example above always evaluates to
<code class="code">false</code>.
</p>
<p>See the <a xmlns="" class="xref" href="service.namespaces.html#org.osgi.namespace.unresolvable.UnresolvableNamespace" title="135.11.2 public final class UnresolvableNamespace extends Namespace">UnresolvableNamespace</a> class for this Namespace definition.
</p>
</div>
<div class="section package">
<div xmlns="" class="titlepage">
<div>
<div>
<h2 xmlns="http://www.w3.org/1999/xhtml" class="title" style="clear: both"><a xmlns="" class="anchor" id="org.osgi.namespace.contract"></a><span xmlns="" class="number">135.7</span> org.osgi.namespace.contract
</h2>
</div>
<div>
<p xmlns="http://www.w3.org/1999/xhtml" class="releaseinfo">Version 1.0</p>
</div>
</div>
</div>
<p>
Contract Namespace Package Version 1.0.
</p>
<p>
Bundles should not need to import this package at runtime since all
the types in this package just contain constants for capability and
requirement namespaces specified by the OSGi Alliance.
</p>
<div class="section summary">
<div xmlns="" class="titlepage">
<div>
<div>
<h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="d0e115424"></a><span xmlns="" class="number">135.7.1</span> Summary
</h3>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a xmlns="" class="link" href="service.namespaces.html#org.osgi.namespace.contract.ContractNamespace" title="135.7.2 public final class ContractNamespace extends Namespace">
<code xmlns="http://www.w3.org/1999/xhtml" class="code">ContractNamespace</code>
</a> -
Contract Capability and Requirement Namespace.
</p>
</li>
</ul>
</div>
</div>
<div class="section class">
<div xmlns="" class="titlepage">
<div>
<div>
<h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="org.osgi.namespace.contract.ContractNamespace"></a><span xmlns="" class="number">135.7.2</span> public final class ContractNamespace<br xmlns="" /> extends Namespace
</h3>
</div>
</div>
</div>
<p>
Contract Capability and Requirement Namespace.
</p>
<p>
This class defines the names for the attributes and directives for this
namespace. All unspecified capability attributes are of type <code class="code">String</code>
and are used as arbitrary matching attributes for the capability. The values
associated with the specified directive and attribute keys are of type
<code class="code">String</code>, unless otherwise indicated.
</p>
<p xmlns="" class="parameter"><label>Concurrency</label><span>Immutable </span></p>
<div class="section field">
<div xmlns="" class="titlepage">
<div>
<div>
<h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="org.osgi.namespace.contract.ContractNamespace.CAPABILITY_VERSION_ATTRIBUTE"></a><span xmlns="" class="number">135.7.2.1</span> public static final String CAPABILITY_VERSION_ATTRIBUTE = "version"
</h4>
</div>
</div>
</div>
<p>
The capability attribute contains the <code class="code">Version</code>s of the
specification of the contract. The value of this attribute must be of
type <code class="code">Version</code>, <code class="code">Version[]</code>, or <code class="code">List<Version></code>.
</p>
</div>
<div class="section field">
<div xmlns="" class="titlepage">
<div>
<div>
<h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="org.osgi.namespace.contract.ContractNamespace.CONTRACT_NAMESPACE"></a><span xmlns="" class="number">135.7.2.2</span> public static final String CONTRACT_NAMESPACE = "osgi.contract"
</h4>
</div>
</div>
</div>
<p>
Namespace name for contract capabilities and requirements.
</p>
<p>
Also, the capability attribute used to specify the name of the contract.
</p>
</div>
</div>
</div>
<div class="section package">
<div xmlns="" class="titlepage">
<div>
<div>
<h2 xmlns="http://www.w3.org/1999/xhtml" class="title" style="clear: both"><a xmlns="" class="anchor" id="org.osgi.namespace.extender"></a><span xmlns="" class="number">135.8</span> org.osgi.namespace.extender
</h2>
</div>
<div>
<p xmlns="http://www.w3.org/1999/xhtml" class="releaseinfo">Version 1.0</p>
</div>
</div>
</div>
<p>
Extender Namespace Package Version 1.0.
</p>
<p>
Bundles should not need to import this package at runtime since all
the types in this package just contain constants for capability and
requirement namespaces specified by the OSGi Alliance.
</p>
<div class="section summary">
<div xmlns="" class="titlepage">
<div>
<div>
<h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="d0e115493"></a><span xmlns="" class="number">135.8.1</span> Summary
</h3>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a xmlns="" class="link" href="service.namespaces.html#org.osgi.namespace.extender.ExtenderNamespace" title="135.8.2 public final class ExtenderNamespace extends Namespace">
<code xmlns="http://www.w3.org/1999/xhtml" class="code">ExtenderNamespace</code>
</a> -
Extender Capability and Requirement Namespace.
</p>
</li>
</ul>
</div>
</div>
<div class="section class">
<div xmlns="" class="titlepage">
<div>
<div>
<h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="org.osgi.namespace.extender.ExtenderNamespace"></a><span xmlns="" class="number">135.8.2</span> public final class ExtenderNamespace<br xmlns="" /> extends Namespace
</h3>
</div>
</div>
</div>
<p>
Extender Capability and Requirement Namespace.
</p>
<p>
This class defines the names for the attributes and directives for this
namespace. All unspecified capability attributes are of type <code class="code">String</code>
and are used as arbitrary matching attributes for the capability. The values
associated with the specified directive and attribute keys are of type
<code class="code">String</code>, unless otherwise indicated.
</p>
<p xmlns="" class="parameter"><label>Concurrency</label><span>Immutable </span></p>
<div class="section field">
<div xmlns="" class="titlepage">
<div>
<div>
<h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="org.osgi.namespace.extender.ExtenderNamespace.CAPABILITY_VERSION_ATTRIBUTE"></a><span xmlns="" class="number">135.8.2.1</span> public static final String CAPABILITY_VERSION_ATTRIBUTE = "version"
</h4>
</div>
</div>
</div>
<p>
The capability attribute contains the <code class="code">Version</code> of the
specification of the extender. The value of this attribute must be of
type <code class="code">Version</code>.
</p>
</div>
<div class="section field">
<div xmlns="" class="titlepage">
<div>
<div>
<h4 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="org.osgi.namespace.extender.ExtenderNamespace.EXTENDER_NAMESPACE"></a><span xmlns="" class="number">135.8.2.2</span> public static final String EXTENDER_NAMESPACE = "osgi.extender"
</h4>
</div>
</div>
</div>
<p>
Namespace name for extender capabilities and requirements.
</p>
<p>
Also, the capability attribute used to specify the name of the extender.
</p>
</div>
</div>
</div>
<div class="section package">
<div xmlns="" class="titlepage">
<div>
<div>
<h2 xmlns="http://www.w3.org/1999/xhtml" class="title" style="clear: both"><a xmlns="" class="anchor" id="org.osgi.namespace.service"></a><span xmlns="" class="number">135.9</span> org.osgi.namespace.service
</h2>
</div>
<div>
<p xmlns="http://www.w3.org/1999/xhtml" class="releaseinfo">Version 1.0</p>
</div>
</div>
</div>
<p>
Service Namespace Package Version 1.0.
</p>
<p>
Bundles should not need to import this package at runtime since all
the types in this package just contain constants for capability and
requirement namespaces specified by the OSGi Alliance.
</p>
<div class="section summary">
<div xmlns="" class="titlepage">
<div>
<div>
<h3 xmlns="http://www.w3.org/1999/xhtml" class="title"><a xmlns="" class="anchor" id="d0e115556"></a><span xmlns="" class="number">135.9.1</span> Summary
</h3>
</div>
</div>
</div>
<div class="itemizedlist">
<ul class="itemizedlist" style="list-style-type: disc; ">
<li class="listitem">
<p>
<a xmlns="" class="link" href="service.namespaces.html#org.osgi.namespace.service.ServiceNamespace" title="135.9.2 public final class ServiceNamespace extends Namespace">
<code xmlns="http://www.w3.org/1999/xhtml" class="code">ServiceNamespace</code>
</a> -
Service Capability and Requirement Namespace.
</p>
</li>