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(a)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(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-as7-dev