1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 package org.strutsit.chain;
25
26 import java.util.ArrayList;
27 import java.util.List;
28 import java.util.StringTokenizer;
29
30 import org.apache.commons.chain.Command;
31
32 /***
33 * Base implementation of a {@link Command}that is used in the conf-chain
34 * framework. This command reads some attributes, that can configured in the
35 * chain-conf.xml:
36 *
37 * <ul>
38 * <li>idref Reference to a chain that is already configured (composite).</li>
39 * <li>depends List of dependencies to this command (may only other commands).
40 * </li>
41 * </ul>
42 *
43 * @author <a href="mailto:wolff@struts-it.de">Manfred Wolff </a>
44 * @since JDK 1.4
45 * @version $Revision: 1.2 $
46 */
47 public abstract class ConfCommand implements Command {
48
49
50 private String idref;
51
52
53 private String depends;
54
55
56 protected List dependencies = new ArrayList();
57
58 /***
59 * @return Returns the depends.
60 */
61 public String getDepends() {
62 return depends;
63 }
64
65 /***
66 * @param depends
67 * The depends to set.
68 */
69 public void setDepends(String depends) {
70
71 this.depends = depends;
72 dependencies.clear();
73 StringTokenizer tokenizer = new StringTokenizer(depends, ",");
74 while (tokenizer.hasMoreTokens()) {
75 String token = tokenizer.nextToken();
76 token = token.trim();
77 dependencies.add(token);
78 }
79 }
80
81 /***
82 * @return Returns the idref.
83 */
84 public String getIdref() {
85 return idref;
86 }
87
88 /***
89 * @param idref
90 * The idref to set.
91 */
92 public void setIdref(String idref) {
93 this.idref = idref;
94 }
95 }