Repository: jclouds-site
Updated Branches:
  refs/heads/master e32f77e7e -> 12ebec5bc


Add a small explanatino about the context linking internals


Project: http://git-wip-us.apache.org/repos/asf/jclouds-site/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-site/commit/12ebec5b
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-site/tree/12ebec5b
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-site/diff/12ebec5b

Branch: refs/heads/master
Commit: 12ebec5bc716128cb17dfb80b47b047b57b67d7f
Parents: e32f77e
Author: Ignasi Barrera <[email protected]>
Authored: Sun Feb 25 10:41:22 2018 +0100
Committer: Ignasi Barrera <[email protected]>
Committed: Sun Feb 25 10:41:22 2018 +0100

----------------------------------------------------------------------
 _posts/2018-02-06-nova-neutron.md | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-site/blob/12ebec5b/_posts/2018-02-06-nova-neutron.md
----------------------------------------------------------------------
diff --git a/_posts/2018-02-06-nova-neutron.md 
b/_posts/2018-02-06-nova-neutron.md
index a761255..f3c34dd 100644
--- a/_posts/2018-02-06-nova-neutron.md
+++ b/_posts/2018-02-06-nova-neutron.md
@@ -46,3 +46,18 @@ NovaApi nova = ContextBuilder.newBuilder("openstack-nova")
 {% endhighlight %}
 
 With this configuration the `nova` API is configured to use the linked 
`neutron` for all networking operations.
+
+## Writing code that accepts a linked context
+
+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:
+
+{% highlight java %}
+@Inject(optional = true)
+@Named("openstack-neutron")
+private Supplier<Context> neutronContextSupplier;
+{% endhighlight %}
+
+* You must use the **Provider or API id** in the `@Named` annotation.
+* If the linked context is optional you can declare an optional injection.
+
+Then you can access the portble abstraction view or provider-specific API from 
the injected context.

Reply via email to