org.apache.camel.impl
Class DefaultManagementNameStrategy

java.lang.Object
  extended by org.apache.camel.impl.DefaultManagementNameStrategy
All Implemented Interfaces:
ManagementNameStrategy

public class DefaultManagementNameStrategy
extends Object
implements ManagementNameStrategy

Default implementation of ManagementNameStrategy

This implementation will by default use a name pattern as #name# and in case of a clash, then the pattern will fallback to be using the counter as #name#-#counter#.


Constructor Summary
DefaultManagementNameStrategy(CamelContext camelContext)
           
DefaultManagementNameStrategy(CamelContext camelContext, String defaultPattern, String nextPattern)
           
 
Method Summary
protected  String customResolveManagementName(String pattern, String answer)
          Strategy to do any custom resolution of the name
 String getName()
          Gets the name

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

 String getNamePattern()
          Gets the custom name pattern.
 String getNextName()
          Gets the next calculated name, if this strategy is not using fixed names.
 boolean isFixedName()
          Whether the name will be fixed, or allow re-calculation such as by using an unique counter.
protected  String resolveManagementName(String pattern, String name)
          Creates a new management name with the given pattern
static void setCounter(int value)
          To reset the counter, should only be used for testing purposes.
 void setNamePattern(String namePattern)
          Sets a custom name pattern, which will be used instead of any default patterns.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultManagementNameStrategy

public DefaultManagementNameStrategy(CamelContext camelContext)

DefaultManagementNameStrategy

public DefaultManagementNameStrategy(CamelContext camelContext,
                                     String defaultPattern,
                                     String nextPattern)
Method Detail

getNamePattern

public String getNamePattern()
Description copied from interface: ManagementNameStrategy
Gets the custom name pattern.

Specified by:
getNamePattern in interface ManagementNameStrategy
Returns:
the custom name pattern, or null if using the default pattern strategy.

setNamePattern

public void setNamePattern(String namePattern)
Description copied from interface: ManagementNameStrategy
Sets a custom name pattern, which will be used instead of any default patterns.

Specified by:
setNamePattern in interface ManagementNameStrategy
Parameters:
namePattern - a custom name pattern.

getName

public String getName()
Description copied from interface: ManagementNameStrategy
Gets the name

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

Specified by:
getName in interface ManagementNameStrategy
Returns:
the name.

getNextName

public String getNextName()
Description copied from interface: ManagementNameStrategy
Gets the next calculated name, if this strategy is not using fixed names.

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

Specified by:
getNextName in interface ManagementNameStrategy
Returns:
the next name

isFixedName

public boolean isFixedName()
Description copied from interface: ManagementNameStrategy
Whether the name will be fixed, or allow re-calculation such as by using an unique counter.

Specified by:
isFixedName in interface ManagementNameStrategy
Returns:
true for fixed names, false for names which can re-calculated

resolveManagementName

protected String resolveManagementName(String pattern,
                                       String name)
Creates a new management name with the given pattern

Parameters:
pattern - the pattern
name - the name
Returns:
the management name
Throws:
IllegalArgumentException - if the pattern or name is invalid or empty

customResolveManagementName

protected String customResolveManagementName(String pattern,
                                             String answer)
Strategy to do any custom resolution of the name

Parameters:
pattern - the pattern
answer - the current answer, which may have custom patterns still to be resolved
Returns:
the resolved name

setCounter

public static void setCounter(int value)
To reset the counter, should only be used for testing purposes.

Parameters:
value - the counter value


Apache CAMEL