1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 package org.talika.tarsis.command;
24
25 import org.talika.tarsis.command.action.Action;
26 import org.talika.tarsis.command.view.View;
27
28 /**
29 * Interface that defines a command in Tarsis MVC Framework.<br>
30 * <br>
31 * A command is defined by a bussines activity defined by a set of <i>parameters</i>
32 * it needs to be invoked, an <i>action</i> to be performed when it is invoked and
33 * a set of <i>views</i> to be forwarded when action is completed.<br>
34 * <br>
35 * A command has a name which is used to inkove him and can be member of a package.
36 * Packages in Tarsis works same way that packages in Java and are usefull to group
37 * commands.<br>
38 *
39 * @author Jose M. Palomar
40 * @version $Revision: 121 $
41 * @see CommandParameter
42 * @see Action
43 * @see View
44 *
45 * @todo Change property duplicable to repetable that is better name.
46 */
47 public interface Command {
48
49
50 /**
51 * Package separator.
52 */
53 char PACKAGE_SEPARATOR = '/';
54
55 /**
56 * Stateless command type.
57 */
58 int STATELESS = 0;
59
60 /**
61 * Statefull command type.
62 */
63 int STATEFULL = 1;
64
65
66 /**
67 * Returns the package of command.
68 *
69 * @return String package of command.
70 */
71 String getPackage();
72
73 /**
74 * Returns the name of command.
75 *
76 * @return String name of command.
77 */
78 String getName();
79
80 /**
81 * Returns the fullname of command. The fullname is package name +
82 * PACKAGE_SEPARATOR + name.
83 *
84 * @return String fullname of command.
85 */
86 String getFullName();
87
88 /**
89 * Returns the <code>Action</code> of this command.
90 *
91 * @return Action <code>Action</code> of this command.
92 */
93 Action getAction();
94
95 /**
96 * Returns the <code>View</code> of command with matching name.
97 *
98 * @param viewName String name of view.
99 * @return View matching view or <code>null</code>.
100 */
101 View getView(String viewName);
102
103 /**
104 * Returns the default <code>View</code> of command. The default view is
105 * the view to be invoked when no other matching view has been found. The default
106 * view has a especial name defined in <code>View</code> interface.
107 *
108 * @return View default <code>View</code> instance of command.
109 */
110 View getDefaultView();
111
112 /**
113 * Returns the input <code>View</code> instance of command. The input vew is the
114 * view from where the command is invoked.
115 *
116 * @return View input <code>View</code> instance of command.
117 */
118 View getInputView();
119
120 /**
121 * Returns an array with the parameters of this command.
122 *
123 * @return CommandParameter[] the parameter of this command.
124 */
125 CommandParameter[] getParameters();
126
127 /**
128 * Returns <code>true</code> if the command response can be cached by browsers.
129 *
130 * @return boolean <code>true</code> if the command response can be cached by
131 * browsers.
132 */
133 boolean isCacheable();
134
135 /**
136 * Returns <code>true</code> if the command can be repeated with same sync ticket.
137 *
138 * @return boolean <code>true</code> if the command can be repeated with same sync
139 * ticket.
140 */
141 boolean isDuplicable();
142
143 /**
144 * Returns <code>true</code> if command parameters must be validated.
145 *
146 * @return boolean <code>true</code> if command parameters must be validated.
147 */
148 boolean isValidable();
149
150 /**
151 * Returns <code>true</code> if command parameters must be executed in secure
152 * mode (HTTPS).
153 *
154 * @return boolean <code>true</code> if command parameters must be executed in
155 * secure mode (HTTPS).
156 */
157 boolean isSecure();
158
159 /**
160 * Returns the type of command. Command types are <code>STATELESS</code> and
161 * <code>STATEFULL</code>.<br>
162 * <br>
163 * Stateless commands doesn't store information between invokations and there is
164 * only one instance of his action that process all calls. Stateless works much
165 * like servlets or stateless session beans.<br>
166 * <br>
167 * Statefull command mantains information between invokations. When and statefull
168 * command is invoked it searches in user's session for a created instance of his
169 * action and if not found creates a new one that is stored in user's session.
170 * This instance remains active for all user's session time.<br>
171 *
172 * @return int type of command.
173 */
174 int getType();
175
176 }