org.apache.servicemix.eip.patterns
Class SplitAggregator

java.lang.Object
  extended by org.apache.servicemix.common.endpoints.AbstractEndpoint
      extended by org.apache.servicemix.common.endpoints.SimpleEndpoint
          extended by org.apache.servicemix.common.endpoints.ProviderEndpoint
              extended by org.apache.servicemix.eip.EIPEndpoint
                  extended by org.apache.servicemix.eip.support.AbstractAggregator
                      extended by org.apache.servicemix.eip.patterns.SplitAggregator
All Implemented Interfaces:
org.apache.servicemix.common.Endpoint
Direct Known Subclasses:
RecipientListAggregator

public class SplitAggregator
extends AbstractAggregator

Aggregator can be used to wait and combine several messages. This component implements the Aggregator pattern. This aggregator collect messages with a count, index and correlationId properties. These properties are automatically set by splitters. A timeout may be specified so that the aggregator will not keep data forever if a message is missing.

Version:
$Revision: 376451 $
Author:
gnodet

Nested Class Summary
protected static class SplitAggregator.SplitterAggregation
           
 
Field Summary
protected  QName aggregateElementName
           
protected  org.apache.servicemix.expression.Expression corrId
           
protected  org.apache.servicemix.expression.Expression count
           
protected  String countAttribute
           
protected  org.apache.servicemix.expression.Expression index
           
protected  String indexAttribute
           
protected  QName messageElementName
           
protected  long timeout
           
 
Fields inherited from class org.apache.servicemix.eip.EIPEndpoint
lockManager, store, storeFactory, timerManager, wsdlExchangeTarget, wsdlResource
 
Fields inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
definition, description, endpoint, interfaceName, logger, service, serviceUnit
 
Constructor Summary
SplitAggregator()
           
 
Method Summary
 boolean addMessage(Object aggregation, javax.jbi.messaging.NormalizedMessage message, javax.jbi.messaging.MessageExchange exchange)
          Add a newly received message to this aggregation
 void buildAggregate(Object aggregation, javax.jbi.messaging.NormalizedMessage message, javax.jbi.messaging.MessageExchange exchange, boolean doTimeout)
          Fill the given JBI message with the aggregation result.
 Object createAggregation(String correlationID)
          Creates a new empty aggregation.
protected  Element createChildElement(QName name, Node parent)
           
 QName getAggregateElementName()
           
 String getCorrelationID(javax.jbi.messaging.MessageExchange exchange, javax.jbi.messaging.NormalizedMessage message)
          Retrieve the correlation ID of the given exchange
 org.apache.servicemix.expression.Expression getCorrId()
           
 org.apache.servicemix.expression.Expression getCount()
           
 String getCountAttribute()
           
 org.apache.servicemix.expression.Expression getIndex()
           
 String getIndexAttribute()
           
 QName getMessageElementName()
           
 long getTimeout()
           
 Date getTimeout(Object aggregation)
          Returns the date when the onTimeout method should be called if the aggregation is not completed yet, or null if the aggregation has no timeout.
 void setAggregateElementName(QName aggregateElementName)
           
 void setCorrId(org.apache.servicemix.expression.Expression corrId)
           
 void setCount(org.apache.servicemix.expression.Expression count)
           
 void setCountAttribute(String countAttribute)
           
 void setIndex(org.apache.servicemix.expression.Expression index)
           
 void setIndexAttribute(String indexAttribute)
           
 void setMessageElementName(QName messageElementName)
           
 void setTimeout(long timeout)
           
 
Methods inherited from class org.apache.servicemix.eip.support.AbstractAggregator
closeAggregation, getClosedAggregatesStoreFactory, getTarget, isAggregationClosed, isCopyAttachments, isCopyProperties, isRescheduleTimeouts, isSynchronous, onTimeout, process, processAsync, processSync, sendAggregate, setClosedAggregatesStoreFactory, setCopyAttachments, setCopyProperties, setRescheduleTimeouts, setSynchronous, setTarget, start
 
Methods inherited from class org.apache.servicemix.eip.EIPEndpoint
chooseFirstEndpointWithDescriptor, copyAttachments, copyProperties, getDefinition, getDefinitionFromDescription, getDefinitionFromWsdlExchangeTarget, getDefinitionFromWsdlResource, getDescription, getDescriptionForExchangeTarget, getEndpointsForExchangeTarget, getLockManager, getStore, getStoreFactory, getTimerManager, getWsdlExchangeTarget, getWsdlResource, setLockManager, setStore, setStoreFactory, setTimerManager, setWsdlExchangeTarget, setWsdlResource, stop
 
Methods inherited from class org.apache.servicemix.common.endpoints.ProviderEndpoint
activate, deactivate, getRole, processInOnly, processInOut
 
Methods inherited from class org.apache.servicemix.common.endpoints.SimpleEndpoint
done, fail, getChannel, getContext, getExchangeFactory, send, sendSync
 
Methods inherited from class org.apache.servicemix.common.endpoints.AbstractEndpoint
getEndpoint, getInterfaceName, getKey, getService, getServiceUnit, isExchangeOkay, prepareExchange, setDefinition, setDescription, setEndpoint, setInterfaceName, setService, setServiceUnit, toString, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

count

protected org.apache.servicemix.expression.Expression count

index

protected org.apache.servicemix.expression.Expression index

corrId

protected org.apache.servicemix.expression.Expression corrId

aggregateElementName

protected QName aggregateElementName

messageElementName

protected QName messageElementName

countAttribute

protected String countAttribute

indexAttribute

protected String indexAttribute

timeout

protected long timeout
Constructor Detail

SplitAggregator

public SplitAggregator()
Method Detail

getAggregateElementName

public QName getAggregateElementName()
Returns:
the aggregateElementName

setAggregateElementName

public void setAggregateElementName(QName aggregateElementName)
Parameters:
aggregateElementName - the aggregateElementName to set

getCorrId

public org.apache.servicemix.expression.Expression getCorrId()
Returns:
the corrId

setCorrId

public void setCorrId(org.apache.servicemix.expression.Expression corrId)
Parameters:
corrId - the corrId to set

getCount

public org.apache.servicemix.expression.Expression getCount()
Returns:
the count

setCount

public void setCount(org.apache.servicemix.expression.Expression count)
Parameters:
count - the count to set

getCountAttribute

public String getCountAttribute()
Returns:
the countAttribute

setCountAttribute

public void setCountAttribute(String countAttribute)
Parameters:
countAttribute - the countAttribute to set

getIndex

public org.apache.servicemix.expression.Expression getIndex()
Returns:
the index

setIndex

public void setIndex(org.apache.servicemix.expression.Expression index)
Parameters:
index - the index to set

getIndexAttribute

public String getIndexAttribute()
Returns:
the indexAttribute

setIndexAttribute

public void setIndexAttribute(String indexAttribute)
Parameters:
indexAttribute - the indexAttribute to set

getMessageElementName

public QName getMessageElementName()
Returns:
the messageElementName

setMessageElementName

public void setMessageElementName(QName messageElementName)
Parameters:
messageElementName - the messageElementName to set

getTimeout

public long getTimeout()
Returns:
the timeout

setTimeout

public void setTimeout(long timeout)
Parameters:
timeout - the timeout to set

createAggregation

public Object createAggregation(String correlationID)
Description copied from class: AbstractAggregator
Creates a new empty aggregation.

Specified by:
createAggregation in class AbstractAggregator
Returns:
a newly created aggregation

getCorrelationID

public String getCorrelationID(javax.jbi.messaging.MessageExchange exchange,
                               javax.jbi.messaging.NormalizedMessage message)
                        throws Exception
Description copied from class: AbstractAggregator
Retrieve the correlation ID of the given exchange

Specified by:
getCorrelationID in class AbstractAggregator
Returns:
the correlationID
Throws:
Exception

addMessage

public boolean addMessage(Object aggregation,
                          javax.jbi.messaging.NormalizedMessage message,
                          javax.jbi.messaging.MessageExchange exchange)
                   throws Exception
Description copied from class: AbstractAggregator
Add a newly received message to this aggregation

Specified by:
addMessage in class AbstractAggregator
Returns:
true if the aggregate id complete
Throws:
Exception

buildAggregate

public void buildAggregate(Object aggregation,
                           javax.jbi.messaging.NormalizedMessage message,
                           javax.jbi.messaging.MessageExchange exchange,
                           boolean doTimeout)
                    throws Exception
Description copied from class: AbstractAggregator
Fill the given JBI message with the aggregation result.

Specified by:
buildAggregate in class AbstractAggregator
doTimeout - false if the aggregation has completed or true if this aggregation has timed out
Throws:
Exception

createChildElement

protected Element createChildElement(QName name,
                                     Node parent)

getTimeout

public Date getTimeout(Object aggregation)
Description copied from class: AbstractAggregator
Returns the date when the onTimeout method should be called if the aggregation is not completed yet, or null if the aggregation has no timeout.

Specified by:
getTimeout in class AbstractAggregator
Returns:


Copyright © 2005-2008 Apache Software Foundation. All Rights Reserved.