Ok, thanks for the tip. Regarding the isPrimary() method, I've been
thinking that there has to be a better way. :-)
>
> There is no elegant solution for this (in the future this should not be a
> problem). Currently you can something like:
> ...
> @Requirement
> private NexusConfiguration configuration;
> ...
> private boolean isEnabled()
> {
> this.configuration.getRealms().contains( "realm-hint" ) );
> }
> ...
> (instead of using the NexusConfiguration, you could use the RealmLocator.
>
> A word of caution, do not depend on the isPrimary() method. That will be
> removed soon (as soon as i get some time to add another test or two). As a
> replacement we will be using the order that the realms are defined. This
> approach more flexible.
> To check if your realm is enabled you can wrap your method calls with the
> isEnabled() method if you have too. (Yes, I realize this is lame)
> Ideally, when we finish integrating the planned plugin manager (and this has
> been the plan right along)
> Your class will not be loaded when your plugin is not installed. So you
> will not need this.
> Note: The only down side (and your the judge for this) of not adding the
> isEnabled() type of check, is that your realms users will show up in the
> user search when the realm is disabled. They will NOT be able to login.
> Also, if you go the road of isEnabled(), your User Locator will still show
> up in the User page, and appear to return nothing.
>
>
> On Mar 31, 2009, at 8:58 AM, Anders Hammar wrote:
>
> Ok, makes sense. Is there a way of telling of my realm is
> selected/activated in Nexus? I would like this information to make
> isPrimary() of my user locator to return true if the realm is selected
> and false if not.
>
> Thanks,
> /Anders
>
> 2009/3/31 Tamás Cservenák <
tamas@...>:
>
> Hi,
>
> Plexus' Disposable interface will be called on Plexus Container Dispose
>
> (when components are disposed). Not during "normal" app lifetime....
>
> From a Realm component viewpoint, it is selected when initialize() _is_
>
> called, since then a Plexus lookup is made for it, and Plexus will call all
>
> the lifecycle methods properly, as your component implements them
>
> (initializable, Startable, etc).
>
> If no lookup is made against your Realm, it will be not brought up as a
>
> Plexus component at all.
>
> Now, there is a situation like bringing up Nexus with your Realm _enabled_,
>
> than disabling it via UI.... Your Realm is currently completely unaware it
>
> is being "turned off".
>
> ~t~
>
> On Tue, Mar 31, 2009 at 2:45 PM, Anders Hammar <
anders@...> wrote:
>
> Btw, I'm using Nexus 1.3.1.
>
> /Anders
>
> On Tue, Mar 31, 2009 at 14:42, Anders Hammar <
anders@...> wrote:
>
> Hi,
>
> I have a realm that implements Initializable and Disposable. When then
>
> realm isn't selected at startup (in the Nexus conf), its initialize()
>
> method isn't called. When selecting it (in runtime), it is called. So,
>
> when de-selecting it I expected its dispose() method to be called (in
>
> runtime), but it isn't.
>
> Is this a bug or intended behavior? If intended behavior, how can I
>
> tell if a realm is currently selected or not?
>
> /Anders
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail:
nexus-dev-unsubscribe@...
>
> For additional commands, e-mail:
nexus-dev-help@...
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
nexus-dev-unsubscribe@...
> For additional commands, e-mail:
nexus-dev-help@...
>
>
>