Examples of DescriptorSupport


Examples of javax.management.modelmbean.DescriptorSupport

   
   
    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

Examples of javax.management.modelmbean.DescriptorSupport

          
        return desc;
   
   
    public Descriptor buildOperationDescriptor(ManagedOperation mo, String operationName) {
        Descriptor desc = new DescriptorSupport();
       
        desc.setField("name", operationName);
       
        desc.setField("descriptorType", "operation");
       
        desc.setField("role", "operation");
       
        if (mo.description() != null) {
            desc.setField("displayName", mo.description());
        }
                   
        if (mo.currencyTimeLimit() >= -1) {
            desc.setField("currencyTimeLimit", mo.currencyTimeLimit());
        }
       
        return desc;
    }
View Full Code Here

Examples of javax.management.modelmbean.DescriptorSupport

        return desc;
    }
   
    public Descriptor buildAttributeOperationDescriptor(String operationName) {
       
        Descriptor desc = new DescriptorSupport();
       
        desc.setField("name", operationName);
       
        desc.setField("descriptorType", "operation");
       
        if (operationName.indexOf("set") == 0) {
            desc.setField("role", "setter");
        } else {
            desc.setField("role", "getter");
        }  
       
        return desc;
    }
View Full Code Here

Examples of javax.management.modelmbean.DescriptorSupport

        return desc;
    }
           
   
    public Descriptor buildMBeanDescriptor(ManagedResource mr) {
        Descriptor desc = new DescriptorSupport();
       
        if (mr.componentName() != null) {
            desc.setField("name", mr.componentName());
        }
       
        desc.setField("descriptorType", "mbean");
       
        if (mr.description() != null) {
            desc.setField("displayName", mr.description());
        }
       
        if (mr.persistLocation() != null) {
            desc.setField("persistLocation", mr.persistLocation());
        }
           
        if (mr.persistName() != null) {
            desc.setField("persistName", mr.persistName());
        }
       
        if (mr.log()) {
            desc.setField("log", "true");
        } else {
            desc.setField("log", "false");
        }
           
        if (mr.persistPolicy() != null) {
            desc.setField("persistPolicy", mr.persistPolicy());
        }
       
        if (mr.persistPeriod() >= -1) {
            desc.setField("persistPeriod", mr.persistPeriod());
        }
       
        if (mr.logFile() != null) {
            desc.setField("logFile", mr.logFile());
        }
       
        if (mr.currencyTimeLimit() >= -1) {
            desc.setField("currencyTimeLimit", mr.currencyTimeLimit());
        }
       
        return desc;
       
    }   
View Full Code Here

Examples of javax.management.modelmbean.DescriptorSupport

        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

Examples of javax.management.modelmbean.DescriptorSupport

        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

Examples of javax.management.modelmbean.DescriptorSupport

  
   // Protected -----------------------------------------------------
  
   protected Descriptor getDescriptor(final Element parent, final String infoName, final String type) throws NotCompliantMBeanException
   {
      Descriptor descr = new DescriptorSupport();
      descr.setField(NAME, infoName);
      descr.setField(DESCRIPTOR_TYPE, type);

      Element descriptors = parent.getChild("descriptors");
      if (descriptors == null)
      {
         return descr;
      } // end of if ()
      for (Iterator i = descriptors.getChildren().iterator(); i.hasNext();)
      {
         Element descriptor = (Element)i.next();
         String name = descriptor.getName();
         if (name.equals("persistence"))
         {
            Attribute persistPolicy = descriptor.getAttribute(PERSIST_POLICY);
            Attribute persistPeriod = descriptor.getAttribute(PERSIST_PERIOD);
            Attribute persistLocation = descriptor.getAttribute(PERSIST_LOCATION);
            Attribute persistName = descriptor.getAttribute(PERSIST_NAME);
            if (persistPolicy != null)
            {
               String value = persistPolicy.getValue();
               validate(value, PERSIST_POLICY_LIST);
               descr.setField(PERSIST_POLICY, value);
            }
            if (persistPeriod != null)
            {
               descr.setField(PERSIST_PERIOD, persistPeriod.getValue());
            }
            if (persistLocation != null)
            {
               descr.setField(PERSIST_LOCATION, persistLocation.getValue());
            }
            if (persistName != null)
            {
               descr.setField(PERSIST_NAME, persistName.getValue());
            }
         }
         else if (name.equals(CURRENCY_TIME_LIMIT))
         {
            descr.setField(CURRENCY_TIME_LIMIT, descriptor.getAttributeValue("value"));
         } // end of else
         else if (name.equals(STATE_ACTION_ON_UPDATE))
         {
            String value = descriptor.getAttributeValue("value");
            validate(value, STATE_ACTION_ON_UPDATE_LIST);
            descr.setField(STATE_ACTION_ON_UPDATE, value);
         } // end of else
         else if (name.equals(DEFAULT))
         {
            String value = descriptor.getAttributeValue("value");
            descr.setField(DEFAULT, value);
         }
         else if (name.equals("display-name"))
         {
            String value = descriptor.getAttributeValue("value");
            descr.setField(DISPLAY_NAME, value);
         }
         else if (name.equals(VALUE))
         {
            String value = descriptor.getAttributeValue("value");
            descr.setField(VALUE, value);
         }
         else if (name.equals(PERSISTENCE_MANAGER))
         {
            descr.setField(PERSISTENCE_MANAGER, descriptor.getAttributeValue("value"));
         } // end of else
         else if (name.equals(DESCRIPTOR))
         {
            descr.setField(descriptor.getAttributeValue("name"), descriptor.getAttributeValue("value"));
         } // end of else
      } // end of for ()
      return descr;
   }
View Full Code Here

Examples of javax.management.modelmbean.DescriptorSupport

         {

            Object getterOpType = getters.get(getMethod);
            if (getterOpType == null || getterOpType.equals(type) == false)
            {     
               Descriptor getterDescriptor = new DescriptorSupport();
               getterDescriptor.setField(NAME, getMethod);
               getterDescriptor.setField(DESCRIPTOR_TYPE, OPERATION_DESCRIPTOR);
               getterDescriptor.setField(ROLE, GETTER);
               ModelMBeanOperationInfo info = new ModelMBeanOperationInfo
               (
                  getMethod,
                  "getMethod operation for '" + name + "' attribute.",
                  new MBeanParameterInfo[0],
                  type,
                  MBeanOperationInfo.INFO,
                  getterDescriptor
               );
               infos.add(info);
            }
         }

         // Fabricate a setter operation
        
         if (setMethod != null)
         {
            HashSet setterOpTypes = (HashSet) setters.get(setMethod);
            if (setterOpTypes == null || setterOpTypes.contains(type) == false)
            {     
               Descriptor setterDescriptor = new DescriptorSupport();
               setterDescriptor.setField(NAME, setMethod);
               setterDescriptor.setField(DESCRIPTOR_TYPE, OPERATION_DESCRIPTOR);
               setterDescriptor.setField(ROLE, SETTER);
               ModelMBeanOperationInfo info = new ModelMBeanOperationInfo
               (
                  setMethod,
                  "setMethod operation for '" + name + "' attribute.",
                  new MBeanParameterInfo[]
View Full Code Here

Examples of javax.management.modelmbean.DescriptorSupport

                  getterOperationName = "is" + attributes[i].getName();
               else
                  getterOperationName = "get" + attributes[i].getName();
                 
               // create a descriptor for 'getter' mgmt operation
               getterDescriptor = new DescriptorSupport();
               getterDescriptor.setField(NAME, getterOperationName);
               getterDescriptor.setField(DESCRIPTOR_TYPE, OPERATION_DESCRIPTOR);
               getterDescriptor.setField(ROLE, GETTER);
              
               // create the new management operation
               ModelMBeanOperationInfo opInfo = new ModelMBeanOperationInfo(
                     getterOperationName,
                     "Read accessor operation for '" + attributes[i].getName() + "' attribute.",
                     new MBeanParameterInfo[0],    // void signature
                     attributes[i].getType(),      // return type
                     MBeanOperationInfo.INFO,      // impact
                     getterDescriptor
               );

               // modify the attributes descriptor to map the read operation
               // to the above created management operation
               Descriptor attrDescriptor = mmbAttributes[i].getDescriptor();
               attrDescriptor.setField(GET_METHOD, getterOperationName);
               mmbAttributes[i].setDescriptor(attrDescriptor);
              
               accessorOperations.add(opInfo);
            }
           
            // figure out the setter
            if (attributes[i].isWritable())
            {
               setterOperationName = "set" + attributes[i].getName();  
              
               // create a descriptor for 'setter' mgmt operation
               setterDescriptor = new DescriptorSupport();
               setterDescriptor.setField(NAME, setterOperationName);
               setterDescriptor.setField(DESCRIPTOR_TYPE, OPERATION_DESCRIPTOR);
               setterDescriptor.setField(ROLE, SETTER);
              
               // create the new management operation
View Full Code Here

Examples of javax.management.modelmbean.DescriptorSupport

         Attribute persistPeriod = root.getAttribute(PERSIST_PERIOD);
         Attribute persistLocation = root.getAttribute(PERSIST_LOCATION);
         Attribute persistName = root.getAttribute(PERSIST_NAME);
         Attribute currTimeLimit = root.getAttribute(CURRENCY_TIME_LIMIT);

         Descriptor descr = new DescriptorSupport();
         descr.setField("name", mmbClassName);
         descr.setField("descriptorType", "mbean");

         if (persistPolicy != null)
            descr.setField(PERSIST_POLICY, persistPolicy.getValue());
         if (persistPeriod != null)
            descr.setField(PERSIST_PERIOD, persistPeriod.getValue());
         if (persistLocation != null)
            descr.setField(PERSIST_LOCATION, persistLocation.getValue());
         if (persistName != null)
            descr.setField(PERSIST_NAME, persistName.getValue());
         if (currTimeLimit != null)
            descr.setField(CURRENCY_TIME_LIMIT, currTimeLimit.getValue());

         ModelMBeanInfo info = buildMBeanMetaData(
            description, constructors, operations,
            attributes, notifications, descr
         );
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.