Howto bind stuff to JNDI?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Howto bind stuff to JNDI?

Thomas Diesler
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
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev
Reply | Threaded
Open this post in threaded view
|

Re: Howto bind stuff to JNDI?

Jason T. Greene
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 <[hidden email]> 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
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev

_______________________________________________
jboss-as7-dev mailing list
[hidden email]
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev