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 CountStatisticWrapper extends StatisticWrapper {
12: public String[] getItemNames() {
13: return new String[] { "Count", "Description", "LastSampleTime",
14: "Name", "StartTime", "Unit" };
15: }
16:
17: public String[] getItemDescriptions() {
18: return new String[] { "CountDescription",
19: "DescriptionDescription", "LastSampleTimeDescription",
20: "NameDescription", "StartTimeDescription",
21: "UnitDescription" };
22: }
23:
24: public OpenType[] getItemTypes() {
25: return new OpenType[] { SimpleType.LONG, SimpleType.STRING,
26: SimpleType.LONG, SimpleType.STRING, SimpleType.LONG,
27: SimpleType.STRING };
28: }
29:
30: public StatisticImpl getStatisticImpl() {
31: if (statisticImpl == null) {
32: statisticImpl = new CountStatisticImpl();
33: }
34:
35: return statisticImpl;
36: }
37:
38: public Object[] getItemValues() {
39: CountStatisticImpl countStatistic = (CountStatisticImpl) getStatisticImpl();
40:
41: return new Object[] { new Long(countStatistic.getCount()),
42: countStatistic.getDescription(),
43: new Long(countStatistic.getLastSampleTime()),
44: countStatistic.getName(),
45: new Long(countStatistic.getStartTime()),
46: countStatistic.getUnit() };
47: }
48:
49: public void setItemValues(CompositeData compositeData) {
50: Object[] values = compositeData.getAll(getItemNames());
51:
52: CountStatisticImpl countStatistic = (CountStatisticImpl) getStatisticImpl();
53: countStatistic.setCount(((Long) values[0]).longValue());
54: countStatistic.setDescription((String) values[0]);
55: countStatistic
56: .setLastSampleTime(((Long) values[2]).longValue());
57: countStatistic.setName((String) values[3]);
58: countStatistic.setStartTime(((Long) values[4]).longValue());
59: countStatistic.setUnit((String) values[5]);
60: }
61:
62: public void reset() {
63: CountStatisticImpl countStatistic = (CountStatisticImpl) getStatisticImpl();
64: countStatistic.reset();
65: }
66: }
|