Examples of OpenType


Examples of javax.management.openmbean.OpenType

   private void testSerialization(String className, String type, String description)
      throws Exception
   {
      // Create the role
      OpenType original = new MyOpenType(className, type, description);

      // Serialize it
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(original);
   
      // Deserialize it
      ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
      ObjectInputStream ois = new ObjectInputStream(bais);
      OpenType result = (OpenType) ois.readObject();

      // Did it work?
      assertEquals(original.getClassName(), result.getClassName());
      assertEquals(original.getTypeName(), result.getTypeName());
      assertEquals(original.getDescription(), result.getDescription());
      assertEquals(original.isArray(), result.isArray());
   }
View Full Code Here

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

Examples of javax.management.openmbean.OpenType

            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

Examples of javax.management.openmbean.OpenType

      CompositeType type = data.getCompositeType();
      Set<String> names = type.keySet();
      Class clazz = expected.getClass();
      for (String name : names)
      {
         OpenType itemType = type.getType(name);
         try
         {
            Method method = MXBeanUtils.getCompositeDataMethod(clazz, name, itemType == SimpleType.BOOLEAN);
            Object expectedValue = method.invoke(expected, null);
            Object actualValue = handler.invoke(actual, method, null);
View Full Code Here

Examples of javax.management.openmbean.OpenType

      constructReconstructTest(initialValue, type, expectedOpenData, expected);
   }

   protected void constructReconstructTest(Object initialValue, Type type, Object expectedOpenData, Object expected) throws Exception
   {
      OpenType openType = MXBeanUtils.getOpenType(type);
      constructReconstructTest(initialValue, type, openType, expectedOpenData, expected);
   }
View Full Code Here

Examples of javax.management.openmbean.OpenType

   }

   public void testConstructorSimple()
      throws Exception
   {
      OpenType test = new MyOpenType("java.lang.Void", "type", "description");
      assertEquals("java.lang.Void", test.getClassName());
      assertEquals("type", test.getTypeName());
      assertEquals("description", test.getDescription());
      assertEquals(false, test.isArray());
   }
View Full Code Here

Examples of javax.management.openmbean.OpenType

   }

   public void testConstructorArray()
      throws Exception
   {
      OpenType test = new MyOpenType("[[Ljava.lang.Void;", "type", "description");
      assertEquals("[[Ljava.lang.Void;", test.getClassName());
      assertEquals("type", test.getTypeName());
      assertEquals("description", test.getDescription());
      assertEquals(true, test.isArray());
   }
View Full Code Here

Examples of javax.management.openmbean.OpenType

   private void testSerialization(String className, String type, String description)
      throws Exception
   {
      // Create the role
      OpenType original = new MyOpenType(className, type, description);

      // Serialize it
      ByteArrayOutputStream baos = new ByteArrayOutputStream();
      ObjectOutputStream oos = new ObjectOutputStream(baos);
      oos.writeObject(original);
   
      // Deserialize it
      ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
      ObjectInputStream ois = new ObjectInputStream(bais);
      OpenType result = (OpenType) ois.readObject();

      // Did it work?
      assertEquals(original.getClassName(), result.getClassName());
      assertEquals(original.getTypeName(), result.getTypeName());
      assertEquals(original.getDescription(), result.getDescription());
      assertEquals(original.isArray(), result.isArray());
   }
View Full Code Here

Examples of javax.management.openmbean.OpenType

    private static OpenConverter
  makeArrayOrCollectionConverter(Type collectionType, Type elementType)
      throws OpenDataException {

        final OpenConverter elementConverter = toConverter(elementType);
  final OpenType elementOpenType = elementConverter.getOpenType();
  final ArrayType openType = new ArrayType(1, elementOpenType);
  final Class elementOpenClass = elementConverter.getOpenClass();

  final Class openArrayClass;
        final String openArrayClassName;
View Full Code Here

Examples of javax.management.openmbean.OpenType

      throws OpenDataException {

  final String objTypeName = objType.toString();
  final OpenConverter keyConverter = toConverter(keyType);
  final OpenConverter valueConverter = toConverter(valueType);
  final OpenType keyOpenType = keyConverter.getOpenType();
  final OpenType valueOpenType = valueConverter.getOpenType();
  final CompositeType rowType =
      new CompositeType(objTypeName,
            objTypeName,
            keyValueArray,
            keyValueArray,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.