org.apache.servicemix.components.mps
Class MessagePropertySetterXML
java.lang.Object
org.apache.servicemix.jbi.management.BaseLifeCycle
org.apache.servicemix.components.util.PojoSupport
org.apache.servicemix.components.util.ComponentSupport
org.apache.servicemix.components.util.TransformComponentSupport
org.apache.servicemix.components.mps.MessagePropertySetterXML
- All Implemented Interfaces:
- javax.jbi.component.Component, javax.jbi.component.ComponentLifeCycle, javax.jbi.management.LifeCycleMBean, org.apache.servicemix.jbi.listener.MessageExchangeListener, MBeanInfoProvider
public class MessagePropertySetterXML
- extends TransformComponentSupport
Sets properties on the message, loaded from an XML MPS file
where the properties to set are located in a
inside the XML config file.
There can be more than one propertySet to "load".
The property values are derived from 3 types of config.
The first config that can return a value as a String to
set onto the message, will be the "value" that is set
as the property.
As it's name suggests, the "value" of this element
will be the value of the JBI property.
This is helpful as a default value, or as a static value.
and
This will obtain the value of an existing property (itself)
or another property on the same message.
This can be helpful when you want the to "ONLY" change the
the value of the property if there is some "xpath" expression
that could not be derived.
name=".." form will copy the string value of the other JBI property
onto this one, (duping it). This may be handy when you have a component
which expects a new property, but you have it as a different name at the moment.
As it's name suggests, will locate a value in the inMessage source
and set the resulting XPath String as the value of the JBI property.
So given the three types, they can be arranged in any order. and the first
PropertyValue Type that returns a value, will become the "value" of the JBI property.
- Author:
- rbuckland
| Fields inherited from interface javax.jbi.management.LifeCycleMBean |
SHUTDOWN, STARTED, STOPPED, UNKNOWN |
|
Method Summary |
void |
init(javax.jbi.component.ComponentContext context)
We are only interested in loading the XML onfig, nothing else |
void |
setPropertySet(String propertySet)
|
void |
setXmlConfiguration(org.springframework.core.io.Resource xmlConfiguration)
|
void |
setXpathForPropertySet(String xpathForPropertySet)
|
protected boolean |
transform(javax.jbi.messaging.MessageExchange arg0,
javax.jbi.messaging.NormalizedMessage in,
javax.jbi.messaging.NormalizedMessage out)
Here is the transform of the message
We will locate the propertySetName to use
and the load up our propertySet magic wand and apply all the properties
we can to the outgoing NormalizedMessage |
| Methods inherited from class org.apache.servicemix.components.util.TransformComponentSupport |
copyPropertiesAndAttachments, getStore, getStoreFactory, init, isCopyAttachments, isCopyProperties, onMessageExchange, processFirstExchange, processOngoingExchange, setCopyAttachments, setCopyProperties, setStore, setStoreFactory |
| Methods inherited from class org.apache.servicemix.components.util.ComponentSupport |
createComponentLifeCycle, createInOnlyExchange, createInOnlyExchange, createInOnlyExchange, createInOptionalOutExchange, createInOutExchange, createInOutExchange, createRobustInOnlyExchange, createServiceUnitManager, creatInOutExchange, forwardToExchange, forwardToExchange, getInMessage, getLifeCycle, getMessageTransformer, getServiceDescription, getServiceUnitManager, initializeServiceUnitManager, invoke, isExchangeWithConsumerOkay, isExchangeWithProviderOkay, propagateCorrelationId, resolveEndpointReference, setMessageTransformer |
| Methods inherited from class org.apache.servicemix.components.util.PojoSupport |
answer, done, fail, fail, getBody, getContext, getDeliveryChannel, getDescription, getEndpoint, getExchangeFactory, getExtensionMBeanName, getService, isInAndOut, send, sendSync, sendSync, setBody, setEndpoint, setExtensionMBeanName, setService, shutDown |
| Methods inherited from class org.apache.servicemix.jbi.management.BaseLifeCycle |
firePropertyChanged, getAttributeInfos, getCurrentState, getName, getObjectToManage, getOperationInfos, getSubType, getType, isInitialized, isShutDown, isStarted, isStopped, isUnknown, setCurrentState, setPropertyChangeListener, start, stop |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface javax.jbi.component.ComponentLifeCycle |
start, stop |
MPS_PROP_NAME_PROPERTYSET
public static final String MPS_PROP_NAME_PROPERTYSET
- The name of our JBI property we may have to interrogate to
use as the "xpath" for the set of config.
- See Also:
- Constant Field Values
XML_ELEMENT_NAME
public static final String XML_ELEMENT_NAME
- The XML Element name "property-set"
- See Also:
- Constant Field Values
MessagePropertySetterXML
public MessagePropertySetterXML()
transform
protected boolean transform(javax.jbi.messaging.MessageExchange arg0,
javax.jbi.messaging.NormalizedMessage in,
javax.jbi.messaging.NormalizedMessage out)
throws javax.jbi.messaging.MessagingException
- Here is the transform of the message
We will locate the propertySetName to use
and the load up our propertySet magic wand and apply all the properties
we can to the outgoing NormalizedMessage
- Specified by:
transform in class TransformComponentSupport
- Throws:
javax.jbi.messaging.MessagingException
init
public void init(javax.jbi.component.ComponentContext context)
throws javax.jbi.JBIException
- We are only interested in loading the XML onfig, nothing else
- Specified by:
init in interface javax.jbi.component.ComponentLifeCycle- Overrides:
init in class PojoSupport
- Throws:
javax.jbi.JBIException
setPropertySet
public void setPropertySet(String propertySet)
- Parameters:
propertySet - The propertySet to set.
setXmlConfiguration
public void setXmlConfiguration(org.springframework.core.io.Resource xmlConfiguration)
- Parameters:
xmlConfiguration - The xmlConfiguration to set.
setXpathForPropertySet
public void setXpathForPropertySet(String xpathForPropertySet)
- Parameters:
xpathForPropertySet - xpath to apply to a message to derive the name of the property-set we want to load
Copyright © 2005-2010 The Apache Software Foundation. All Rights Reserved.