1 14 package org.jmanage.testapp.mbeans; 15 16 import javax.management.openmbean.*; 17 18 24 public class OpenMBeanDataTypeTest implements OpenMBeanDataTypeTestMBean { 25 26 private TabularData tabularData; 27 private CompositeData compositeData; 28 29 public OpenMBeanDataTypeTest() throws OpenDataException { 30 31 String [] itemNames = { 32 "Name", 33 "NumberOfFloors", 34 "Height", 35 "UndergroundParking", 36 "NumberOfElevators", 37 "OfficeSpage"}; 38 39 String [] itemDescriptions = { 40 "Name of the building", 41 "The number of floors the building has", 42 "The height of the building in feet", 43 "Whether or not the building has underground parking", 44 "The total number of elevators in the building", 45 "The amount of office space in square feet" 46 }; 47 48 OpenType[] itemTypes = { 49 SimpleType.STRING, 50 SimpleType.SHORT, 51 SimpleType.INTEGER, 52 SimpleType.BOOLEAN, 53 SimpleType.SHORT, 54 SimpleType.LONG 55 }; 56 57 CompositeType buildingType = new CompositeType( 58 "BuildingCompositeType", 59 "CompositeType that represents a building", 60 itemNames, 61 itemDescriptions, 62 itemTypes); 63 64 Object [] itemValuesA = { 65 "Building A", 66 new Short ((short)3), 67 new Integer (100), 68 Boolean.FALSE, 69 new Short ((short)1), 70 new Long (10000) 71 }; 72 73 Object [] itemValuesB = { 74 "Building B", 75 new Short ((short)5), 76 new Integer (90), 77 Boolean.FALSE, 78 new Short ((short)2), 79 new Long (20000) 80 }; 81 82 Object [] itemValuesC = { 83 "Building C", 84 new Short ((short)5), 85 new Integer (80), 86 Boolean.FALSE, 87 new Short ((short)2), 88 new Long (20000) 89 }; 90 91 compositeData = new CompositeDataSupport(buildingType, 92 itemNames, itemValuesA); 93 94 TabularType tabularType = 95 new TabularType(TabularData.class.getName(), 96 "Table containing building info", 97 buildingType, 98 new String []{"Name"}); 99 tabularData = new TabularDataSupport(tabularType); 100 tabularData.put(new CompositeDataSupport(buildingType, itemNames, 101 itemValuesB)); 102 tabularData.put(compositeData); 103 tabularData.put(new CompositeDataSupport(buildingType, itemNames, 104 itemValuesC)); 105 } 106 107 public TabularData getTabularData() { 108 return tabularData; 109 } 110 111 public CompositeData getCompositeData() { 112 return compositeData; 113 } 114 115 } 116 | Popular Tags |