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 TimeStatisticWrapper extends StatisticWrapper {
12: public String[] getItemNames() {
13: return new String[] { "Count", "Description", "LastSampleTime",
14: "MaxTime", "MinTime", "Name", "StartTime", "TotalTime",
15: "Unit" };
16: }
17:
18: public String[] getItemDescriptions() {
19: return new String[] { "CountDescription",
20: "DescriptionDescription", "LastSampleTimeDescription",
21: "MaxTimeDescription", "MinTimeDescription",
22: "NameDescription", "StartTimeDescription",
23: "TotalTimeDescription", "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.LONG,
30: SimpleType.STRING };
31: }
32:
33: public StatisticImpl getStatisticImpl() {
34: if (statisticImpl == null) {
35: statisticImpl = new TimeStatisticImpl();
36: }
37:
38: return statisticImpl;
39: }
40:
41: public Object[] getItemValues() {
42: TimeStatisticImpl timeStatistic = (TimeStatisticImpl) getStatisticImpl();
43:
44: return new Object[] { new Long(timeStatistic.getCount()),
45: timeStatistic.getDescription(),
46: new Long(timeStatistic.getLastSampleTime()),
47: new Long(timeStatistic.getMaxTime()),
48: new Long(timeStatistic.getMinTime()),
49: timeStatistic.getName(),
50: new Long(timeStatistic.getStartTime()),
51: new Long(timeStatistic.getTotalTime()),
52: timeStatistic.getUnit() };
53: }
54:
55: public void setItemValues(CompositeData compositeData) {
56: Object[] values = compositeData.getAll(getItemNames());
57:
58: TimeStatisticImpl timeStatistic = (TimeStatisticImpl) getStatisticImpl();
59: timeStatistic.setCount(((Long) values[0]).longValue());
60: timeStatistic.setDescription((String) values[1]);
61: timeStatistic.setLastSampleTime(((Long) values[2]).longValue());
62: timeStatistic.setMaxTime(((Long) values[3]).longValue());
63: timeStatistic.setMinTime(((Long) values[4]).longValue());
64: timeStatistic.setName((String) values[5]);
65: timeStatistic.setStartTime(((Long) values[6]).longValue());
66: timeStatistic.setTotalTime(((Long) values[7]).longValue());
67: timeStatistic.setUnit((String) values[8]);
68: }
69:
70: public void reset() {
71: TimeStatisticImpl timeStatistic = (TimeStatisticImpl) getStatisticImpl();
72: timeStatistic.reset();
73: }
74: }
|