01: /**
02: * Copyright (c) 2004-2005 jManage.org
03: *
04: * This is a free software; you can redistribute it and/or
05: * modify it under the terms of the license at
06: * http://www.jmanage.org.
07: *
08: * Unless required by applicable law or agreed to in writing, software
09: * distributed under the License is distributed on an "AS IS" BASIS,
10: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11: * See the License for the specific language governing permissions and
12: * limitations under the License.
13: */package org.jmanage.testapp.mbeans;
14:
15: import javax.management.openmbean.*;
16:
17: /**
18: *
19: * <p>
20: * Date: Sep 26, 2005
21: * @author Rakesh Kalra
22: */
23: public class OpenMBeanDataTypeTest implements
24: OpenMBeanDataTypeTestMBean {
25:
26: private TabularData tabularData;
27: private CompositeData compositeData;
28:
29: public OpenMBeanDataTypeTest() throws OpenDataException {
30:
31: String[] itemNames = { "Name", "NumberOfFloors", "Height",
32: "UndergroundParking", "NumberOfElevators",
33: "OfficeSpage" };
34:
35: String[] itemDescriptions = { "Name of the building",
36: "The number of floors the building has",
37: "The height of the building in feet",
38: "Whether or not the building has underground parking",
39: "The total number of elevators in the building",
40: "The amount of office space in square feet" };
41:
42: OpenType[] itemTypes = { SimpleType.STRING, SimpleType.SHORT,
43: SimpleType.INTEGER, SimpleType.BOOLEAN,
44: SimpleType.SHORT, SimpleType.LONG };
45:
46: CompositeType buildingType = new CompositeType(
47: "BuildingCompositeType",
48: "CompositeType that represents a building", itemNames,
49: itemDescriptions, itemTypes);
50:
51: Object[] itemValuesA = { "Building A", new Short((short) 3),
52: new Integer(100), Boolean.FALSE, new Short((short) 1),
53: new Long(10000) };
54:
55: Object[] itemValuesB = { "Building B", new Short((short) 5),
56: new Integer(90), Boolean.FALSE, new Short((short) 2),
57: new Long(20000) };
58:
59: Object[] itemValuesC = { "Building C", new Short((short) 5),
60: new Integer(80), Boolean.FALSE, new Short((short) 2),
61: new Long(20000) };
62:
63: compositeData = new CompositeDataSupport(buildingType,
64: itemNames, itemValuesA);
65:
66: TabularType tabularType = new TabularType(TabularData.class
67: .getName(), "Table containing building info",
68: buildingType, new String[] { "Name" });
69: tabularData = new TabularDataSupport(tabularType);
70: tabularData.put(new CompositeDataSupport(buildingType,
71: itemNames, itemValuesB));
72: tabularData.put(compositeData);
73: tabularData.put(new CompositeDataSupport(buildingType,
74: itemNames, itemValuesC));
75: }
76:
77: public TabularData getTabularData() {
78: return tabularData;
79: }
80:
81: public CompositeData getCompositeData() {
82: return compositeData;
83: }
84:
85: }
|