[jboss-as7-dev] Howto bind stuff to JNDI?
Thomas Diesler
thomas.diesler at jboss.com
Thu Jul 28 11:23:28 EDT 2011
Folks,
[AS7-1426 <https://issues.jboss.org/browse/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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-as7-dev/attachments/20110728/4f71e03d/attachment.html
More information about the jboss-as7-dev
mailing list