Package javax.management.modelmbean

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


        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

        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

                        if( !persistentProperty.isImmutable() )
                        {
                            String propertyName = persistentProperty.qualifiedName().name();
                            String type = persistentProperty.valueType().mainType().getName();

                            Descriptor attrDescriptor = new DescriptorSupport();
                            attrDescriptor.setField( "name", propertyName );
                            attrDescriptor.setField( "descriptorType", "attribute" );

                            if( persistentProperty.valueType() instanceof EnumType )
                            {
                                type = String.class.getName();

                                // Try to add legal values
                                try
                                {
                                    Set<String> legalValues = new LinkedHashSet();
                                    Class<?> enumType = getClass().getClassLoader()
                                        .loadClass( persistentProperty.valueType().mainType().getName() );
                                    for( Field field : enumType.getFields() )
                                    {
                                        legalValues.add( field.getName() );
                                    }
                                    attrDescriptor.setField( "legalValues", legalValues );
                                }
                                catch( ClassNotFoundException e )
                                {
                                    // Ignore
                                    e.printStackTrace();
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

          
        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

        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

        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

    /**
     * @return notificationInfo
     */
    public final MBeanNotificationInfo[] getNotificationInfo() {
        MBeanNotificationInfo[] result = new MBeanNotificationInfo[2];
        Descriptor genericDescriptor = new DescriptorSupport(new String[] {
            "name=GENERIC", "descriptorType=notification", "log=T",
            "severity=5", "displayName=jmx.modelmbean.generic" });
        result[0] = new ModelMBeanNotificationInfo(new String[] {"jmx.modelmbean.generic" }, "GENERIC",
            "A text notification has been issued by the managed resource", genericDescriptor);
        Descriptor attributeDescriptor = new DescriptorSupport(new String[] {"name=ATTRIBUTE_CHANGE", "descriptorType=notification",
            "log=T", "severity=5", "displayName=jmx.attribute.change" });
        result[1] = new ModelMBeanNotificationInfo(new String[] {"jmx.attribute.change" }, "ATTRIBUTE_CHANGE",
            "Signifies that an observed MBean attribute value has changed", attributeDescriptor);
        return result;
    }
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

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.