Package org.apache.camel.spi
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:
-
CamelContextNameStrategy
org.apache.camel.impl.DefaultManagementNameStrategy
-
Method Summary
Modifier and TypeMethodDescriptiongetName()
Gets the nameGets 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
setNamePattern
(String pattern) 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
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 TheisFixedName()
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. TheisFixedName()
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
Creates a new management name with the given pattern.- Parameters:
pattern
- the patternname
- the nameinvalidCheck
- whether to check for invalid pattern- Returns:
- the management name
- Throws:
IllegalArgumentException
- if the pattern or name is invalid or empty
-