Package javax.management.openmbean

Examples of javax.management.openmbean.CompositeType


                                     ObjectName objectName,
                                     ObjectAttributeInfo attrInfo,
                                     String[] dataTypes,
                                     List attributesList){

        CompositeType type = getCompositeType(connection, objectName, attrInfo);
        for(Iterator it=type.keySet().iterator(); it.hasNext(); ){
            String itemName = (String)it.next();
            OpenType itemType = type.getType(itemName);
            Class itemTypeClass = getClass(itemType.getClassName(),
                        this.getClass().getClassLoader());
            for(int j=0; j<dataTypes.length; j++){

                Class dataType = getClass(dataTypes[j],
                        this.getClass().getClassLoader());
                if(dataType.isAssignableFrom(itemTypeClass)){
                    attributesList.add(
                            new ObjectAttributeInfo(
                                    attrInfo.getName() + COMPOSITE_ATTR_SEPARATOR + itemName,
                                    type.getDescription(itemName),
                                    itemType.getClassName(), false, true, false));
                }
            }
        }
    }
View Full Code Here


            itemName = attribute.substring(index + 1);
            attribute = attribute.substring(0, index);
            for(int i=0; i<objAttributes.length; i++){
                if(objAttributes[i].getName().equals(attribute)){
                    // it is a CompositeData type
                    CompositeType type = getCompositeType(connection,
                            objectName, objAttributes[i]);
                    return type.getType(itemName).getClassName();
                }
            }
        }
        throw new ServiceException(ErrorCodes.INVALID_MBEAN_ATTRIBUTE,
                attribute, objectName);
View Full Code Here

    private CompositeType createCompositeType()
        throws Exception {
       
        String[] itemDescriptions = itemNames;
       
        CompositeType compositeType = new CompositeType(
                CompositeType.class.getName(), compTypeDesc,
                itemNames,
                itemDescriptions,
                itemTypes);
       
View Full Code Here

      String[] keys = properties.keySet().toArray(new String[0]);
      OpenType[] itemTypes = new OpenType[keys.length];
      for (int i = 0; i < itemTypes.length; i++) {
        itemTypes[i] = SimpleType.STRING;
      }
      CompositeType propsType;
      propsType = new CompositeType("Properties type", "properties", keys, keys, itemTypes);
      CompositeDataSupport propsData = new CompositeDataSupport(propsType, properties);
      return propsData;
    } catch (OpenDataException e) {
      throw new AssertException("problem with jmx data generation", e);
    }
View Full Code Here

        return this.bundleService.selectBundles(ids, false);
    }

    public TabularData getBundles() throws MBeanException {
        try {
            CompositeType bundleType = new CompositeType("Bundle", "OSGi Bundle",
                    new String[]{"ID", "Name", "Version", "Start Level", "State"},
                    new String[]{"ID of the Bundle", "Name of the Bundle", "Version of the Bundle", "Start Level of the Bundle", "Current State of the Bundle"},
                    new OpenType[]{SimpleType.LONG, SimpleType.STRING, SimpleType.STRING, SimpleType.INTEGER, SimpleType.STRING});
            TabularType tableType = new TabularType("BundlesMBeanImpl", "Tables of all BundlesMBeanImpl", bundleType, new String[]{"ID"});
            TabularData table = new TabularDataSupport(tableType);
View Full Code Here

import org.easymock.EasyMock;
import org.junit.Assert;

public class JmxInstanceTest extends TestCase {
    public void testJMXInstanceStatics() {
        CompositeType it = JmxInstance.INSTANCE;
        Assert.assertEquals(
            new HashSet<String>(Arrays.asList(AdminServiceMBean.INSTANCE)),
            it.keySet());

        TabularType tt = JmxInstance.INSTANCE_TABLE;
        Assert.assertEquals("Instances", tt.getTypeName());
    }
View Full Code Here

        return result;
    }

    private Map<String, Object> convertObject(final CompositeData cd) {
        final CompositeType type = cd.getCompositeType();
        final Map<String, Object> result = new HashMap<String, Object>();
        result.put(Constants.PROP_RESOURCE_SUPER_TYPE, Constants.TYPE_ATTRIBUTES);
        result.put(Constants.PROP_RESOURCE_TYPE, type.getTypeName());

        final Map<String, Object> attrMap = new TreeMap<String, Object>();
        attrMap.put(Constants.PROP_RESOURCE_TYPE, Constants.TYPE_ATTRIBUTES);
        result.put(Constants.RSRC_ATTRIBUTES, attrMap);

        final Set<String> names = type.keySet();
        for(final String name : names) {
            final Map<String, Object> dataMap = new HashMap<String, Object>();
            attrMap.put(name, dataMap);
            dataMap.put(ResourceResolver.PROPERTY_RESOURCE_TYPE, type.getType(name));
            dataMap.put(Constants.PROP_RESOURCE_SUPER_TYPE, Constants.TYPE_ATTRIBUTE);

            if ( type.getDescription() != null ) {
                dataMap.put(Constants.PROP_DESCRIPTION, type.getDescription());
            }
            dataMap.put(Constants.PROP_TYPE, type.getType(name).getTypeName());

            final Object value = cd.get(name);
            if ( value != null ) {
                if ( value.getClass().isArray() ) {
                    final int length = Array.getLength(value);
View Full Code Here

                    } else if (row.containsKey("version")) {
                        version = row.get("version");
                    }
                }

                CompositeType ct = CamelOpenMBeanTypes.listComponentsCompositeType();
                CompositeData data = new CompositeDataSupport(ct, new String[]{"name", "description", "status", "type", "groupId", "artifactId", "version"},
                        new Object[]{name, description, status, type, groupId, artifactId, version});
                answer.put(data);
            }
            return answer;
View Full Code Here

    public TabularData listEndpoints() {
        try {
            TabularData answer = new TabularDataSupport(CamelOpenMBeanTypes.listEndpointsTabularType());
            Collection<Endpoint> endpoints = endpointRegistry.values();
            for (Endpoint endpoint : endpoints) {
                CompositeType ct = CamelOpenMBeanTypes.listEndpointsCompositeType();
                String url = endpoint.getEndpointUri();

                CompositeData data = new CompositeDataSupport(ct, new String[]{"url"}, new Object[]{url});
                answer.put(data);
            }
View Full Code Here

                String javaType = row.get("javaType");
                String value = row.get("value") != null ? row.get("value") : "";
                String defaultValue = row.get("defaultValue") != null ? row.get("defaultValue") : "";
                String description = row.get("description") != null ? row.get("description") : "";

                CompositeType ct = CamelOpenMBeanTypes.explainEndpointsCompositeType();
                CompositeData data = new CompositeDataSupport(ct,
                        new String[]{"option", "type", "java type", "value", "default value", "description"},
                        new Object[]{option, type, javaType, value, defaultValue, description});
                answer.put(data);
            }
View Full Code Here

TOP

Related Classes of javax.management.openmbean.CompositeType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.