You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by Danny Robinson <da...@gmail.com> on 2007/06/13 14:53:46 UTC
[Trinidad] Declaring flowScope Managed Beans
For our applications we utilize the flowScope in preference to the session
given it's ability to clean-up and support multiple flowScopes for multiple
windows. So its an invaluable feature in Trinidad, but sadly it's only
possible via code to add new Managed Beans to the flowScope map. This feels
like a step back from Dependency Injection.
So I was wondering if there would be a way we could provide a feature in
Trinidad to auto-register managed beans into the flowScope when they are
initially referenced. Sadly there's no way to add a custom scope to the
managed bean declaration, but I was thinking we could perhaps piggy-back on
the instantiation of request scope beans, by using something like
annotations, (e.g. @TrinidadFlowScopeBean) would be placed into flowScope,
and then using a custom VariableResolver we could search this scope in
between looking in the request, and session scopes. This wouldn't interfere
with the way flowScope is used today (and could be an optional feature), but
would make it more usable moving forward, and fit better with UI design
tools that provide value-binding wizards.
Obviously Annotations isn't the only option to accomplish this.
Thoughts?
Danny
--
Chordiant Software Inc.
www.chordiant.com
Re: [Trinidad] Declaring flowScope Managed Beans
Posted by Martin Marinschek <ma...@gmail.com>.
IMHO, this is one of the points where the managed-bean facility shows
that it is not a full-blown bean-container (which it wasn't meant to
be of course from the beginning).
In Spring 2.0, you can add custom scopes; and with Mario's Orchestra
bridge, you can then get past this problem and use conversation scoped
beans just like normal beans - I kind of like this approach.
regards,
Martin
On 6/14/07, Adam Winer <aw...@gmail.com> wrote:
> We could, but there's a couple of hiccups:
> - It's a lot of work :)
> - This means pageFlowScope would appear after
> requestScope, etc. in priority, when we really want
> it to come between request and session scopes.
>
> For that first point, it really is a bunch, especially
> when you figure on supporting JSF 1.2 annotations.
>
> -- Adam
>
>
> On 6/14/07, Simon Lessard <si...@gmail.com> wrote:
> > I thought about that before, couldn't we create a custom
> > VariableResolver/ELResolver using decorator pattern to load beans fro mflow
> > scope when parent call fails? We could declare the bean in
> > trinidad-config.xml using the same syntax as faces-config.xml.
> >
> >
> > Regards,
> >
> > ~ Simon
> >
> >
> > On 6/14/07, Adam Winer <aw...@gmail.com> wrote:
> > > The simplest possible solution I can come up with is:
> > >
> > > - Continue to require pageFlowScope as an EL prefix:
> > > #{pageFlowScope.foo}
> > > - Enhance the pageFlowScope resolution so that, if a lookup
> > > fails, it will:
> > > - Perform a general VariableResolver lookup for that
> > > as a top-level variable
> > > - If we get back a non-null value, see if the class
> > > has an annotation (like you say)
> > > - If so, push it into pageFlowScope
> > >
> > > It wouldn't help you for #{foo}, but it would help you
> > > for #{pageFlowScope.foo}.
> > >
> > > -- Adam
> > >
> > >
> > > On 6/13/07, Danny Robinson < dannyjrobinson@gmail.com> wrote:
> > > > For our applications we utilize the flowScope in preference to the
> > session
> > > > given it's ability to clean-up and support multiple flowScopes for
> > multiple
> > > > windows. So its an invaluable feature in Trinidad, but sadly it's only
> > > > possible via code to add new Managed Beans to the flowScope map. This
> > feels
> > > > like a step back from Dependency Injection.
> > > >
> > > > So I was wondering if there would be a way we could provide a feature in
> > > > Trinidad to auto-register managed beans into the flowScope when they are
> > > > initially referenced. Sadly there's no way to add a custom scope to the
> > > > managed bean declaration, but I was thinking we could perhaps piggy-back
> > on
> > > > the instantiation of request scope beans, by using something like
> > > > annotations, ( e.g. @TrinidadFlowScopeBean) would be placed into
> > flowScope,
> > > > and then using a custom VariableResolver we could search this scope in
> > > > between looking in the request, and session scopes. This wouldn't
> > interfere
> > > > with the way flowScope is used today (and could be an optional feature),
> > but
> > > > would make it more usable moving forward, and fit better with UI design
> > > > tools that provide value-binding wizards.
> > > >
> > > > Obviously Annotations isn't the only option to accomplish this.
> > > >
> > > > Thoughts?
> > > >
> > > > Danny
> > > > --
> > > > Chordiant Software Inc.
> > > > www.chordiant.com
> > >
> >
> >
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces
Re: [Trinidad] Declaring flowScope Managed Beans
Posted by Adam Winer <aw...@gmail.com>.
We could, but there's a couple of hiccups:
- It's a lot of work :)
- This means pageFlowScope would appear after
requestScope, etc. in priority, when we really want
it to come between request and session scopes.
For that first point, it really is a bunch, especially
when you figure on supporting JSF 1.2 annotations.
-- Adam
On 6/14/07, Simon Lessard <si...@gmail.com> wrote:
> I thought about that before, couldn't we create a custom
> VariableResolver/ELResolver using decorator pattern to load beans fro mflow
> scope when parent call fails? We could declare the bean in
> trinidad-config.xml using the same syntax as faces-config.xml.
>
>
> Regards,
>
> ~ Simon
>
>
> On 6/14/07, Adam Winer <aw...@gmail.com> wrote:
> > The simplest possible solution I can come up with is:
> >
> > - Continue to require pageFlowScope as an EL prefix:
> > #{pageFlowScope.foo}
> > - Enhance the pageFlowScope resolution so that, if a lookup
> > fails, it will:
> > - Perform a general VariableResolver lookup for that
> > as a top-level variable
> > - If we get back a non-null value, see if the class
> > has an annotation (like you say)
> > - If so, push it into pageFlowScope
> >
> > It wouldn't help you for #{foo}, but it would help you
> > for #{pageFlowScope.foo}.
> >
> > -- Adam
> >
> >
> > On 6/13/07, Danny Robinson < dannyjrobinson@gmail.com> wrote:
> > > For our applications we utilize the flowScope in preference to the
> session
> > > given it's ability to clean-up and support multiple flowScopes for
> multiple
> > > windows. So its an invaluable feature in Trinidad, but sadly it's only
> > > possible via code to add new Managed Beans to the flowScope map. This
> feels
> > > like a step back from Dependency Injection.
> > >
> > > So I was wondering if there would be a way we could provide a feature in
> > > Trinidad to auto-register managed beans into the flowScope when they are
> > > initially referenced. Sadly there's no way to add a custom scope to the
> > > managed bean declaration, but I was thinking we could perhaps piggy-back
> on
> > > the instantiation of request scope beans, by using something like
> > > annotations, ( e.g. @TrinidadFlowScopeBean) would be placed into
> flowScope,
> > > and then using a custom VariableResolver we could search this scope in
> > > between looking in the request, and session scopes. This wouldn't
> interfere
> > > with the way flowScope is used today (and could be an optional feature),
> but
> > > would make it more usable moving forward, and fit better with UI design
> > > tools that provide value-binding wizards.
> > >
> > > Obviously Annotations isn't the only option to accomplish this.
> > >
> > > Thoughts?
> > >
> > > Danny
> > > --
> > > Chordiant Software Inc.
> > > www.chordiant.com
> >
>
>
Re: [Trinidad] Declaring flowScope Managed Beans
Posted by Simon Lessard <si...@gmail.com>.
I thought about that before, couldn't we create a custom
VariableResolver/ELResolver using decorator pattern to load beans fro mflow
scope when parent call fails? We could declare the bean in
trinidad-config.xml using the same syntax as faces-config.xml.
Regards,
~ Simon
On 6/14/07, Adam Winer <aw...@gmail.com> wrote:
>
> The simplest possible solution I can come up with is:
>
> - Continue to require pageFlowScope as an EL prefix:
> #{pageFlowScope.foo}
> - Enhance the pageFlowScope resolution so that, if a lookup
> fails, it will:
> - Perform a general VariableResolver lookup for that
> as a top-level variable
> - If we get back a non-null value, see if the class
> has an annotation (like you say)
> - If so, push it into pageFlowScope
>
> It wouldn't help you for #{foo}, but it would help you
> for #{pageFlowScope.foo}.
>
> -- Adam
>
>
> On 6/13/07, Danny Robinson <da...@gmail.com> wrote:
> > For our applications we utilize the flowScope in preference to the
> session
> > given it's ability to clean-up and support multiple flowScopes for
> multiple
> > windows. So its an invaluable feature in Trinidad, but sadly it's only
> > possible via code to add new Managed Beans to the flowScope map. This
> feels
> > like a step back from Dependency Injection.
> >
> > So I was wondering if there would be a way we could provide a feature in
> > Trinidad to auto-register managed beans into the flowScope when they are
> > initially referenced. Sadly there's no way to add a custom scope to the
> > managed bean declaration, but I was thinking we could perhaps piggy-back
> on
> > the instantiation of request scope beans, by using something like
> > annotations, ( e.g. @TrinidadFlowScopeBean) would be placed into
> flowScope,
> > and then using a custom VariableResolver we could search this scope in
> > between looking in the request, and session scopes. This wouldn't
> interfere
> > with the way flowScope is used today (and could be an optional feature),
> but
> > would make it more usable moving forward, and fit better with UI design
> > tools that provide value-binding wizards.
> >
> > Obviously Annotations isn't the only option to accomplish this.
> >
> > Thoughts?
> >
> > Danny
> > --
> > Chordiant Software Inc.
> > www.chordiant.com
>
Re: [Trinidad] Declaring flowScope Managed Beans
Posted by Adam Winer <aw...@gmail.com>.
The simplest possible solution I can come up with is:
- Continue to require pageFlowScope as an EL prefix:
#{pageFlowScope.foo}
- Enhance the pageFlowScope resolution so that, if a lookup
fails, it will:
- Perform a general VariableResolver lookup for that
as a top-level variable
- If we get back a non-null value, see if the class
has an annotation (like you say)
- If so, push it into pageFlowScope
It wouldn't help you for #{foo}, but it would help you
for #{pageFlowScope.foo}.
-- Adam
On 6/13/07, Danny Robinson <da...@gmail.com> wrote:
> For our applications we utilize the flowScope in preference to the session
> given it's ability to clean-up and support multiple flowScopes for multiple
> windows. So its an invaluable feature in Trinidad, but sadly it's only
> possible via code to add new Managed Beans to the flowScope map. This feels
> like a step back from Dependency Injection.
>
> So I was wondering if there would be a way we could provide a feature in
> Trinidad to auto-register managed beans into the flowScope when they are
> initially referenced. Sadly there's no way to add a custom scope to the
> managed bean declaration, but I was thinking we could perhaps piggy-back on
> the instantiation of request scope beans, by using something like
> annotations, ( e.g. @TrinidadFlowScopeBean) would be placed into flowScope,
> and then using a custom VariableResolver we could search this scope in
> between looking in the request, and session scopes. This wouldn't interfere
> with the way flowScope is used today (and could be an optional feature), but
> would make it more usable moving forward, and fit better with UI design
> tools that provide value-binding wizards.
>
> Obviously Annotations isn't the only option to accomplish this.
>
> Thoughts?
>
> Danny
> --
> Chordiant Software Inc.
> www.chordiant.com
Re: [Trinidad] Declaring flowScope Managed Beans
Posted by Martin Marinschek <ma...@gmail.com>.
Well, well. That wouldn't be this easy, I suspect. You couldn't
decorate the VariableResolver anymore, you'd essentially have to
replace it - and read the managed-bean configuration yourself.
regards,
Martin
On 6/13/07, Danny Robinson <da...@gmail.com> wrote:
> For our applications we utilize the flowScope in preference to the session
> given it's ability to clean-up and support multiple flowScopes for multiple
> windows. So its an invaluable feature in Trinidad, but sadly it's only
> possible via code to add new Managed Beans to the flowScope map. This feels
> like a step back from Dependency Injection.
>
> So I was wondering if there would be a way we could provide a feature in
> Trinidad to auto-register managed beans into the flowScope when they are
> initially referenced. Sadly there's no way to add a custom scope to the
> managed bean declaration, but I was thinking we could perhaps piggy-back on
> the instantiation of request scope beans, by using something like
> annotations, ( e.g. @TrinidadFlowScopeBean) would be placed into flowScope,
> and then using a custom VariableResolver we could search this scope in
> between looking in the request, and session scopes. This wouldn't interfere
> with the way flowScope is used today (and could be an optional feature), but
> would make it more usable moving forward, and fit better with UI design
> tools that provide value-binding wizards.
>
> Obviously Annotations isn't the only option to accomplish this.
>
> Thoughts?
>
> Danny
> --
> Chordiant Software Inc.
> www.chordiant.com
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces