Class MonitoringDataProvider

java.lang.Object
org.jppf.management.diagnostics.provider.MonitoringDataProvider
Direct Known Subclasses:
DefaultMonitoringDataProvider

public abstract class MonitoringDataProvider extends Object
Base class for pluggable providers of monitoring data. Concrete implementations must have a no-args constructor.
Author:
Laurent Cohen
  • Constructor Details

    • MonitoringDataProvider

      public MonitoringDataProvider()
  • Method Details

    • defineProperties

      public abstract void defineProperties()
      Perform the definition of the properties supplied by this provider. This method is called extactly once in both producer (where the data comes from) and consumer (where the data is rendered, e.g. admin console) sides.
    • init

      public abstract void init()
      Perform the initialization of this provider. This method is called exactly once on the producer (where the data comes from) side only.
    • getValues

      public abstract TypedProperties getValues()
      Get the values for the defined properties.

      This method is expected to be called repeatedly on the producer side (where the data comes from).

      Returns:
      the values as a TypedProperties object, mapping the properties names to their value as a String.
    • getLocalizationBase

      protected String getLocalizationBase()
      Get the base path to the localization bundles for this provider. For exemple, if the base path is mypackage.MyProps, then the packahe mypackage should at least contain the file MyProps.properties, along with other localized bundles such as MyProps_fr.properties, MyProps_en_GB.properties, etc.

      This default implementation returns null. It should be overriden to provide a different value.

      Returns:
      the base path to the localization bundles for this provider.
      See Also:
    • setIntProperty

      public MonitoringDataProvider setIntProperty(String name, int defaultValue)
      Add an integer property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property.
      defaultValue - the default value.
      Returns:
      this provider, for method call chaining.
    • setIntProperty

      public MonitoringDataProvider setIntProperty(String name, int defaultValue, int minValue, int maxValue)
      Add an integer property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property.
      defaultValue - the default value.
      minValue - the minimum accepted value for this property.
      maxValue - the maximum accepted value for this property.
      Returns:
      this provider, for method call chaining.
    • setLongProperty

      public MonitoringDataProvider setLongProperty(String name, long defaultValue)
      Add a long property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property.
      defaultValue - the default value.
      Returns:
      this provider, for method call chaining.
    • setLongProperty

      public MonitoringDataProvider setLongProperty(String name, long defaultValue, long minValue, long maxValue)
      Add a long property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property.
      defaultValue - the default value.
      minValue - the minimum accepted value for this property.
      maxValue - the maximum accepted value for this property.
      Returns:
      this provider, for method call chaining.
    • setFloatProperty

      public MonitoringDataProvider setFloatProperty(String name, float defaultValue)
      Add a float property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property.
      defaultValue - the default value.
      Returns:
      this provider, for method call chaining.
    • setFloatProperty

      public MonitoringDataProvider setFloatProperty(String name, float defaultValue, float minValue, float maxValue)
      Add a float property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property.
      defaultValue - the default value.
      minValue - the minimum accepted value for this property.
      maxValue - the maximum accepted value for this property.
      Returns:
      this provider, for method call chaining.
    • setDoubleProperty

      public MonitoringDataProvider setDoubleProperty(String name, double defaultValue)
      Add a double property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property.
      defaultValue - the default value.
      Returns:
      this provider, for method call chaining.
    • setDoubleProperty

      public MonitoringDataProvider setDoubleProperty(String name, double defaultValue, double minValue, double maxValue)
      Add a double property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property.
      defaultValue - the default value.
      minValue - the minimum accepted value for this property.
      maxValue - the maximum accepted value for this property.
      Returns:
      this provider, for method call chaining.
    • setBooleanProperty

      public MonitoringDataProvider setBooleanProperty(String name, boolean defaultValue)
      Add a boolean property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property.
      defaultValue - the default value.
      Returns:
      this provider, for method call chaining.
    • setStringProperty

      public MonitoringDataProvider setStringProperty(String name, String defaultValue)
      Add a String property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property.
      defaultValue - the default value.
      Returns:
      this provider, for method call chaining.
    • getProperty

      public JPPFProperty<?> getProperty(String name)
      Get the property with the specified name.
      Parameters:
      name - the name of the property to lookup.
      Returns:
      a JPPFProperty instance, or null if there is no property with the specified name.
    • removeProperty

      public MonitoringDataProvider removeProperty(String name)
      Remove the specified property. If a property with the same name already exists, it is replaced.
      Parameters:
      name - the name of the property to remove.
      Returns:
      this provider, for method call chaining.
    • removeProperty

      public MonitoringDataProvider removeProperty(JPPFProperty<?> property)
      Remove the specified property.
      Parameters:
      property - the property to remove.
      Returns:
      this provider, for method call chaining.
    • getProperties

      public Collection<JPPFProperty<?>> getProperties()
      Get the properties defined for this provider.
      Returns:
      a collection of the defined properties.
    • setConverter

      public MonitoringDataProvider setConverter(String name, MonitoringValueConverter converter)
      Associate a value converter to the specified property. If either the property name or the converter is null, then this method has no effect.
      Parameters:
      name - the name of the property to remove.
      converter - the value converter to associate with the property.
      Returns:
      this provider, for method call chaining.
    • getConverters

      public Map<String,MonitoringValueConverter> getConverters()
      Get the mappings of property names to their associted converter, if any.
      Returns:
      a Map of string property names to their associated MonitoringValueConverter.