MonitoredAttribute.java revision 672:2bb058ce572e
1/*
2 * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.  Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25package com.sun.corba.se.spi.monitoring;
26
27import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo;
28import java.util.*;
29
30/**
31 * @author Hemanth Puttaswamy
32 *
33 * Monitored Attribute is the interface to represent a Monitorable
34 * Attribute. Using this interface, one can get the value of the attribute
35 * and set the value if it is a writeable attribute.
36 */
37public interface MonitoredAttribute {
38
39  ///////////////////////////////////////
40  // operations
41
42/**
43 * Gets the Monitored Attribute Info for the attribute.
44 *
45 * @param monitoredAttributeInfo for this Monitored Attribute.
46 */
47    public MonitoredAttributeInfo getAttributeInfo();
48/**
49 * Sets the value for the Monitored Attribute if isWritable() is false, the
50 * method will throw ILLEGAL Operation exception.
51 *
52 * Also, the type of 'value' should be same as specified in the
53 * MonitoredAttributeInfo for a particular instance.
54 *
55 * @param value should be any one of the Basic Java Type Objects which are
56 * Long, Double, Float, String, Integer, Short, Character, Byte.
57 */
58    public void setValue(Object value);
59
60
61/**
62 * Gets the value of the Monitored Attribute. The value can be obtained
63 * from different parts of the module. User may choose to delegate the call
64 * to getValue() to other variables.
65 *
66 * NOTE: It is important to make sure that the type of Object returned in
67 * getvalue is same as the one specified in MonitoredAttributeInfo for this
68 * attribute.
69 *
70 * @param value is the current value for this MonitoredAttribute
71 */
72    public Object getValue();
73/**
74 * Gets the name of the Monitored Attribute.
75 *
76 * @return name of this Attribute
77 */
78    public String getName();
79/**
80 * If this attribute needs to be cleared, the user needs to implement this
81 * method to reset the state to initial state. If the Monitored Attribute
82 * doesn't change like for example (ConnectionManager High Water Mark),
83 * then clearState() is a No Op.
84 */
85    public void clearState();
86
87} // end MonitoredAttribute
88