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