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  */
  25 package com.sun.corba.se.spi.monitoring;
  26 
  27 import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo;
  28 import java.util.*;
  29 
  30 /**
  31  * <p>
  32  *
  33  * @author Hemanth Puttaswamy
  34  * </p>
  35  * <p>
  36  * Monitored Attribute is the interface to represent a Monitorable
  37  * Attribute. Using this interface, one can get the value of the attribute
  38  * and set the value if it is a writeable attribute.
  39  * </p>
  40  */
  41 public interface MonitoredAttribute {
  42 
  43   ///////////////////////////////////////
  44   // operations
  45 
  46 /**
  47  * <p>
  48  * Gets the Monitored Attribute Info for the attribute.
  49  * </p>
  50  * <p>
  51  *
  52  * @param monitoredAttributeInfo for this Monitored Attribute.
  53  * </p>
  54  */
  55     public MonitoredAttributeInfo getAttributeInfo();
  56 /**
  57  * <p>
  58  * Sets the value for the Monitored Attribute if isWritable() is false, the
  59  * method will throw ILLEGAL Operation exception.
  60  *
  61  * Also, the type of 'value' should be same as specified in the
  62  * MonitoredAttributeInfo for a particular instance.
  63  * </p>
  64  * <p>
  65  *
  66  * @param value should be any one of the Basic Java Type Objects which are
  67  * Long, Double, Float, String, Integer, Short, Character, Byte.
  68  * </p>
  69  */
  70     public void setValue(Object value);
  71 
  72 
  73 /**
  74  * <p>
  75  * Gets the value of the Monitored Attribute. The value can be obtained
  76  * from different parts of the module. User may choose to delegate the call
  77  * to getValue() to other variables.
  78  *
  79  * NOTE: It is important to make sure that the type of Object returned in
  80  * getvalue is same as the one specified in MonitoredAttributeInfo for this
  81  * attribute.
  82  * </p>
  83  * <p>
  84  *
  85  * </p>
  86  * <p>
  87  *
  88  * @param value is the current value for this MonitoredAttribute
  89  * </p>
  90  */
  91     public Object getValue();
  92 /**
  93  * <p>
  94  * Gets the name of the Monitored Attribute.
  95  * </p>
  96  * <p>
  97  *
  98  * @param name of this Attribute
  99  * </p>
 100  */
 101     public String getName();
 102 /**
 103  * <p>
 104  * If this attribute needs to be cleared, the user needs to implement this
 105  * method to reset the state to initial state. If the Monitored Attribute
 106  * doesn't change like for example (ConnectionManager High Water Mark),
 107  * then clearState() is a No Op.
 108  * </p>
 109  *
 110  */
 111     public void clearState();
 112 
 113 } // end MonitoredAttribute