org.apache.camel.spi
Interface ManagementStrategy

All Superinterfaces:
Service
All Known Implementing Classes:
DefaultManagementStrategy, ManagedManagementStrategy

public interface ManagementStrategy
extends Service

Strategy for management.

This is totally pluggable allowing to use a custom or 3rd party management implementation with Camel.

Version:
See Also:
EventNotifier, EventFactory, ManagementNamingStrategy, ManagementAgent

Method Summary
 void addEventNotifier(EventNotifier eventNotifier)
          Adds the event notifier to use.
 EventFactory getEventFactory()
          Gets the event factory
 List<EventNotifier> getEventNotifiers()
          Gets the event notifiers.
<T> T
getManagedObjectName(Object managedObject, String customName, Class<T> nameType)
          Construct an object name, where either the object to be managed and/or a custom name component are provided
 ManagementAgent getManagementAgent()
          Gets the management agent
 ManagementNamingStrategy getManagementNamingStrategy()
          Gets the naming strategy to use
 ManagementObjectStrategy getManagementObjectStrategy()
          Gets the object strategy to use
 ManagementStatisticsLevel getStatisticsLevel()
          Gets the statistics level
 boolean isManaged(Object managedObject, Object name)
          Determines if an object or name is managed.
 boolean isOnlyManageProcessorWithCustomId()
          Checks whether only to manage processors if they have been configured with a custom id
 void manageNamedObject(Object managedObject, Object preferredName)
          Adds a managed object allowing the ManagementStrategy implementation to record or expose the object as it sees fit.
 void manageObject(Object managedObject)
          Adds a managed object allowing the ManagementStrategy implementation to record or expose the object as it sees fit.
 boolean manageProcessor(ProcessorDefinition<?> definition)
          Filter whether the processor should be managed or not.
 void notify(EventObject event)
          Management events provide a single model for capturing information about execution points in the application code.
 void onlyManageProcessorWithCustomId(boolean flag)
          Sets the whether only manage processors if they have been configured with a custom id

Default is false.

 boolean removeEventNotifier(EventNotifier eventNotifier)
          Removes the event notifier
 void setEventFactory(EventFactory eventFactory)
          Sets the event factory to use
 void setEventNotifiers(List<EventNotifier> eventNotifier)
          Sets the list of event notifier to use.
 void setManagementAgent(ManagementAgent managementAgent)
          Sets the management agent to use
 void setManagementNamingStrategy(ManagementNamingStrategy strategy)
          Sets the naming strategy to use
 void setManagementObjectStrategy(ManagementObjectStrategy strategy)
          Sets the object strategy to use
 void setStatisticsLevel(ManagementStatisticsLevel level)
          Sets the statistics level

Default is ManagementStatisticsLevel.All

 void unmanageNamedObject(Object name)
          Removes a managed object by name.
 void unmanageObject(Object managedObject)
          Removes the managed object.
 
Methods inherited from interface org.apache.camel.Service
start, stop
 

Method Detail

manageObject

void manageObject(Object managedObject)
                  throws Exception
Adds a managed object allowing the ManagementStrategy implementation to record or expose the object as it sees fit.

Parameters:
managedObject - the managed object
Throws:
Exception - can be thrown if the object could not be added

manageNamedObject

void manageNamedObject(Object managedObject,
                       Object preferredName)
                       throws Exception
Adds a managed object allowing the ManagementStrategy implementation to record or expose the object as it sees fit.

Parameters:
managedObject - the managed object
preferredName - representing the preferred name, maybe a String, or a JMX ObjectName
Throws:
Exception - can be thrown if the object could not be added

getManagedObjectName

<T> T getManagedObjectName(Object managedObject,
                           String customName,
                           Class<T> nameType)
                       throws Exception
Construct an object name, where either the object to be managed and/or a custom name component are provided

Parameters:
managedObject - the object to be managed
customName - a custom name component
nameType - the name type required
Returns:
an object name of the required type if supported, otherwise null
Throws:
Exception - can be thrown if the object name could not be created

unmanageObject

void unmanageObject(Object managedObject)
                    throws Exception
Removes the managed object.

Parameters:
managedObject - the managed object
Throws:
Exception - can be thrown if the object could not be removed

unmanageNamedObject

void unmanageNamedObject(Object name)
                         throws Exception
Removes a managed object by name.

Parameters:
name - an object name previously created by this strategy.
Throws:
Exception - can be thrown if the object could not be removed

isManaged

boolean isManaged(Object managedObject,
                  Object name)
Determines if an object or name is managed.

Parameters:
managedObject - the object to consider
name - the name to consider
Returns:
true if the given object or name is managed

notify

void notify(EventObject event)
            throws Exception
Management events provide a single model for capturing information about execution points in the application code. Management strategy implementations decide if and where to record these events. Applications communicate events to management strategy implementations via the notify(EventObject) method.

Parameters:
event - the event
Throws:
Exception - can be thrown if the notification failed

getEventNotifiers

List<EventNotifier> getEventNotifiers()
Gets the event notifiers.

Returns:
event notifiers

setEventNotifiers

void setEventNotifiers(List<EventNotifier> eventNotifier)
Sets the list of event notifier to use.

Parameters:
eventNotifier - list of event notifiers

addEventNotifier

void addEventNotifier(EventNotifier eventNotifier)
Adds the event notifier to use.

Ensure the event notifier has been started if its a Service, as otherwise it would not be used.

Parameters:
eventNotifier - event notifier

removeEventNotifier

boolean removeEventNotifier(EventNotifier eventNotifier)
Removes the event notifier

Parameters:
eventNotifier - event notifier to remove
Returns:
true if removed, false if already removed

getEventFactory

EventFactory getEventFactory()
Gets the event factory

Returns:
event factory

setEventFactory

void setEventFactory(EventFactory eventFactory)
Sets the event factory to use

Parameters:
eventFactory - event factory

getManagementNamingStrategy

ManagementNamingStrategy getManagementNamingStrategy()
Gets the naming strategy to use

Returns:
naming strategy

setManagementNamingStrategy

void setManagementNamingStrategy(ManagementNamingStrategy strategy)
Sets the naming strategy to use

Parameters:
strategy - naming strategy

getManagementObjectStrategy

ManagementObjectStrategy getManagementObjectStrategy()
Gets the object strategy to use

Returns:
object strategy

setManagementObjectStrategy

void setManagementObjectStrategy(ManagementObjectStrategy strategy)
Sets the object strategy to use

Parameters:
strategy - object strategy

getManagementAgent

ManagementAgent getManagementAgent()
Gets the management agent

Returns:
management agent

setManagementAgent

void setManagementAgent(ManagementAgent managementAgent)
Sets the management agent to use

Parameters:
managementAgent - management agent

manageProcessor

boolean manageProcessor(ProcessorDefinition<?> definition)
Filter whether the processor should be managed or not.

Is used to filter out unwanted processors to avoid managing at too fine grained level.

Parameters:
definition - definition of the processor
Returns:
true to manage it

onlyManageProcessorWithCustomId

void onlyManageProcessorWithCustomId(boolean flag)
Sets the whether only manage processors if they have been configured with a custom id

Default is false.

Parameters:
flag - true will only manage if custom id was set.

isOnlyManageProcessorWithCustomId

boolean isOnlyManageProcessorWithCustomId()
Checks whether only to manage processors if they have been configured with a custom id

Returns:
true or false

setStatisticsLevel

void setStatisticsLevel(ManagementStatisticsLevel level)
Sets the statistics level

Default is ManagementStatisticsLevel.All

Parameters:
level - the new level

getStatisticsLevel

ManagementStatisticsLevel getStatisticsLevel()
Gets the statistics level

Returns:
the level


Apache CAMEL