dev@glassfish.java.net

Re: How to load a class using HK2 mechanisms

From: Ron Monzillo <Ronald.Monzillo_at_Sun.COM>
Date: Mon, 14 Jul 2008 12:24:38 -0400

A Glassfish Realm also has an associated JAAS Login module; whose class
name would typically get configured in the JASS config file (i.e.,
login.config).
Ron

Sahoo wrote:
> Kumar,
>
> This is a good question. I am copying dev@ for others' benefit.
> Something like this should work:
>
> 1. Realm is a contract, which means.
> @Contract intercace Realm {...}
> 2. Let's say user provides FooRealm. They write:
> @Service class FooRealm implements Realm {...}
> They can choose to implement the same using OSGi service mechanism as
> well. We do the mapping from OSGi to HK2 service transparently.
>
> 3. Assuming you have the class name from domain.xml, in your code, you
> can use Habitat API to get hold of the service as shown below:
> @Inject Habitat habitat;
> Realm customRealm = habitat.getInhabitantsByType("FooRealm").get();
>
> Hope this helps,
>
> Thanks,
> Sahoo
> V B Kumar Jayanti wrote:
>
>> Hi Sahoo,
>>
>> I wanted to put in code for loading a Custom Realm defined as a
>> HK2/OSGI Module. Can you tell me how i can do that.
>>
>> regards,
>> kumar
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>