oranjestad.spring.beanutils.messaging.dispatching
Class SpringMappedMethodAndArgumentsDispatcher

java.lang.Object
  extended by oranjestad.commons.beanutils.messaging.dispatching.MappedMethodAndArgumentsDispatcher
      extended by oranjestad.spring.beanutils.messaging.dispatching.SpringMappedMethodAndArgumentsDispatcher
All Implemented Interfaces:
java.io.Serializable, oranjestad.commons.beanutils.messaging.GenericMessageListener, org.springframework.beans.factory.BeanFactoryAware

public class SpringMappedMethodAndArgumentsDispatcher
extends oranjestad.commons.beanutils.messaging.dispatching.MappedMethodAndArgumentsDispatcher
implements org.springframework.beans.factory.BeanFactoryAware

Extension to the standard MappedMethodAndArgumentsDispatcher that integrates with Spring. It's main function is to expose the BeanFactory at the object message level so that nested properties can refer to the bean factory and beans within the factory.

The bean factory is exposed as a Map which allows the usage of map syntax with nested properties.

beanFactory(beanName)

The above would pull out a bean named beanName from the bean factory.

This is similar to how arguments are refereneced arguments[n] using nested properties.

Available properties

The object that is being referenced when using nested properties is an instanceof BeanFactoryAwareGenericMessage. This gives use access to most every aspect of the original method invocation. The following is a list of properties you could reference.

Property type Description
beanFactory java.util.Map A Map representation of the BeanFactory used to create the SpringMappedMethodAndArgumentsDispatcher. This object is presented as a Map so that the standard nested property syntax can be used. (e.g. beanFactory(someBean)).
arguments java.lang.Object[] The arguments passed into the original method. Using the nested property syntax you can access any of the arguments in the array (e.g. arguments[2]).
method java.lang.reflect.Method The method getting executed. (e.g. method.name)
channel oranjestad.commons.beanutils.messaging.Channel The channel that this listener was registered to.
originalArguments
originalMethod
originalChannel
Same as corresponding properties

Original properties are not intended to be changed after creation of the message. In theory, a GenericMessageListener could manipulate a generic message by changing any of its properties, but it should never modify the original values.

In practice these fields are not used very often.

Since:
1.1
Author:
Bryant Harris
See Also:
Serialized Form

Constructor Summary
SpringMappedMethodAndArgumentsDispatcher()
           
 
Method Summary
protected  oranjestad.commons.beanutils.messaging.GenericMessage massageMessage(oranjestad.commons.beanutils.messaging.GenericMessage message)
          Overrides the standard method to return a BeanFactoryAwareGenericMessage that adds the beanFactory property to the generic message.
 void setBeanFactory(org.springframework.beans.factory.BeanFactory bf)
           
 
Methods inherited from class oranjestad.commons.beanutils.messaging.dispatching.MappedMethodAndArgumentsDispatcher
onGenericMessage, setGenericMessageDispatchingOptions, setMappings, setTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SpringMappedMethodAndArgumentsDispatcher

public SpringMappedMethodAndArgumentsDispatcher()
Method Detail

setBeanFactory

public void setBeanFactory(org.springframework.beans.factory.BeanFactory bf)
                    throws org.springframework.beans.BeansException
Specified by:
setBeanFactory in interface org.springframework.beans.factory.BeanFactoryAware
Throws:
org.springframework.beans.BeansException

massageMessage

protected oranjestad.commons.beanutils.messaging.GenericMessage massageMessage(oranjestad.commons.beanutils.messaging.GenericMessage message)
Overrides the standard method to return a BeanFactoryAwareGenericMessage that adds the beanFactory property to the generic message.

Overrides:
massageMessage in class oranjestad.commons.beanutils.messaging.dispatching.MappedMethodAndArgumentsDispatcher
Since:
1.1


Copyright © 2008. All Rights Reserved.