Author: buildbot
Date: Wed Mar 4 15:22:29 2015
New Revision: 942314
Log:
Staging update by buildbot for felix
Added:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/whatsnew.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.html
Modified:
websites/staging/felix/trunk/content/ (props changed)
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/bundles-and-dependencies.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/design-patterns.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/development.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/performance-tuning.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/resources.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-resource-adapter.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/components.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependencies.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-bundle.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-configuration.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-resource.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/dependency-service.html
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/external-links.html
Propchange: websites/staging/felix/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Mar 4 15:22:29 2015
@@ -1 +1 @@
-1663933
+1664040
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4.html
Wed Mar 4 15:22:29 2015
@@ -90,6 +90,7 @@
<ul>
<li><a
href="apache-felix-dependency-manager-4/guides/history.html">History</a></li>
<li><a
href="apache-felix-dependency-manager-4/guides/background.html">Background</a></li>
+<li><a href="apache-felix-dependency-manager-4/guides/whatsnew.html">What's
new in version 4</a></li>
<li><a
href="apache-felix-dependency-manager-4/guides/bundles-and-dependencies.html">Bundles
and dependencies</a></li>
<li><a
href="apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.html">Migrating
from earlier versions</a></li>
<li><a
href="apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.html">Migrating
from other solutions</a></li>
@@ -106,6 +107,8 @@
<li><a
href="apache-felix-dependency-manager-4/reference/component-aspect.html">Aspect</a></li>
<li><a
href="apache-felix-dependency-manager-4/reference/component-adapter.html">Adapter</a></li>
<li><a
href="apache-felix-dependency-manager-4/reference/component-resource-adapter.html">Resource
Adapter</a></li>
+<li><a
href="apache-felix-dependency-manager-4/reference/component-bundle-adapter.html">Bundle
Adapter</a></li>
+<li><a
href="apache-felix-dependency-manager-4/reference/component-factory-configuration-adapter.html">Factory
Configuration Adapter</a></li>
<li><a
href="apache-felix-dependency-manager-4/reference/dependencies.html">Dependencies</a></li>
<li><a
href="apache-felix-dependency-manager-4/reference/dependency-service.html">Service</a></li>
<li><a
href="apache-felix-dependency-manager-4/reference/dependency-configuration.html">Configuration</a></li>
@@ -114,7 +117,7 @@
<li><a
href="apache-felix-dependency-manager-4/reference/external-links.html">External
Links and Articles</a></li>
</ul>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663926 by marrs on Wed, 4 Mar 2015 10:41:40 +0000
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/bundles-and-dependencies.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/bundles-and-dependencies.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/bundles-and-dependencies.html
Wed Mar 4 15:22:29 2015
@@ -18,7 +18,7 @@
limitations under the License.
-->
<head>
- <title>Apache Felix - </title>
+ <title>Apache Felix - Apache Felix Dependency Manager - Bundles and
Dependencies</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.css" type="text/css"
media="all">
@@ -67,10 +67,10 @@
- <h1></h1>
-
+ <h1>Apache Felix Dependency Manager - Bundles and Dependencies</h1>
+ <p>TODO</p>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663924 by marrs on Wed, 4 Mar 2015 10:39:19 +0000
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/design-patterns.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/design-patterns.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/design-patterns.html
Wed Mar 4 15:22:29 2015
@@ -18,7 +18,7 @@
limitations under the License.
-->
<head>
- <title>Apache Felix - </title>
+ <title>Apache Felix - Apache Felix Dependency Manager - Design
Patterns</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.css" type="text/css"
media="all">
@@ -67,10 +67,126 @@
- <h1></h1>
-
+ <h1>Apache Felix Dependency Manager - Design Patterns</h1>
+ <h2 id="osgi-design-patterns">OSGi Design Patterns</h2>
+<p>This section lists a couple of design patterns as they can be applied in an
OSGi context.</p>
+<h3 id="singleton-service">Singleton Service</h3>
+<p>Provides a service as long as its dependencies are resolved.</p>
+<h4 id="motivation">Motivation</h4>
+<p>In a dynamic framework, services can come and go. Components that publish a
service are often themselves dependent on other services to perform their task.
In such cases, they have a dependency on those services and it makes sense to
only publish their own services when these dependencies are available. Being
able to declare such dependencies in code ensures consistent life cycle
behavior.</p>
+<h4 id="structure">Structure</h4>
+<p>{gliffy:name=singleton|space=FELIX|page=Apache Felix Dependency Manager -
OSGi Design Patterns|pageid=9374247|align=center|size=L|border=false}</p>
+<h4 id="code-example">Code Example</h4>
+<div class="codehilite"><pre><span class="n">public</span> <span
class="n">class</span> <span class="n">Activator</span> <span
class="n">extends</span> <span class="n">DependencyActivatorBase</span> <span
class="p">{</span>
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">init</span><span class="p">(</span><span
class="n">BundleContext</span> <span class="n">context</span><span
class="p">,</span> <span class="n">DependencyManager</span> <span
class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{</span>
+ <span class="n">manager</span><span class="p">.</span><span
class="n">add</span><span class="p">(</span><span
class="n">createComponent</span><span class="p">()</span>
+ <span class="p">.</span><span class="n">setInterface</span><span
class="p">(</span><span class="n">UserStore</span><span class="p">.</span><span
class="n">class</span><span class="p">,</span> <span class="n">new</span> <span
class="n">Properties</span><span class="p">()</span> <span class="p">)</span>
+ <span class="p">.</span><span
class="n">setImplementation</span><span class="p">(</span><span
class="n">UserStoreImpl</span><span class="p">.</span><span
class="n">class</span><span class="p">)</span>
+ <span class="p">.</span><span class="n">add</span><span
class="p">(</span><span class="n">createServiceDependency</span><span
class="p">()</span>
+ <span class="p">.</span><span class="n">setService</span><span
class="p">(</span><span class="n">Store</span><span class="p">.</span><span
class="n">class</span><span class="p">)</span>
+ <span class="p">.</span><span
class="n">setRequired</span><span class="p">(</span><span
class="n">true</span><span class="p">)</span>
+ <span class="p">)</span>
+ <span class="p">.</span><span class="n">add</span><span
class="p">(</span><span class="n">createServiceDependency</span><span
class="p">()</span>
+ <span class="p">.</span><span class="n">setService</span><span
class="p">(</span><span class="n">LogService</span><span
class="p">.</span><span class="n">class</span><span class="p">)</span>
+ <span class="p">.</span><span
class="n">setRequired</span><span class="p">(</span><span
class="n">false</span><span class="p">)</span>
+ <span class="p">)</span>
+ <span class="p">);</span>
+ <span class="p">}</span>
+
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">destroy</span><span class="p">(</span><span
class="n">BundleContext</span> <span class="n">context</span><span
class="p">,</span> <span class="n">DependencyManager</span> <span
class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{}</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<h3 id="aspect-service">Aspect Service</h3>
+<p>Provides an aspect on top of a specific type of service.</p>
+<h4 id="motivation_1">Motivation</h4>
+<p>In aspect oriented programming, supporting functions are isolated from the
main application's business logic. This increases modularity at the source
level by allowing the separation of cross-cutting concerns. In OSGi we want to
extend this modularity to the runtime, therefore we implement aspects to work
on certain services, where the aspect itself publishes that same service but
(usually) with a higher priority. This allows you to dynamically add and remove
aspects.</p>
+<h4 id="structure_1">Structure</h4>
+<p>{gliffy:name=aspect|space=FELIX|page=Apache Felix Dependency Manager - OSGi
Design Patterns|pageid=9374247|align=center|size=L|border=false}</p>
+<h4 id="code-example_1">Code Example</h4>
+<div class="codehilite"><pre><span class="n">public</span> <span
class="n">class</span> <span class="n">Activator</span> <span
class="n">extends</span> <span class="n">DependencyActivatorBase</span> <span
class="p">{</span>
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">init</span><span class="p">(</span><span
class="n">BundleContext</span> <span class="n">context</span><span
class="p">,</span> <span class="n">DependencyManager</span> <span
class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{</span>
+ <span class="n">manager</span><span class="p">.</span><span
class="n">add</span><span class="p">(</span><span
class="n">createAspectService</span><span class="p">(</span><span
class="n">Manageable</span><span class="p">.</span><span
class="n">class</span><span class="p">,</span> "<span
class="p">(</span><span class="n">monitor</span><span class="p">=</span><span
class="n">true</span><span class="p">)</span>"<span class="p">,</span>
50<span class="p">)</span>
+ <span class="p">.</span><span
class="n">setImplementation</span><span class="p">(</span><span
class="n">ManageableMonitor</span><span class="p">.</span><span
class="n">class</span><span class="p">)</span>
+ <span class="p">);</span>
+ <span class="p">}</span>
+
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">destroy</span><span class="p">(</span><span
class="n">BundleContext</span> <span class="n">context</span><span
class="p">,</span> <span class="n">DependencyManager</span> <span
class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{}</span>
+<span class="p">}</span>
+
+<span class="n">public</span> <span class="n">interface</span> <span
class="n">Manageable</span> <span class="p">{</span>
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">setProperty</span><span class="p">(</span><span
class="n">String</span> <span class="n">key</span><span class="p">,</span>
<span class="n">String</span> <span class="n">value</span><span
class="p">);</span>
+<span class="p">}</span>
+
+<span class="n">public</span> <span class="n">class</span> <span
class="n">ManageableMonitor</span> <span class="n">implements</span> <span
class="n">Manageable</span> <span class="p">{</span>
+ <span class="n">private</span> <span class="n">volatile</span> <span
class="n">Manageable</span> <span class="n">m_manageable</span><span
class="p">;</span>
+
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">setProperty</span><span class="p">(</span><span
class="n">String</span> <span class="n">key</span><span class="p">,</span>
<span class="n">String</span> <span class="n">value</span><span
class="p">)</span> <span class="p">{</span>
+ <span class="n">System</span><span class="p">.</span><span
class="n">out</span><span class="p">.</span><span class="n">println</span><span
class="p">(</span>"<span class="n">Someone</span> <span
class="n">set</span> " <span class="o">+</span> <span class="n">key</span>
<span class="o">+</span> " <span class="n">to</span> " <span
class="o">+</span> <span class="n">value</span><span class="p">);</span>
+ <span class="n">m_manageable</span><span class="p">.</span><span
class="n">setProperty</span><span class="p">(</span><span
class="n">key</span><span class="p">,</span> <span class="n">value</span><span
class="p">);</span>
+ <span class="p">}</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<h3 id="adapter-service">Adapter Service</h3>
+<p>Provides an adapter for a specific type of service.</p>
+<h4 id="motivation_2">Motivation</h4>
+<p>Like with aspects, sometimes you want to create adapters for certain
services, which add certain behavior that results in the publication of (in
this case) a different service. Adapters can dynamically be added and removed
and allow you to keep your basic services implementations clean and simple,
adding extra features on top of them in a modular way. </p>
+<h4 id="structure_2">Structure</h4>
+<p>{gliffy:name=adapter|space=FELIX|page=Apache Felix Dependency Manager -
OSGi Design Patterns|pageid=9374247|align=center|size=L|border=false}</p>
+<h4 id="code-example_2">Code Example</h4>
+<div class="codehilite"><pre><span class="n">public</span> <span
class="n">class</span> <span class="n">Activator</span> <span
class="n">extends</span> <span class="n">DependencyActivatorBase</span> <span
class="p">{</span>
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">init</span><span class="p">(</span><span
class="n">BundleContext</span> <span class="n">context</span><span
class="p">,</span> <span class="n">DependencyManager</span> <span
class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{</span>
+ <span class="n">manager</span><span class="p">.</span><span
class="n">add</span><span class="p">(</span><span
class="n">createAdapterService</span><span class="p">(</span><span
class="n">Manageable</span><span class="p">.</span><span
class="n">class</span><span class="p">,</span> "<span
class="p">(</span><span class="n">publish</span><span class="p">=</span><span
class="n">servlet</span><span class="p">)</span>"<span class="p">)</span>
+ <span class="p">.</span><span class="n">setInterface</span><span
class="p">(</span><span class="n">HttpServlet</span><span
class="p">.</span><span class="n">class</span><span class="p">.</span><span
class="n">getName</span><span class="p">(),</span> <span
class="n">null</span><span class="p">)</span>
+ <span class="p">.</span><span
class="n">setImplementation</span><span class="p">(</span><span
class="n">ManageableServlet</span><span class="p">.</span><span
class="n">class</span><span class="p">)</span>
+ <span class="p">);</span>
+ <span class="p">}</span>
+
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">destroy</span><span class="p">(</span><span
class="n">BundleContext</span> <span class="n">context</span><span
class="p">,</span> <span class="n">DependencyManager</span> <span
class="n">manager</span><span class="p">)</span> <span class="n">throws</span>
<span class="n">Exception</span> <span class="p">{}</span>
+<span class="p">}</span>
+
+<span class="n">public</span> <span class="n">interface</span> <span
class="n">Manageable</span> <span class="p">{</span>
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">setProperty</span><span class="p">(</span><span
class="n">String</span> <span class="n">key</span><span class="p">,</span>
<span class="n">String</span> <span class="n">value</span><span
class="p">);</span>
+<span class="p">}</span>
+
+<span class="n">public</span> <span class="n">class</span> <span
class="n">ManageableServlet</span> <span class="n">implements</span> <span
class="n">HttpServlet</span> <span class="p">{</span>
+ <span class="n">private</span> <span class="n">volatile</span> <span
class="n">Manageable</span> <span class="n">m_manageable</span><span
class="p">;</span>
+
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">doPost</span><span class="p">(</span><span
class="n">HttpRequest</span> <span class="n">req</span><span class="p">,</span>
<span class="n">HttpResponse</span> <span class="n">response</span><span
class="p">)</span> <span class="p">{</span>
+ <span class="n">String</span> <span class="n">key</span> <span
class="p">=</span> <span class="n">req</span><span class="p">.</span><span
class="n">getProperty</span><span class="p">(</span>"<span
class="n">key</span>"<span class="p">);</span>
+ <span class="n">String</span> <span class="n">value</span> <span
class="p">=</span> <span class="n">req</span><span class="p">.</span><span
class="n">getProperty</span><span class="p">(</span>"<span
class="n">value</span>"<span class="p">);</span>
+ <span class="n">m_manageable</span><span class="p">.</span><span
class="n">setProperty</span><span class="p">(</span><span
class="n">key</span><span class="p">,</span> <span class="n">value</span><span
class="p">);</span>
+ <span class="p">}</span>
+<span class="p">}</span>
+</pre></div>
+
+
+<h3 id="resource-adapter-service">Resource Adapter Service</h3>
+<p>Provides an adapter for a specific type of resource.</p>
+<h4 id="motivation_3">Motivation</h4>
+<p>Resource adapters are similar to normal adapters, but instead of requiring
a service, they require a resource and provide a service on top of it.
Resources are an abstraction that is introduced by the dependency manager,
represented as a URL. They can be implemented to serve resources embedded in
bundles, somewhere on a file system or in a content repository or database.</p>
+<h4 id="structure_3">Structure</h4>
+<p>{gliffy:name=resource-adapter|space=FELIX|page=Apache Felix Dependency
Manager - OSGi Design
Patterns|pageid=9374247|align=center|size=L|border=false}</p>
+<h3 id="temporal-dependency">Temporal Dependency</h3>
+<p>Provides a proxy that hides the service dynamics of a dependency, even if
it disappears for a short time.</p>
+<h4 id="motivation_4">Motivation</h4>
+<p>As a service consumer, you sometimes do not want to deal with the dynamics
of services and the fact that they tend to go away for short periods of time
whilst their hosting bundle gets updated. A temporal dependency provides you
with a proxy that hides these dynamics and blocks your calls if you try to
invoke a method on a service that is currently "updating". The maximum time to
wait is configurable and you will get an exception if no new service becomes
available before that time.</p>
+<h4 id="structure_4">Structure</h4>
+<h3 id="null-object">Null Object</h3>
+<p>Provides an implementation of an object that does nothing and can be used
in the absence of the real object.</p>
+<h4 id="motivation_5">Motivation</h4>
+<p>When a component depends on a service, but the dependency is optional, it
means that it will use this service when available, but it can still operate if
it's not. Constantly checking in your code if a service is actually available
tends to lead to code with a lot of "<code>if (service != null)
service.invoke();</code>" constructions which do not help with code
readability. Instead, the dependency manager offers you a mechanism where it
will inject null objects for services that are currently not available so you
can simply invoke methods on them that "do nothing".</p>
+<h4 id="structure_5">Structure</h4>
+<h3 id="whiteboard">Whiteboard</h3>
+<p>Handles listeners by leveraging the OSGi service registry to publish and
look them up.</p>
+<h4 id="motivation_6">Motivation</h4>
+<p>The traditional model for dealing with listeners in Java needlessly
complicates things in an OSGi context. Instead of having listeners registering
themselves with the component that will invoke them on any change, a listener
simply registers itself in the service registry and the component will do a
lookup of all relevant services. This is explained in more detail on the
OSGi.org wiki in the <a
href="http://www.osgi.org/wiki/uploads/Links/whiteboard.pdf">"Listeners
considered harmful: the 'whiteboard' pattern"</a> article.</p>
+<h4 id="structure_6">Structure</h4>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663924 by marrs on Wed, 4 Mar 2015 10:39:19 +0000
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/development.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/development.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/development.html
Wed Mar 4 15:22:29 2015
@@ -18,7 +18,7 @@
limitations under the License.
-->
<head>
- <title>Apache Felix - </title>
+ <title>Apache Felix - Apache Felix Dependency Manager - Development</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.css" type="text/css"
media="all">
@@ -67,10 +67,53 @@
- <h1></h1>
-
+ <h1>Apache Felix Dependency Manager - Development</h1>
+ <p>When downloading or checking out the source code, please also consult
release/resources/src/README.src for up to date instructions on how to build
that particular version.</p>
+<h2 id="prerequisites">Prerequisites</h2>
+<p>If you are building a released
<code>org.apache.felix.dependencymanager-r<n>-src.zip</code> artifact,
then you also have to extract the
<code>org.apache.felix.dependencymanager-r<n>-deps.zip</code> in the same
directory where you have extracted the source archive. There is no need to do
this if you have checked out from the Felix trunk in Subversion.</p>
+<h2 id="compilation-using-gradle">Compilation Using gradle:</h2>
+<ul>
+<li>
+<p>Install Java 7.</p>
+</li>
+<li>
+<p>Compile Dependendency Manager annotations bndtools plugin:</p>
+<p>$ ./gradlew org.apache.felix.dependencymanager.annotation:jar</p>
+</li>
+<li>
+<p>Compile all other bundles:</p>
+<p>$ ./gradlew jar</p>
+</li>
+<li>
+<p>Run junit tests:</p>
+<p>$ ./gradlew test</p>
+</li>
+<li>
+<p>Run integration tests:</p>
+<p>$ ./gradlew check</p>
+</li>
+</ul>
+<h2 id="compilation-using-eclipse">Compilation Using Eclipse:</h2>
+<ul>
+<li>Install either Eclipse Kepler SR2 or Eclipse Luna.</li>
+<li>Use the dependency manager folder as the root of your workspace.</li>
+<li>Configure two JREs for both Java 7 and Java 8:<ul>
+<li>Go to Windows -> Preferences -> Java -> Installed JREs</li>
+<li>Add two JREs: one for Java 7, and the other for Java 8.</li>
+<li>Declare the Java 7 JRE as the default one. Java 8 is only used to build
and run the <code>org.apache.felix.dependencymanager.benchmark</code> module,
which is used to perform DM performance tests within Eclipse Bndtools.</li>
+</ul>
+</li>
+<li>Install BndTools 2.4.1, and (optionally) a subversion plugin for
Eclipse.</li>
+<li>Open BndTools perspective</li>
+<li>Import Dependency Manager into Eclipse, and compile everything</li>
+<li>if it's the first time you import the project into eclipse, it may happen
that some modules that requires the Dependency Manager Annotations bnd plugin
don't compile: It's a know issue. To work around, restart eclipse and rebuild
every modules. </li>
+<li>Click on org.apache.felix.dependencymanager project and run it as "JUnit
test".</li>
+<li>Click on org.apache.felix.dependencymanager.shell and run it as "JUnit
test"</li>
+<li>Click on org.apache.felix.dependencymanager.itest and run it as "Bnd OSGi
Test Launcher (Junit)".</li>
+<li>Click on org.apache.felix.dependencymanager.runtime.itest and run it as
""Bnd OSGi Test Launcer (Junit)".</li>
+</ul>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663924 by marrs on Wed, 4 Mar 2015 10:39:19 +0000
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-earlier-versions.html
Wed Mar 4 15:22:29 2015
@@ -18,7 +18,7 @@
limitations under the License.
-->
<head>
- <title>Apache Felix - </title>
+ <title>Apache Felix - Apache Felix Dependency Manager - Migrating from
earlier versions</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.css" type="text/css"
media="all">
@@ -67,10 +67,25 @@
- <h1></h1>
-
+ <h1>Apache Felix Dependency Manager - Migrating from earlier
versions</h1>
+ <h1 id="migrating-from-version-3">Migrating from version 3</h1>
+<p>DependencyManager 4.0 has some API changes that need to be taken into
account when migrating from DependencyManager 3. </p>
+<ul>
+<li>A dependency can no longer be shared accross components. </li>
+<li>You no longer have to call setInstanceBound() when adding a dependency
from within the init() method of a component. Therefore the setInstanceBound()
method has been removed from all Dependency interfaces.</li>
+<li>in the Dependency interface, the following method have been removed:
isInstanceBound, invokeAdded, invokeRemoved, createCopy.</li>
+<li>In the Component interface, the "Object Component.getService()" method has
been replaced by the "<T> T getInstance()" method.</li>
+<li>In the Component interface, the "void
addStateListener(ComponentStateListener listener) method" has been replaced by
the "add(ComponentStateListener listener)" method.</li>
+<li>In the Component interface, the "start", "stop", "getDependencies" methods
have been removed.</li>
+<li>In the Component interface and in the DependencyManager class, the
createTemporalServiceDependency() method is now taking a timeout parameter:
createTemporalServiceDependency(long timeout).</li>
+<li>The ComponentStateListener interface has changed: it is now providing a
single "changed(Component c, ComponentState state)" method.</li>
+<li>The DependencyManager 4 Shell commands are no longer available for
framework specific shell implementations, and support the gogo shell only.</li>
+<li>The TemporalServiceDependency interface has been removed.</li>
+</ul>
+<h1 id="migrating-from-version-2">Migrating from version 2</h1>
+<p>...</p>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663924 by marrs on Wed, 4 Mar 2015 10:39:19 +0000
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/migrating-from-other-solutions.html
Wed Mar 4 15:22:29 2015
@@ -18,7 +18,7 @@
limitations under the License.
-->
<head>
- <title>Apache Felix - </title>
+ <title>Apache Felix - Apache Felix Dependency Manager - Migrating from
other solutions</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.css" type="text/css"
media="all">
@@ -67,10 +67,14 @@
- <h1></h1>
-
+ <h1>Apache Felix Dependency Manager - Migrating from other solutions</h1>
+ <p>TODO</p>
+<h1 id="declarative-services">Declarative Services</h1>
+<h1 id="blueprint">Blueprint</h1>
+<h1 id="ipojo">iPOJO</h1>
+<h1 id="service-binder">Service Binder</h1>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663924 by marrs on Wed, 4 Mar 2015 10:39:19 +0000
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/performance-tuning.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/performance-tuning.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/performance-tuning.html
Wed Mar 4 15:22:29 2015
@@ -18,7 +18,7 @@
limitations under the License.
-->
<head>
- <title>Apache Felix - </title>
+ <title>Apache Felix - Apache Felix Dependency Manager - Performance
Tuning</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.css" type="text/css"
media="all">
@@ -67,10 +67,47 @@
- <h1></h1>
-
+ <h1>Apache Felix Dependency Manager - Performance Tuning</h1>
+ <h3 id="filter-indices">Filter Indices</h3>
+<p>Filter indices allow you to speed up the service resolution process by
skipping the services registry, in favor of a fast index on given service
properties.</p>
+<p>The Dependency Manager will look for a set of filter indices in the
<code>org.apache.felix.dependencymanager.filterindex</code> system property.
This system property uses the following syntax,</p>
+<div class="codehilite"><pre><span class="n">property</span><span
class="o">-</span><span class="n">index</span> <span class="p">::=</span> <span
class="n">service</span><span class="o">-</span><span class="n">property</span>
<span class="o">|</span> <span class="n">service</span><span
class="o">-</span><span class="n">property</span> <span
class="s">','</span> <span class="n">property</span><span
class="o">-</span><span class="n">index</span>
+<span class="n">index</span> <span class="p">::=</span> <span
class="s">'*aspect*'</span> <span class="o">|</span> <span
class="s">'*adapter*'</span> <span class="o">|</span> <span
class="n">property</span><span class="o">-</span><span class="n">index</span>
+<span class="n">indices</span> <span class="p">::=</span> <span
class="n">index</span> <span class="o">|</span> <span class="n">indices</span>
<span class="s">';'</span> <span class="n">index</span>
+</pre></div>
+
+
+<p>The implementation ships with three kinds of index implementations.</p>
+<ul>
+<li><em>Service property indices</em> are based on a set of service
properties, like a multi-column index in a database. </li>
+<li><em>Aspect indices</em> work with Dependency Manager Aspect services, and
will provide indexing for the specific filters that they use.</li>
+<li><em>Adapter indices</em> work like Aspect indices, but for Adapter
services.</li>
+</ul>
+<h4 id="performance">Performance</h4>
+<p>The index isn't free, but reduces the linear (and wasteful) filter-based
lookup to an indexed log(n) lookup. You can expect noticeable speedup if you
have at least several hundred services.</p>
+<h4 id="examples">Examples</h4>
+<div class="codehilite"><pre><span class="o">-</span><span
class="n">Dorg</span><span class="p">.</span><span class="n">apache</span><span
class="p">.</span><span class="n">felix</span><span class="p">.</span><span
class="n">dependencymanager</span><span class="p">.</span><span
class="n">filterindex</span><span class="p">=</span><span
class="n">objectClass</span>
+</pre></div>
+
+
+<p>Sets an index on <code>objectClass</code>, speeding up lookups for any
filter that contains an <code>objectClass</code> in its filter (all regular
services do).</p>
+<div class="codehilite"><pre><span class="o">-</span><span
class="n">Dorg</span><span class="p">.</span><span class="n">apache</span><span
class="p">.</span><span class="n">felix</span><span class="p">.</span><span
class="n">dependencymanager</span><span class="p">.</span><span
class="n">filterindex</span><span class="p">=</span><span
class="n">objectClass</span><span class="p">,</span><span class="n">id</span>
+</pre></div>
+
+
+<p>This filter helps if you have a lot of similar services, identified by some
<code>id</code>.</p>
+<div class="codehilite"><pre><span class="o">-</span><span
class="n">Dorg</span><span class="p">.</span><span class="n">apache</span><span
class="p">.</span><span class="n">felix</span><span class="p">.</span><span
class="n">dependencymanager</span><span class="p">.</span><span
class="n">filterindex</span><span class="p">=</span><span
class="n">objectClass</span><span class="p">,</span><span
class="n">id</span><span class="p">;</span><span
class="n">objectClass</span><span class="p">,</span><span
class="n">ipAddress</span>
+</pre></div>
+
+
+<p>This is a set of two filter indices, helping when you have one set of
services that has an <code>id</code>, and another set that uses an
<code>ipAddress</code> for identification.</p>
+<div class="codehilite"><pre><span class="o">-</span><span
class="n">Dorg</span><span class="p">.</span><span class="n">apache</span><span
class="p">.</span><span class="n">felix</span><span class="p">.</span><span
class="n">dependencymanager</span><span class="p">.</span><span
class="n">filterindex</span><span class="p">=</span><span
class="o">*</span><span class="n">aspect</span><span class="o">*</span>
+</pre></div>
+
+
+<p>Provides indexing for all Aspect services.</p>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663924 by marrs on Wed, 4 Mar 2015 10:39:19 +0000
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/resources.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/resources.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/resources.html
Wed Mar 4 15:22:29 2015
@@ -18,7 +18,7 @@
limitations under the License.
-->
<head>
- <title>Apache Felix - </title>
+ <title>Apache Felix - Apache Felix Dependency Manager - Resources</title>
<link rel="icon" href="/res/favicon.ico">
<link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
<link rel="stylesheet" href="/res/codehilite.css" type="text/css"
media="all">
@@ -67,10 +67,10 @@
- <h1></h1>
-
+ <h1>Apache Felix Dependency Manager - Resources</h1>
+ <p>...</p>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663924 by marrs on Wed, 4 Mar 2015 10:39:19 +0000
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Added:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/whatsnew.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/whatsnew.html
(added)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/guides/whatsnew.html
Wed Mar 4 15:22:29 2015
@@ -0,0 +1,145 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE- 2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+ <head>
+ <title>Apache Felix - Apache Felix Dependency Manager - What's new in
version 4?</title>
+ <link rel="icon" href="/res/favicon.ico">
+ <link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
+ <link rel="stylesheet" href="/res/codehilite.css" type="text/css"
media="all">
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+ </head>
+ <body>
+ <div class="title">
+ <div class="logo">
+ <a href="http://felix.apache.org/">
+ <img border="0" alt="Apache Felix" src="/res/logo.png">
+ </a>
+ </div>
+ <div class="header">
+ <a href="http://www.apache.org/">
+ <img border="0" alt="Apache" src="/res/apache.png">
+ </a>
+ </div>
+ </div>
+
+ <div class="menu">
+ <p><a href="/news.html">news</a> <br />
+<a href="/license.html">license</a> <br />
+<a href="/downloads.cgi">downloads</a> <br />
+<a href="/documentation.html">documentation</a> <br />
+<a href="/mailinglists.html">mailing lists</a> <br />
+<a href="/documentation/community/contributing.html">contributing</a> <br />
+<a href="/sitemap.html">site map</a> <br />
+<a href="http://www.apache.org/">asf</a> <br />
+<a href="http://www.apache.org/security/">security</a> <br />
+<a href="http://www.apache.org/foundation/sponsorship.html">sponsorship</a>
<br />
+<a href="http://www.apache.org/foundation/thanks.html">sponsors</a> </p>
+<iframe
+ src="http://www.apache.org/ads/button.html"
+ style="border-width:0; float: left"
+ frameborder="0"
+ scrolling="no"
+ width="135"
+ height="135">
+</iframe>
+ </div>
+
+ <div class="main">
+ <div class="breadcrump" style="font-size: 80%;">
+ <a href="/">Home</a> » <a
href="/documentation.html">Documentation</a> » <a
href="/documentation/subprojects.html">Apache Felix Subproject
Documentation</a> » <a
href="/documentation/subprojects/apache-felix-dependency-manager-4.html">Apache
Felix Dependency Manager 4</a>
+ </div>
+
+
+
+ <h1>Apache Felix Dependency Manager - What's new in version 4?</h1>
+ <h1 id="whats-new-in-version-4">What's new in version 4?</h1>
+<p>DependencyManager 4.0 has been significantly reworked to improve support
for concurrency. The following principles form the basis of the new concurrency
model in DM4.</p>
+<ul>
+<li>All external events that influence the state of dependencies are recorded
and given to the serial executor of the component. We record whatever data
comes in, so when the actual job is run by the serial executor, we still have
access to the original data without having to access other sources whose state
might have changed since.</li>
+<li>The serial executor of a component will execute a job immediately if it is
being called by the thread that is already executing jobs.</li>
+<li>If the serial executor of a component had not yet started a job, it will
queue and start it on the current thread.</li>
+<li>If the serial executor gets invoked from a different thread than the one
currently executing jobs, the job will be put at the end of the queue. As
mentioned before, any data associated with the event will also be recorded so
it is available when the job executes.</li>
+<li>State in the component and dependency can only be modified via the serial
executor thread. This means we don't need explicit synchronization
anywhere.</li>
+</ul>
+<p>DependencyManager 4 now also supports parallel execution of component
wiring.</p>
+<p>Added support for parallelism: To allow components to be started and
handled in parallel, you can now register in the OSGi service registry a
ComponentExecutorFactory service that is used to get an Executor for the
management of all components dependencies/lifecycle callbacks. See javadoc from
the org.apache.felix.dm.ComponentExecutorFactory interface for more
information.</p>
+<p>You can also take a look at the the
org.apache.felix.dependencymanager.samples project, which is registering a
ComponentExecutorFactory from org.apache.felix.dependencymanager.samples.tpool
bundle.</p>
+<p>See also the following property in the
org.apache.felix.dependencymanager.samples/bnd.bnd </p>
+<div class="codehilite"><pre><span class="n">org</span><span
class="p">.</span><span class="n">apache</span><span class="p">.</span><span
class="n">felix</span><span class="p">.</span><span
class="n">dependencymanager</span><span class="p">.</span><span
class="n">parallel</span><span class="p">=</span><span class="o">\</span>
+ <span class="s">'!org.apache.felix.dependencymanager.samples.tpool,
*'</span><span class="p">,</span><span class="o">\</span>
+</pre></div>
+
+
+<p>Here, all components will be handled by Executors provided by the
ComponentExecutorFactory, except those having a package starting with
"org.apache.felix.dependencymanager.samples.tpool" (because the threadpool is
itself defined using the Dependency Manager API).</p>
+<p>In addition, some new features have been implemented in dependency
manager:</p>
+<ul>
+<li>
+<p>Auto Config Iterable fields: AutoConfig dependencies can be applied on
Iterable<Service> fields in order to be able to traverse currently injected
services safely. The Iterable must be parameterized with the Service type. See
org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/api/Spellcheck.java
for an example.</p>
+</li>
+<li>
+<p>AutoConfig Map field: AutoConfig dependencies can be applied on a field
with a Map<Service, Dictionary> type, allowing to traverse currently injected
services safely, including service properties. The Map must be traversed using
the Map.Entry iterator. See javadoc for DependencyManager.setAutoConfig().</p>
+</li>
+<li>
+<p>Inject Configuration on separate callback instance: Configuration can be
injected on a separate callback instance, like a CompositionManager for
example. See an example in the samples, in
org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/compositefactory/Activator.java.
+See FELIX-2706</p>
+</li>
+<li>
+<p>Added propagate flag for Service Adapters: you can now choose to propagate
or not adaptee service properties. See FELIX-4600</p>
+</li>
+<li>
+<p>"Top" command in the shell: a "top" command is now available from the shell
and can be used to display all top components sorted by their init/start
elapsed time.</p>
+</li>
+<li>
+<p>The Annotations plugin can now automatically generate a Require-Capability
header on the Dependency Manager Runtime bundle.
+Use "add-require-capability=true" option in the plugin declaration property to
enable this new feature (see FELIX-4676):
+** -plugin: org.apache.felix.dm.annotation.plugin.bnd.AnnotationPlugin;
add-require-capability=true</p>
+</li>
+<li>
+<p>The Configuration Dependency Configuration dependency now supports a "name"
attribute, allowing to dynamically configure configuration pids from the @Init
method. see FELIX-4777</p>
+</li>
+<li>
+<p>Added a benchmark tool for dependency manager (not released, only available
from the trunk, see
dependencymanager/org.apache.felix.dependencymanager.benchmark/README</p>
+</li>
+<li>
+<p>The Annotations "Factory Sets" are deprecated and have been replaced by a
nice api exported by the runtime bundle. See FELIX-4684</p>
+</li>
+</ul>
+<h1 id="whats-changed-in-dependencymanager-40">What's changed in
DependencyManager 4.0</h1>
+<ul>
+<li>
+<p>The Annotations processor is not generating anymore the
Import-Service/Export Service by default (no need to specify the
"build-import-export-service=false" option in the
+annotations plugin if you don't need to generate automatically the deprecated
headers.</p>
+</li>
+<li>
+<p>The Dependency Manager metatype Annotations are now deprecated and it is
encouraged to use standard bndtools metatypes.
+See
org.apache.felix.dependencymanager.samples/src/org/apache/felix/dependencymanager/samples/dictionary/annot/DictionaryConfiguration.java
for an example.
+You can also check http://www.aqute.biz/Bnd/MetaType for more information
about the bnd metatypes annotations.</p>
+</li>
+</ul>
+ <div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
+ </div>
+ <div class="trademarkFooter">
+ Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
+ logo are trademarks of The Apache Software Foundation. All other marks
mentioned
+ may be trademarks or registered trademarks of their respective owners.
+ </div>
+ </div>
+ </body>
+</html>
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-adapter.html
Wed Mar 4 15:22:29 2015
@@ -68,9 +68,62 @@
<h1></h1>
-
+ <h4 id="adapters">Adapters</h4>
+<p>Adapters, like aspects, are used to "extend" existing services, and can
publish different services based on the existing one. An example would be
implementing a management interface.</p>
+<h2 id="adapterservice">@AdapterService</h2>
+<p>Adapters, like with <em>@AspectService</em>, are used to "extend" existing
services,
+and can publish different services based on the existing one. An example
+would be implementing a management interface for an existing service,
+etc .... When you annotate an adapter class with the <em>@AdapterService</em>
+annotation, it will be applied to any service that matches the implemented
+interface and filter. The adapter will be registered with the specified
+interface and existing properties from the original service plus any extra
+properties you supply here. If you declare the original service as a member
+it will be injected. </p>
+<h3 id="annotation-attributes">Annotation attributes:</h3>
+<hr />
+<p><strong><code>adapteeService</code></strong> <br />
+<em>Required</em>: True <br />
+<em>Default</em>: --</p>
+<p>Sets the adaptee service interface this adapter is applying to.</p>
+<hr />
+<p><strong><code>provides</code></strong> <br />
+<em>Required</em>: False <br />
+<em>Default</em>: all directly implemented interfaces.</p>
+<p>Sets the adapter service interface(s). By default, the directly implemented
+interface(s) is (are) used. </p>
+<hr />
+<p><strong><code>properties</code></strong> <br />
+<em>Required</em>: False <br />
+<em>Default</em>: All inherited adaptee service properties.</p>
+<p>Sets some additional properties to use with the adapter service
registration.
+By default, the adapter will inherit all adaptee service properties.</p>
+<hr />
+<p><strong><code>adapteeFilter</code></strong> <br />
+<em>Required</em>: False <br />
+<em>Default</em>: --</p>
+<p>Sets the filter condition to use with the adapted service interface.</p>
+<hr />
+<p><strong><code>factoryMethod</code></strong> <br />
+<em>Required</em>: False <br />
+<em>Default</em>: --</p>
+<p>Sets the static method used to create the adapter service implementation
+instance. By default, the default constructor of the annotated class is
used.</p>
+<h3 id="usage-example">Usage example</h3>
+<p>Here, the AdapterService is registered into the OSGI registry each time an
AdapteeService is found from the registry. The AdapterImpl class adapts the
AdapteeService to the AdapterService. The AdapterService will also have a
service property (param=value), and will also include eventual service
properties found from the AdapteeService:</p>
+<div class="codehilite"><pre> <span class="p">@</span><span
class="n">AdapterService</span><span class="p">(</span><span
class="n">adapteeService</span> <span class="p">=</span> <span
class="n">AdapteeService</span><span class="p">.</span><span
class="n">class</span><span class="p">,</span> <span
class="k">properties</span><span class="p">={@</span><span
class="n">Property</span><span class="p">(</span><span
class="n">name</span><span class="p">=</span>"<span
class="n">param</span>"<span class="p">,</span> <span
class="n">value</span><span class="p">=</span>"<span
class="n">value</span>"<span class="p">)})</span>
+ <span class="n">class</span> <span class="n">AdapterImpl</span> <span
class="n">implements</span> <span class="n">AdapterService</span> <span
class="p">{</span>
+ <span class="o">//</span> <span class="n">The</span> <span
class="n">service</span> <span class="n">we</span> <span class="n">are</span>
<span class="n">adapting</span> <span class="p">(</span><span
class="n">injected</span> <span class="n">by</span> <span
class="n">reflection</span><span class="p">)</span>
+ <span class="n">protected</span> <span class="n">AdapteeService</span>
<span class="n">adaptee</span><span class="p">;</span>
+
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">doWork</span><span class="p">()</span> <span class="p">{</span>
+ <span class="n">adaptee</span><span class="p">.</span><span
class="n">mehod1</span><span class="p">();</span>
+ <span class="n">adaptee</span><span class="p">.</span><span
class="n">method2</span><span class="p">();</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+</pre></div>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663924 by marrs on Wed, 4 Mar 2015 10:39:19 +0000
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Modified:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.html
(original)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-aspect.html
Wed Mar 4 15:22:29 2015
@@ -68,9 +68,62 @@
<h1></h1>
-
+ <h4 id="aspects">Aspects</h4>
+<p>Aspects, as part of aspect oriented programming, can be used in a dynamic
environment such as OSGi to "extend" existing services and add certain
"capabilities" to them. Examples of these are adding a specific caching
mechanism to a storage service or implementing logging. Aspects in OSGi can be
applied to services and can be added and removed at runtime.</p>
+<h2 id="aspectservice">@AspectService</h2>
+<p>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. It will also inherit all dependencies, and if you
declare the original service as a member it will be injected.</p>
+<h3 id="annotation-attributes">Annotation attributes</h3>
+<hr />
+<p><strong><code>ranking</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: -- </p>
+<p>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.</p>
+<hr />
+<p><strong><code>service</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: all directly implemented interfaces. </p>
+<p>Sets the service interface to apply the aspect to. By default, the directly
+implemented interface is used.</p>
+<hr />
+<p><strong><code>filter</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: --</p>
+<p>Sets the filter condition to use with the service interface this aspect is
+applying to.</p>
+<hr />
+<p><strong><code>properties</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: --</p>
+<p>Sets Additional properties to use with the aspect service registration.</p>
+<hr />
+<p><strong><code>field</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: --</p>
+<p>Sets the field name where to inject the original service. By default, the
original service is injected in any attributes in the aspect implementation
that are of the same type as the aspect interface.</p>
+<hr />
+<p><strong><code>factoryMethod</code></strong> <br />
+<em>Required</em>: No <br />
+<em>Default</em>: --</p>
+<p>Sets the static method used to create the aspect service 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.</p>
+<h3 id="usage-example">Usage example:</h3>
+<div class="codehilite"><pre> <span class="p">@</span><span
class="n">AspectService</span><span class="p">(</span><span
class="n">ranking</span><span class="p">=</span>10<span class="p">),</span>
<span class="k">properties</span><span class="p">={@</span><span
class="n">Property</span><span class="p">(</span><span
class="n">name</span><span class="p">=</span>"<span
class="n">param</span>"<span class="p">,</span> <span
class="n">value</span><span class="p">=</span>"<span
class="n">value</span>"<span class="p">)})</span>
+ <span class="n">class</span> <span class="n">AspectService</span> <span
class="n">implements</span> <span class="n">InterceptedService</span> <span
class="p">{</span>
+ <span class="o">//</span> <span class="n">The</span> <span
class="n">service</span> <span class="n">we</span> <span class="n">are</span>
<span class="n">intercepting</span> <span class="p">(</span><span
class="n">injected</span> <span class="n">by</span> <span
class="n">reflection</span><span class="p">)</span>
+ <span class="n">protected</span> <span
class="n">InterceptedService</span> <span class="n">intercepted</span><span
class="p">;</span>
+
+ <span class="n">public</span> <span class="n">void</span> <span
class="n">doWork</span><span class="p">()</span> <span class="p">{</span>
+ <span class="n">intercepted</span><span class="p">.</span><span
class="n">doWork</span><span class="p">();</span>
+ <span class="p">}</span>
+ <span class="p">}</span>
+</pre></div>
<div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
- Rev. 1663924 by marrs on Wed, 4 Mar 2015 10:39:19 +0000
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
</div>
<div class="trademarkFooter">
Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
Added:
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.html
==============================================================================
---
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.html
(added)
+++
websites/staging/felix/trunk/content/documentation/subprojects/apache-felix-dependency-manager-4/reference/component-bundle-adapter.html
Wed Mar 4 15:22:29 2015
@@ -0,0 +1,141 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<!--
+
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE- 2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+ <head>
+ <title>Apache Felix - </title>
+ <link rel="icon" href="/res/favicon.ico">
+ <link rel="stylesheet" href="/res/site.css" type="text/css" media="all">
+ <link rel="stylesheet" href="/res/codehilite.css" type="text/css"
media="all">
+ <meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
+ </head>
+ <body>
+ <div class="title">
+ <div class="logo">
+ <a href="http://felix.apache.org/">
+ <img border="0" alt="Apache Felix" src="/res/logo.png">
+ </a>
+ </div>
+ <div class="header">
+ <a href="http://www.apache.org/">
+ <img border="0" alt="Apache" src="/res/apache.png">
+ </a>
+ </div>
+ </div>
+
+ <div class="menu">
+ <p><a href="/news.html">news</a> <br />
+<a href="/license.html">license</a> <br />
+<a href="/downloads.cgi">downloads</a> <br />
+<a href="/documentation.html">documentation</a> <br />
+<a href="/mailinglists.html">mailing lists</a> <br />
+<a href="/documentation/community/contributing.html">contributing</a> <br />
+<a href="/sitemap.html">site map</a> <br />
+<a href="http://www.apache.org/">asf</a> <br />
+<a href="http://www.apache.org/security/">security</a> <br />
+<a href="http://www.apache.org/foundation/sponsorship.html">sponsorship</a>
<br />
+<a href="http://www.apache.org/foundation/thanks.html">sponsors</a> </p>
+<iframe
+ src="http://www.apache.org/ads/button.html"
+ style="border-width:0; float: left"
+ frameborder="0"
+ scrolling="no"
+ width="135"
+ height="135">
+</iframe>
+ </div>
+
+ <div class="main">
+ <div class="breadcrump" style="font-size: 80%;">
+ <a href="/">Home</a> » <a
href="/documentation.html">Documentation</a> » <a
href="/documentation/subprojects.html">Apache Felix Subproject
Documentation</a> » <a
href="/documentation/subprojects/apache-felix-dependency-manager-4.html">Apache
Felix Dependency Manager 4</a>
+ </div>
+
+
+
+ <h1></h1>
+ <h2 id="bundleadapterservice">@BundleAdapterService</h2>
+<p>Bundle adapters are similar to AdapterService, but instead of adapting a
+service, they adapt a bundle with a certain set of states
(STARTED|INSTALLED|...), and provide a service on top of it.</p>
+<p>The bundle adapter will be applied to any bundle that matches the specified
+bundle state mask and filter conditions, which may match some of the bundle
+OSGi manifest headers. For each matching bundle an adapter will be created
+based on the adapter implementation class. The adapter will be registered
+with the specified interface and with service properties found from the
+original bundle OSGi manifest headers plus any extra properties you supply
+here. If you declare the original bundle as a member it will be injected. </p>
+<h3 id="annotation-attributes">Annotation attributes:</h3>
+<hr />
+<p><strong><code>filter</code></strong> <br />
+<em>Required</em>: False <br />
+<em>Default</em>: --</p>
+<p>The filter used to match some OSGi manifest headers from a given bundle.</p>
+<hr />
+<p><strong><code>provides</code></strong> <br />
+<em>Required</em>: False <br />
+<em>Default</em>: all directly implemented interfaces.</p>
+<p>The interface(s) to use when registering adapters.
+By default, the interface(s) directly implemented by the annotated class is
(are) used.</p>
+<hr />
+<p><strong><code>properties</code></strong> <br />
+<em>Required</em>: False <br />
+<em>Default</em>: --</p>
+<p>Additional properties to use with the service registration.</p>
+<hr />
+<p><strong><code>stateMask</code></strong> <br />
+<em>Required</em>: False <br />
+<em>Default</em>: INSTALLED | RESOLVED | ACTIVE</p>
+<p>The bundle state mask to apply. The mask is made up of the flags provided
by
+the org.osgi.framework.Bundle states
+(UNINSTALLED | INSTALLED | RESOLVED | STARTING | STARTED | ACTIVE).</p>
+<hr />
+<p><strong><code>propagate</code></strong> <br />
+<em>Required</em>: False <br />
+<em>Default</em>: true</p>
+<p>Specifies if manifest headers from the bundle should be propagated to the
+exposed service properties.</p>
+<hr />
+<p><strong><code>factoryMethod</code></strong> <br />
+<em>Required</em>: False <br />
+<em>Default</em>: --</p>
+<p>Sets the static method used to create the BundleAdapterService
implementation
+instance.</p>
+<h3 id="usage-examples">Usage Examples</h3>
+<p>In the following example, a "VideoPlayer" Service is registered into the
OSGi registry each time an active bundle containing a "Video-Path" manifest
header is detected:</p>
+<div class="codehilite"><pre><span
class="nd">@BundleAdapterService</span><span class="o">(</span><span
class="n">filter</span> <span class="o">=</span> <span
class="s">"(Video-Path=*)"</span><span class="o">,</span> <span
class="n">stateMask</span> <span class="o">=</span> <span
class="n">Bundle</span><span class="o">.</span><span
class="na">ACTIVE</span><span class="o">,</span> <span
class="n">propagate</span><span class="o">=</span><span
class="kc">true</span><span class="o">)</span>
+<span class="kd">public</span> <span class="kd">class</span> <span
class="nc">VideoPlayerImpl</span> <span class="kd">implements</span> <span
class="n">VideoPlayer</span> <span class="o">{</span>
+ <span class="n">Bundle</span> <span class="n">bundle</span><span
class="o">;</span> <span class="c1">// Injected by reflection</span>
+
+ <span class="kt">void</span> <span class="nf">play</span><span
class="o">()</span> <span class="o">{</span>
+ <span class="n">URL</span> <span class="n">mpegFile</span> <span
class="o">=</span> <span class="n">bundle</span><span class="o">.</span><span
class="na">getEntry</span><span class="o">(</span><span
class="n">bundle</span><span class="o">.</span><span
class="na">getHeaders</span><span class="o">().</span><span
class="na">get</span><span class="o">(</span><span
class="s">"Video-Path"</span><span class="o">));</span>
+ <span class="c1">// play the video provided by the bundle ...</span>
+ <span class="o">}</span>
+
+ <span class="kt">void</span> <span class="nf">stop</span><span
class="o">()</span> <span class="o">{}</span>
+<span class="o">}</span>
+</pre></div>
+ <div class="timestamp" style="margin-top: 30px; font-size: 80%;
text-align: right;">
+ Rev. 1664040 by marrs on Wed, 4 Mar 2015 15:21:58 +0000
+ </div>
+ <div class="trademarkFooter">
+ Apache Felix, Felix, Apache, the Apache feather logo, and the Apache
Felix project
+ logo are trademarks of The Apache Software Foundation. All other marks
mentioned
+ may be trademarks or registered trademarks of their respective owners.
+ </div>
+ </div>
+ </body>
+</html>