<html><body bgcolor="#FFFFFF"><div>Take a look at the subclasses of InjectionSource (in the EE module).<br><br>Sent from my iPad</div><div><br>On Jul 28, 2011, at 10:24 AM, Thomas Diesler &lt;<a href="mailto:thomas.diesler@jboss.com">thomas.diesler@jboss.com</a>&gt; wrote:<br><br></div><div></div><blockquote type="cite"><div>
    <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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Register BundleContext in JNDI<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BinderService service = new
        BinderService(CONTEXT_LONG_NAME, context);<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; service.getManagedObjectInjector().inject(new
        StaticManagedObject(context));<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ServiceBuilder&lt;?&gt; builder =
        target.addService(CONTEXT_LONG_SERVICE_NAME, service);<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; builder.addDependency(CONTEXT_BASE_SERVICE_NAME,
        NamingStore.class, service.getNamingStoreInjector());<br>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 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>&nbsp;&nbsp;&nbsp; @Resource(lookup =
        "java:global/osgi/BundleContext")<br>
        &nbsp;&nbsp;&nbsp; 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>
  

</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>jboss-as7-dev mailing list</span><br><span><a href="mailto:jboss-as7-dev@lists.jboss.org">jboss-as7-dev@lists.jboss.org</a></span><br><span><a href="https://lists.jboss.org/mailman/listinfo/jboss-as7-dev">https://lists.jboss.org/mailman/listinfo/jboss-as7-dev</a></span><br></div></blockquote></body></html>