Interface ManagementNameStrategy


public interface ManagementNameStrategy
Strategy for assigning the name part of the ObjectName for a managed CamelContext.

A strategy is needed as you can run multiple CamelContext in the same JVM, and want them to be enlisted in the JVM wide JMXMBeanServer. And this requires a strategy to be able to calculate unique names, in case of clashes. Or to enforce an explicit fixed name, to ensure the JMX name is not using dynamic counters etc.

This strategy supports a naming pattern which supports at least the following tokens

  • #camelId# - the camel id (eg the camel name)
  • #name# - same as #camelId#
  • #counter# - an incrementing counter
See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Gets the name
    Gets the custom name pattern.
    Gets the next calculated name, if this strategy is not using fixed names.
    boolean
    Whether the name will be fixed, or allow re-calculation such as by using an unique counter.
    resolveManagementName(String pattern, String name, boolean invalidCheck)
    Creates a new management name with the given pattern.
    void
    Sets a custom name pattern, which will be used instead of any default patterns.
  • Method Details

    • getNamePattern

      String getNamePattern()
      Gets the custom name pattern.
      Returns:
      the custom name pattern, or null if using the default pattern strategy.
    • setNamePattern

      void setNamePattern(String pattern)
      Sets a custom name pattern, which will be used instead of any default patterns.
      Parameters:
      pattern - a custom name pattern.
    • getName

      String getName()
      Gets the name

      The isFixedName() determines if the name can be re-calculated such as when using a counter, or the name is always fixed.

      Returns:
      the name.
    • getNextName

      String getNextName()
      Gets the next calculated name, if this strategy is not using fixed names.

      The isFixedName() determines if the name can be re-calculated such as when using a counter, or the name is always fixed.

      Returns:
      the next name
    • isFixedName

      boolean isFixedName()
      Whether the name will be fixed, or allow re-calculation such as by using an unique counter.
      Returns:
      true for fixed names, false for names which can re-calculated
    • resolveManagementName

      String resolveManagementName(String pattern, String name, boolean invalidCheck)
      Creates a new management name with the given pattern.
      Parameters:
      pattern - the pattern
      name - the name
      invalidCheck - whether to check for invalid pattern
      Returns:
      the management name
      Throws:
      IllegalArgumentException - if the pattern or name is invalid or empty