<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<tt>Folks,<br>
<br>
[<a href="https://issues.jboss.org/browse/AS7-1426">AS7-1426</a>]
Provide injectable BundleContext in JNDI<br>
<br>
I currently use this code to bind the OSGi system BundleContext to
java:global/osgi/BundleContext<br>
</tt>
<blockquote><tt> // Register BundleContext in JNDI<br>
BinderService service = new
BinderService(CONTEXT_LONG_NAME, context);<br>
service.getManagedObjectInjector().inject(new
StaticManagedObject(context));<br>
ServiceBuilder<?> builder =
target.addService(CONTEXT_LONG_SERVICE_NAME, service);<br>
builder.addDependency(CONTEXT_BASE_SERVICE_NAME,
NamingStore.class, service.getNamingStoreInjector());<br>
builder.install();<br>
</tt></blockquote>
<tt>is this the right code and JNDI context?<br>
<br>
The resource injection works like this<br>
</tt>
<blockquote><tt> @Resource(lookup =
"java:global/osgi/BundleContext")<br>
private BundleContext context;<br>
</tt></blockquote>
<tt>What needs to be done to get rid of the lookup attribute (i.e.
injection by type)?<br>
<br>
cheers<br>
-thomas<br>
</tt>
<blockquote><br>
</blockquote>
<blockquote><br>
</blockquote>
<pre class="moz-signature" cols="72">--
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
Thomas Diesler
JBoss OSGi Lead
JBoss, a division of Red Hat
xxxxxxxxxxxxxxxxxxxxxxxxxxxx
</pre>
</body>
</html>