You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2018/02/25 09:45:01 UTC

svn commit: r1825298 - in /jclouds/site-content/blog: 2018/02/06/nova-neutron/index.html atom.xml

Author: nacx
Date: Sun Feb 25 09:45:01 2018
New Revision: 1825298

URL: http://svn.apache.org/viewvc?rev=1825298&view=rev
Log:
deploy jclouds site content

Modified:
    jclouds/site-content/blog/2018/02/06/nova-neutron/index.html
    jclouds/site-content/blog/atom.xml

Modified: jclouds/site-content/blog/2018/02/06/nova-neutron/index.html
URL: http://svn.apache.org/viewvc/jclouds/site-content/blog/2018/02/06/nova-neutron/index.html?rev=1825298&r1=1825297&r2=1825298&view=diff
==============================================================================
--- jclouds/site-content/blog/2018/02/06/nova-neutron/index.html (original)
+++ jclouds/site-content/blog/2018/02/06/nova-neutron/index.html Sun Feb 25 09:45:01 2018
@@ -204,6 +204,24 @@
 
 <p>With this configuration the <code>nova</code> API is configured to use the linked <code>neutron</code> for all networking operations.</p>
 
+<h2>Writing code that accepts a linked context</h2>
+
+<p>When writing an API or Provider that needs to use another jclouds API, you can easily leverage the context linking feature by injecting the target API as follows:</p>
+
+<div class="highlight"><pre><code class="java"><span class="nd">@Inject</span><span class="o">(</span><span class="n">optional</span> <span class="o">=</span> <span class="kc">true</span><span class="o">)</span>
+<span class="nd">@Named</span><span class="o">(</span><span class="s">&quot;openstack-neutron&quot;</span><span class="o">)</span>
+<span class="kd">private</span> <span class="n">Supplier</span><span class="o">&lt;</span><span class="n">Context</span><span class="o">&gt;</span> <span class="n">neutronContextSupplier</span><span class="o">;</span>
+</code></pre></div>
+
+
+<ul>
+<li>You must use the <strong>Provider or API id</strong> in the <code>@Named</code> annotation.</li>
+<li>If the linked context is optional you can declare an optional injection.</li>
+</ul>
+
+
+<p>Then you can access the portble abstraction view or provider-specific API from the injected context.</p>
+
             
             <div id="comments">
                 <hr/>

Modified: jclouds/site-content/blog/atom.xml
URL: http://svn.apache.org/viewvc/jclouds/site-content/blog/atom.xml?rev=1825298&r1=1825297&r2=1825298&view=diff
==============================================================================
--- jclouds/site-content/blog/atom.xml (original)
+++ jclouds/site-content/blog/atom.xml Sun Feb 25 09:45:01 2018
@@ -52,6 +52,24 @@
 
 
 <p>With this configuration the <code>nova</code> API is configured to use the linked <code>neutron</code> for all networking operations.</p>
+
+<h2>Writing code that accepts a linked context</h2>
+
+<p>When writing an API or Provider that needs to use another jclouds API, you can easily leverage the context linking feature by injecting the target API as follows:</p>
+
+<div class="highlight"><pre><code class="java"><span class="nd">@Inject</span><span class="o">(</span><span class="n">optional</span> <span class="o">=</span> <span class="kc">true</span><span class="o">)</span>
+<span class="nd">@Named</span><span class="o">(</span><span class="s">&quot;openstack-neutron&quot;</span><span class="o">)</span>
+<span class="kd">private</span> <span class="n">Supplier</span><span class="o">&lt;</span><span class="n">Context</span><span class="o">&gt;</span> <span class="n">neutronContextSupplier</span><span class="o">;</span>
+</code></pre></div>
+
+
+<ul>
+<li>You must use the <strong>Provider or API id</strong> in the <code>@Named</code> annotation.</li>
+<li>If the linked context is optional you can declare an optional injection.</li>
+</ul>
+
+
+<p>Then you can access the portble abstraction view or provider-specific API from the injected context.</p>
 ]]></content>
   </entry>