[jboss-user] [JBoss Seam] - @Unwrap question

enzhao do-not-reply at jboss.com
Sat Jul 7 05:45:41 EDT 2007

Hi folks,

I would like to use the @Unwrap annotation in an APPLICATION scoped dataStore bean. This stateless bean mainly caches the read-only static data which would be used in the application. I'd like to learn more detail about the @Unwrap than which are already presented in the reference manual. (I build a new Seam dist everyday from the CVS, so my reference manual is always the latest.)

Here are my questions:

1. What's the difference between @Factory and @Unwrap in the following two code fragments? (from reference section 3.8)

  | @Factory(scope=CONVERSATION)
  | public List<Customer> getCustomerList() { 
  |     return ... ;
  | }


  | @Name("customerList")
  | public class CustomerListManager
  | {
  |     ...
  |     @Unwrap
  |     public List<Customer> getCustomerList() { 
  |         return ... ;
  |     }
  | }

The reference says 
anonymous wrote : 
  | A manager component is any component with an @Unwrap method. This method returns the value that will be visable to clients, and is called every time a context variable is referenced.
Doesn't the method in first code fragment with the @Factory annotation also return a List? Is it not visible to clients?

2. The reference says:
anonymous wrote : 
  | An even more powerful pattern is the manager component pattern. In this case, we have a Seam component that is bound to a context variable, that manages the value of the context variable, while remaining invisible to clients.

What does the manager component here exactly manage? And in which situation/context is this manager component pattern bestly used? I looked at the HenHouse example, it seems useful when dealing with events which would cause value changes in the managed list.

Many thanks in advance for any enlightenment!


View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061563#4061563

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061563

More information about the jboss-user mailing list