KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > propagation > StateItem


1 package propagation;
2
3 /**
4  * The <code>StateItem</code> interface represents an electrical switch to
5  * supervise, e.g., a sensor's component like power supply, sensor unit, network IF, etc.
6  * A <code>StateItem</code> is distinguished by item id in the associated parent <code>Node</code>.
7  * The state field represents device's state (either it's ok or failure). It has 4 digits.
8  * <p/>
9  * The first digit represents if the state item is summary (overall status) or not. A summary state item
10  * represents the overall status of that node, e.g., if any part of the items are malfucntioning, the
11  * summary item may (or may not) show failure (depending on the rule).
12  * 1 means physical item and 2 means summary item.<p>
13  * If it is physical item, then
14  * the fourth digit signifies whether it is failure or not.
15  * 0 means ok, and
16  * 1 means failure.
17  * The second and third digits represent the state's severity, repsectively. The larger
18  * number means the more serious the failure.
19  * <p/>
20  * If it's summary item,
21  * then third and fourth digits represent the state's severity. The severity of 0
22  * means there is no failure overall, e.g., the overall <code>Node</code> is functioning.
23  * <pre>
24  * 1041 : physical failure, severity is 4
25  * 1031 : physical failure, severity is 3
26  * 2000 : summary state, not failure
27  * 2004 : summary is failure, severity is 4
28  * </pre>
29  *
30  * @author y-komori
31  */

32 @org.jboss.cache.pojo.annotation.Replicable
33 public interface StateItem {
34    /**
35     * A constant which represents a state is changed.
36     */

37    public static final boolean STATE_CHANGED = true;
38
39    /**
40     * A constant which represents a state is not changed.
41     */

42    public static final boolean STATE_NOT_CHANGED = false;
43
44    /**
45     * Returns this <code>StateItem</code>'s ID.
46     * The item ID is given only once when a StateItem instance is created.
47     *
48     * @return this <code>StateItem</code>'s item ID
49     */

50    public long getItemId();
51
52    /**
53     * Sets the specified state to this <code>StateItem</code> object.
54     * As a result of setting the state, returns
55     * <code>StateItem.STATE_CHANGED</code> if it's state is changed from it's
56     * old state.
57     * Returns <code>StateItem.STATE_NOT_CHANGED</code> if it's state stays
58     * constant.
59     *
60     * @param state a state to be set.
61     * @return <code>StateItem.STATE_CHANGED</code> if it's state is changed
62     * from it's old state, <code>StateItem.STATE_NOT_CHANGED</code>
63     * if it's state stays constant.
64     */

65    public boolean setState(long state);
66
67    /**
68     * Returns this StateItem's state.
69     *
70     * @return this StateItem's state
71     */

72    public long getState();
73
74    /**
75     * A logical name to associate with this item.
76     * @param name
77     */

78    public void setName(String JavaDoc name);
79
80    public String JavaDoc getName();
81 }
82
Popular Tags