[jboss-as7-dev] Howto bind stuff to JNDI?

Jason Greene jgreene at redhat.com
Thu Jul 28 12:26:01 EDT 2011


Take a look at the subclasses of InjectionSource (in the EE module).

Sent from my iPad

On Jul 28, 2011, at 10:24 AM, Thomas Diesler <thomas.diesler at jboss.com> wrote:

> Folks,
> 
> [AS7-1426] Provide injectable BundleContext in JNDI
> 
> I currently use this code to bind the OSGi system BundleContext to java:global/osgi/BundleContext
>             // Register BundleContext in JNDI
>             BinderService service = new BinderService(CONTEXT_LONG_NAME, context);
>             service.getManagedObjectInjector().inject(new StaticManagedObject(context));
>             ServiceBuilder<?> builder = target.addService(CONTEXT_LONG_SERVICE_NAME, service);
>             builder.addDependency(CONTEXT_BASE_SERVICE_NAME, NamingStore.class, service.getNamingStoreInjector());
>             builder.install();
> is this the right code and JNDI context?
> 
> The resource injection works like this
>     @Resource(lookup = "java:global/osgi/BundleContext")
>     private BundleContext context;
> What needs to be done to get rid of the lookup attribute (i.e. injection by type)?
> 
> cheers
> -thomas
> 
> 
> -- 
> xxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Thomas Diesler
> JBoss OSGi Lead
> JBoss, a division of Red Hat
> xxxxxxxxxxxxxxxxxxxxxxxxxxxx 
> _______________________________________________
> jboss-as7-dev mailing list
> jboss-as7-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-as7-dev/attachments/20110728/f8863c9b/attachment.html 


More information about the jboss-as7-dev mailing list