Package javax.management.openmbean

Examples of javax.management.openmbean.TabularDataSupport


         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanParameterInfoSupport info = new OpenMBeanParameterInfoSupport(
            "name", "description", tabularType, data, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for tabular type and default value");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);

         OpenMBeanParameterInfoSupport info = new OpenMBeanParameterInfoSupport(
            "name", "description", tabularType, null, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for tabular type and null default value and legals");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanParameterInfoSupport info = new OpenMBeanParameterInfoSupport(
            "name", "description", arrayType, null, new String[] { "hello", "goodbye" });
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for array type and default value");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanParameterInfoSupport info = new OpenMBeanParameterInfoSupport(
            "name", "description", arrayType, null, new String[0]);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for array type and no default value and empty legals");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanParameterInfoSupport info = new OpenMBeanParameterInfoSupport(
            "name", "description", tabularType, null, new TabularDataSupport[] { data });
      }
      catch (OpenDataException e)
View Full Code Here


         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanParameterInfoSupport info = new OpenMBeanParameterInfoSupport(
            "name", "description", tabularType, data, null, null);
      }
      catch (OpenDataException e)
View Full Code Here

         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, data);
      }
      catch (OpenDataException e)
View Full Code Here

         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, data, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for tabular type and default value");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, null, null);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for tabular type and null default value and legals");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, null, new String[] { "hello", "goodbye" });
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == false)
         fail("Expected OpenDataException for array type and default value");

      caught = false;
      try
      {
         ArrayType arrayType = new ArrayType(1, SimpleType.STRING);
         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", arrayType, true, true, false, null, new String[0]);
      }
      catch (OpenDataException e)
      {
         caught = true;
      }
      if (caught == true)
         fail("Didn't expect OpenDataException for array type and no default value and empty legals");

      caught = false;
      try
      {
         String[] itemNames = new String[] { "name1", "name2" };
         String[] itemDescriptions = new String[] { "desc1", "desc2" };
         OpenType[] itemTypes = new OpenType[] { SimpleType.STRING, SimpleType.INTEGER };
         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, null, new TabularDataSupport[] { data });
      }
      catch (OpenDataException e)
View Full Code Here

         CompositeType rowType = new CompositeType("rowTypeName", "rowDescription",
            itemNames, itemDescriptions, itemTypes);

         String[] indexNames = new String[] { "name1", "name2" };
         TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);
         TabularDataSupport data = new TabularDataSupport(tabularType);

         OpenMBeanAttributeInfoSupport info = new OpenMBeanAttributeInfoSupport(
            "name", "description", tabularType, true, true, false, data, null, null);
      }
      catch (OpenDataException e)
View Full Code Here

         itemNames, itemDescriptions, itemTypes);
      ArrayType compArrayType3 = new ArrayType(2, compositeType2);
      assertTrue("compData1 should not be a value of array type, wrong element type", compArrayType3.isValue(compData1) == false);

      TabularType tabularType = new TabularType("typeName", "description", compositeType, new String[] { "name1" });
      TabularDataSupport tds = new TabularDataSupport(tabularType);
      TabularDataSupport[][] tabData1 = new TabularDataSupport[][]
      {
         { tds, null }, { tds, tds }
      };
View Full Code Here

      TabularType tabularType = new TabularType("typeName", "description", rowType, indexNames);

      assertTrue("null is not a value of tabular type", tabularType.isValue(null) == false);
      assertTrue("object is not a value of tabular type", tabularType.isValue(new Object()) == false);

      TabularDataSupport data = new TabularDataSupport(tabularType);
      assertTrue("data should is a value", tabularType.isValue(data));

      TabularType tabularType2 = new TabularType("typeName", "description", rowType, indexNames);
      data = new TabularDataSupport(tabularType2);
      assertTrue("data is a value, even though the tabular type is a different instance",
                 tabularType.isValue(data));

      tabularType2 = new TabularType("typeName2", "description", rowType, indexNames);
      data = new TabularDataSupport(tabularType2);
      assertTrue("data should not be a value, they have different type names",
                 tabularType.isValue(data) == false);

      CompositeType rowType2 = new CompositeType("rowTypeName2", "rowDescription",
         itemNames, itemDescriptions, itemTypes);
      tabularType2 = new TabularType("typeName", "description", rowType2, indexNames);
      data = new TabularDataSupport(tabularType2);
      assertTrue("data should not be a value, they have different row types",
                 tabularType.isValue(data) == false);

      String[] indexNames2 = new String[] { "name2", "name1" };
      tabularType2 = new TabularType("typeName", "description", rowType, indexNames2);
      data = new TabularDataSupport(tabularType2);
      assertTrue("data should not be a value, they have different index names",
                 tabularType.isValue(data) == false);
   }
View Full Code Here

    public TabularData browseAsTable(SubscriptionView view) throws OpenDataException {
        OpenTypeFactory factory = OpenTypeSupport.getFactory(ActiveMQMessage.class);
        List<Message> messages = getSubscriberMessages(view);
        CompositeType ct = factory.getCompositeType();
        TabularType tt = new TabularType("MessageList", "MessageList", ct, new String[] {"JMSMessageID"});
        TabularDataSupport rc = new TabularDataSupport(tt);
        for (int i = 0; i < messages.size(); i++) {
            rc.put(new CompositeDataSupport(ct, factory.getFields(messages.get(i))));
        }
        return rc;
    }
View Full Code Here

    public TabularData browseAsTable(String selector) throws OpenDataException, InvalidSelectorException {
        OpenTypeFactory factory = OpenTypeSupport.getFactory(ActiveMQMessage.class);
        Message[] messages = destination.browse();
        CompositeType ct = factory.getCompositeType();
        TabularType tt = new TabularType("MessageList", "MessageList", ct, new String[] { "JMSMessageID" });
        TabularDataSupport rc = new TabularDataSupport(tt);

        MessageEvaluationContext ctx = new MessageEvaluationContext();
        ctx.setDestination(destination.getActiveMQDestination());
        BooleanExpression selectorExpression = selector == null ? null : SelectorParser.parse(selector);

        for (int i = 0; i < messages.length; i++) {
            try {
                if (selectorExpression == null) {
                    rc.put(new CompositeDataSupport(ct, factory.getFields(messages[i])));
                } else {
                    ctx.setMessageReference(messages[i]);
                    if (selectorExpression.matches(ctx)) {
                        rc.put(new CompositeDataSupport(ct, factory.getFields(messages[i])));
                    }
                }
            } catch (Throwable e) {
                LOG.warn("exception browsing destination", e);
            }
View Full Code Here

                } else {
                    createProperty(propertyPrefix + "." + key, value);
                }
            }
        } else if (result instanceof TabularDataSupport) {
            TabularDataSupport data = (TabularDataSupport) result;
            for (Iterator<Object> 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);
View Full Code Here

TOP

Related Classes of javax.management.openmbean.TabularDataSupport

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.