01: /*
02: * Copyright 2005 Sun Microsystems, Inc. All rights reserved.
03: * PROPRIETARY/CONFIDENTIAL. Use of this product is subject to license terms.
04: */
05: package com.sun.portal.monitoring.statistics;
06:
07: import javax.management.openmbean.CompositeData;
08: import javax.management.openmbean.OpenType;
09: import javax.management.openmbean.SimpleType;
10:
11: public class RangeStatisticWrapper extends StatisticWrapper {
12: public String[] getItemNames() {
13: return new String[] { "Current", "Description",
14: "HighWaterMark", "LastSampleTime", "LowWaterMark",
15: "Name", "StartTime", "Unit" };
16: }
17:
18: public String[] getItemDescriptions() {
19: return new String[] { "CurrentDescription",
20: "DescriptionDescription", "HighWaterMarkDescription",
21: "LastSampleTimeDescription", "LowWaterMarkDescription",
22: "NameDescription", "StartTimeDescription",
23: "UnitDescription" };
24: }
25:
26: public OpenType[] getItemTypes() {
27: return new OpenType[] { SimpleType.LONG, SimpleType.STRING,
28: SimpleType.LONG, SimpleType.LONG, SimpleType.LONG,
29: SimpleType.STRING, SimpleType.LONG, SimpleType.STRING };
30: }
31:
32: public StatisticImpl getStatisticImpl() {
33: if (statisticImpl == null) {
34: statisticImpl = new RangeStatisticImpl();
35: }
36:
37: return statisticImpl;
38: }
39:
40: public Object[] getItemValues() {
41: RangeStatisticImpl rangeStatistic = (RangeStatisticImpl) getStatisticImpl();
42:
43: return new Object[] { new Long(rangeStatistic.getCurrent()),
44: rangeStatistic.getDescription(),
45: new Long(rangeStatistic.getHighWaterMark()),
46: new Long(rangeStatistic.getLastSampleTime()),
47: new Long(rangeStatistic.getLowWaterMark()),
48: rangeStatistic.getName(),
49: new Long(rangeStatistic.getStartTime()),
50: rangeStatistic.getUnit() };
51: }
52:
53: public void setItemValues(CompositeData compositeData) {
54: Object[] values = compositeData.getAll(getItemNames());
55:
56: RangeStatisticImpl rangeStatistic = (RangeStatisticImpl) getStatisticImpl();
57: rangeStatistic.setCurrent(((Long) values[0]).longValue());
58: rangeStatistic.setDescription((String) values[1]);
59: rangeStatistic.setHighWaterMark(((Long) values[2]).longValue());
60: rangeStatistic
61: .setLastSampleTime(((Long) values[3]).longValue());
62: rangeStatistic.setLowWaterMark(((Long) values[4]).longValue());
63: rangeStatistic.setName((String) values[5]);
64: rangeStatistic.setStartTime(((Long) values[6]).longValue());
65: rangeStatistic.setUnit((String) values[7]);
66: }
67:
68: public void reset() {
69: RangeStatisticImpl rangeStatistic = (RangeStatisticImpl) getStatisticImpl();
70: rangeStatistic.reset();
71: }
72: }
|