org.mule.module.xml.routing
Class FilteringXmlMessageSplitter

java.lang.Object
  extended by org.mule.routing.AbstractRouter
      extended by org.mule.routing.outbound.AbstractOutboundRouter
          extended by org.mule.routing.outbound.FilteringOutboundRouter
              extended by org.mule.routing.outbound.AbstractMessageSplitter
                  extended by org.mule.module.xml.routing.FilteringXmlMessageSplitter
All Implemented Interfaces:
MuleContextAware, Disposable, Initialisable, OutboundRouter, Router
Direct Known Subclasses:
RoundRobinXmlSplitter

public class FilteringXmlMessageSplitter
extends AbstractMessageSplitter

FilteringXmlMessageSplitter will split a DOM4J document into nodes based on the "splitExpression" property.

Optionally, you can specify a namespaces property map that contain prefix/namespace mappings. Mind if you have a default namespace declared you should map it to some namespace, and reference it in the splitExpression property.

The splitter can optionally validate against an XML schema. By default schema validation is turned off.

You may reference an external schema from the classpath by using the externalSchemaLocation property.

Note that each part returned is actually returned as a new Document.


Field Summary
protected  String externalSchemaLocation
           
protected  Map namespaces
           
protected  ThreadLocal nodesContext
           
protected  ThreadLocal propertiesContext
           
protected  String splitExpression
           
protected  boolean validateSchema
           
 
Fields inherited from class org.mule.routing.outbound.AbstractMessageSplitter
honorSynchronicity, multimatch
 
Fields inherited from class org.mule.routing.outbound.AbstractOutboundRouter
ENABLE_CORRELATION_ALWAYS, ENABLE_CORRELATION_IF_NOT_SET, ENABLE_CORRELATION_NEVER, enableCorrelation, endpoints, logger, messageInfoMapping, replyTo, transactionConfig
 
Fields inherited from class org.mule.routing.AbstractRouter
muleContext
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
FilteringXmlMessageSplitter()
           
 
Method Summary
protected  void cleanup()
          This method is called after all parts of the original message have been processed; typically this is the case after AbstractMessageSplitter.getMessagePart(MuleMessage, OutboundEndpoint) returned null.
 String getExternalSchemaLocation()
           
protected  MuleMessage getMessagePart(MuleMessage message, OutboundEndpoint endpoint)
          Retrieves a specific message part for the given endpoint.
 Map getNamespaces()
           
 String getSplitExpression()
           
protected  void initialise(MuleMessage message)
          Template method can be used to split the message up before the getMessagePart method is called .
 boolean isValidateSchema()
           
 void setExternalSchemaLocation(String externalSchemaLocation)
          Set classpath location of the XSD to check against.
 void setNamespaces(Map namespaces)
           
 void setSplitExpression(String splitExpression)
           
 void setValidateSchema(boolean validateSchema)
           
 
Methods inherited from class org.mule.routing.outbound.AbstractMessageSplitter
isHonorSynchronicity, route, setHonorSynchronicity
 
Methods inherited from class org.mule.routing.outbound.FilteringOutboundRouter
addEndpoint, getEndpoint, getFilter, getTransformers, isMatch, isUseTemplates, setFilter, setTransformers, setUseTemplates
 
Methods inherited from class org.mule.routing.outbound.AbstractOutboundRouter
createTransactionTemplate, dispatch, getEnableCorrelation, getEndpoint, getEndpoints, getMessageInfoMapping, getReplyTo, getTransactionConfig, isDynamicEndpoints, removeEndpoint, send, setEnableCorrelation, setEnableCorrelationAsString, setEndpoints, setMessageInfoMapping, setMessageProperties, setReplyTo, setTransactionConfig
 
Methods inherited from class org.mule.routing.AbstractRouter
dispose, getMuleContext, getRouterStatistics, initialise, setMuleContext, setRouterStatistics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.api.routing.Router
getRouterStatistics, setRouterStatistics
 
Methods inherited from interface org.mule.api.lifecycle.Initialisable
initialise
 
Methods inherited from interface org.mule.api.lifecycle.Disposable
dispose
 

Field Detail

propertiesContext

protected final ThreadLocal propertiesContext

nodesContext

protected final ThreadLocal nodesContext

splitExpression

protected volatile String splitExpression

namespaces

protected volatile Map namespaces

validateSchema

protected volatile boolean validateSchema

externalSchemaLocation

protected volatile String externalSchemaLocation
Constructor Detail

FilteringXmlMessageSplitter

public FilteringXmlMessageSplitter()
Method Detail

setSplitExpression

public void setSplitExpression(String splitExpression)

setNamespaces

public void setNamespaces(Map namespaces)

getNamespaces

public Map getNamespaces()

getSplitExpression

public String getSplitExpression()

isValidateSchema

public boolean isValidateSchema()

setValidateSchema

public void setValidateSchema(boolean validateSchema)

getExternalSchemaLocation

public String getExternalSchemaLocation()

setExternalSchemaLocation

public void setExternalSchemaLocation(String externalSchemaLocation)
Set classpath location of the XSD to check against. If the resource cannot be found, an exception will be thrown at runtime.

Parameters:
externalSchemaLocation - location of XSD

initialise

protected void initialise(MuleMessage message)
Template method can be used to split the message up before the getMessagePart method is called .

Specified by:
initialise in class AbstractMessageSplitter
Parameters:
message - the message being routed

cleanup

protected void cleanup()
Description copied from class: AbstractMessageSplitter
This method is called after all parts of the original message have been processed; typically this is the case after AbstractMessageSplitter.getMessagePart(MuleMessage, OutboundEndpoint) returned null.

Specified by:
cleanup in class AbstractMessageSplitter

getMessagePart

protected MuleMessage getMessagePart(MuleMessage message,
                                     OutboundEndpoint endpoint)
Retrieves a specific message part for the given endpoint. the message will then be routed via the provider.

Specified by:
getMessagePart in class AbstractMessageSplitter
Parameters:
message - the current message being processed
endpoint - the endpoint that will be used to route the resulting message part
Returns:
the message part to dispatch


Copyright © 2003-2008 MuleSource, Inc.. All Rights Reserved.