Package javax.management.openmbean

Examples of javax.management.openmbean.OpenType


    Collections.addAll(all, items);

    int size = all.size();
    String names[] = new String[size];
    String descriptions[] = new String[size];
    OpenType types[] = new OpenType[size];

    int m = 0;
    for (Item item : all) {
      names[m] = item.name;
      descriptions[m] = item.description;
View Full Code Here


            CompositeType compositeType = data.getCompositeType();
            Set keys = compositeType.keySet();
            for (Iterator iter = keys.iterator(); iter.hasNext();) {
                String key = (String) iter.next();
                Object value = data.get(key);
                OpenType type = compositeType.getType(key);
                if (type instanceof SimpleType) {
                    setProperty(propertyPrefix + "." + key, value);
                } else {
                    createProperty(propertyPrefix + "." + key, value);
                }
            }
        } else if (result instanceof TabularDataSupport) {
            TabularDataSupport data = (TabularDataSupport) result;
            for (Iterator iter = data.keySet().iterator(); iter.hasNext();) {
                Object key = iter.next();
                for (Iterator iter1 = ((List) key).iterator(); iter1.hasNext();) {
                    Object key1 = iter1.next();
                    CompositeData valuedata = data.get(new Object[] { key1 });
                    Object value = valuedata.get("value");
                    OpenType type = valuedata.getCompositeType().getType(
                            "value");
                    if (type instanceof SimpleType) {
                        setProperty(propertyPrefix + "." + key1, value);
                    } else {
                        createProperty(propertyPrefix + "." + key1, value);
View Full Code Here

    {
      // no OpenType for a null
      throw new IllegalArgumentException();
    }
   
    OpenType  type  = getSimpleType( o.getClass() );
   
    if ( type == null )
    {
      final Class  theClass  = o.getClass();
     
View Full Code Here

      super.tearDown();
   }

   public void testIsValue()
   {
      OpenType type = SimpleType.BOOLEAN;
      OpenType type2 = SimpleType.INTEGER;
      assertTrue(type.isValue(new Boolean(true)));
      assertTrue(!(type.isValue(new Integer(0))));
   }
View Full Code Here

      assertTrue(!(type.isValue(new Integer(0))));
   }

   public void testEquals()
   {
      OpenType type = SimpleType.BOOLEAN;
      OpenType type2 = SimpleType.BOOLEAN;
      OpenType type3 = SimpleType.OBJECTNAME;
      OpenType type4 = SimpleType.DATE;

      assertTrue(type.equals(type2));
      // test the reverse
      assertTrue(type2.equals(type));
      assertTrue(!(type.equals(type3)));
      assertTrue(!(type.equals(type4)));
      // test reverse
      assertTrue(!(type3.equals(type)));
      assertTrue(!(type4.equals(type)));

      assertTrue(type4.equals(SimpleType.DATE));
   }
View Full Code Here

   public void testHashCode()
   {
      Map m = new HashMap();
      // these objects are immutable hence the instances must be the same, equal, with an equal hashCode
      OpenType type = SimpleType.CHARACTER;
      OpenType type2 = SimpleType.CHARACTER;
      OpenType type3 = SimpleType.OBJECTNAME;

      m.put(type, "java.lang.Character");
      String value = (String)m.get(type2);

      assertEquals(value, "java.lang.Character");
      assertEquals(type.hashCode(), type2.hashCode());
      assertTrue(type.hashCode() != type3.hashCode());
   }
View Full Code Here

      assertTrue(type.hashCode() != type3.hashCode());
   }

   public void testTypeNameDescriptionClassNameAllEqual()
   {
      OpenType type = SimpleType.BIGINTEGER;
      String typeName = type.getTypeName();
      String description = type.getDescription();
      String className = type.getClassName();

      assertTrue(typeName.equals(description));
      assertTrue(typeName.equals(className));
      assertTrue(className.equals(description));
View Full Code Here

      assertTrue(expected == result);
   }

   public void testGetType()
   {
      OpenType expected = SimpleType.FLOAT;
      OpenType result = tShirtType.getType("price");
      assertEquals(expected, result);
   }
View Full Code Here

        {
            // no OpenType for a null
            throw new IllegalArgumentException();
        }

        OpenType type = getSimpleType(o.getClass());

        if (type == null)
        {
            final Class<?> theClass = o.getClass();
View Full Code Here

        // ItemNames in composite data
        List<String> itemNames = new ArrayList<String>(data.getCompositeType().keySet());

        for (String itemName : itemNames)
        {
            OpenType itemType = data.getCompositeType().getType(itemName);
            Label keyLabel = toolkit.createLabel(compositeHolder, itemName, SWT.TRAIL);
            GridData layoutData = new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1);
            layoutData.minimumWidth = 70;
            keyLabel.setLayoutData(layoutData);

            if (itemType.isArray())
            {
                OpenType type = ((ArrayType)itemType).getElementOpenType();
                //  If Byte array and mimetype is text, convert to text string
                if (type.getClassName().equals(Byte.class.getName()))
                {
                    String mimeType = null;
                    String encoding = null;
                    if (data.containsKey("MimeType"))
                    {
                        mimeType = (String)data.get("MimeType");
                    }
                    if (data.containsKey("Encoding"))
                    {
                        encoding = (String)data.get("Encoding");
                    }
                   
                    if (encoding == null || encoding.length() == 0)
                    {
                        encoding = Charset.defaultCharset().name();
                    }

                    if ("text/plain".equals(mimeType))
                    {
                        convertByteArray(toolkit, compositeHolder, data, itemName, encoding);
                    }
                    else
                    {
                        handleBinaryMessageContent(toolkit, compositeHolder, data, itemName, encoding);
                    }                       
                }
                // If array of any other supported type, show as a list of String array
                else if (SUPPORTED_ARRAY_DATATYPES.contains(type.getClassName()))
                {
                    convertArrayItemForDisplay(compositeHolder, data, itemName);
                }
                else
                {
View Full Code Here

TOP

Related Classes of javax.management.openmbean.OpenType

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.