Package javax.management.modelmbean

Examples of javax.management.modelmbean.DescriptorSupport


      xmldescriptor.append("name=\"null\" ");
      xmldescriptor.append("value=\"(null)\"");
      xmldescriptor.append(">");
      xmldescriptor.append("</field>");
      xmldescriptor.append("</Descriptor>");
      DescriptorSupport ds = new DescriptorSupport(xmldescriptor.toString());
      String xml = ds.toXMLString();
      assertTrue("Descriptor from XML != Descriptor", descriptorsEqual(ds, (new DescriptorSupport(xml))));
   }
View Full Code Here


      xmldescriptor.append("name=\"date\" ");
      xmldescriptor.append("value=\"(java.net.URL/http://mx4j.sourceforge.net)\"");
      xmldescriptor.append(">");
      xmldescriptor.append("</field>");
      xmldescriptor.append("</Descriptor>");
      DescriptorSupport ds = new DescriptorSupport(xmldescriptor.toString());
      String xml = ds.toXMLString();
      assertTrue("Descriptor from XML != Descriptor", descriptorsEqual(ds, (new DescriptorSupport(xml))));
   }
View Full Code Here

   public void testBogusXMLConstructor() throws Exception
   {
      try
      {
         new DescriptorSupport("<Descriptor><field name=</Descriptor>");
         fail("Expecting XMLParseException");
      }
      catch (XMLParseException x)
      {
      }
View Full Code Here

         xmldescriptor.append("name=\"bogus\" ");
         xmldescriptor.append("value=\"(java.lang.Byte/256)\"");
         xmldescriptor.append(">");
         xmldescriptor.append("</field>");
         xmldescriptor.append("</Descriptor>");
         new DescriptorSupport(xmldescriptor.toString());
         fail("Expecting XMLParseException");
      }
      catch (XMLParseException x)
      {
      }
View Full Code Here

   //
   // MODELMBEAN package
   //
   public void compareDescriptorSupport(Object o1, Object o2)
   {
      DescriptorSupport s1 = (DescriptorSupport)o1;
      DescriptorSupport s2 = (DescriptorSupport)o2;

      String[] names1 = s1.getFieldNames();
      String[] names2 = s2.getFieldNames();
      Object[] values1 = s1.getFieldValues(names1);
      Object[] values2 = s2.getFieldValues(names2);

      ArrayList list1 = new ArrayList(Arrays.asList(names1));
      ArrayList list2 = new ArrayList(Arrays.asList(names2));
      if (!list1.containsAll(list2) || !list2.containsAll(list1)) throw new RuntimeException();
View Full Code Here

     */
    public static DescriptorSupport mergeDescriptors(
            final Descriptor src,
            final Descriptor dest)
    {
        final DescriptorSupport d = new DescriptorSupport();

        // do it manually, the APIs screw up booleans making the "(true)" instead of "true".
        String[] fieldNames = dest.getFieldNames();
        for (final String fieldName : fieldNames)
        {
            d.setField(fieldName, dest.getFieldValue(fieldName));
        }

        // now overwrite conflicting fields with those from 'src'
        fieldNames = src.getFieldNames();
        for (final String fieldName : fieldNames)
        {
            d.setField(fieldName, src.getFieldValue(fieldName));
        }

        return d;
    }
View Full Code Here

            final boolean singleton,
            final boolean globalSingleton,
            final String group,
            final boolean supportsAdoption,
            final String[] subTypes) {
        final DescriptorSupport desc = new DescriptorSupport();

        if (intf == null || !intf.isInterface()) {
            throw new IllegalArgumentException("interface class must be an interface");
        }

        desc.setField(DESC_STD_IMMUTABLE_INFO, immutable);
        desc.setField(DESC_STD_INTERFACE_NAME, intf.getName());
        desc.setField(DESC_IS_SINGLETON, singleton);
        desc.setField(DESC_IS_GLOBAL_SINGLETON, globalSingleton);
        desc.setField(DESC_GROUP, group);
        desc.setField(DESC_SUPPORTS_ADOPTION, supportsAdoption);

        if (subTypes != null) {
            desc.setField(DESC_SUB_TYPES, subTypes);
        }

        return desc;
    }
View Full Code Here

        MBeanNotificationInfo response[] =
            new MBeanNotificationInfo[current.length + 2];
        Descriptor descriptor = null;

        // Fill in entry for general notifications
        descriptor = new DescriptorSupport
            (new String[] { "name=GENERIC",
                            "descriptorType=notification",
                            "log=T",
                            "severity=5",
                            "displayName=jmx.modelmbean.generic" });
        response[0] = new ModelMBeanNotificationInfo
            (new String[] { "jmx.modelmbean.generic" },
             "GENERIC",
             "Text message notification from the managed resource",
             descriptor);

        // Fill in entry for attribute change notifications
        descriptor = new DescriptorSupport
            (new String[] { "name=ATTRIBUTE_CHANGE",
                            "descriptorType=notification",
                            "log=T",
                            "severity=5",
                            "displayName=jmx.attribute.change" });
View Full Code Here

        MBeanNotificationInfo response[] =
            new MBeanNotificationInfo[current.length + 2];
        Descriptor descriptor = null;

        // Fill in entry for general notifications
        descriptor = new DescriptorSupport
            (new String[] { "name=GENERIC",
                            "descriptorType=notification",
                            "log=T",
                            "severity=5",
                            "displayName=jmx.modelmbean.generic" });
        response[0] = new ModelMBeanNotificationInfo
            (new String[] { "jmx.modelmbean.generic" },
             "GENERIC",
             "Text message notification from the managed resource",
             descriptor);

        // Fill in entry for attribute change notifications
        descriptor = new DescriptorSupport
            (new String[] { "name=ATTRIBUTE_CHANGE",
                            "descriptorType=notification",
                            "log=T",
                            "severity=5",
                            "displayName=jmx.attribute.change" });
View Full Code Here

   
   
    public Descriptor buildAttributeDescriptor(
        ManagedAttribute ma, String attributeName, boolean is, boolean read, boolean write) {
        
        Descriptor desc = new DescriptorSupport();

        desc.setField("name", attributeName);
      
        desc.setField("descriptorType", "attribute");
       
        if (read) {
            if (is) {
                desc.setField("getMethod", "is" + attributeName);
            } else {
                desc.setField("getMethod", "get" + attributeName);
            }               
        }
       
        if (write) {
            desc.setField("setMethod", "set" + attributeName);
        }
      
      
        if (ma.currencyTimeLimit() >= -1) {
            desc.setField("currencyTimeLimit", ma.currencyTimeLimit());
        }
          
        if (ma.persistPolicy().length() > 0) {
            desc.setField("persistPolicy", ma.persistPolicy());
        }
          
        if (ma.persistPeriod() >= -1) {
            desc.setField("persistPeriod", ma.persistPeriod());
        }
          
        if (ma.defaultValue() != null) {
            desc.setField("default", ma.defaultValue());
        }
          
        return desc;
   
View Full Code Here

TOP

Related Classes of javax.management.modelmbean.DescriptorSupport

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.