ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From build...@apache.org
Subject svn commit: r813497 - in /websites/staging/ace/trunk/content: ./ dev-doc/design/ace-deployment-strategies.html
Date Wed, 18 Apr 2012 08:07:36 GMT
Author: buildbot
Date: Wed Apr 18 08:07:35 2012
New Revision: 813497

Log:
Staging update by buildbot for ace

Modified:
    websites/staging/ace/trunk/content/   (props changed)
    websites/staging/ace/trunk/content/dev-doc/design/ace-deployment-strategies.html

Propchange: websites/staging/ace/trunk/content/
------------------------------------------------------------------------------
--- cms:source-revision (original)
+++ cms:source-revision Wed Apr 18 08:07:35 2012
@@ -1 +1 @@
-1327406
+1327415

Modified: websites/staging/ace/trunk/content/dev-doc/design/ace-deployment-strategies.html
==============================================================================
--- websites/staging/ace/trunk/content/dev-doc/design/ace-deployment-strategies.html (original)
+++ websites/staging/ace/trunk/content/dev-doc/design/ace-deployment-strategies.html Wed Apr 18 08:07:35 2012
@@ -151,22 +151,22 @@
       <p><a href="/"><i class='icon-home'></i> Home</a>&nbsp;&raquo&nbsp;<a href="/dev-doc/">Dev-doc</a>&nbsp;&raquo&nbsp;<a href="/dev-doc/design/">Design</a></p>
       <h1></h1>
       <div class="clear"></div>
-      <div id="content"><h1 id="ace-deployment-strategies">Ace deployment strategies</h1>
+      <div id="content"><h1 id="deployment-strategies">Deployment strategies</h1>
 <p><em>implementing custom update policies</em></p>
 <h2 id="introduction">Introduction</h2>
-<p>This article describes how Ace deploys new deployment packages to targets and how this strategy can be adapted to support more sophisticated scenario's.<br />
-The remainder of this article assumes the reader has basic knowledge of the principles behind Ace, and has sufficient programming skills. For this article, the latest code of Ace (0.8.1-SNAPSHOT, rev.1326140) was used.</p>
+<p>This article describes how ACE deploys new deployment packages to targets and how this strategy can be adapted to support more sophisticated scenario's.<br />
+The remainder of this article assumes the reader has basic knowledge of the principles behind ACE, and has sufficient programming skills. For this article, the latest code of ACE (0.8.1-SNAPSHOT, rev.1326140) was used.</p>
 <h2 id="provisioning">Provisioning</h2>
-<p>Apache Ace is all about provisioning software artifacts to targets. Software artifacts, or simply, artifacts, can be compiled code, configuration files, or any other artifact needed for a software system to operate. Provisioned artifacts are bundled in so-called "deployment packages", that is comprised of the differences between the target's current artifacts and the to-be-deployed artifacts. To distinguish between deployment packages, each one is given its own version. The increment of versions is done automatically by Ace when changes are committed to its repository.<br />
-When a new deployment package is available, it is not automatically sent to the target as the communication between target and management server (Ace) is unidirectional and initiated by the target. A target has to periodically check whether new deployment packages are available, and if so, do something with it.</p>
-<h2 id="understanding-aces-deployment-strategy">Understanding Ace's deployment strategy</h2>
+<p>Apache ACE is all about provisioning software artifacts to targets. Software artifacts, or simply, artifacts, can be compiled code, configuration files, or any other artifact needed for a software system to operate. Provisioned artifacts are bundled in so-called "deployment packages", that is comprised of the differences between the target's current artifacts and the to-be-deployed artifacts. To distinguish between deployment packages, each one is given its own version. The increment of versions is done automatically by ACE when changes are committed to its repository.<br />
+When a new deployment package is available, it is not automatically sent to the target as the communication between target and management server (ACE) is unidirectional and initiated by the target. A target has to periodically check whether new deployment packages are available, and if so, do something with it.</p>
+<h2 id="understanding-aces-deployment-strategy">Understanding ACE's deployment strategy</h2>
 <p>Upon startup, the management agent, which represents a target, schedules several tasks that periodically synchronize the local state with that of the management server. Two of these tasks relate to the handling of deployment packages: <code>DeploymentCheckTask</code> and <code>DeploymentUpdateTask</code>. Figure 1 shows the relationship between the various components.</p>
 <p><img alt="Figure 1: class diagram" src="deployment_strategy_classdiagram.svg" title="Figure 1: class diagram" /><br />
 Figure 1: deployment strategy class diagram.</p>
 <p>The <code>DeploymentCheckTask</code> is responsible for periodically checking the management server for newer versions of deployment packages and if found emits an event. The <code>DeploymentUpdateTask</code> also periodically checks the management server, and if it finds a newer version, automatically downloads and installs it.</p>
 <p><img alt="Figure 2: sequence diagram" src="deployment_strategy_update_seq.svg" title="Figure 2: sequence diagram" /><br />
 Figure 2: deployment strategy sequence diagram.</p>
-<p>Figure 2 shows a more detailed sequence diagram of the deployment update strategy in Ace. The scheduler in the management agent calls the run()-method of the DeploymentUpdateTask once every <em>N</em> seconds. This method in its turn makes several calls to the <code>DeploymentService</code>, which acts as a facade for other services in Ace. The <code>DeploymentService</code> is queried for the highest local and remote versions. If the remote version is newer than the local version, a deployment package containing the changes between the local and the remote version is installed. Note that this installation is done in a best effort strategy: if it fails, all changes are rolled back to what they were. As a consequence, if the installation fails one time, it probably will fail the next time as well. </p>
+<p>Figure 2 shows a more detailed sequence diagram of the deployment update strategy in ACE. The scheduler in the management agent calls the run()-method of the DeploymentUpdateTask once every <em>N</em> seconds. This method in its turn makes several calls to the <code>DeploymentService</code>, which acts as a facade for other services in ACE. The <code>DeploymentService</code> is queried for the highest local and remote versions. If the remote version is newer than the local version, a deployment package containing the changes between the local and the remote version is installed. Note that this installation is done in a best effort strategy: if it fails, all changes are rolled back to what they were. As a consequence, if the installation fails one time, it probably will fail the next time as well. </p>
 <h3 id="tweaking-the-deployment-strategy">Tweaking the deployment strategy</h3>
 <p>By default, the management agent allows the interval in which the update task is run to be customized. To change this interval, the management agent should be started with the extra system property "<code>-Dsyncinterval=1500</code>". The value of this property is interpreted as the interval time in milliseconds. Note that this property also changes the interval of other tasks as well, so setting it to a lower interval could potentially raise lots of traffic to your management server.</p>
 <p>Another thing you can customize is whether or not the update task should run at all. This is done by starting the management agent with the system property "<code>-Dorg.apache.ace.deployment.task=disabled</code>". While this option is not really useful out-of-the-box (the target is not be able to obtain any version at all) it opens up a possibility for providing custom deployment strategies.</p>
@@ -186,20 +186,20 @@ The (stub) code for our update task look
 11
 12
 13
-14</pre></div></td><td class="code"><div class="codehilite"><pre><span class="kn">package</span> <span class="n">net</span><span class="o">.</span><span class="na">luminis</span><span class="o">.</span><span class="na">ace</span><span class="o">.</span><span class="na">updatetask</span><span class="o">;</span>
+14</pre></div></td><td class="code"><div class="codehilite"><pre><span class="nb">package</span> <span class="n">net</span><span class="o">.</span><span class="n">luminis</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">updatetask</span><span class="p">;</span>
 
-<span class="kn">import</span> <span class="nn">org.apache.ace.deployment.service.DeploymentService</span><span class="o">;</span>
-<span class="kn">import</span> <span class="nn">org.osgi.service.log.LogService</span><span class="o">;</span>
+<span class="nb">import</span> <span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">deployment</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="n">DeploymentService</span><span class="p">;</span>
+<span class="nb">import</span> <span class="n">org</span><span class="o">.</span><span class="n">osgi</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="nb">log</span><span class="o">.</span><span class="n">LogService</span><span class="p">;</span>
 
-<span class="kd">public</span><span class="err"> </span><span class="kd">class</span> <span class="nc">MyUpdateTask</span> <span class="kd">implements</span> <span class="n">Runnable</span> <span class="o">{</span>
-    <span class="c1">// injected by DependencyManager</span>
-<span class="err">   </span> <span class="kd">private</span> <span class="n">DeploymentService</span> <span class="n">m_service</span><span class="o">;</span> 
-<span class="err">   </span> <span class="kd">private</span> <span class="n">LogService</span> <span class="n">m_logService</span><span class="o">;</span>
-
-<span class="err">   </span> <span class="kd">public</span><span class="err"> </span><span class="kt">void</span> <span class="n">run</span><span class="o">()</span> <span class="o">{</span>
-<span class="err">       </span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;Hello from MyUpdateTask: &quot;</span> <span class="o">+</span> <span class="k">new</span> <span class="n">java</span><span class="o">.</span><span class="na">util</span><span class="o">.</span><span class="na">Date</span><span class="o">());</span>
-<span class="err">   </span> <span class="o">}</span>
-<span class="o">}</span>
+<span class="n">public</span><span class="err"> </span><span class="n">class</span> <span class="n">MyUpdateTask</span> <span class="n">implements</span> <span class="n">Runnable</span> <span class="p">{</span>
+    <span class="sr">//</span> <span class="n">injected</span> <span class="n">by</span> <span class="n">DependencyManager</span>
+<span class="err">   </span> <span class="n">private</span> <span class="n">DeploymentService</span> <span class="n">m_service</span><span class="p">;</span> 
+<span class="err">   </span> <span class="n">private</span> <span class="n">LogService</span> <span class="n">m_logService</span><span class="p">;</span>
+
+<span class="err">   </span> <span class="n">public</span><span class="err"> </span><span class="n">void</span> <span class="n">run</span><span class="p">()</span> <span class="p">{</span>
+<span class="err">       </span> <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Hello from MyUpdateTask: &quot;</span> <span class="o">+</span> <span class="k">new</span> <span class="n">java</span><span class="o">.</span><span class="n">util</span><span class="o">.</span><span class="n">Date</span><span class="p">());</span>
+<span class="err">   </span> <span class="p">}</span>
+<span class="p">}</span>
 </pre></div>
 </td></tr></table>
 
@@ -239,85 +239,70 @@ The (stub) code for our update task look
 33
 34
 35
-36</pre></div></td><td class="code"><div class="codehilite"><pre><span class="kn">package</span> <span class="n">net</span><span class="o">.</span><span class="na">luminis</span><span class="o">.</span><span class="na">ace</span><span class="o">.</span><span class="na">updatetask</span><span class="o">;</span>
+36</pre></div></td><td class="code"><div class="codehilite"><pre><span class="nb">package</span> <span class="n">net</span><span class="o">.</span><span class="n">luminis</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">updatetask</span><span class="p">;</span>
 
-<span class="kn">import</span> <span class="nn">java.util.Properties</span><span class="o">;</span>
+<span class="nb">import</span> <span class="n">java</span><span class="o">.</span><span class="n">util</span><span class="o">.</span><span class="n">Properties</span><span class="p">;</span>
 
-<span class="kn">import</span> <span class="nn">org.apache.ace.deployment.service.DeploymentService</span><span class="o">;</span>
-<span class="kn">import</span> <span class="nn">org.apache.ace.scheduler.constants.SchedulerConstants</span><span class="o">;</span>
-<span class="kn">import</span> <span class="nn">org.apache.felix.dm.DependencyActivatorBase</span><span class="o">;</span>
-<span class="kn">import</span> <span class="nn">org.apache.felix.dm.DependencyManager</span><span class="o">;</span>
-<span class="kn">import</span> <span class="nn">org.osgi.framework.BundleContext</span><span class="o">;</span>
-<span class="kn">import</span> <span class="nn">org.osgi.service.log.LogService</span><span class="o">;</span>
-
-<span class="kd">public</span><span class="err"> </span><span class="kd">class</span> <span class="nc">Activator</span> <span class="kd">extends</span> <span class="n">DependencyActivatorBase</span> <span class="o">{</span>
-  <span class="kd">public</span> <span class="kt">void</span> <span class="nf">init</span><span class="o">(</span><span class="n">BundleContext</span> <span class="n">context</span><span class="o">,</span> <span class="n">DependencyManager</span> <span class="n">manager</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span>
-    <span class="n">Properties</span> <span class="n">props</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Properties</span><span class="o">();</span>
-    <span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="n">SchedulerConstants</span><span class="o">.</span><span class="na">SCHEDULER_NAME_KEY</span><span class="o">,</span> <span class="n">MyUpdateTask</span><span class="o">.</span><span class="na">class</span><span class="o">.</span><span class="na">getName</span><span class="o">());</span>
-    <span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="n">SchedulerConstants</span><span class="o">.</span><span class="na">SCHEDULER_DESCRIPTION_KEY</span><span class="o">,</span> <span class="s">&quot;My own deployment update service.&quot;</span><span class="o">);</span>
-    <span class="n">props</span><span class="o">.</span><span class="na">put</span><span class="o">(</span><span class="n">SchedulerConstants</span><span class="o">.</span><span class="na">SCHEDULER_RECIPE</span><span class="o">,</span> <span class="s">&quot;5000&quot;</span><span class="o">);</span>
-
-    <span class="n">manager</span><span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">createComponent</span><span class="o">()</span>
-      <span class="o">.</span><span class="na">setInterface</span><span class="o">(</span><span class="n">Runnable</span><span class="o">.</span><span class="na">class</span><span class="o">.</span><span class="na">getName</span><span class="o">(),</span> <span class="n">props</span><span class="o">)</span>
-      <span class="o">.</span><span class="na">setImplementation</span><span class="o">(</span><span class="k">new</span> <span class="n">MyUpdateTask</span><span class="o">())</span>
-      <span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">createServiceDependency</span><span class="o">()</span>
-        <span class="o">.</span><span class="na">setService</span><span class="o">(</span><span class="n">DeploymentService</span><span class="o">.</span><span class="na">class</span><span class="o">)</span>
-        <span class="o">.</span><span class="na">setRequired</span><span class="o">(</span><span class="kc">true</span><span class="o">)</span>
-      <span class="o">)</span>
-      <span class="o">.</span><span class="na">add</span><span class="o">(</span><span class="n">createServiceDependency</span><span class="o">()</span>
-        <span class="o">.</span><span class="na">setService</span><span class="o">(</span><span class="n">LogService</span><span class="o">.</span><span class="na">class</span><span class="o">)</span>
-        <span class="o">.</span><span class="na">setRequired</span><span class="o">(</span><span class="kc">false</span><span class="o">)</span>
-      <span class="o">)</span>
-    <span class="o">);</span>
-  <span class="o">}</span>
-
-  <span class="kd">public</span> <span class="kt">void</span> <span class="nf">destroy</span><span class="o">(</span><span class="n">BundleContext</span> <span class="n">context</span><span class="o">,</span> <span class="n">DependencyManager</span> <span class="n">manager</span><span class="o">)</span> <span class="kd">throws</span> <span class="n">Exception</span> <span class="o">{</span>
-    <span class="c1">// Nothing</span>
-  <span class="o">}</span>
-<span class="o">}</span>
+<span class="nb">import</span> <span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">deployment</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="n">DeploymentService</span><span class="p">;</span>
+<span class="nb">import</span> <span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">scheduler</span><span class="o">.</span><span class="n">constants</span><span class="o">.</span><span class="n">SchedulerConstants</span><span class="p">;</span>
+<span class="nb">import</span> <span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">felix</span><span class="o">.</span><span class="n">dm</span><span class="o">.</span><span class="n">DependencyActivatorBase</span><span class="p">;</span>
+<span class="nb">import</span> <span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">felix</span><span class="o">.</span><span class="n">dm</span><span class="o">.</span><span class="n">DependencyManager</span><span class="p">;</span>
+<span class="nb">import</span> <span class="n">org</span><span class="o">.</span><span class="n">osgi</span><span class="o">.</span><span class="n">framework</span><span class="o">.</span><span class="n">BundleContext</span><span class="p">;</span>
+<span class="nb">import</span> <span class="n">org</span><span class="o">.</span><span class="n">osgi</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="nb">log</span><span class="o">.</span><span class="n">LogService</span><span class="p">;</span>
+
+<span class="n">public</span><span class="err"> </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">Properties</span> <span class="n">props</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Properties</span><span class="p">();</span>
+    <span class="n">props</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">SchedulerConstants</span><span class="o">.</span><span class="n">SCHEDULER_NAME_KEY</span><span class="p">,</span> <span class="n">MyUpdateTask</span><span class="o">.</span><span class="n">class</span><span class="o">.</span><span class="n">getName</span><span class="p">());</span>
+    <span class="n">props</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">SchedulerConstants</span><span class="o">.</span><span class="n">SCHEDULER_DESCRIPTION_KEY</span><span class="p">,</span> <span class="s">&quot;My own deployment update service.&quot;</span><span class="p">);</span>
+    <span class="n">props</span><span class="o">.</span><span class="n">put</span><span class="p">(</span><span class="n">SchedulerConstants</span><span class="o">.</span><span class="n">SCHEDULER_RECIPE</span><span class="p">,</span> <span class="s">&quot;5000&quot;</span><span class="p">);</span>
+
+    <span class="n">manager</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">createComponent</span><span class="p">()</span>
+      <span class="o">.</span><span class="n">setInterface</span><span class="p">(</span><span class="n">Runnable</span><span class="o">.</span><span class="n">class</span><span class="o">.</span><span class="n">getName</span><span class="p">(),</span> <span class="n">props</span><span class="p">)</span>
+      <span class="o">.</span><span class="n">setImplementation</span><span class="p">(</span><span class="k">new</span> <span class="n">MyUpdateTask</span><span class="p">())</span>
+      <span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">createServiceDependency</span><span class="p">()</span>
+        <span class="o">.</span><span class="n">setService</span><span class="p">(</span><span class="n">DeploymentService</span><span class="o">.</span><span class="n">class</span><span class="p">)</span>
+        <span class="o">.</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="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">createServiceDependency</span><span class="p">()</span>
+        <span class="o">.</span><span class="n">setService</span><span class="p">(</span><span class="n">LogService</span><span class="o">.</span><span class="n">class</span><span class="p">)</span>
+        <span class="o">.</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="sr">//</span> <span class="n">Nothing</span>
+  <span class="p">}</span>
+<span class="p">}</span>
 </pre></div>
 </td></tr></table>
 
-<p>The activator isn't that different from any other one, the only interesting part is the service properties that we register along with our update task. The three properties are used by the Ace's scheduler to determine that our service is actually a scheduled task. With the "recipe" key, the scheduler is told what interval (in milliseconds) is to be used to execute our task. In our case the recipe is set to 5000, causing our task to be run once every five seconds.<br />
+<p>The activator isn't that different from any other one, the only interesting part is the service properties that we register along with our update task. The three properties are used by the ACE's scheduler to determine that our service is actually a scheduled task. With the "recipe" key, the scheduler is told what interval (in milliseconds) is to be used to execute our task. In our case the recipe is set to 5000, causing our task to be run once every five seconds.<br />
 To complete the whole cycle, we need some build scripting. For this, we use <a href="http://bndtools.org">BndTools</a>:</p>
-<table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
-10
-11</pre></div></td><td class="code"><div class="codehilite"><pre><span class="n">Bundle</span><span class="o">-</span><span class="n">Name:</span> <span class="n">My</span> <span class="n">Update</span> <span class="n">Task</span>
-<span class="n">Bundle</span><span class="o">-</span><span class="n">Version:</span> <span class="mf">0.0.1</span>
-<span class="n">Bundle</span><span class="o">-</span><span class="n">SymbolicName:</span> <span class="n">net</span><span class="o">.</span><span class="n">luminis</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">updatetask</span>
-<span class="n">Bundle</span><span class="o">-</span><span class="n">Activator:</span> <span class="n">net</span><span class="o">.</span><span class="n">luminis</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">updatetask</span><span class="o">.</span><span class="n">Activator</span>
-<span class="n">Private</span><span class="o">-</span><span class="n">Package:</span> <span class="n">net</span><span class="o">.</span><span class="n">luminis</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">updatetask</span>
-<span class="n">Import</span><span class="o">-</span><span class="n">Package:</span> <span class="o">*</span>
-<span class="o">-</span><span class="n">buildpath:</span> <span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">deployment</span><span class="o">.</span><span class="n">task</span><span class="o">.</span><span class="n">base</span><span class="p">;</span><span class="n">version</span><span class="o">=</span><span class="mf">0.8</span><span class="p">,</span><span class="o">\</span>
-<span class="err">     </span><span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">scheduler</span><span class="o">.</span><span class="n">api</span><span class="p">;</span><span class="n">version</span><span class="o">=</span><span class="mf">0.8</span><span class="p">,</span><span class="o">\</span>
-<span class="err">     </span><span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">felix</span><span class="o">.</span><span class="n">dependencymanager</span><span class="p">;</span><span class="n">version</span><span class="o">=</span><span class="mf">3.0</span><span class="p">,</span><span class="o">\</span>
-<span class="err">     </span><span class="n">osgi</span><span class="o">.</span><span class="n">core</span><span class="p">;</span><span class="n">version</span><span class="o">=</span><span class="mf">4.2.0</span><span class="p">,</span><span class="o">\</span>
-<span class="err">     </span><span class="n">osgi</span><span class="o">.</span><span class="n">cmpn</span><span class="p">;</span><span class="n">version</span><span class="o">=</span><span class="mf">4.2.0</span>
+<div class="codehilite"><pre>Bundle-Name: My Update Task
+Bundle-Version: 0.0.1
+Bundle-SymbolicName: net.luminis.ace.updatetask
+Bundle-Activator: net.luminis.ace.updatetask.Activator
+Private-Package: net.luminis.ace.updatetask
+Import-Package: *
+-buildpath: org.apache.ace.deployment.task.base;version=0.8,\
+     org.apache.ace.scheduler.api;version=0.8,\
+     org.apache.felix.dependencymanager;version=3.0,\
+     osgi.core;version=4.2.0,\
+     osgi.cmpn;version=4.2.0
 </pre></div>
-</td></tr></table>
+
 
 <p>To let the management agent to find and use our custom update task bundle, we need to add the JAR-file to its class path, and start the management agent with the following options:</p>
-<table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre>1
-2
-3
-4
-5
-6</pre></div></td><td class="code"><div class="codehilite"><pre><span class="o">[</span>localhost:~/<span class="o">]</span><span class="nv">$ </span>java -Dorg.apache.ace.deployment.task<span class="o">=</span>disabled <span class="se">\</span>
+<div class="codehilite"><pre><span class="o">[</span>localhost:~/<span class="o">]</span><span class="nv">$ </span>java -Dorg.apache.ace.deployment.task<span class="o">=</span>disabled <span class="se">\</span>
  -cp org.apache.ace.launcher-0.8.1-SNAPSHOT.jar:net.luminis.ace.updatetask-1.0.0.jar <span class="se">\</span>
  org.apache.ace.launcher.Main <span class="se">\</span>
  bundle<span class="o">=</span>net.luminis.ace.updatetask.Activator <span class="se">\</span>
  identification<span class="o">=</span>myTarget <span class="se">\</span>
  discovery<span class="o">=</span>http://localhost:8080
 </pre></div>
-</td></tr></table>
+
 
 <p>Note that besides adding our bundle to the class path, we also have added the <code>bundle</code> argument to tell the management agent to include our bundle activator in its startup.<br />
 If everything went well, one of the first few lines printed out on the console should be something like:</p>
@@ -352,37 +337,37 @@ If everything went well, one of the firs
 21
 22
 23
-24</pre></div></td><td class="code"><div class="codehilite"><pre><span class="err"> </span> <span class="err">  </span><span class="kd">public</span><span class="err"> </span><span class="kt">void</span> <span class="n">run</span><span class="o">()</span> <span class="o">{</span>
-<span class="err">       </span> <span class="k">try</span> <span class="o">{</span>
-<span class="err">           </span> <span class="n">Version</span> <span class="n">local</span> <span class="o">=</span> <span class="n">m_service</span><span class="o">.</span><span class="na">getHighestLocalVersion</span><span class="o">();</span>
-<span class="err">           </span> <span class="n">Version</span> <span class="n">remote</span> <span class="o">=</span> <span class="n">m_service</span><span class="o">.</span><span class="na">getHighestRemoteVersion</span><span class="o">();</span>
-
-<span class="err">           </span> <span class="k">if</span> <span class="o">((</span><span class="n">remote</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span> <span class="o">&amp;&amp;</span> <span class="o">((</span><span class="n">local</span> <span class="o">==</span> <span class="kc">null</span><span class="o">)</span> <span class="o">||</span> <span class="o">(</span><span class="n">remote</span><span class="o">.</span><span class="na">compareTo</span><span class="o">(</span><span class="n">local</span><span class="o">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="o">)))</span> <span class="o">{</span>
-<span class="err">               </span> <span class="c1">// Ask user whether this update should proceed...</span>
-<span class="err">               </span> <span class="n">System</span><span class="o">.</span><span class="na">out</span><span class="o">.</span><span class="na">println</span><span class="o">(</span><span class="s">&quot;Update available! Upgrade from &quot;</span> <span class="o">+</span> <span class="n">local</span> <span class="o">+</span> <span class="s">&quot; to &quot;</span> <span class="o">+</span> <span class="n">remote</span> <span class="o">+</span> <span class="s">&quot; [Y/N]?&quot;</span><span class="o">);</span>
-
-<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="n">BufferedReader</span> <span class="n">reader</span> <span class="o">=</span> <span class="k">new</span> <span class="n">BufferedReader</span><span class="o">(</span><span class="k">new</span> <span class="n">InputStreamReader</span><span class="o">(</span><span class="n">System</span><span class="o">.</span><span class="na">in</span><span class="o">));</span>
-<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="n">String</span> <span class="n">result</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="na">readLine</span><span class="o">();</span>
-
-<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err">  </span><span class="k">if</span> <span class="o">(</span><span class="s">&quot;y&quot;</span><span class="o">.</span><span class="na">equalsIgnoreCase</span><span class="o">(</span><span class="n">result</span><span class="o">))</span> <span class="o">{</span>
-<span class="err">                   </span> <span class="c1">// Ask the deployer service to install this update...</span>
-<span class="err">                   </span> <span class="n">m_service</span><span class="o">.</span><span class="na">installVersion</span><span class="o">(</span><span class="n">remote</span><span class="o">,</span> <span class="n">local</span><span class="o">);</span>
-
-<span class="err">                   </span> <span class="n">m_logService</span><span class="o">.</span><span class="na">log</span><span class="o">(</span><span class="n">LogService</span><span class="o">.</span><span class="na">LOG_INFO</span><span class="o">,</span> <span class="s">&quot;Update installed!&quot;</span><span class="o">);</span>
-<span class="err">               </span> <span class="o">}</span>
-<span class="err">           </span> <span class="o">}</span>
-<span class="err">       </span> <span class="o">}</span> <span class="k">catch</span> <span class="o">(</span><span class="n">IOException</span> <span class="n">e</span><span class="o">)</span> <span class="o">{</span>
-<span class="err">           </span> <span class="n">m_logService</span><span class="o">.</span><span class="na">log</span><span class="o">(</span><span class="n">LogService</span><span class="o">.</span><span class="na">LOG_WARNING</span><span class="o">,</span> <span class="s">&quot;Update failed!&quot;</span><span class="o">,</span> <span class="n">e</span><span class="o">);</span>
-<span class="err">       </span> <span class="o">}</span> <span class="k">catch</span> <span class="o">(</span><span class="n">Exception</span> <span class="n">e</span><span class="o">)</span> <span class="o">{</span>
-<span class="err">           </span> <span class="n">m_logService</span><span class="o">.</span><span class="na">log</span><span class="o">(</span><span class="n">LogService</span><span class="o">.</span><span class="na">LOG_WARNING</span><span class="o">,</span> <span class="s">&quot;Update failed!&quot;</span><span class="o">,</span> <span class="n">e</span><span class="o">);</span>
-<span class="err">       </span> <span class="o">}</span>
+24</pre></div></td><td class="code"><div class="codehilite"><pre><span class="err"> </span> <span class="err">  </span><span class="n">public</span><span class="err"> </span><span class="n">void</span> <span class="n">run</span><span class="p">()</span> <span class="p">{</span>
+<span class="err">       </span> <span class="n">try</span> <span class="p">{</span>
+<span class="err">           </span> <span class="n">Version</span> <span class="nb">local</span> <span class="o">=</span> <span class="n">m_service</span><span class="o">.</span><span class="n">getHighestLocalVersion</span><span class="p">();</span>
+<span class="err">           </span> <span class="n">Version</span> <span class="n">remote</span> <span class="o">=</span> <span class="n">m_service</span><span class="o">.</span><span class="n">getHighestRemoteVersion</span><span class="p">();</span>
+
+<span class="err">           </span> <span class="k">if</span> <span class="p">((</span><span class="n">remote</span> <span class="o">!=</span> <span class="n">null</span><span class="p">)</span> <span class="o">&amp;&amp;</span> <span class="p">((</span><span class="nb">local</span> <span class="o">==</span> <span class="n">null</span><span class="p">)</span> <span class="o">||</span> <span class="p">(</span><span class="n">remote</span><span class="o">.</span><span class="n">compareTo</span><span class="p">(</span><span class="nb">local</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">)))</span> <span class="p">{</span>
+<span class="err">               </span> <span class="sr">//</span> <span class="n">Ask</span> <span class="n">user</span> <span class="n">whether</span> <span class="n">this</span> <span class="n">update</span> <span class="n">should</span> <span class="n">proceed</span><span class="o">...</span>
+<span class="err">               </span> <span class="n">System</span><span class="o">.</span><span class="n">out</span><span class="o">.</span><span class="n">println</span><span class="p">(</span><span class="s">&quot;Update available! Upgrade from &quot;</span> <span class="o">+</span> <span class="nb">local</span> <span class="o">+</span> <span class="s">&quot; to &quot;</span> <span class="o">+</span> <span class="n">remote</span> <span class="o">+</span> <span class="s">&quot; [Y/N]?&quot;</span><span class="p">);</span>
+
+<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="n">BufferedReader</span> <span class="n">reader</span> <span class="o">=</span> <span class="k">new</span> <span class="n">BufferedReader</span><span class="p">(</span><span class="k">new</span> <span class="n">InputStreamReader</span><span class="p">(</span><span class="n">System</span><span class="o">.</span><span class="n">in</span><span class="p">));</span>
+<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="n">String</span> <span class="n">result</span> <span class="o">=</span> <span class="n">reader</span><span class="o">.</span><span class="n">readLine</span><span class="p">();</span>
+
+<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err">  </span><span class="k">if</span> <span class="p">(</span><span class="s">&quot;y&quot;</span><span class="o">.</span><span class="n">equalsIgnoreCase</span><span class="p">(</span><span class="n">result</span><span class="p">))</span> <span class="p">{</span>
+<span class="err">                   </span> <span class="sr">//</span> <span class="n">Ask</span> <span class="n">the</span> <span class="n">deployer</span> <span class="n">service</span> <span class="n">to</span> <span class="n">install</span> <span class="n">this</span> <span class="n">update</span><span class="o">...</span>
+<span class="err">                   </span> <span class="n">m_service</span><span class="o">.</span><span class="n">installVersion</span><span class="p">(</span><span class="n">remote</span><span class="p">,</span> <span class="nb">local</span><span class="p">);</span>
+
+<span class="err">                   </span> <span class="n">m_logService</span><span class="o">.</span><span class="nb">log</span><span class="p">(</span><span class="n">LogService</span><span class="o">.</span><span class="n">LOG_INFO</span><span class="p">,</span> <span class="s">&quot;Update installed!&quot;</span><span class="p">);</span>
+<span class="err">               </span> <span class="p">}</span>
+<span class="err">           </span> <span class="p">}</span>
+<span class="err">       </span> <span class="p">}</span> <span class="n">catch</span> <span class="p">(</span><span class="n">IOException</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+<span class="err">           </span> <span class="n">m_logService</span><span class="o">.</span><span class="nb">log</span><span class="p">(</span><span class="n">LogService</span><span class="o">.</span><span class="n">LOG_WARNING</span><span class="p">,</span> <span class="s">&quot;Update failed!&quot;</span><span class="p">,</span> <span class="n">e</span><span class="p">);</span>
+<span class="err">       </span> <span class="p">}</span> <span class="n">catch</span> <span class="p">(</span><span class="n">Exception</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
+<span class="err">           </span> <span class="n">m_logService</span><span class="o">.</span><span class="nb">log</span><span class="p">(</span><span class="n">LogService</span><span class="o">.</span><span class="n">LOG_WARNING</span><span class="p">,</span> <span class="s">&quot;Update failed!&quot;</span><span class="p">,</span> <span class="n">e</span><span class="p">);</span>
+<span class="err">       </span> <span class="p">}</span>
 </pre></div>
 </td></tr></table>
 
 <p>This new implementation first asks the <code>DeploymentService</code> what the current local (= version current running on management agent) and remote (= version available in the management server) versions are. If the remote version is newer/higher than the local version, than we ask the user for permission to install the update. When given, the <code>DeploymentService</code> is requested to upgrade from the local version to the remote version.<br />
-If you would run this code, you'll notice that if the user doesn't respond within the task's interval, a new task is started, causing an ever increasing number of tasks to be waiting for user input in case an update is available. Currently, due to the current implementation of Ace's scheduler, there is no way of disabling this behavior (although it is not really difficult to resolve this problem locally in your task).</p>
+If you would run this code, you'll notice that if the user doesn't respond within the task's interval, a new task is started, causing an ever increasing number of tasks to be waiting for user input in case an update is available. Currently, due to the current implementation of ACE's scheduler, there is no way of disabling this behavior (although it is not really difficult to resolve this problem locally in your task).</p>
 <h2 id="taking-it-a-step-further">Taking it a step further…</h2>
-<p>So far, we've reused the <code>DeploymentService</code> facade from Ace to tweak the update process of the management agent a bit. However, there still some magic going on in the installation of newer versions (all the logic behind <code>DeploymentService#installVersion</code>).  
+<p>So far, we've reused the <code>DeploymentService</code> facade from ACE to tweak the update process of the management agent a bit. However, there still some magic going on in the installation of newer versions (all the logic behind <code>DeploymentService#installVersion</code>).  
 Let's explore this method a bit more into detail. The <code>installVersion</code> method roughly (some details are left out for brevity) has the following implementation:</p>
 <table class="codehilitetable"><tr><td class="linenos"><div class="linenodiv"><pre> 1
  2
@@ -421,54 +406,54 @@ Let's explore this method a bit more int
 35
 36
 37
-38</pre></div></td><td class="code"><div class="codehilite"><pre><span class="err"> </span> <span class="err">  </span><span class="c1">// injected by Felix&#39; dependency manager</span>
-<span class="err"> </span> <span class="err">  </span><span class="kd">volatile</span> <span class="n">Deployment</span> <span class="n">m_deployer</span><span class="o">;</span>
-<span class="err"> </span> <span class="err">  </span><span class="kd">volatile</span> <span class="n">EventAdmin</span> <span class="n">m_eventAdmin</span><span class="o">;</span>
-<span class="err"> </span> <span class="err">  </span><span class="kd">volatile</span> <span class="n">Identification</span> <span class="n">m_identification</span><span class="o">;</span>
-<span class="err"> </span> <span class="err">  </span><span class="c1">// denotes the host + port where Ace is listening, e.g. http://192.168.1.1:8080/</span>
-<span class="err"> </span> <span class="err"> </span> <span class="kd">final</span><span class="err"> </span><span class="n">String</span><span class="err"> </span><span class="n">m_host</span><span class="o">;</span>
-
-<span class="err"> </span> <span class="err">  </span><span class="cm">/**</span>
-<span class="cm">     * @see org.apache.ace.deployment.service.impl.DeploymentServiceImpl#installVersion</span>
-<span class="cm">     */</span>
-<span class="err">   </span> <span class="kd">public</span><span class="err"> </span><span class="kt">void</span> <span class="n">installVersion</span><span class="o">(</span><span class="n">Version</span> <span class="n">highestRemoteVersion</span><span class="o">,</span> <span class="n">Version</span> <span class="n">highestLocalVersion</span><span class="o">)</span> <span class="kd">throws</span><span class="err"> </span><span class="n">Exception</span> <span class="o">{</span>
-<span class="err">       </span> <span class="n">InputStream</span> <span class="n">inputStream</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
+38</pre></div></td><td class="code"><div class="codehilite"><pre><span class="err"> </span> <span class="err">  </span><span class="sr">//</span> <span class="n">injected</span> <span class="n">by</span> <span class="n">Felix</span><span class="err">&#39; </span><span class="n">dependency</span> <span class="n">manager</span>
+<span class="err"> </span> <span class="err">  </span><span class="n">volatile</span> <span class="n">Deployment</span> <span class="n">m_deployer</span><span class="p">;</span>
+<span class="err"> </span> <span class="err">  </span><span class="n">volatile</span> <span class="n">EventAdmin</span> <span class="n">m_eventAdmin</span><span class="p">;</span>
+<span class="err"> </span> <span class="err">  </span><span class="n">volatile</span> <span class="n">Identification</span> <span class="n">m_identification</span><span class="p">;</span>
+<span class="err"> </span> <span class="err">  </span><span class="sr">//</span> <span class="n">denotes</span> <span class="n">the</span> <span class="n">host</span> <span class="o">+</span> <span class="n">port</span> <span class="n">where</span> <span class="n">ACE</span> <span class="n">is</span> <span class="n">listening</span><span class="p">,</span> <span class="n">e</span><span class="o">.</span><span class="n">g</span><span class="o">.</span> <span class="n">http:</span><span class="sr">//</span><span class="mf">192.168.1.1</span><span class="p">:</span><span class="mi">8080</span><span class="o">/</span>
+<span class="err"> </span> <span class="err"> </span> <span class="n">final</span><span class="err"> </span><span class="n">String</span><span class="err"> </span><span class="n">m_host</span><span class="p">;</span>
+
+<span class="err"> </span> <span class="err">  </span><span class="o">/**</span>
+<span class="err">    </span> <span class="o">*</span> <span class="nv">@see</span> <span class="n">org</span><span class="o">.</span><span class="n">apache</span><span class="o">.</span><span class="n">ace</span><span class="o">.</span><span class="n">deployment</span><span class="o">.</span><span class="n">service</span><span class="o">.</span><span class="n">impl</span><span class="o">.</span><span class="n">DeploymentServiceImpl</span><span class="c1">#installVersion</span>
+<span class="err">    </span> <span class="o">*/</span>
+<span class="err">   </span> <span class="n">public</span><span class="err"> </span><span class="n">void</span> <span class="n">installVersion</span><span class="p">(</span><span class="n">Version</span> <span class="n">highestRemoteVersion</span><span class="p">,</span> <span class="n">Version</span> <span class="n">highestLocalVersion</span><span class="p">)</span> <span class="n">throws</span><span class="err"> </span><span class="n">Exception</span> <span class="p">{</span>
+<span class="err">       </span> <span class="n">InputStream</span> <span class="n">inputStream</span> <span class="o">=</span> <span class="n">null</span><span class="p">;</span>
 <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err">  </span>
-<span class="err">       </span> <span class="k">try</span> <span class="o">{</span>
-<span class="err">           </span> <span class="n">String</span> <span class="n">version</span> <span class="o">=</span> <span class="n">highestRemoteVersion</span><span class="o">.</span><span class="na">toString</span><span class="o">();</span>
-<span class="err">           </span> <span class="n">URL</span> <span class="n">baseURL</span> <span class="o">=</span><span class="err"> </span><span class="k">new</span> <span class="n">URL</span><span class="o">(</span><span class="n">m_host</span><span class="o">,</span> <span class="s">&quot;deployment/&quot;</span> <span class="o">+</span> <span class="n">m_identification</span><span class="o">.</span><span class="na">getID</span><span class="o">()</span> <span class="o">+</span> <span class="s">&quot;/versions/&quot;</span><span class="o">);</span>
-<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err">  </span><span class="k">if</span> <span class="o">(</span><span class="n">highestLocalVersion</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
-<span class="err">               </span> <span class="n">version</span> <span class="o">+=</span> <span class="s">&quot;?current=&quot;</span> <span class="o">+</span> <span class="n">highestLocalVersion</span><span class="o">.</span><span class="na">toString</span><span class="o">();</span>
-<span class="err">           </span> <span class="o">}</span>
-<span class="err">          </span>  <span class="n">URL</span> <span class="n">dataURL</span> <span class="o">=</span> <span class="k">new</span> <span class="n">URL</span><span class="o">(</span><span class="n">baseURL</span><span class="o">,</span> <span class="n">version</span><span class="o">);</span>
-<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="n">inputStream</span> <span class="o">=</span> <span class="n">dataURL</span><span class="o">.</span><span class="na">openStream</span><span class="o">();</span>
-
-<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err">  </span><span class="c1">// Post event for audit log</span>
-<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="n">String</span> <span class="n">topic</span><span class="err"> </span><span class="o">=</span> <span class="s">&quot;org/apache/ace/deployment/INSTALL&quot;</span><span class="o">;</span>
-<span class="err">           </span> <span class="n">m_eventAdmin</span><span class="o">.</span><span class="na">postEvent</span><span class="o">(</span><span class="n">createEvent</span><span class="o">(</span><span class="n">topic</span><span class="o">,</span> <span class="n">version</span><span class="o">,</span> <span class="n">dataURL</span><span class="o">));</span>
-
-<span class="err">           </span> <span class="n">m_deployer</span><span class="o">.</span><span class="na">install</span><span class="o">(</span><span class="n">inputStream</span><span class="o">);</span>
-<span class="err">       </span> <span class="o">}</span>
-<span class="err">       </span> <span class="k">finally</span> <span class="o">{</span>
-<span class="err">           </span> <span class="k">if</span> <span class="o">(</span><span class="n">inputStream</span> <span class="o">!=</span> <span class="kc">null</span><span class="o">)</span> <span class="o">{</span>
-<span class="err">               </span> <span class="k">try</span> <span class="o">{</span>
-<span class="err">                   </span> <span class="n">inputStream</span><span class="o">.</span><span class="na">close</span><span class="o">();</span>
-<span class="err">               </span> <span class="o">}</span>
-<span class="err">               </span> <span class="k">catch</span> <span class="o">(</span><span class="n">Exception</span> <span class="n">ex</span><span class="o">)</span> <span class="o">{</span>
-<span class="err">                   </span> <span class="c1">// Not much we can do.</span>
-<span class="err">               </span> <span class="o">}</span>
-<span class="err">           </span> <span class="o">}</span>
-<span class="err">       </span> <span class="o">}</span>
+<span class="err">       </span> <span class="n">try</span> <span class="p">{</span>
+<span class="err">           </span> <span class="n">String</span> <span class="n">version</span> <span class="o">=</span> <span class="n">highestRemoteVersion</span><span class="o">.</span><span class="n">toString</span><span class="p">();</span>
+<span class="err">           </span> <span class="n">URL</span> <span class="n">baseURL</span> <span class="o">=</span><span class="err"> </span><span class="k">new</span> <span class="n">URL</span><span class="p">(</span><span class="n">m_host</span><span class="p">,</span> <span class="s">&quot;deployment/&quot;</span> <span class="o">+</span> <span class="n">m_identification</span><span class="o">.</span><span class="n">getID</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;/versions/&quot;</span><span class="p">);</span>
+<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err">  </span><span class="k">if</span> <span class="p">(</span><span class="n">highestLocalVersion</span> <span class="o">!=</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span>
+<span class="err">               </span> <span class="n">version</span> <span class="o">+=</span> <span class="s">&quot;?current=&quot;</span> <span class="o">+</span> <span class="n">highestLocalVersion</span><span class="o">.</span><span class="n">toString</span><span class="p">();</span>
+<span class="err">           </span> <span class="p">}</span>
+<span class="err">          </span>  <span class="n">URL</span> <span class="n">dataURL</span> <span class="o">=</span> <span class="k">new</span> <span class="n">URL</span><span class="p">(</span><span class="n">baseURL</span><span class="p">,</span> <span class="n">version</span><span class="p">);</span>
+<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="n">inputStream</span> <span class="o">=</span> <span class="n">dataURL</span><span class="o">.</span><span class="n">openStream</span><span class="p">();</span>
+
+<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err">  </span><span class="sr">//</span> <span class="n">Post</span> <span class="n">event</span> <span class="k">for</span> <span class="n">audit</span> <span class="nb">log</span>
+<span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="err"> </span> <span class="n">String</span> <span class="n">topic</span><span class="err"> </span><span class="o">=</span> <span class="s">&quot;org/apache/ace/deployment/INSTALL&quot;</span><span class="p">;</span>
+<span class="err">           </span> <span class="n">m_eventAdmin</span><span class="o">.</span><span class="n">postEvent</span><span class="p">(</span><span class="n">createEvent</span><span class="p">(</span><span class="n">topic</span><span class="p">,</span> <span class="n">version</span><span class="p">,</span> <span class="n">dataURL</span><span class="p">));</span>
+
+<span class="err">           </span> <span class="n">m_deployer</span><span class="o">.</span><span class="n">install</span><span class="p">(</span><span class="n">inputStream</span><span class="p">);</span>
+<span class="err">       </span> <span class="p">}</span>
+<span class="err">       </span> <span class="n">finally</span> <span class="p">{</span>
+<span class="err">           </span> <span class="k">if</span> <span class="p">(</span><span class="n">inputStream</span> <span class="o">!=</span> <span class="n">null</span><span class="p">)</span> <span class="p">{</span>
+<span class="err">               </span> <span class="n">try</span> <span class="p">{</span>
+<span class="err">                   </span> <span class="n">inputStream</span><span class="o">.</span><span class="nb">close</span><span class="p">();</span>
+<span class="err">               </span> <span class="p">}</span>
+<span class="err">               </span> <span class="n">catch</span> <span class="p">(</span><span class="n">Exception</span> <span class="n">ex</span><span class="p">)</span> <span class="p">{</span>
+<span class="err">                   </span> <span class="sr">//</span> <span class="n">Not</span> <span class="n">much</span> <span class="n">we</span> <span class="n">can</span> <span class="k">do</span><span class="o">.</span>
+<span class="err">               </span> <span class="p">}</span>
+<span class="err">           </span> <span class="p">}</span>
+<span class="err">       </span> <span class="p">}</span>
 </pre></div>
 </td></tr></table>
 
-<p>Basically, the method builds up an URL to access the deployment service of Ace. Through this URL, the deployment-service creates a deployment package containing the changed artifacts between the given local and remote version. The <code>InputStream</code> containing this deployment package is given to the <code>Deployment</code> service (a facade to the standard DeploymentAdmin service) to be installed. Note that if the installation of the deployment package fails, an exception is thrown. As mentioned earlier, the installation of deployment packages is done in a "all or nothing" strategy, meaning that if it fails, all changes are reverted. For more details on this, you can read the DeploymentAdmin specification (see [2], chapter 114).<br />
-Aside the actual installation of the deployment package, an event is also posted to keep track of this installation. This event is picked up by the <code>AuditLog</code> service of Ace to track all changes made to the management agent (<em>one can argue whether this shouldn't be a responsibility of the Deployment facade</em>). </p>
-<p>Now we have seen how the installation of deployment packages is implemented in Ace, we can even tweak that process a bit. For example, we could first download the deployment package entirely to a temporary location, and install it from there. Or, as we have access to the deployment package, we could also provide the user additional information about its contents, perhaps showing a change log or a summary of its contents, before installing it.</p>
+<p>Basically, the method builds up an URL to access the deployment service of ACE. Through this URL, the deployment-service creates a deployment package containing the changed artifacts between the given local and remote version. The <code>InputStream</code> containing this deployment package is given to the <code>Deployment</code> service (a facade to the standard DeploymentAdmin service) to be installed. Note that if the installation of the deployment package fails, an exception is thrown. As mentioned earlier, the installation of deployment packages is done in a "all or nothing" strategy, meaning that if it fails, all changes are reverted. For more details on this, you can read the DeploymentAdmin specification (see [2], chapter 114).<br />
+Aside the actual installation of the deployment package, an event is also posted to keep track of this installation. This event is picked up by the <code>AuditLog</code> service of ACE to track all changes made to the management agent (<em>one can argue whether this shouldn't be a responsibility of the Deployment facade</em>). </p>
+<p>Now we have seen how the installation of deployment packages is implemented in ACE, we can even tweak that process a bit. For example, we could first download the deployment package entirely to a temporary location, and install it from there. Or, as we have access to the deployment package, we could also provide the user additional information about its contents, perhaps showing a change log or a summary of its contents, before installing it.</p>
 <h2 id="references">References</h2>
 <ol>
-<li>Ace subversion, http://svn.apache.org/repos/asf/ace/;</li>
-<li>OSGi 4.2 compendium specification, http://www.osgi.org/Download/Release4V42.</li>
+<li><a href="http://svn.apache.org/repos/asf/ace/">ACE subversion</a>;</li>
+<li><a href="http://www.osgi.org/Download/Release4V42">OSGi 4.2 compendium specification</a>.</li>
 </ol></div>
       <hr>
       <footer>



Mime
View raw message