1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.apache.commons.jelly.tags.bean;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import org.apache.commons.logging.Log;
22 import org.apache.commons.logging.LogFactory;
23
24 /***
25 * A sample bean that we can construct via Jelly tags
26 *
27 * @author <a href="mailto:jstrachan@apache.org">James Strachan</a>
28 * @version $Revision: 155420 $
29 */
30 public class Manager {
31
32 /*** The Log to which logging calls will be made. */
33 private static final Log log = LogFactory.getLog(Manager.class);
34
35 private List customers = new ArrayList();
36
37 boolean invoked = false;
38
39 public Manager() {
40 }
41
42 public String toString() {
43 return super.toString() + "[customers=" + customers + "]";
44 }
45
46 /***
47 * The invoke method which is called when the bean is constructed
48 */
49 public void run() {
50 invoked = true;
51
52 log.info("Invoked the run() method with customers: " + customers);
53 }
54
55
56 public List getCustomers() {
57 return customers;
58 }
59
60 public void addCustomer(Customer customer) {
61 customers.add(customer);
62 }
63
64 public void removeCustomer(Customer customer) {
65 customers.remove(customer);
66 }
67
68 /***
69 * @return boolean
70 */
71 public boolean isInvoked() {
72 return invoked;
73 }
74
75 /***
76 * Sets the invoked.
77 * @param invoked The invoked to set
78 */
79 public void setInvoked(boolean invoked) {
80 this.invoked = invoked;
81 }
82
83 }