blob: a3d91fa84c9f83c5cbbf0c786c78a3cadd94afb7 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!-- NewPage -->
<html lang="en">
<head>
<!-- Generated by javadoc (1.8.0_191) on Wed Dec 26 11:25:31 CET 2018 -->
<title>AspectService</title>
<meta name="date" content="2018-12-26">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">
<script type="text/javascript" src="../../../../../../script.js"></script>
</head>
<body>
<script type="text/javascript"><!--
try {
if (location.href.indexOf('is-external=true') == -1) {
parent.document.title="AspectService";
}
}
catch(err) {
}
//-->
</script>
<noscript>
<div>JavaScript is disabled on your browser.</div>
</noscript>
<!-- ========= START OF TOP NAVBAR ======= -->
<div class="topNav"><a name="navbar.top">
<!-- -->
</a>
<div class="skipNav"><a href="#skip.navbar.top" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.top.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../org/apache/felix/dm/annotation/api/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/apache/felix/dm/annotation/api/AdapterService.html" title="annotation in org.apache.felix.dm.annotation.api"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../../org/apache/felix/dm/annotation/api/BundleAdapterService.html" title="annotation in org.apache.felix.dm.annotation.api"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/felix/dm/annotation/api/AspectService.html" target="_top">Frames</a></li>
<li><a href="AspectService.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_top">
<li><a href="../../../../../../allclasses-noframe.html">All&nbsp;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>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.required.element.summary">Required</a>&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.element.detail">Element</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.apache.felix.dm.annotation.api</div>
<h2 title="Annotation Type AspectService" class="title">Annotation Type AspectService</h2>
</div>
<div class="contentContainer">
<div class="description">
<ul class="blockList">
<li class="blockList">
<hr>
<br>
<pre>@Retention(value=CLASS)
@Target(value=TYPE)
public @interface <span class="memberNameLabel">AspectService</span></pre>
<div class="block">Annotates an Aspect service. Aspects allow you to define an interceptor, or chain of interceptors
for a service (to add features like caching or logging, etc ...). The dependency manager intercepts
the original service, and allows you to execute some code before invoking the original service ...
The aspect will be applied to any service that matches the specified interface and filter and
will be registered with the same interface and properties as the original service, plus any
extra properties you supply here. If you declare the original service as a member it will be injected.
<p> For "add", "change", "remove" callbacks, the following method signatures are supported:
<pre><code>
(Component comp, ServiceReference ref, Service service)
(Component comp, ServiceReference ref, Object service)
(Component comp, ServiceReference ref)
(Component comp, Service service)
(Component comp, Object service)
(Component comp)
(Component comp, Map properties, Service service)
(ServiceReference ref, Service service)
(ServiceReference ref, Object service)
(ServiceReference ref)
(Service service)
(Service service, Map propeerties)
(Map properties, Service, service)
(Service service, Dictionary properties)
(Dictionary properties, Service service)
(Object service)
</code></pre>
<p> For "swap" callbacks, the following method signatures are supported:
<pre><code>
(Service old, Service replace)
(Object old, Object replace)
(ServiceReference old, Service old, ServiceReference replace, Service replace)
(ServiceReference old, Object old, ServiceReference replace, Object replace)
(Component comp, Service old, Service replace)
(Component comp, Object old, Object replace)
(Component comp, ServiceReference old, Service old, ServiceReference replace, Service replace)
(Component comp, ServiceReference old, Object old, ServiceReference replace, Object replace)
(ServiceReference old, ServiceReference replace)
(Component comp, ServiceReference old, ServiceReference replace)
</code></pre>
<h3>Usage Examples</h3>
<p> Here, the AspectService is registered into the OSGI registry each time an InterceptedService
is found from the registry. The AspectService class intercepts the InterceptedService, and decorates
its "doWork()" method. This aspect uses a rank with value "10", meaning that it will intercept some
other eventual aspects with lower ranks. The Aspect also uses a service property (param=value), and
include eventual service properties found from the InterceptedService:
<blockquote>
<pre>
&#64;AspectService(ranking=10))
class AspectService implements InterceptedService {
// The service we are intercepting (injected by reflection)
volatile InterceptedService intercepted;
public void doWork() {
intercepted.doWork();
}
}
</pre>
</blockquote></div>
</li>
</ul>
</div>
<div class="summary">
<ul class="blockList">
<li class="blockList">
<!-- =========== ANNOTATION TYPE REQUIRED MEMBER SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.required.element.summary">
<!-- -->
</a>
<h3>Required Element Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Required Element Summary table, listing required elements, and an explanation">
<caption><span>Required Elements</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Required Element and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>int</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#ranking--">ranking</a></span></code>
<div class="block">Sets the ranking of this aspect.</div>
</td>
</tr>
</table>
</li>
</ul>
<!-- =========== ANNOTATION TYPE OPTIONAL MEMBER SUMMARY =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.optional.element.summary">
<!-- -->
</a>
<h3>Optional Element Summary</h3>
<table class="memberSummary" border="0" cellpadding="3" cellspacing="0" summary="Optional Element Summary table, listing optional elements, and an explanation">
<caption><span>Optional Elements</span><span class="tabEnd">&nbsp;</span></caption>
<tr>
<th class="colFirst" scope="col">Modifier and Type</th>
<th class="colLast" scope="col">Optional Element and Description</th>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#added--">added</a></span></code>
<div class="block">The callback method to be invoked when the original service is available.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#changed--">changed</a></span></code>
<div class="block">The callback method to be invoked when the original service properties have changed.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#factoryMethod--">factoryMethod</a></span></code>
<div class="block">Sets the static method used to create the AspectService implementation instance.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#field--">field</a></span></code>
<div class="block">Sets the field name where to inject the original service.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#filter--">filter</a></span></code>
<div class="block">Sets the filter condition to use with the service interface this aspect is applying to.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../org/apache/felix/dm/annotation/api/Property.html" title="annotation in org.apache.felix.dm.annotation.api">Property</a>[]</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#properties--">properties</a></span></code>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;
<div class="block"><span class="deprecationComment">you can apply <a href="../../../../../../org/apache/felix/dm/annotation/api/Property.html" title="annotation in org.apache.felix.dm.annotation.api"><code>Property</code></a> annotation directly on the component class.</span></div>
</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#removed--">removed</a></span></code>
<div class="block">The callback method to invoke when the service is lost.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code><a href="../../../../../../org/apache/felix/dm/annotation/api/ServiceScope.html" title="enum in org.apache.felix.dm.annotation.api">ServiceScope</a></code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#scope--">scope</a></span></code>
<div class="block">The service scope for the service of this Component.</div>
</td>
</tr>
<tr class="altColor">
<td class="colFirst"><code>java.lang.Class&lt;?&gt;</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#service--">service</a></span></code>
<div class="block">Sets the service interface to apply the aspect to.</div>
</td>
</tr>
<tr class="rowColor">
<td class="colFirst"><code>java.lang.String</code></td>
<td class="colLast"><code><span class="memberNameLink"><a href="../../../../../../org/apache/felix/dm/annotation/api/AspectService.html#swap--">swap</a></span></code>
<div class="block">name of the callback method to invoke on swap.</div>
</td>
</tr>
</table>
</li>
</ul>
</li>
</ul>
</div>
<div class="details">
<ul class="blockList">
<li class="blockList">
<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="annotation.type.element.detail">
<!-- -->
</a>
<h3>Element Detail</h3>
<a name="ranking--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>ranking</h4>
<pre>public abstract&nbsp;int&nbsp;ranking</pre>
<div class="block">Sets the ranking of this aspect. Since aspects are chained, the ranking defines the order in which they are chained.
Chain ranking is implemented as a service ranking so service lookups automatically retrieve the top of the chain.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the aspect service rank</dd>
</dl>
</li>
</ul>
</li>
</ul>
<!-- ============ ANNOTATION TYPE MEMBER DETAIL =========== -->
<ul class="blockList">
<li class="blockList"><a name="service--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>service</h4>
<pre>public abstract&nbsp;java.lang.Class&lt;?&gt;&nbsp;service</pre>
<div class="block">Sets the service interface to apply the aspect to. By default, the directly implemented interface is used.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the service aspect</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>java.lang.Object.class</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="filter--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>filter</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;filter</pre>
<div class="block">Sets the filter condition to use with the service interface this aspect is applying to.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the service aspect filter</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>""</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="properties--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>properties</h4>
<pre>public abstract&nbsp;<a href="../../../../../../org/apache/felix/dm/annotation/api/Property.html" title="annotation in org.apache.felix.dm.annotation.api">Property</a>[]&nbsp;properties</pre>
<div class="block"><span class="deprecatedLabel">Deprecated.</span>&nbsp;<span class="deprecationComment">you can apply <a href="../../../../../../org/apache/felix/dm/annotation/api/Property.html" title="annotation in org.apache.felix.dm.annotation.api"><code>Property</code></a> annotation directly on the component class.</span></div>
<div class="block">Sets Additional properties to use with the aspect service registration</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the aspect service properties.</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>{}</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="field--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>field</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;field</pre>
<div class="block">Sets the field name where to inject the original service. By default, the original service is injected
in any attributes of the aspect implementation that are of the same type as the aspect interface.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the field used to inject the original service</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>""</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="added--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>added</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;added</pre>
<div class="block">The callback method to be invoked when the original service is available. This attribute can't be mixed with
the field attribute.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the add callback</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>""</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="changed--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>changed</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;changed</pre>
<div class="block">The callback method to be invoked when the original service properties have changed. When this attribute is used,
then the added attribute must also be used.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the changed callback</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>""</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="removed--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>removed</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;removed</pre>
<div class="block">The callback method to invoke when the service is lost. When this attribute is used, then the added attribute
must also be used.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the remove callback</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>""</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="swap--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>swap</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;swap</pre>
<div class="block">name of the callback method to invoke on swap.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the swap callback</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>""</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="factoryMethod--">
<!-- -->
</a>
<ul class="blockList">
<li class="blockList">
<h4>factoryMethod</h4>
<pre>public abstract&nbsp;java.lang.String&nbsp;factoryMethod</pre>
<div class="block">Sets the static method used to create the AspectService implementation instance. The
default constructor of the annotated class is used. The factoryMethod can be used to provide a specific
aspect implements, like a DynamicProxy.</div>
<dl>
<dt><span class="returnLabel">Returns:</span></dt>
<dd>the aspect service factory method</dd>
</dl>
<dl>
<dt>Default:</dt>
<dd>""</dd>
</dl>
</li>
</ul>
</li>
</ul>
<ul class="blockList">
<li class="blockList"><a name="scope--">
<!-- -->
</a>
<ul class="blockListLast">
<li class="blockList">
<h4>scope</h4>
<pre>public abstract&nbsp;<a href="../../../../../../org/apache/felix/dm/annotation/api/ServiceScope.html" title="enum in org.apache.felix.dm.annotation.api">ServiceScope</a>&nbsp;scope</pre>
<div class="block">The service scope for the service of this Component.
<p>
If not specified, the <a href="../../../../../../org/apache/felix/dm/annotation/api/ServiceScope.html#SINGLETON"><code>singleton</code></a> service
scope is used.</div>
<dl>
<dt>Default:</dt>
<dd>org.apache.felix.dm.annotation.api.ServiceScope.SINGLETON</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>
<div class="skipNav"><a href="#skip.navbar.bottom" title="Skip navigation links">Skip navigation links</a></div>
<a name="navbar.bottom.firstrow">
<!-- -->
</a>
<ul class="navList" title="Navigation">
<li><a href="../../../../../../org/apache/felix/dm/annotation/api/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/apache/felix/dm/annotation/api/AdapterService.html" title="annotation in org.apache.felix.dm.annotation.api"><span class="typeNameLink">Prev&nbsp;Class</span></a></li>
<li><a href="../../../../../../org/apache/felix/dm/annotation/api/BundleAdapterService.html" title="annotation in org.apache.felix.dm.annotation.api"><span class="typeNameLink">Next&nbsp;Class</span></a></li>
</ul>
<ul class="navList">
<li><a href="../../../../../../index.html?org/apache/felix/dm/annotation/api/AspectService.html" target="_top">Frames</a></li>
<li><a href="AspectService.html" target="_top">No&nbsp;Frames</a></li>
</ul>
<ul class="navList" id="allclasses_navbar_bottom">
<li><a href="../../../../../../allclasses-noframe.html">All&nbsp;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>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.required.element.summary">Required</a>&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.optional.element.summary">Optional</a></li>
</ul>
<ul class="subNavList">
<li>Detail:&nbsp;</li>
<li>Field&nbsp;|&nbsp;</li>
<li><a href="#annotation.type.element.detail">Element</a></li>
</ul>
</div>
<a name="skip.navbar.bottom">
<!-- -->
</a></div>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
</body>
</html>