/usr/share/doc/libosgi-core-java/api/org/osgi/framework/BundleContext.html is in libosgi-core-java-doc 6.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<title>BundleContext</title>
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">
</head>
<body>
<script type="text/javascript"><!--
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="BundleContext";
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar_top">
<!-- -->
</a><a href="#skip-navbar_top" title="Skip navigation links"></a><a name="navbar_top_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/osgi/framework/BundleActivator.html" title="interface in org.osgi.framework"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../org/osgi/framework/BundleEvent.html" title="class in org.osgi.framework"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/osgi/framework/BundleContext.html" target="_top">Frames</a></li>
<li><a href="BundleContext.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_top");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_top">
<!-- -->
</a></div>
<!-- ========= END OF TOP NAVBAR ========= -->
<!-- ======== START OF CLASS DATA ======== -->
<div class="header">
<div class="subTitle">org.osgi.framework</div>
<h2 title="Interface BundleContext" class="title">Interface BundleContext</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><a href="../../../org/osgi/framework/BundleReference.html" title="interface in org.osgi.framework">BundleReference</a></dd>
</dl>
<hr>
<br>
<pre>@ProviderType
public interface <span class="strong">BundleContext</span>
extends <a href="../../../org/osgi/framework/BundleReference.html" title="interface in org.osgi.framework">BundleReference</a></pre>
<div class="block">A bundle's execution context within the Framework. The context is used to
grant access to other methods so that this bundle can interact with the
Framework.
<p>
<code>BundleContext</code> methods allow a bundle to:
<ul>
<li>Subscribe to events published by the Framework.</li>
<li>Register service objects with the Framework service registry.</li>
<li>Retrieve <code>ServiceReferences</code> from the Framework service registry.</li>
<li>Get and release service objects for a referenced service.</li>
<li>Install new bundles in the Framework.</li>
<li>Get the list of bundles installed in the Framework.</li>
<li>Get the <a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework"><code>Bundle</code></a> object for a bundle.</li>
<li>Create <code>File</code> objects for files in a persistent storage area
provided for the bundle by the Framework.</li>
</ul>
<p>
A <code>BundleContext</code> object will be created for a bundle when the bundle
is started. The <code>Bundle</code> object associated with a <code>BundleContext</code>
object is called the <em>context bundle</em>.
<p>
The <code>BundleContext</code> object will be passed to the
<a href="../../../org/osgi/framework/BundleActivator.html#start(org.osgi.framework.BundleContext)"><code>BundleActivator.start(BundleContext)</code></a> method during activation of the
context bundle. The same <code>BundleContext</code> object will be passed to the
<a href="../../../org/osgi/framework/BundleActivator.html#stop(org.osgi.framework.BundleContext)"><code>BundleActivator.stop(BundleContext)</code></a> method when the context bundle is
stopped. A <code>BundleContext</code> object is generally for the private use of
its associated bundle and is not meant to be shared with other bundles in the
OSGi environment.
<p>
The <code>BundleContext</code> object is only valid during the execution of its
context bundle; that is, during the period from when the context bundle is in
the <code>STARTING</code>, <code>STOPPING</code>, and <code>ACTIVE</code> bundle states.
However, the <code>BundleContext</code> object becomes invalid after
<a href="../../../org/osgi/framework/BundleActivator.html#stop(org.osgi.framework.BundleContext)"><code>BundleActivator.stop(BundleContext)</code></a> returns (if the bundle has a
Bundle Activator). The <code>BundleContext</code> object becomes invalid before
disposing of any remaining registered services and releasing any remaining
services in use. Since those activities can result in other bundles being
called (for example, <a href="../../../org/osgi/framework/ServiceListener.html" title="interface in org.osgi.framework"><code>ServiceListener</code></a>s for
<a href="../../../org/osgi/framework/ServiceEvent.html#UNREGISTERING"><code>ServiceEvent.UNREGISTERING</code></a> events and <a href="../../../org/osgi/framework/ServiceFactory.html" title="interface in org.osgi.framework"><code>ServiceFactory</code></a>s for
unget operations), those other bundles can observe the stopping bundle in the
<code>STOPPING</code> state but with an invalid <code>BundleContext</code> object. If
the <code>BundleContext</code> object is used after it has become invalid, an
<code>IllegalStateException</code> must be thrown. The <code>BundleContext</code>
object must never be reused after its context bundle is stopped.
<p>
Two <code>BundleContext</code> objects are equal if they both refer to the same
execution context of a bundle. The Framework is the only entity that can
create <code>BundleContext</code> objects and they are only valid within the
Framework that created them.
<p>
A <a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework"><code>Bundle</code></a> can be <a href="../../../org/osgi/framework/Bundle.html#adapt(java.lang.Class)"><code>adapted</code></a> to its
<code>BundleContext</code>. In order for this to succeed, the caller must have the
appropriate <code>AdminPermission[bundle,CONTEXT]</code> if the Java Runtime
Environment supports permissions.</div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- ========== METHOD SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="method_summary">
<!-- -->
</a>
<h3>Method Summary</h3>
<table class="overviewSummary" border="0" cellpadding="3" cellspacing="0" summary="Method Summary table, listing methods, and an explanation">
<caption><span>Methods</span><span class="tabEnd"> </span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Method and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#addBundleListener(org.osgi.framework.BundleListener)">addBundleListener</a></strong>(<a href="../../../org/osgi/framework/BundleListener.html" title="interface in org.osgi.framework">BundleListener</a> listener)</code>
<div class="block">Adds the specified <code>BundleListener</code> object to the context bundle's
list of listeners if not already present.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#addFrameworkListener(org.osgi.framework.FrameworkListener)">addFrameworkListener</a></strong>(<a href="../../../org/osgi/framework/FrameworkListener.html" title="interface in org.osgi.framework">FrameworkListener</a> listener)</code>
<div class="block">Adds the specified <code>FrameworkListener</code> object to the context
bundle's list of listeners if not already present.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#addServiceListener(org.osgi.framework.ServiceListener)">addServiceListener</a></strong>(<a href="../../../org/osgi/framework/ServiceListener.html" title="interface in org.osgi.framework">ServiceListener</a> listener)</code>
<div class="block">Adds the specified <code>ServiceListener</code> object to the context bundle's
list of listeners.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#addServiceListener(org.osgi.framework.ServiceListener,%20java.lang.String)">addServiceListener</a></strong>(<a href="../../../org/osgi/framework/ServiceListener.html" title="interface in org.osgi.framework">ServiceListener</a> listener,
java.lang.String filter)</code>
<div class="block">Adds the specified <code>ServiceListener</code> object with the specified
<code>filter</code> to the context bundle's list of listeners.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/Filter.html" title="interface in org.osgi.framework">Filter</a></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#createFilter(java.lang.String)">createFilter</a></strong>(java.lang.String filter)</code>
<div class="block">Creates a <code>Filter</code> object.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><?>[]</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getAllServiceReferences(java.lang.String,%20java.lang.String)">getAllServiceReferences</a></strong>(java.lang.String clazz,
java.lang.String filter)</code>
<div class="block">Returns an array of <code>ServiceReference</code> objects.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getBundle()">getBundle</a></strong>()</code>
<div class="block">Returns the <code>Bundle</code> object associated with this
<code>BundleContext</code>.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getBundle(long)">getBundle</a></strong>(long id)</code>
<div class="block">Returns the bundle with the specified identifier.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getBundle(java.lang.String)">getBundle</a></strong>(java.lang.String location)</code>
<div class="block">Returns the bundle with the specified location.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getBundles()">getBundles</a></strong>()</code>
<div class="block">Returns a list of all installed bundles.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.io.File</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getDataFile(java.lang.String)">getDataFile</a></strong>(java.lang.String filename)</code>
<div class="block">Creates a <code>File</code> object for a file in the persistent storage area
provided for the bundle by the Framework.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getProperty(java.lang.String)">getProperty</a></strong>(java.lang.String key)</code>
<div class="block">Returns the value of the specified property.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><S> S</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getService(org.osgi.framework.ServiceReference)">getService</a></strong>(<a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><S> reference)</code>
<div class="block">Returns the service object for the service referenced by the specified
<code>ServiceReference</code> object.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><S> <a href="../../../org/osgi/framework/ServiceObjects.html" title="interface in org.osgi.framework">ServiceObjects</a><S></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getServiceObjects(org.osgi.framework.ServiceReference)">getServiceObjects</a></strong>(<a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><S> reference)</code>
<div class="block">Returns the <a href="../../../org/osgi/framework/ServiceObjects.html" title="interface in org.osgi.framework"><code>ServiceObjects</code></a> object for the service referenced by
the specified <code>ServiceReference</code> object.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><S> <a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><S></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getServiceReference(java.lang.Class)">getServiceReference</a></strong>(java.lang.Class<S> clazz)</code>
<div class="block">Returns a <code>ServiceReference</code> object for a service that implements
and was registered under the name of the specified class.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><?></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getServiceReference(java.lang.String)">getServiceReference</a></strong>(java.lang.String clazz)</code>
<div class="block">Returns a <code>ServiceReference</code> object for a service that implements
and was registered under the specified class.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><S> java.util.Collection<<a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><S>></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getServiceReferences(java.lang.Class,%20java.lang.String)">getServiceReferences</a></strong>(java.lang.Class<S> clazz,
java.lang.String filter)</code>
<div class="block">Returns a collection of <code>ServiceReference</code> objects.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><?>[]</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#getServiceReferences(java.lang.String,%20java.lang.String)">getServiceReferences</a></strong>(java.lang.String clazz,
java.lang.String filter)</code>
<div class="block">Returns an array of <code>ServiceReference</code> objects.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#installBundle(java.lang.String)">installBundle</a></strong>(java.lang.String location)</code>
<div class="block">Installs a bundle from the specified <code>location</code> identifier.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#installBundle(java.lang.String,%20java.io.InputStream)">installBundle</a></strong>(java.lang.String location,
java.io.InputStream input)</code>
<div class="block">Installs a bundle from the specified <code>InputStream</code> object.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><S> <a href="../../../org/osgi/framework/ServiceRegistration.html" title="interface in org.osgi.framework">ServiceRegistration</a><S></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#registerService(java.lang.Class,%20S,%20java.util.Dictionary)">registerService</a></strong>(java.lang.Class<S> clazz,
S service,
java.util.Dictionary<java.lang.String,?> properties)</code>
<div class="block">Registers the specified service object with the specified properties
under the name of the specified class with the Framework.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><S> <a href="../../../org/osgi/framework/ServiceRegistration.html" title="interface in org.osgi.framework">ServiceRegistration</a><S></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#registerService(java.lang.Class,%20org.osgi.framework.ServiceFactory,%20java.util.Dictionary)">registerService</a></strong>(java.lang.Class<S> clazz,
<a href="../../../org/osgi/framework/ServiceFactory.html" title="interface in org.osgi.framework">ServiceFactory</a><S> factory,
java.util.Dictionary<java.lang.String,?> properties)</code>
<div class="block">Registers the specified service factory object with the specified
properties under the name of the specified class with the Framework.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/ServiceRegistration.html" title="interface in org.osgi.framework">ServiceRegistration</a><?></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#registerService(java.lang.String[],%20java.lang.Object,%20java.util.Dictionary)">registerService</a></strong>(java.lang.String[] clazzes,
java.lang.Object service,
java.util.Dictionary<java.lang.String,?> properties)</code>
<div class="block">Registers the specified service object with the specified properties
under the specified class names into the Framework.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../org/osgi/framework/ServiceRegistration.html" title="interface in org.osgi.framework">ServiceRegistration</a><?></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#registerService(java.lang.String,%20java.lang.Object,%20java.util.Dictionary)">registerService</a></strong>(java.lang.String clazz,
java.lang.Object service,
java.util.Dictionary<java.lang.String,?> properties)</code>
<div class="block">Registers the specified service object with the specified properties
under the specified class name with the Framework.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#removeBundleListener(org.osgi.framework.BundleListener)">removeBundleListener</a></strong>(<a href="../../../org/osgi/framework/BundleListener.html" title="interface in org.osgi.framework">BundleListener</a> listener)</code>
<div class="block">Removes the specified <code>BundleListener</code> object from the context
bundle's list of listeners.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#removeFrameworkListener(org.osgi.framework.FrameworkListener)">removeFrameworkListener</a></strong>(<a href="../../../org/osgi/framework/FrameworkListener.html" title="interface in org.osgi.framework">FrameworkListener</a> listener)</code>
<div class="block">Removes the specified <code>FrameworkListener</code> object from the context
bundle's list of listeners.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>void</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#removeServiceListener(org.osgi.framework.ServiceListener)">removeServiceListener</a></strong>(<a href="../../../org/osgi/framework/ServiceListener.html" title="interface in org.osgi.framework">ServiceListener</a> listener)</code>
<div class="block">Removes the specified <code>ServiceListener</code> object from the context
bundle's list of listeners.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/BundleContext.html#ungetService(org.osgi.framework.ServiceReference)">ungetService</a></strong>(<a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><?> reference)</code>
<div class="block">Releases the service object for the service referenced by the specified
<code>ServiceReference</code> object.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ METHOD DETAIL ========== -->
<ul class="blockList">
<li class="blockList"><a name="method_detail">
<!-- -->
</a>
<h3>Method Detail</h3>
<a name="getProperty(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getProperty</h4>
<pre>java.lang.String getProperty(java.lang.String key)</pre>
<div class="block">Returns the value of the specified property. If the key is not found in
the Framework properties, the system properties are then searched. The
method returns <code>null</code> if the property is not found.
<p>
All bundles must have permission to read properties whose names start
with "org.osgi.".</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - The name of the requested property.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The value of the requested property, or <code>null</code> if the
property is undefined.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.SecurityException</code> - If the caller does not have the appropriate
<code>PropertyPermission</code> to read the property, and the Java
Runtime Environment supports permissions.</dd></dl>
</li>
</ul>
<a name="getBundle()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBundle</h4>
<pre><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a> getBundle()</pre>
<div class="block">Returns the <code>Bundle</code> object associated with this
<code>BundleContext</code>. This bundle is called the context bundle.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="../../../org/osgi/framework/BundleReference.html#getBundle()">getBundle</a></code> in interface <code><a href="../../../org/osgi/framework/BundleReference.html" title="interface in org.osgi.framework">BundleReference</a></code></dd>
<dt><span class="strong">Returns:</span></dt><dd>The <code>Bundle</code> object associated with this
<code>BundleContext</code>.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd></dl>
</li>
</ul>
<a name="installBundle(java.lang.String, java.io.InputStream)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>installBundle</h4>
<pre><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a> installBundle(java.lang.String location,
java.io.InputStream input)
throws <a href="../../../org/osgi/framework/BundleException.html" title="class in org.osgi.framework">BundleException</a></pre>
<div class="block">Installs a bundle from the specified <code>InputStream</code> object.
<p>
If the specified <code>InputStream</code> is <code>null</code>, the Framework must
create the <code>InputStream</code> from which to read the bundle by
interpreting, in an implementation dependent manner, the specified
<code>location</code>.
<p>
The specified <code>location</code> identifier will be used as the identity of
the bundle. Every installed bundle is uniquely identified by its location
identifier which is typically in the form of a URL.
<p>
The following steps are required to install a bundle:
<ol>
<li>If a bundle containing the same location identifier is already
installed, the <code>Bundle</code> object for that bundle is returned.</li>
<li>The bundle's content is read from the input stream. If this fails, a
<a href="../../../org/osgi/framework/BundleException.html" title="class in org.osgi.framework"><code>BundleException</code></a> is thrown.</li>
<li>The bundle's associated resources are allocated. The associated
resources minimally consist of a unique identifier and a persistent
storage area if the platform has file system support. If this step fails,
a <code>BundleException</code> is thrown.</li>
<li>The bundle's state is set to <code>INSTALLED</code>.</li>
<li>A bundle event of type <a href="../../../org/osgi/framework/BundleEvent.html#INSTALLED"><code>BundleEvent.INSTALLED</code></a> is fired.</li>
<li>The <code>Bundle</code> object for the newly or previously installed
bundle is returned.</li>
</ol>
<b>Postconditions, no exceptions thrown </b>
<ul>
<li><code>getState()</code> in { <code>INSTALLED</code>, <code>RESOLVED</code>
}.</li>
<li>Bundle has a unique ID.</li>
</ul>
<b>Postconditions, when an exception is thrown </b>
<ul>
<li>Bundle is not installed. If there was an existing bundle for the
specified location, then that bundle must still be in the state it was
prior to calling this method.</li>
</ul></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>location</code> - The location identifier of the bundle to install.</dd><dd><code>input</code> - The <code>InputStream</code> object from which this bundle will
be read or <code>null</code> to indicate the Framework must create the
input stream from the specified location identifier. The input
stream must always be closed when this method completes, even if
an exception is thrown.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The <code>Bundle</code> object of the installed bundle.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../org/osgi/framework/BundleException.html" title="class in org.osgi.framework">BundleException</a></code> - If the installation failed. BundleException types
thrown by this method include: <a href="../../../org/osgi/framework/BundleException.html#READ_ERROR"><code>BundleException.READ_ERROR</code></a>
, <a href="../../../org/osgi/framework/BundleException.html#DUPLICATE_BUNDLE_ERROR"><code>BundleException.DUPLICATE_BUNDLE_ERROR</code></a>,
<a href="../../../org/osgi/framework/BundleException.html#MANIFEST_ERROR"><code>BundleException.MANIFEST_ERROR</code></a>, and
<a href="../../../org/osgi/framework/BundleException.html#REJECTED_BY_HOOK"><code>BundleException.REJECTED_BY_HOOK</code></a>.</dd>
<dd><code>java.lang.SecurityException</code> - If the caller does not have the appropriate
<code>AdminPermission[installed bundle,LIFECYCLE]</code>, and the Java
Runtime Environment supports permissions.</dd>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd></dl>
</li>
</ul>
<a name="installBundle(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>installBundle</h4>
<pre><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a> installBundle(java.lang.String location)
throws <a href="../../../org/osgi/framework/BundleException.html" title="class in org.osgi.framework">BundleException</a></pre>
<div class="block">Installs a bundle from the specified <code>location</code> identifier.
<p>
This method performs the same function as calling
<a href="../../../org/osgi/framework/BundleContext.html#installBundle(java.lang.String,%20java.io.InputStream)"><code>installBundle(String,InputStream)</code></a> with the specified
<code>location</code> identifier and a <code>null</code> InputStream.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>location</code> - The location identifier of the bundle to install.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The <code>Bundle</code> object of the installed bundle.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../org/osgi/framework/BundleException.html" title="class in org.osgi.framework">BundleException</a></code> - If the installation failed. BundleException types
thrown by this method include: <a href="../../../org/osgi/framework/BundleException.html#READ_ERROR"><code>BundleException.READ_ERROR</code></a>
, <a href="../../../org/osgi/framework/BundleException.html#DUPLICATE_BUNDLE_ERROR"><code>BundleException.DUPLICATE_BUNDLE_ERROR</code></a>,
<a href="../../../org/osgi/framework/BundleException.html#MANIFEST_ERROR"><code>BundleException.MANIFEST_ERROR</code></a>, and
<a href="../../../org/osgi/framework/BundleException.html#REJECTED_BY_HOOK"><code>BundleException.REJECTED_BY_HOOK</code></a>.</dd>
<dd><code>java.lang.SecurityException</code> - If the caller does not have the appropriate
<code>AdminPermission[installed bundle,LIFECYCLE]</code>, and the Java
Runtime Environment supports permissions.</dd>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/BundleContext.html#installBundle(java.lang.String,%20java.io.InputStream)"><code>installBundle(String, InputStream)</code></a></dd></dl>
</li>
</ul>
<a name="getBundle(long)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBundle</h4>
<pre><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a> getBundle(long id)</pre>
<div class="block">Returns the bundle with the specified identifier.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>id</code> - The identifier of the bundle to retrieve.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <code>Bundle</code> object or <code>null</code> if the identifier does
not match any installed bundle.</dd></dl>
</li>
</ul>
<a name="getBundles()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBundles</h4>
<pre><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a>[] getBundles()</pre>
<div class="block">Returns a list of all installed bundles.
<p>
This method returns a list of all bundles installed in the OSGi
environment at the time of the call to this method. However, since the
Framework is a very dynamic environment, bundles can be installed or
uninstalled at anytime.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>An array of <code>Bundle</code> objects, one object per installed
bundle.</dd></dl>
</li>
</ul>
<a name="addServiceListener(org.osgi.framework.ServiceListener, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addServiceListener</h4>
<pre>void addServiceListener(<a href="../../../org/osgi/framework/ServiceListener.html" title="interface in org.osgi.framework">ServiceListener</a> listener,
java.lang.String filter)
throws <a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework">InvalidSyntaxException</a></pre>
<div class="block">Adds the specified <code>ServiceListener</code> object with the specified
<code>filter</code> to the context bundle's list of listeners. See
<a href="../../../org/osgi/framework/Filter.html" title="interface in org.osgi.framework"><code>Filter</code></a> for a description of the filter syntax.
<code>ServiceListener</code> objects are notified when a service has a
lifecycle state change.
<p>
If the context bundle's list of listeners already contains a listener
<code>l</code> such that <code>(l==listener)</code>, then this method replaces that
listener's filter (which may be <code>null</code>) with the specified one
(which may be <code>null</code>).
<p>
The listener is called if the filter criteria is met. To filter based
upon the class of the service, the filter should reference the
<a href="../../../org/osgi/framework/Constants.html#OBJECTCLASS"><code>Constants.OBJECTCLASS</code></a> property. If <code>filter</code> is <code>null</code>
, all services are considered to match the filter.
<p>
When using a <code>filter</code>, it is possible that the <code>ServiceEvent</code>
s for the complete lifecycle of a service will not be delivered to the
listener. For example, if the <code>filter</code> only matches when the
property <code>x</code> has the value <code>1</code>, the listener will not be
called if the service is registered with the property <code>x</code> not set
to the value <code>1</code>. Subsequently, when the service is modified
setting property <code>x</code> to the value <code>1</code>, the filter will match
and the listener will be called with a <code>ServiceEvent</code> of type
<code>MODIFIED</code>. Thus, the listener will not be called with a
<code>ServiceEvent</code> of type <code>REGISTERED</code>.
<p>
If the Java Runtime Environment supports permissions, the
<code>ServiceListener</code> object will be notified of a service event only
if the bundle that is registering it has the <code>ServicePermission</code> to
get the service using at least one of the named classes the service was
registered under.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>listener</code> - The <code>ServiceListener</code> object to be added.</dd><dd><code>filter</code> - The filter criteria.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework">InvalidSyntaxException</a></code> - If <code>filter</code> contains an invalid
filter string that cannot be parsed.</dd>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/ServiceEvent.html" title="class in org.osgi.framework"><code>ServiceEvent</code></a>,
<a href="../../../org/osgi/framework/ServiceListener.html" title="interface in org.osgi.framework"><code>ServiceListener</code></a>,
<a href="../../../org/osgi/framework/ServicePermission.html" title="class in org.osgi.framework"><code>ServicePermission</code></a></dd></dl>
</li>
</ul>
<a name="addServiceListener(org.osgi.framework.ServiceListener)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addServiceListener</h4>
<pre>void addServiceListener(<a href="../../../org/osgi/framework/ServiceListener.html" title="interface in org.osgi.framework">ServiceListener</a> listener)</pre>
<div class="block">Adds the specified <code>ServiceListener</code> object to the context bundle's
list of listeners.
<p>
This method is the same as calling
<code>BundleContext.addServiceListener(ServiceListener listener,
String filter)</code> with <code>filter</code> set to <code>null</code>.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>listener</code> - The <code>ServiceListener</code> object to be added.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/BundleContext.html#addServiceListener(org.osgi.framework.ServiceListener,%20java.lang.String)"><code>addServiceListener(ServiceListener, String)</code></a></dd></dl>
</li>
</ul>
<a name="removeServiceListener(org.osgi.framework.ServiceListener)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeServiceListener</h4>
<pre>void removeServiceListener(<a href="../../../org/osgi/framework/ServiceListener.html" title="interface in org.osgi.framework">ServiceListener</a> listener)</pre>
<div class="block">Removes the specified <code>ServiceListener</code> object from the context
bundle's list of listeners.
<p>
If <code>listener</code> is not contained in this context bundle's list of
listeners, this method does nothing.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>listener</code> - The <code>ServiceListener</code> to be removed.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd></dl>
</li>
</ul>
<a name="addBundleListener(org.osgi.framework.BundleListener)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addBundleListener</h4>
<pre>void addBundleListener(<a href="../../../org/osgi/framework/BundleListener.html" title="interface in org.osgi.framework">BundleListener</a> listener)</pre>
<div class="block">Adds the specified <code>BundleListener</code> object to the context bundle's
list of listeners if not already present. BundleListener objects are
notified when a bundle has a lifecycle state change.
<p>
If the context bundle's list of listeners already contains a listener
<code>l</code> such that <code>(l==listener)</code>, this method does nothing.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>listener</code> - The <code>BundleListener</code> to be added.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd>
<dd><code>java.lang.SecurityException</code> - If listener is a
<code>SynchronousBundleListener</code> and the caller does not have
the appropriate <code>AdminPermission[context bundle,LISTENER]</code>,
and the Java Runtime Environment supports permissions.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/BundleEvent.html" title="class in org.osgi.framework"><code>BundleEvent</code></a>,
<a href="../../../org/osgi/framework/BundleListener.html" title="interface in org.osgi.framework"><code>BundleListener</code></a></dd></dl>
</li>
</ul>
<a name="removeBundleListener(org.osgi.framework.BundleListener)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeBundleListener</h4>
<pre>void removeBundleListener(<a href="../../../org/osgi/framework/BundleListener.html" title="interface in org.osgi.framework">BundleListener</a> listener)</pre>
<div class="block">Removes the specified <code>BundleListener</code> object from the context
bundle's list of listeners.
<p>
If <code>listener</code> is not contained in the context bundle's list of
listeners, this method does nothing.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>listener</code> - The <code>BundleListener</code> object to be removed.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd>
<dd><code>java.lang.SecurityException</code> - If listener is a
<code>SynchronousBundleListener</code> and the caller does not have
the appropriate <code>AdminPermission[context bundle,LISTENER]</code>,
and the Java Runtime Environment supports permissions.</dd></dl>
</li>
</ul>
<a name="addFrameworkListener(org.osgi.framework.FrameworkListener)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>addFrameworkListener</h4>
<pre>void addFrameworkListener(<a href="../../../org/osgi/framework/FrameworkListener.html" title="interface in org.osgi.framework">FrameworkListener</a> listener)</pre>
<div class="block">Adds the specified <code>FrameworkListener</code> object to the context
bundle's list of listeners if not already present. FrameworkListeners are
notified of general Framework events.
<p>
If the context bundle's list of listeners already contains a listener
<code>l</code> such that <code>(l==listener)</code>, this method does nothing.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>listener</code> - The <code>FrameworkListener</code> object to be added.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/FrameworkEvent.html" title="class in org.osgi.framework"><code>FrameworkEvent</code></a>,
<a href="../../../org/osgi/framework/FrameworkListener.html" title="interface in org.osgi.framework"><code>FrameworkListener</code></a></dd></dl>
</li>
</ul>
<a name="removeFrameworkListener(org.osgi.framework.FrameworkListener)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removeFrameworkListener</h4>
<pre>void removeFrameworkListener(<a href="../../../org/osgi/framework/FrameworkListener.html" title="interface in org.osgi.framework">FrameworkListener</a> listener)</pre>
<div class="block">Removes the specified <code>FrameworkListener</code> object from the context
bundle's list of listeners.
<p>
If <code>listener</code> is not contained in the context bundle's list of
listeners, this method does nothing.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>listener</code> - The <code>FrameworkListener</code> object to be removed.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd></dl>
</li>
</ul>
<a name="registerService(java.lang.String[], java.lang.Object, java.util.Dictionary)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>registerService</h4>
<pre><a href="../../../org/osgi/framework/ServiceRegistration.html" title="interface in org.osgi.framework">ServiceRegistration</a><?> registerService(java.lang.String[] clazzes,
java.lang.Object service,
java.util.Dictionary<java.lang.String,?> properties)</pre>
<div class="block">Registers the specified service object with the specified properties
under the specified class names into the Framework. A
<code>ServiceRegistration</code> object is returned. The
<code>ServiceRegistration</code> object is for the private use of the bundle
registering the service and should not be shared with other bundles. The
registering bundle is defined to be the context bundle. Other bundles can
locate the service by using one of the
<a href="../../../org/osgi/framework/BundleContext.html#getServiceReferences(java.lang.Class,%20java.lang.String)"><code>getServiceReferences(Class, String)</code></a>,
<a href="../../../org/osgi/framework/BundleContext.html#getServiceReferences(java.lang.String,%20java.lang.String)"><code>getServiceReferences(String, String)</code></a>,
<a href="../../../org/osgi/framework/BundleContext.html#getServiceReference(java.lang.Class)"><code>getServiceReference(Class)</code></a> or
<a href="../../../org/osgi/framework/BundleContext.html#getServiceReference(java.lang.String)"><code>getServiceReference(String)</code></a> methods.
<p>
A bundle can register a service object that implements the
<a href="../../../org/osgi/framework/ServiceFactory.html" title="interface in org.osgi.framework"><code>ServiceFactory</code></a> interface to have more flexibility in providing
service objects to other bundles.
<p>
The following steps are required to register a service:
<ol>
<li>If <code>service</code> does not implement <code>ServiceFactory</code>, an
<code>IllegalArgumentException</code> is thrown if <code>service</code> is not an
<code>instanceof</code> all the specified class names.</li>
<li>The Framework adds the following service properties to the service
properties from the specified <code>Dictionary</code> (which may be
<code>null</code>):
<ul>
<li>A property named <a href="../../../org/osgi/framework/Constants.html#SERVICE_ID"><code>Constants.SERVICE_ID</code></a> identifying the
registration number of the service</li>
<li>A property named <a href="../../../org/osgi/framework/Constants.html#OBJECTCLASS"><code>Constants.OBJECTCLASS</code></a> containing all the
specified classes.</li>
<li>A property named <a href="../../../org/osgi/framework/Constants.html#SERVICE_SCOPE"><code>Constants.SERVICE_SCOPE</code></a> identifying the
scope of the service.</li>
<li>A property named <a href="../../../org/osgi/framework/Constants.html#SERVICE_BUNDLEID"><code>Constants.SERVICE_BUNDLEID</code></a> identifying the
the context bundle.</li>
</ul>
Properties with these names in the specified <code>Dictionary</code> will be
ignored.</li>
<li>The service is added to the Framework service registry and may now be
used by other bundles.</li>
<li>A service event of type <a href="../../../org/osgi/framework/ServiceEvent.html#REGISTERED"><code>ServiceEvent.REGISTERED</code></a> is fired.</li>
<li>A <code>ServiceRegistration</code> object for this registration is
returned.</li>
</ol></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>clazzes</code> - The class names under which the service can be located.
The class names in this array will be stored in the service's
properties under the key <a href="../../../org/osgi/framework/Constants.html#OBJECTCLASS"><code>Constants.OBJECTCLASS</code></a>.</dd><dd><code>service</code> - The service object or an object implementing
<code>ServiceFactory</code>.</dd><dd><code>properties</code> - The properties for this service. The keys in the
properties object must all be <code>String</code> objects. See
<a href="../../../org/osgi/framework/Constants.html" title="interface in org.osgi.framework"><code>Constants</code></a> for a list of standard service property keys.
Changes should not be made to this object after calling this
method. To update the service's properties the
<a href="../../../org/osgi/framework/ServiceRegistration.html#setProperties(java.util.Dictionary)"><code>ServiceRegistration.setProperties(Dictionary)</code></a> method must
be called. The set of properties may be <code>null</code> if the
service has no properties.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <code>ServiceRegistration</code> object for use by the bundle
registering the service to update the service's properties or to
unregister the service.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalArgumentException</code> - If one of the following is true:
<ul>
<li><code>service</code> is <code>null</code>.</li><li><code>service</code> does
not implement <code>ServiceFactory</code> and is not an instance of
all the specified classes.</li><li> <code>properties</code> contains
case variants of the same key name.</li>
</ul></dd>
<dd><code>java.lang.SecurityException</code> - If the caller does not have the
<code>ServicePermission</code> to register the service for all the
named classes and the Java Runtime Environment supports
permissions.</dd>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/ServiceRegistration.html" title="interface in org.osgi.framework"><code>ServiceRegistration</code></a>,
<a href="../../../org/osgi/framework/PrototypeServiceFactory.html" title="interface in org.osgi.framework"><code>PrototypeServiceFactory</code></a>,
<a href="../../../org/osgi/framework/ServiceFactory.html" title="interface in org.osgi.framework"><code>ServiceFactory</code></a></dd></dl>
</li>
</ul>
<a name="registerService(java.lang.String, java.lang.Object, java.util.Dictionary)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>registerService</h4>
<pre><a href="../../../org/osgi/framework/ServiceRegistration.html" title="interface in org.osgi.framework">ServiceRegistration</a><?> registerService(java.lang.String clazz,
java.lang.Object service,
java.util.Dictionary<java.lang.String,?> properties)</pre>
<div class="block">Registers the specified service object with the specified properties
under the specified class name with the Framework.
<p>
This method is otherwise identical to
<a href="../../../org/osgi/framework/BundleContext.html#registerService(java.lang.String[],%20java.lang.Object,%20java.util.Dictionary)"><code>registerService(String[], Object, Dictionary)</code></a> and is provided as
a convenience when <code>service</code> will only be registered under a single
class name. Note that even in this case the value of the service's
<a href="../../../org/osgi/framework/Constants.html#OBJECTCLASS"><code>Constants.OBJECTCLASS</code></a> property will be an array of string, rather
than just a single string.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>clazz</code> - The class name under which the service can be located.</dd><dd><code>service</code> - The service object or an object implementing
<code>ServiceFactory</code>.</dd><dd><code>properties</code> - The properties for this service.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <code>ServiceRegistration</code> object for use by the bundle
registering the service to update the service's properties or to
unregister the service.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/BundleContext.html#registerService(java.lang.String[],%20java.lang.Object,%20java.util.Dictionary)"><code>registerService(String[], Object, Dictionary)</code></a></dd></dl>
</li>
</ul>
<a name="registerService(java.lang.Class,java.lang.Object,java.util.Dictionary)">
<!-- -->
</a><a name="registerService(java.lang.Class, S, java.util.Dictionary)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>registerService</h4>
<pre><S> <a href="../../../org/osgi/framework/ServiceRegistration.html" title="interface in org.osgi.framework">ServiceRegistration</a><S> registerService(java.lang.Class<S> clazz,
S service,
java.util.Dictionary<java.lang.String,?> properties)</pre>
<div class="block">Registers the specified service object with the specified properties
under the name of the specified class with the Framework.
<p>
This method is otherwise identical to
<a href="../../../org/osgi/framework/BundleContext.html#registerService(java.lang.String,%20java.lang.Object,%20java.util.Dictionary)"><code>registerService(String, Object, Dictionary)</code></a> and is provided to
return a type safe <code>ServiceRegistration</code>.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>S</code> - Type of Service.</dd><dt><span class="strong">Parameters:</span></dt><dd><code>clazz</code> - The class under whose name the service can be located.</dd><dd><code>service</code> - The service object or an object implementing
<code>ServiceFactory</code>.</dd><dd><code>properties</code> - The properties for this service.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <code>ServiceRegistration</code> object for use by the bundle
registering the service to update the service's properties or to
unregister the service.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.6</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/BundleContext.html#registerService(java.lang.String,%20java.lang.Object,%20java.util.Dictionary)"><code>registerService(String, Object, Dictionary)</code></a></dd></dl>
</li>
</ul>
<a name="registerService(java.lang.Class, org.osgi.framework.ServiceFactory, java.util.Dictionary)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>registerService</h4>
<pre><S> <a href="../../../org/osgi/framework/ServiceRegistration.html" title="interface in org.osgi.framework">ServiceRegistration</a><S> registerService(java.lang.Class<S> clazz,
<a href="../../../org/osgi/framework/ServiceFactory.html" title="interface in org.osgi.framework">ServiceFactory</a><S> factory,
java.util.Dictionary<java.lang.String,?> properties)</pre>
<div class="block">Registers the specified service factory object with the specified
properties under the name of the specified class with the Framework.
<p>
This method is otherwise identical to
<a href="../../../org/osgi/framework/BundleContext.html#registerService(java.lang.Class,%20S,%20java.util.Dictionary)"><code>registerService(Class, Object, Dictionary)</code></a> and is provided to
return a type safe <code>ServiceRegistration</code> when registering a
<a href="../../../org/osgi/framework/ServiceFactory.html" title="interface in org.osgi.framework"><code>ServiceFactory</code></a>.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>S</code> - Type of Service.</dd><dt><span class="strong">Parameters:</span></dt><dd><code>clazz</code> - The class under whose name the service can be located.</dd><dd><code>factory</code> - The <code>ServiceFactory</code> object.</dd><dd><code>properties</code> - The properties for this service.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <code>ServiceRegistration</code> object for use by the bundle
registering the service to update the service's properties or to
unregister the service.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.8</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/BundleContext.html#registerService(java.lang.Class,%20S,%20java.util.Dictionary)"><code>registerService(Class, Object, Dictionary)</code></a></dd></dl>
</li>
</ul>
<a name="getServiceReferences(java.lang.String, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getServiceReferences</h4>
<pre><a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><?>[] getServiceReferences(java.lang.String clazz,
java.lang.String filter)
throws <a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework">InvalidSyntaxException</a></pre>
<div class="block">Returns an array of <code>ServiceReference</code> objects. The returned array
of <code>ServiceReference</code> objects contains services that were
registered under the specified class, match the specified filter
expression, and the packages for the class names under which the services
were registered match the context bundle's packages as defined in
<a href="../../../org/osgi/framework/ServiceReference.html#isAssignableTo(org.osgi.framework.Bundle,%20java.lang.String)"><code>ServiceReference.isAssignableTo(Bundle, String)</code></a>.
<p>
The list is valid at the time of the call to this method. However since
the Framework is a very dynamic environment, services can be modified or
unregistered at any time.
<p>
The specified <code>filter</code> expression is used to select the registered
services whose service properties contain keys and values which satisfy
the filter expression. See <a href="../../../org/osgi/framework/Filter.html" title="interface in org.osgi.framework"><code>Filter</code></a> for a description of the filter
syntax. If the specified <code>filter</code> is <code>null</code>, all registered
services are considered to match the filter. If the specified
<code>filter</code> expression cannot be parsed, an
<a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework"><code>InvalidSyntaxException</code></a> will be thrown with a human readable
message where the filter became unparsable.
<p>
The result is an array of <code>ServiceReference</code> objects for all
services that meet all of the following conditions:
<ul>
<li>If the specified class name, <code>clazz</code>, is not <code>null</code>, the
service must have been registered with the specified class name. The
complete list of class names with which a service was registered is
available from the service's <a href="../../../org/osgi/framework/Constants.html#OBJECTCLASS"><code>objectClass</code></a>
property.</li>
<li>If the specified <code>filter</code> is not <code>null</code>, the filter
expression must match the service.</li>
<li>If the Java Runtime Environment supports permissions, the caller must
have <code>ServicePermission</code> with the <code>GET</code> action for at least
one of the class names under which the service was registered.</li>
<li>For each class name with which the service was registered, calling
<a href="../../../org/osgi/framework/ServiceReference.html#isAssignableTo(org.osgi.framework.Bundle,%20java.lang.String)"><code>ServiceReference.isAssignableTo(Bundle, String)</code></a> with the context
bundle and the class name on the service's <code>ServiceReference</code>
object must return <code>true</code></li>
</ul></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>clazz</code> - The class name with which the service was registered or
<code>null</code> for all services.</dd><dd><code>filter</code> - The filter expression or <code>null</code> for all services.</dd>
<dt><span class="strong">Returns:</span></dt><dd>An array of <code>ServiceReference</code> objects or <code>null</code> if
no services are registered which satisfy the search.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework">InvalidSyntaxException</a></code> - If the specified <code>filter</code> contains
an invalid filter expression that cannot be parsed.</dd>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd></dl>
</li>
</ul>
<a name="getAllServiceReferences(java.lang.String, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getAllServiceReferences</h4>
<pre><a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><?>[] getAllServiceReferences(java.lang.String clazz,
java.lang.String filter)
throws <a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework">InvalidSyntaxException</a></pre>
<div class="block">Returns an array of <code>ServiceReference</code> objects. The returned array
of <code>ServiceReference</code> objects contains services that were
registered under the specified class and match the specified filter
expression.
<p>
The list is valid at the time of the call to this method. However since
the Framework is a very dynamic environment, services can be modified or
unregistered at any time.
<p>
The specified <code>filter</code> expression is used to select the registered
services whose service properties contain keys and values which satisfy
the filter expression. See <a href="../../../org/osgi/framework/Filter.html" title="interface in org.osgi.framework"><code>Filter</code></a> for a description of the filter
syntax. If the specified <code>filter</code> is <code>null</code>, all registered
services are considered to match the filter. If the specified
<code>filter</code> expression cannot be parsed, an
<a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework"><code>InvalidSyntaxException</code></a> will be thrown with a human readable
message where the filter became unparsable.
<p>
The result is an array of <code>ServiceReference</code> objects for all
services that meet all of the following conditions:
<ul>
<li>If the specified class name, <code>clazz</code>, is not <code>null</code>, the
service must have been registered with the specified class name. The
complete list of class names with which a service was registered is
available from the service's <a href="../../../org/osgi/framework/Constants.html#OBJECTCLASS"><code>objectClass</code></a>
property.</li>
<li>If the specified <code>filter</code> is not <code>null</code>, the filter
expression must match the service.</li>
<li>If the Java Runtime Environment supports permissions, the caller must
have <code>ServicePermission</code> with the <code>GET</code> action for at least
one of the class names under which the service was registered.</li>
</ul></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>clazz</code> - The class name with which the service was registered or
<code>null</code> for all services.</dd><dd><code>filter</code> - The filter expression or <code>null</code> for all services.</dd>
<dt><span class="strong">Returns:</span></dt><dd>An array of <code>ServiceReference</code> objects or <code>null</code> if
no services are registered which satisfy the search.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework">InvalidSyntaxException</a></code> - If the specified <code>filter</code> contains
an invalid filter expression that cannot be parsed.</dd>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.3</dd></dl>
</li>
</ul>
<a name="getServiceReference(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getServiceReference</h4>
<pre><a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><?> getServiceReference(java.lang.String clazz)</pre>
<div class="block">Returns a <code>ServiceReference</code> object for a service that implements
and was registered under the specified class.
<p>
The returned <code>ServiceReference</code> object is valid at the time of the
call to this method. However as the Framework is a very dynamic
environment, services can be modified or unregistered at any time.
<p>
This method is the same as calling
<a href="../../../org/osgi/framework/BundleContext.html#getServiceReferences(java.lang.String,%20java.lang.String)"><code>getServiceReferences(String, String)</code></a> with a <code>null</code> filter
expression and then finding the reference with the highest priority. It
is provided as a convenience for when the caller is interested in any
service that implements the specified class.
<p>
If multiple such services exist, the service with the highest priority is
selected. This priority is defined as the service reference with the
highest ranking (as specified in its <a href="../../../org/osgi/framework/Constants.html#SERVICE_RANKING"><code>Constants.SERVICE_RANKING</code></a>
property) is returned.
<p>
If there is a tie in ranking, the service with the lowest service id (as
specified in its <a href="../../../org/osgi/framework/Constants.html#SERVICE_ID"><code>Constants.SERVICE_ID</code></a> property); that is, the
service that was registered first is returned.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>clazz</code> - The class name with which the service was registered.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <code>ServiceReference</code> object, or <code>null</code> if no services
are registered which implement the named class.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/BundleContext.html#getServiceReferences(java.lang.String,%20java.lang.String)"><code>getServiceReferences(String, String)</code></a></dd></dl>
</li>
</ul>
<a name="getServiceReference(java.lang.Class)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getServiceReference</h4>
<pre><S> <a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><S> getServiceReference(java.lang.Class<S> clazz)</pre>
<div class="block">Returns a <code>ServiceReference</code> object for a service that implements
and was registered under the name of the specified class.
<p>
The returned <code>ServiceReference</code> object is valid at the time of the
call to this method. However as the Framework is a very dynamic
environment, services can be modified or unregistered at any time.
<p>
This method is the same as calling
<a href="../../../org/osgi/framework/BundleContext.html#getServiceReferences(java.lang.Class,%20java.lang.String)"><code>getServiceReferences(Class, String)</code></a> with a <code>null</code> filter
expression. It is provided as a convenience for when the caller is
interested in any service that implements the specified class.
<p>
If multiple such services exist, the service with the highest ranking (as
specified in its <a href="../../../org/osgi/framework/Constants.html#SERVICE_RANKING"><code>Constants.SERVICE_RANKING</code></a> property) is returned.
<p>
If there is a tie in ranking, the service with the lowest service id (as
specified in its <a href="../../../org/osgi/framework/Constants.html#SERVICE_ID"><code>Constants.SERVICE_ID</code></a> property); that is, the
service that was registered first is returned.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>S</code> - Type of Service.</dd><dt><span class="strong">Parameters:</span></dt><dd><code>clazz</code> - The class under whose name the service was registered. Must
not be <code>null</code>.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <code>ServiceReference</code> object, or <code>null</code> if no services
are registered which implement the specified class.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.6</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/BundleContext.html#getServiceReferences(java.lang.Class,%20java.lang.String)"><code>getServiceReferences(Class, String)</code></a></dd></dl>
</li>
</ul>
<a name="getServiceReferences(java.lang.Class, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getServiceReferences</h4>
<pre><S> java.util.Collection<<a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><S>> getServiceReferences(java.lang.Class<S> clazz,
java.lang.String filter)
throws <a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework">InvalidSyntaxException</a></pre>
<div class="block">Returns a collection of <code>ServiceReference</code> objects. The returned
collection of <code>ServiceReference</code> objects contains services that
were registered under the name of the specified class, match the
specified filter expression, and the packages for the class names under
which the services were registered match the context bundle's packages as
defined in <a href="../../../org/osgi/framework/ServiceReference.html#isAssignableTo(org.osgi.framework.Bundle,%20java.lang.String)"><code>ServiceReference.isAssignableTo(Bundle, String)</code></a>.
<p>
The collection is valid at the time of the call to this method. However
since the Framework is a very dynamic environment, services can be
modified or unregistered at any time.
<p>
The specified <code>filter</code> expression is used to select the registered
services whose service properties contain keys and values which satisfy
the filter expression. See <a href="../../../org/osgi/framework/Filter.html" title="interface in org.osgi.framework"><code>Filter</code></a> for a description of the filter
syntax. If the specified <code>filter</code> is <code>null</code>, all registered
services are considered to match the filter. If the specified
<code>filter</code> expression cannot be parsed, an
<a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework"><code>InvalidSyntaxException</code></a> will be thrown with a human readable
message where the filter became unparsable.
<p>
The result is a collection of <code>ServiceReference</code> objects for all
services that meet all of the following conditions:
<ul>
<li>The service must have been registered with the name of the specified
class. The complete list of class names with which a service was
registered is available from the service's <a href="../../../org/osgi/framework/Constants.html#OBJECTCLASS"><code>objectClass</code></a> property.</li>
<li>If the specified <code>filter</code> is not <code>null</code>, the filter
expression must match the service.</li>
<li>If the Java Runtime Environment supports permissions, the caller must
have <code>ServicePermission</code> with the <code>GET</code> action for at least
one of the class names under which the service was registered.</li>
<li>For each class name with which the service was registered, calling
<a href="../../../org/osgi/framework/ServiceReference.html#isAssignableTo(org.osgi.framework.Bundle,%20java.lang.String)"><code>ServiceReference.isAssignableTo(Bundle, String)</code></a> with the context
bundle and the class name on the service's <code>ServiceReference</code>
object must return <code>true</code></li>
</ul></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>S</code> - Type of Service</dd><dt><span class="strong">Parameters:</span></dt><dd><code>clazz</code> - The class under whose name the service was registered. Must
not be <code>null</code>.</dd><dd><code>filter</code> - The filter expression or <code>null</code> for all services.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A collection of <code>ServiceReference</code> objects. May be empty if
no services are registered which satisfy the search.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework">InvalidSyntaxException</a></code> - If the specified <code>filter</code> contains
an invalid filter expression that cannot be parsed.</dd>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.6</dd></dl>
</li>
</ul>
<a name="getService(org.osgi.framework.ServiceReference)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getService</h4>
<pre><S> S getService(<a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><S> reference)</pre>
<div class="block">Returns the service object for the service referenced by the specified
<code>ServiceReference</code> object.
<p>
A bundle's use of a service object obtained from this method is tracked
by the bundle's use count of that service. Each time the service object
is returned by <a href="../../../org/osgi/framework/BundleContext.html#getService(org.osgi.framework.ServiceReference)"><code>getService(ServiceReference)</code></a> the context bundle's
use count for the service is incremented by one. Each time the service
object is released by <a href="../../../org/osgi/framework/BundleContext.html#ungetService(org.osgi.framework.ServiceReference)"><code>ungetService(ServiceReference)</code></a> the context
bundle's use count for the service is decremented by one.
<p>
When a bundle's use count for the service drops to zero, the bundle
should no longer use the service object.
<p>
This method will always return <code>null</code> when the service associated
with the specified <code>reference</code> has been unregistered.
<p>
The following steps are required to get the service object:
<ol>
<li>If the service has been unregistered, <code>null</code> is returned.</li>
<li>If the context bundle's use count for the service is currently zero
and the service has <a href="../../../org/osgi/framework/Constants.html#SCOPE_BUNDLE"><code>bundle</code></a> or
<a href="../../../org/osgi/framework/Constants.html#SCOPE_PROTOTYPE"><code>prototype</code></a> scope, the
<a href="../../../org/osgi/framework/ServiceFactory.html#getService(org.osgi.framework.Bundle,%20org.osgi.framework.ServiceRegistration)"><code>ServiceFactory.getService(Bundle, ServiceRegistration)</code></a> method is
called to supply the service object for the context bundle. If the
service object returned by the <code>ServiceFactory</code> object is
<code>null</code>, not an <code>instanceof</code> all the classes named when the
service was registered or the <code>ServiceFactory</code> object throws an
exception or will be recursively called for the context bundle,
<code>null</code> is returned and a Framework event of type
<a href="../../../org/osgi/framework/FrameworkEvent.html#ERROR"><code>FrameworkEvent.ERROR</code></a> containing a <a href="../../../org/osgi/framework/ServiceException.html" title="class in org.osgi.framework"><code>ServiceException</code></a>
describing the error is fired. The supplied service object is cached by
the Framework. While the context bundle's use count for the service is
greater than zero, subsequent calls to get the service object for the
context bundle will return the cached service object.</li>
<li>The context bundle's use count for the service is incremented by one.
</li>
<li>The service object for the service is returned.</li>
</ol></div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>S</code> - Type of Service.</dd><dt><span class="strong">Parameters:</span></dt><dd><code>reference</code> - A reference to the service.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A service object for the service associated with
<code>reference</code> or <code>null</code> if the service is not
registered, the service object returned by a
<code>ServiceFactory</code> does not implement the classes under which
it was registered or the <code>ServiceFactory</code> threw an
exception.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.SecurityException</code> - If the caller does not have the
<code>ServicePermission</code> to get the service using at least one
of the named classes the service was registered under and the
Java Runtime Environment supports permissions.</dd>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If the specified
<code>ServiceReference</code> was not created by the same framework
instance as this <code>BundleContext</code>.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/BundleContext.html#ungetService(org.osgi.framework.ServiceReference)"><code>ungetService(ServiceReference)</code></a>,
<a href="../../../org/osgi/framework/ServiceFactory.html" title="interface in org.osgi.framework"><code>ServiceFactory</code></a></dd></dl>
</li>
</ul>
<a name="ungetService(org.osgi.framework.ServiceReference)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>ungetService</h4>
<pre>boolean ungetService(<a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><?> reference)</pre>
<div class="block">Releases the service object for the service referenced by the specified
<code>ServiceReference</code> object. If the context bundle's use count for
the service is zero, this method returns <code>false</code>. Otherwise, the
context bundle's use count for the service is decremented by one.
<p>
The service object must no longer be used and all references to it should
be destroyed when a bundle's use count for the service drops to zero.
<p>
The following steps are required to release the service object:
<ol>
<li>If the context bundle's use count for the service is zero or the
service has been unregistered, <code>false</code> is returned.</li>
<li>The context bundle's use count for the service is decremented by one.
</li>
<li>If the context bundle's use count for the service is now zero and the
service has <a href="../../../org/osgi/framework/Constants.html#SCOPE_BUNDLE"><code>bundle</code></a> or
<a href="../../../org/osgi/framework/Constants.html#SCOPE_PROTOTYPE"><code>prototype</code></a> scope, the
<a href="../../../org/osgi/framework/ServiceFactory.html#ungetService(org.osgi.framework.Bundle,%20org.osgi.framework.ServiceRegistration,%20S)"><code>ServiceFactory.ungetService(Bundle, ServiceRegistration, Object)</code></a>
method is called to release the service object for the context bundle.</li>
<li><code>true</code> is returned.</li>
</ol></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>reference</code> - A reference to the service to be released.</dd>
<dt><span class="strong">Returns:</span></dt><dd><code>false</code> if the context bundle's use count for the service
is zero or if the service has been unregistered; <code>true</code>
otherwise.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If the specified
<code>ServiceReference</code> was not created by the same framework
instance as this <code>BundleContext</code>.</dd><dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/BundleContext.html#getService(org.osgi.framework.ServiceReference)"><code>getService(ServiceReference)</code></a>,
<a href="../../../org/osgi/framework/ServiceFactory.html" title="interface in org.osgi.framework"><code>ServiceFactory</code></a></dd></dl>
</li>
</ul>
<a name="getServiceObjects(org.osgi.framework.ServiceReference)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getServiceObjects</h4>
<pre><S> <a href="../../../org/osgi/framework/ServiceObjects.html" title="interface in org.osgi.framework">ServiceObjects</a><S> getServiceObjects(<a href="../../../org/osgi/framework/ServiceReference.html" title="interface in org.osgi.framework">ServiceReference</a><S> reference)</pre>
<div class="block">Returns the <a href="../../../org/osgi/framework/ServiceObjects.html" title="interface in org.osgi.framework"><code>ServiceObjects</code></a> object for the service referenced by
the specified <code>ServiceReference</code> object.
<p>
The <a href="../../../org/osgi/framework/ServiceObjects.html" title="interface in org.osgi.framework"><code>ServiceObjects</code></a> object can be used to obtain multiple service
objects for services with <a href="../../../org/osgi/framework/Constants.html#SCOPE_PROTOTYPE"><code>prototype</code></a>
scope.
<p>
For services with <a href="../../../org/osgi/framework/Constants.html#SCOPE_SINGLETON"><code>singleton</code></a> or
<a href="../../../org/osgi/framework/Constants.html#SCOPE_BUNDLE"><code>bundle</code></a> scope, the
<a href="../../../org/osgi/framework/ServiceObjects.html#getService()"><code>ServiceObjects.getService()</code></a> method behaves the same as the
<a href="../../../org/osgi/framework/BundleContext.html#getService(org.osgi.framework.ServiceReference)"><code>getService(ServiceReference)</code></a> method and the
<a href="../../../org/osgi/framework/ServiceObjects.html#ungetService(S)"><code>ServiceObjects.ungetService(Object)</code></a> method behaves the same as
the <a href="../../../org/osgi/framework/BundleContext.html#ungetService(org.osgi.framework.ServiceReference)"><code>ungetService(ServiceReference)</code></a> method. That is, only one,
use-counted service object is available from the <a href="../../../org/osgi/framework/ServiceObjects.html" title="interface in org.osgi.framework"><code>ServiceObjects</code></a>
object.
<p>
This method will always return <code>null</code> when the service associated
with the specified <code>reference</code> has been unregistered.</div>
<dl><dt><span class="strong">Type Parameters:</span></dt><dd><code>S</code> - Type of Service.</dd><dt><span class="strong">Parameters:</span></dt><dd><code>reference</code> - A reference to the service.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <a href="../../../org/osgi/framework/ServiceObjects.html" title="interface in org.osgi.framework"><code>ServiceObjects</code></a> object for the service associated with
the specified <code>reference</code> or <code>null</code> if the service is
not registered.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.SecurityException</code> - If the caller does not have the
<code>ServicePermission</code> to get the service using at least one
of the named classes the service was registered under and the
Java Runtime Environment supports permissions.</dd>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd>
<dd><code>java.lang.IllegalArgumentException</code> - If the specified
<code>ServiceReference</code> was not created by the same framework
instance as this <code>BundleContext</code>.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.8</dd>
<dt><span class="strong">See Also:</span></dt><dd><a href="../../../org/osgi/framework/PrototypeServiceFactory.html" title="interface in org.osgi.framework"><code>PrototypeServiceFactory</code></a></dd></dl>
</li>
</ul>
<a name="getDataFile(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getDataFile</h4>
<pre>java.io.File getDataFile(java.lang.String filename)</pre>
<div class="block">Creates a <code>File</code> object for a file in the persistent storage area
provided for the bundle by the Framework. This method will return
<code>null</code> if the platform does not have file system support.
<p>
A <code>File</code> object for the base directory of the persistent storage
area provided for the context bundle by the Framework can be obtained by
calling this method with an empty string as <code>filename</code>.
<p>
If the Java Runtime Environment supports permissions, the Framework will
ensure that the bundle has the <code>java.io.FilePermission</code> with
actions <code>read</code>,<code>write</code>,<code>delete</code> for all files
(recursively) in the persistent storage area provided for the context
bundle.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>filename</code> - A relative name to the file to be accessed.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <code>File</code> object that represents the requested file or
<code>null</code> if the platform does not have file system support.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd></dl>
</li>
</ul>
<a name="createFilter(java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>createFilter</h4>
<pre><a href="../../../org/osgi/framework/Filter.html" title="interface in org.osgi.framework">Filter</a> createFilter(java.lang.String filter)
throws <a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework">InvalidSyntaxException</a></pre>
<div class="block">Creates a <code>Filter</code> object. This <code>Filter</code> object may be used
to match a <code>ServiceReference</code> object or a <code>Dictionary</code>
object.
<p>
If the filter cannot be parsed, an <a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework"><code>InvalidSyntaxException</code></a> will be
thrown with a human readable message where the filter became unparsable.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>filter</code> - The filter string.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <code>Filter</code> object encapsulating the filter string.</dd>
<dt><span class="strong">Throws:</span></dt>
<dd><code><a href="../../../org/osgi/framework/InvalidSyntaxException.html" title="class in org.osgi.framework">InvalidSyntaxException</a></code> - If <code>filter</code> contains an invalid
filter string that cannot be parsed.</dd>
<dd><code>java.lang.NullPointerException</code> - If <code>filter</code> is null.</dd>
<dd><code>java.lang.IllegalStateException</code> - If this BundleContext is no longer valid.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.1</dd>
<dt><span class="strong">See Also:</span></dt><dd>"Framework specification for a description of the filter string syntax.",
<a href="../../../org/osgi/framework/FrameworkUtil.html#createFilter(java.lang.String)"><code>FrameworkUtil.createFilter(String)</code></a></dd></dl>
</li>
</ul>
<a name="getBundle(java.lang.String)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>getBundle</h4>
<pre><a href="../../../org/osgi/framework/Bundle.html" title="interface in org.osgi.framework">Bundle</a> getBundle(java.lang.String location)</pre>
<div class="block">Returns the bundle with the specified location.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>location</code> - The location of the bundle to retrieve.</dd>
<dt><span class="strong">Returns:</span></dt><dd>A <code>Bundle</code> object or <code>null</code> if the location does not
match any installed bundle.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.6</dd></dl>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<!-- ========= END OF CLASS DATA ========= -->
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<div class="bottomNav"><a name="navbar_bottom">
<!-- -->
</a><a href="#skip-navbar_bottom" title="Skip navigation links"></a><a name="navbar_bottom_firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../overview-summary.html">Overview</a></li>
<li><a href="package-summary.html">Package</a></li>
<li class="navBarCell1Rev">Class</li>
<li><a href="package-tree.html">Tree</a></li>
<li><a href="../../../deprecated-list.html">Deprecated</a></li>
<li><a href="../../../index-all.html">Index</a></li>
<li><a href="../../../help-doc.html">Help</a></li>
</ul>
</div>
<div class="subNav">
<ul class="navList">
<li><a href="../../../org/osgi/framework/BundleActivator.html" title="interface in org.osgi.framework"><span class="strong">Prev Class</span></a></li>
<li><a href="../../../org/osgi/framework/BundleEvent.html" title="class in org.osgi.framework"><span class="strong">Next Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/osgi/framework/BundleContext.html" target="_top">Frames</a></li>
<li><a href="BundleContext.html" target="_top">No Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../allclasses-noframe.html">All Classes</a></li>
</ul>
<div>
<script type="text/javascript"><!--
allClassesLink = document.getElementById("allclasses_navbar_bottom");
if(window==top) {
allClassesLink.style.display = "block";
}
else {
allClassesLink.style.display = "none";
}
//-->
</script>
</div>
<div>
<ul class="subNavList">
<li>Summary: </li>
<li>Nested | </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail: </li>
<li>Field | </li>
<li>Constr | </li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>
|