org.apache.camel.management
Class DefaultManagementStrategy

java.lang.Object
  extended by org.apache.camel.management.DefaultManagementStrategy
All Implemented Interfaces:
CamelContextAware, Service, org.fusesource.commons.management.ManagementStrategy
Direct Known Subclasses:
ManagedManagementStrategy

public class DefaultManagementStrategy
extends Object
implements ManagementStrategy, CamelContextAware

A default management strategy that does not manage.

This is default only used if Camel detects that it cannot use the JMX capable ManagedManagementStrategy strategy. Then Camel will fallback to use this instead that is basically a simple and noop strategy.

This class can also be used to extend your custom management implement. In fact the JMX capable provided by Camel extends this class as well.

Version:
See Also:
ManagedManagementStrategy

Constructor Summary
DefaultManagementStrategy()
           
 
Method Summary
 void addEventNotifier(EventNotifier eventNotifier)
          Adds the event notifier to use.
 org.fusesource.commons.management.Statistic createStatistic(String name, Object owner, org.fusesource.commons.management.Statistic.UpdateMode updateMode)
           
 CamelContext getCamelContext()
          Get the CamelContext
 EventFactory getEventFactory()
          Gets the event factory
 List<EventNotifier> getEventNotifiers()
          Gets the event notifiers.
<T> T
getManagedObjectName(Object managedObject, String customName, Class<T> nameType)
           
 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)
           
 boolean isOnlyManageProcessorWithCustomId()
          Checks whether only to manage processors if they have been configured with a custom id
 void manageNamedObject(Object managedObject, Object preferedName)
           
 void manageObject(Object managedObject)
           
 boolean manageProcessor(ProcessorDefinition<?> definition)
          Filter whether the processor should be managed or not.
 void notify(EventObject event)
           
 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 setCamelContext(CamelContext camelContext)
          Injects the CamelContext
 void setEventFactory(EventFactory eventFactory)
          Sets the event factory to use
 void setEventNotifiers(List<EventNotifier> eventNotifiers)
          Sets the list of event notifier to use.
 void setManagementAgent(ManagementAgent managementAgent)
          Sets the management agent to use
 void setManagementNamingStrategy(ManagementNamingStrategy managementNamingStrategy)
          Sets the naming strategy to use
 void setManagementObjectStrategy(ManagementObjectStrategy managementObjectStrategy)
          Sets the object strategy to use
 void setStatisticsLevel(ManagementStatisticsLevel level)
          Sets the statistics level

Default is ManagementStatisticsLevel.All

 void start()
          Starts the service
 void stop()
          Stops the service
 void unmanageNamedObject(Object name)
           
 void unmanageObject(Object managedObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultManagementStrategy

public DefaultManagementStrategy()
Method Detail

getEventNotifiers

public List<EventNotifier> getEventNotifiers()
Description copied from interface: ManagementStrategy
Gets the event notifiers.

Returns:
event notifiers

addEventNotifier

public void addEventNotifier(EventNotifier eventNotifier)
Description copied from interface: ManagementStrategy
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

public boolean removeEventNotifier(EventNotifier eventNotifier)
Description copied from interface: ManagementStrategy
Removes the event notifier

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

setEventNotifiers

public void setEventNotifiers(List<EventNotifier> eventNotifiers)
Description copied from interface: ManagementStrategy
Sets the list of event notifier to use.

Parameters:
eventNotifiers - list of event notifiers

getEventFactory

public EventFactory getEventFactory()
Description copied from interface: ManagementStrategy
Gets the event factory

Returns:
event factory

setEventFactory

public void setEventFactory(EventFactory eventFactory)
Description copied from interface: ManagementStrategy
Sets the event factory to use

Parameters:
eventFactory - event factory

getManagementNamingStrategy

public ManagementNamingStrategy getManagementNamingStrategy()
Description copied from interface: ManagementStrategy
Gets the naming strategy to use

Returns:
naming strategy

setManagementNamingStrategy

public void setManagementNamingStrategy(ManagementNamingStrategy managementNamingStrategy)
Description copied from interface: ManagementStrategy
Sets the naming strategy to use

Parameters:
managementNamingStrategy - naming strategy

getManagementObjectStrategy

public ManagementObjectStrategy getManagementObjectStrategy()
Description copied from interface: ManagementStrategy
Gets the object strategy to use

Returns:
object strategy

setManagementObjectStrategy

public void setManagementObjectStrategy(ManagementObjectStrategy managementObjectStrategy)
Description copied from interface: ManagementStrategy
Sets the object strategy to use

Parameters:
managementObjectStrategy - object strategy

getManagementAgent

public ManagementAgent getManagementAgent()
Description copied from interface: ManagementStrategy
Gets the management agent

Returns:
management agent

setManagementAgent

public void setManagementAgent(ManagementAgent managementAgent)
Description copied from interface: ManagementStrategy
Sets the management agent to use

Parameters:
managementAgent - management agent

onlyManageProcessorWithCustomId

public void onlyManageProcessorWithCustomId(boolean flag)
Description copied from interface: ManagementStrategy
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

public boolean isOnlyManageProcessorWithCustomId()
Description copied from interface: ManagementStrategy
Checks whether only to manage processors if they have been configured with a custom id

Returns:
true or false

manageProcessor

public boolean manageProcessor(ProcessorDefinition<?> definition)
Description copied from interface: ManagementStrategy
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

manageObject

public void manageObject(Object managedObject)
                  throws Exception
Specified by:
manageObject in interface org.fusesource.commons.management.ManagementStrategy
Throws:
Exception

manageNamedObject

public void manageNamedObject(Object managedObject,
                              Object preferedName)
                       throws Exception
Specified by:
manageNamedObject in interface org.fusesource.commons.management.ManagementStrategy
Throws:
Exception

getManagedObjectName

public <T> T getManagedObjectName(Object managedObject,
                                  String customName,
                                  Class<T> nameType)
                       throws Exception
Specified by:
getManagedObjectName in interface org.fusesource.commons.management.ManagementStrategy
Throws:
Exception

unmanageObject

public void unmanageObject(Object managedObject)
                    throws Exception
Specified by:
unmanageObject in interface org.fusesource.commons.management.ManagementStrategy
Throws:
Exception

unmanageNamedObject

public void unmanageNamedObject(Object name)
                         throws Exception
Specified by:
unmanageNamedObject in interface org.fusesource.commons.management.ManagementStrategy
Throws:
Exception

isManaged

public boolean isManaged(Object managedObject,
                         Object name)
Specified by:
isManaged in interface org.fusesource.commons.management.ManagementStrategy

getCamelContext

public CamelContext getCamelContext()
Description copied from interface: CamelContextAware
Get the CamelContext

Specified by:
getCamelContext in interface CamelContextAware
Returns:
camelContext the Camel context

setCamelContext

public void setCamelContext(CamelContext camelContext)
Description copied from interface: CamelContextAware
Injects the CamelContext

Specified by:
setCamelContext in interface CamelContextAware
Parameters:
camelContext - the Camel context

notify

public void notify(EventObject event)
            throws Exception
Specified by:
notify in interface org.fusesource.commons.management.ManagementStrategy
Throws:
Exception

createStatistic

public org.fusesource.commons.management.Statistic createStatistic(String name,
                                                                   Object owner,
                                                                   org.fusesource.commons.management.Statistic.UpdateMode updateMode)
Specified by:
createStatistic in interface org.fusesource.commons.management.ManagementStrategy

setStatisticsLevel

public void setStatisticsLevel(ManagementStatisticsLevel level)
Description copied from interface: ManagementStrategy
Sets the statistics level

Default is ManagementStatisticsLevel.All

Parameters:
level - the new level

getStatisticsLevel

public ManagementStatisticsLevel getStatisticsLevel()
Description copied from interface: ManagementStrategy
Gets the statistics level

Returns:
the level

start

public void start()
           throws Exception
Description copied from interface: Service
Starts the service

Specified by:
start in interface Service
Throws:
Exception - is thrown if starting failed

stop

public void stop()
          throws Exception
Description copied from interface: Service
Stops the service

Specified by:
stop in interface Service
Throws:
Exception - is thrown if stopping failed


Apache CAMEL