org.springframework.integration.jmx
Class OperationInvokingMessageHandler

java.lang.Object
  extended by org.springframework.integration.context.IntegrationObjectSupport
      extended by org.springframework.integration.handler.AbstractMessageHandler
          extended by org.springframework.integration.handler.AbstractReplyProducingMessageHandler
              extended by org.springframework.integration.jmx.OperationInvokingMessageHandler
All Implemented Interfaces:
org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanClassLoaderAware, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered, org.springframework.integration.context.NamedComponent, org.springframework.integration.context.Orderable, org.springframework.integration.core.MessageHandler, org.springframework.integration.core.MessageProducer, org.springframework.integration.history.TrackableComponent

public class OperationInvokingMessageHandler
extends org.springframework.integration.handler.AbstractReplyProducingMessageHandler
implements org.springframework.beans.factory.InitializingBean

A MessageHandler implementation for invoking JMX operations based on the Message sent to its AbstractMessageHandler.handleMessage(Message) method. Message headers will be checked first when resolving the 'objectName' and 'operationName' to be invoked on an MBean. These values would be supplied with the Message headers defined as JmxHeaders.OBJECT_NAME and JmxHeaders.OPERATION_NAME, respectively. In either case, if no header is present, the value resolution will fallback to the defaults, if any have been configured on this instance via setObjectName(String) and setOperationName(String), respectively.

The operation parameter(s), if any, must be available within the payload of the Message being handled. If the target operation expects multiple parameters, they can be provided in either a List or Map typed payload.

Since:
2.0

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
org.springframework.integration.handler.AbstractReplyProducingMessageHandler.RequestHandler
 
Field Summary
 
Fields inherited from class org.springframework.integration.context.IntegrationObjectSupport
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
OperationInvokingMessageHandler()
           
 
Method Summary
protected  java.lang.Object handleRequestMessage(org.springframework.integration.Message<?> requestMessage)
           
 void onInit()
           
 void setObjectName(java.lang.String objectName)
          Specify a default ObjectName to use when no such header is available on the Message being handled.
 void setOperationName(java.lang.String operationName)
          Specify an operation name to be invoked when no such header is available on the Message being handled.
 void setServer(javax.management.MBeanServerConnection server)
          Provide a reference to the MBeanServer within which the MBean target for operation invocation has been registered.
 
Methods inherited from class org.springframework.integration.handler.AbstractReplyProducingMessageHandler
getMessagingTemplate, handleMessageInternal, setAdviceChain, setBeanClassLoader, setChannelResolver, setOutputChannel, setRequiresReply, setSendTimeout, shouldCopyRequestHeaders
 
Methods inherited from class org.springframework.integration.handler.AbstractMessageHandler
getComponentType, getOrder, handleMessage, setOrder, setShouldTrack
 
Methods inherited from class org.springframework.integration.context.IntegrationObjectSupport
afterPropertiesSet, getBeanFactory, getComponentName, getConversionService, getTaskScheduler, setBeanFactory, setBeanName, setComponentName, setConversionService, setTaskScheduler, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.springframework.beans.factory.InitializingBean
afterPropertiesSet
 
Methods inherited from interface org.springframework.integration.context.NamedComponent
getComponentName
 

Constructor Detail

OperationInvokingMessageHandler

public OperationInvokingMessageHandler()
Method Detail

setServer

public void setServer(javax.management.MBeanServerConnection server)
Provide a reference to the MBeanServer within which the MBean target for operation invocation has been registered.


setObjectName

public void setObjectName(java.lang.String objectName)
Specify a default ObjectName to use when no such header is available on the Message being handled.


setOperationName

public void setOperationName(java.lang.String operationName)
Specify an operation name to be invoked when no such header is available on the Message being handled.


onInit

public final void onInit()
Overrides:
onInit in class org.springframework.integration.handler.AbstractReplyProducingMessageHandler

handleRequestMessage

protected java.lang.Object handleRequestMessage(org.springframework.integration.Message<?> requestMessage)
Specified by:
handleRequestMessage in class org.springframework.integration.handler.AbstractReplyProducingMessageHandler