blob: ba7dca798c8be3a0d970bdc2783db9c030bc5a8d [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="de">
<head>
<!-- Generated by javadoc (version 1.7.0_25) on Mon Jul 01 14:53:29 CEST 2013 -->
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>ServiceReference (Apache Felix Configuration Admin Service 1.4.0 API)</title>
<meta name="date" content="2013-07-01">
<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="ServiceReference (Apache Felix Configuration Admin Service 1.4.0 API)";
}
//-->
</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="class-use/ServiceReference.html">Use</a></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>Prev Class</li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/osgi/framework/ServiceReference.html" target="_top">Frames</a></li>
<li><a href="ServiceReference.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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</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 ServiceReference" class="title">Interface ServiceReference&lt;T&gt;</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<dl>
<dt>All Superinterfaces:</dt>
<dd><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a></dd>
</dl>
<hr>
<br>
<pre>public interface <span class="strong">ServiceReference&lt;T&gt;</span>
extends <a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a></pre>
<div class="block">A reference to a service.
<p>
The Framework returns <code>ServiceReference</code> objects from the
<code>BundleContext.getServiceReference</code> and
<code>BundleContext.getServiceReferences</code> methods.
<p>
A <code>ServiceReference</code> object may be shared between bundles and
can be used to examine the properties of the service and to get the service
object.
<p>
Every service registered in the Framework has a unique
<code>ServiceRegistration</code> object and may have multiple, distinct
<code>ServiceReference</code> objects referring to it.
<code>ServiceReference</code> objects associated with a
<code>ServiceRegistration</code> object have the same <code>hashCode</code>
and are considered equal (more specifically, their <code>equals()</code>
method will return <code>true</code> when compared).
<p>
If the same service object is registered multiple times,
<code>ServiceReference</code> objects associated with different
<code>ServiceRegistration</code> objects are not equal.</div>
<dl><dt><span class="strong">Version:</span></dt>
<dd>$Revision: 1.20 $</dd>
<dt><span class="strong">See Also:</span></dt><dd><code>BundleContext.getServiceReference(java.lang.String)</code>,
<code>BundleContext.getServiceReferences(java.lang.String, java.lang.String)</code>,
<code>BundleContext.getService(org.osgi.framework.ServiceReference)</code></dd></dl>
</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">&nbsp;</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>int</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/ServiceReference.html#compareTo(java.lang.Object)">compareTo</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;reference)</code>
<div class="block">Compares this <code>ServiceReference</code> with the specified
<code>ServiceReference</code> for order.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>org.osgi.framework.Bundle</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/ServiceReference.html#getBundle()">getBundle</a></strong>()</code>
<div class="block">Returns the bundle that registered the service referenced by this
<code>ServiceReference</code> object.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a></code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/ServiceReference.html#getProperty(java.lang.String)">getProperty</a></strong>(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;key)</code>
<div class="block">Returns the property value to which the specified property key is mapped
in the properties <code>Dictionary</code> object of the service
referenced by this <code>ServiceReference</code> object.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/ServiceReference.html#getPropertyKeys()">getPropertyKeys</a></strong>()</code>
<div class="block">Returns an array of the keys in the properties <code>Dictionary</code>
object of the service referenced by this <code>ServiceReference</code>
object.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>org.osgi.framework.Bundle[]</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/ServiceReference.html#getUsingBundles()">getUsingBundles</a></strong>()</code>
<div class="block">Returns the bundles that are using the service referenced by this
<code>ServiceReference</code> object.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>boolean</code></td>
<td class="colLast"><code><strong><a href="../../../org/osgi/framework/ServiceReference.html#isAssignableTo(org.osgi.framework.Bundle, java.lang.String)">isAssignableTo</a></strong>(org.osgi.framework.Bundle&nbsp;bundle,
<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;className)</code>
<div class="block">Tests if the bundle that registered the service referenced by this
<code>ServiceReference</code> and the specified bundle use the same
source for the package of the specified class name.</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><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;getProperty(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;key)</pre>
<div class="block">Returns the property value to which the specified property key is mapped
in the properties <code>Dictionary</code> object of the service
referenced by this <code>ServiceReference</code> object.
<p>
Property keys are case-insensitive.
<p>
This method must continue to return property values after the service has
been unregistered. This is so references to unregistered services (for
example, <code>ServiceReference</code> objects stored in the log) can
still be interrogated.</div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>key</code> - The property key.</dd>
<dt><span class="strong">Returns:</span></dt><dd>The property value to which the key is mapped; <code>null</code>
if there is no property named after the key.</dd></dl>
</li>
</ul>
<a name="getPropertyKeys()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getPropertyKeys</h4>
<pre><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>[]&nbsp;getPropertyKeys()</pre>
<div class="block">Returns an array of the keys in the properties <code>Dictionary</code>
object of the service referenced by this <code>ServiceReference</code>
object.
<p>
This method will continue to return the keys after the service has been
unregistered. This is so references to unregistered services (for
example, <code>ServiceReference</code> objects stored in the log) can
still be interrogated.
<p>
This method is <i>case-preserving </i>; this means that every key in the
returned array must have the same case as the corresponding key in the
properties <code>Dictionary</code> that was passed to the
<code>BundleContext.registerService(String[],Object,java.util.Dictionary)</code>
or <code>ServiceRegistration.setProperties(java.util.Dictionary)</code> methods.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>An array of property keys.</dd></dl>
</li>
</ul>
<a name="getBundle()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getBundle</h4>
<pre>org.osgi.framework.Bundle&nbsp;getBundle()</pre>
<div class="block">Returns the bundle that registered the service referenced by this
<code>ServiceReference</code> object.
<p>
This method must return <code>null</code> when the service has been
unregistered. This can be used to determine if the service has been
unregistered.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>The bundle that registered the service referenced by this
<code>ServiceReference</code> object; <code>null</code> if
that service has already been unregistered.</dd><dt><span class="strong">See Also:</span></dt><dd><code>BundleContext.registerService(String[],Object,java.util.Dictionary)</code></dd></dl>
</li>
</ul>
<a name="getUsingBundles()">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>getUsingBundles</h4>
<pre>org.osgi.framework.Bundle[]&nbsp;getUsingBundles()</pre>
<div class="block">Returns the bundles that are using the service referenced by this
<code>ServiceReference</code> object. Specifically, this method returns
the bundles whose usage count for that service is greater than zero.</div>
<dl><dt><span class="strong">Returns:</span></dt><dd>An array of bundles whose usage count for the service referenced
by this <code>ServiceReference</code> object is greater than
zero; <code>null</code> if no bundles are currently using that
service.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.1</dd></dl>
</li>
</ul>
<a name="isAssignableTo(org.osgi.framework.Bundle, java.lang.String)">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>isAssignableTo</h4>
<pre>boolean&nbsp;isAssignableTo(org.osgi.framework.Bundle&nbsp;bundle,
<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/String.html?is-external=true" title="class or interface in java.lang">String</a>&nbsp;className)</pre>
<div class="block">Tests if the bundle that registered the service referenced by this
<code>ServiceReference</code> and the specified bundle use the same
source for the package of the specified class name.
<p>
This method performs the following checks:
<ol>
<li>Get the package name from the specified class name.</li>
<li>For the bundle that registered the service referenced by this
<code>ServiceReference</code> (registrant bundle); find the source for
the package. If no source is found then return <code>true</code> if the
registrant bundle is equal to the specified bundle; otherwise return
<code>false</code>.</li>
<li>If the package source of the registrant bundle is equal to the
package source of the specified bundle then return <code>true</code>;
otherwise return <code>false</code>.</li>
</ol></div>
<dl><dt><span class="strong">Parameters:</span></dt><dd><code>bundle</code> - The <code>Bundle</code> object to check.</dd><dd><code>className</code> - The class name to check.</dd>
<dt><span class="strong">Returns:</span></dt><dd><code>true</code> if the bundle which registered the service
referenced by this <code>ServiceReference</code> and the
specified bundle use the same source for the package of the
specified class name. Otherwise <code>false</code> is returned.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.3</dd></dl>
</li>
</ul>
<a name="compareTo(java.lang.Object)">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>compareTo</h4>
<pre>int&nbsp;compareTo(<a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Object.html?is-external=true" title="class or interface in java.lang">Object</a>&nbsp;reference)</pre>
<div class="block">Compares this <code>ServiceReference</code> with the specified
<code>ServiceReference</code> for order.
<p>
If this <code>ServiceReference</code> and the specified
<code>ServiceReference</code> have the same
<code>service id</code> they are equal. This
<code>ServiceReference</code> is less than the specified
<code>ServiceReference</code> if it has a lower
<code>service ranking</code> and greater if it has a
higher service ranking. Otherwise, if this <code>ServiceReference</code>
and the specified <code>ServiceReference</code> have the same
<code>service ranking</code>, this
<code>ServiceReference</code> is less than the specified
<code>ServiceReference</code> if it has a higher
<code>service id</code> and greater if it has a lower
service id.</div>
<dl>
<dt><strong>Specified by:</strong></dt>
<dd><code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Comparable.html?is-external=true#compareTo(T)" title="class or interface in java.lang">compareTo</a></code>&nbsp;in interface&nbsp;<code><a href="http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Comparable.html?is-external=true" title="class or interface in java.lang">Comparable</a></code></dd>
<dt><span class="strong">Parameters:</span></dt><dd><code>reference</code> - The <code>ServiceReference</code> to be compared.</dd>
<dt><span class="strong">Returns:</span></dt><dd>Returns a negative integer, zero, or a positive integer if this
<code>ServiceReference</code> is less than, equal to, or
greater than the specified <code>ServiceReference</code>.</dd><dt><span class="strong">Since:</span></dt>
<dd>1.4</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="class-use/ServiceReference.html">Use</a></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>Prev Class</li>
<li>Next Class</li>
</ul>
<ul class="navList">
<li><a href="../../../index.html?org/osgi/framework/ServiceReference.html" target="_top">Frames</a></li>
<li><a href="ServiceReference.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:&nbsp;</li>
<li>Nested&nbsp;|&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_summary">Method</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li>Constr&nbsp;|&nbsp;</li>
<li><a href="#method_detail">Method</a></li>
</ul>
</div>
<a name="skip-navbar_bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<p class="legalCopy"><small>Copyright &#169; 2006&#x2013;2013 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All rights reserved.</small></p>
</body>
</html>