1 package org.lsst.ccs.command.annotations;
2
3 import java.lang.annotation.Documented;
4 import java.lang.annotation.ElementType;
5 import java.lang.annotation.Retention;
6 import java.lang.annotation.RetentionPolicy;
7 import java.lang.annotation.Target;
8
9 /**
10 * Annotation for commands. Allows to specify the name of a command, otherwise
11 * method's name is used.
12 *
13 * @author turri
14 */
15 @Target(ElementType.METHOD)
16 @Retention(RetentionPolicy.RUNTIME)
17 @Documented
18 public @interface Command {
19
20 public static enum CommandType {
21 QUERY,
22 ACTION,
23 CONFIGURATION,
24 ABORT
25 }
26
27 // Some pre-defined levels, this list is not necessarily exhaustive, which is
28 // why we do not use an enumeration.
29 public static final int NORMAL = 0;
30 public static final int ENGINEERING1 = 1;
31 public static final int ENGINEERING2 = 2;
32 public static final int ENGINEERING3 = 3;
33
34 /**
35 * If not null it will replace the method's name as the command name.
36 *
37 * @return "" or null if default name is used, user-specified name
38 * otherwise.
39 */
40 String name() default ""; // if "" then Null is assumed.
41
42 /**
43 * Specify the description of the command.
44 *
45 * @return command's description or "" if not set.
46 */
47 String description() default "";
48
49 /**
50 * Specify aliases for the command.
51 * Multiple aliases can be specified as a comma separated list.
52 *
53 * @return command's abbreviation(s) or "" if not set.
54 */
55 String alias() default "";
56
57 /**
58 * The CommandType of the Command
59 *
60 * @return The command type.
61 */
62 CommandType type() default CommandType.ACTION;
63
64 /**
65 * Specify the level of the command. Only locks at the given level, or
66 * higher will have access to the command.
67 *
68 * @return the level of the Command. The default is zero.
69 */
70 int level() default NORMAL;
71 }