[jboss-cvs] jboss-seam/doc/reference/en/modules ...

Peter Muir peter at bleepbleep.org.uk
Thu Jun 14 12:24:26 EDT 2007


  User: pmuir   
  Date: 07/06/14 12:24:26

  Modified:    doc/reference/en/modules  concepts.xml
  Log:
  JBSEAM-1223
  
  Revision  Changes    Path
  1.58      +43 -3     jboss-seam/doc/reference/en/modules/concepts.xml
  
  (In the diff below, changes in quantity of whitespace are not shown.)
  
  Index: concepts.xml
  ===================================================================
  RCS file: /cvsroot/jboss/jboss-seam/doc/reference/en/modules/concepts.xml,v
  retrieving revision 1.57
  retrieving revision 1.58
  diff -u -b -r1.57 -r1.58
  --- concepts.xml	3 May 2007 09:22:37 -0000	1.57
  +++ concepts.xml	14 Jun 2007 16:24:26 -0000	1.58
  @@ -1167,6 +1167,8 @@
               referenced. 
           </para>
   
  +
  +
           <programlisting><![CDATA[@Name("customerList")
   @Scope(CONVERSATION)
   public class CustomerListManager
  @@ -1180,9 +1182,47 @@
   }]]></programlisting>
   
           <para> 
  -            This pattern is especially useful if we have some heavyweight object that needs a cleanup operation when
  -            the context ends. In this case, the manager component may perform cleanup in the <literal>@Destroy</literal>
  -            method. 
  +            The manager component pattern is especially useful if we have an object where you need more control over the 
  +            lifecycle of the component.  For example, if you have a heavyweight object that needs a cleanup operation when 
  +            the context ends you could <literal>@Unwrap</literal> the object, and perform cleanup in the 
  +            <literal>@Destroy</literal> method of the manager component.
  +        </para>
  +        
  +        <programlisting><![CDATA[@Name("hens")
  + at Scope(APPLICATION) 
  +public class HenHouse {
  +    
  +    private Set<Hen> hens;
  +    
  +    @Unwrap
  +    public List<Hen> getHens() {
  +        if (hens == null) {
  +            // Setup our hens
  +        }
  +        return hens;
  +    }
  +    
  +    @Observer({"chickBorn", "chickenBoughtAtMarket"})
  +    public addHen() {
  +        hens.add(hen);
  +    }
  +    
  +    @Observer("chickenSoldAtMarket")
  +    public removeHen() {
  +        hens.remove(hen);
  +    }
  +    
  +    @Observer("foxGetsIn")
  +    public addHen() {
  +        hens.clear();
  +    }
  +    ...
  +}]]> </programlisting>
  +
  +	<para>
  +		Here the managed component observes many events which change the underlying object. 
  +		The component manages these actions itself, and because the object is unwrapped
  +		on every access, a consistent view is provided.
           </para>
   
       </sect1>
  
  
  



More information about the jboss-cvs-commits mailing list