Class Route
- java.lang.Object
-
- org.wso2.carbon.mediators.router.impl.Route
-
public class Route extends Object
Specifies the
Route
including the route conditions and the routing of a particular route for theRouterMediator
. This stores the properties of a particular route and will be used by theRouterMedaitor
in order to route the messages.This stores the routing path as a
Target
whihc can contain either a sequence or else and endpoint as the routing path and in the endpoint case the message will be delivered to the specified endpoint- See Also:
RouterMediator
,Target
-
-
Field Summary
Fields Modifier and Type Field Description static int
ROUTE_NOT_MACHING_STATE
The state of theRoute
after calling thedoRoute
method is this particular route over the specified message does not match the conditions specified in this route.static int
ROUTED_AND_DROPPED_STATE
The state of theRoute
after calling thedoRoute
method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, at the same time the message must not go through any other matching routes within this router.static int
ROUTED_WITH_BREAK_STATE
The state of theRoute
after calling thedoRoute
method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, and the message should not go though any more routes within this router.static int
ROUTED_WITH_CONTINUE_STATE
The state of theRoute
after calling thedoRoute
method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, but the message may go through any other matching routes within this router for further routing.static int
UNEXPECTED_ROUTING_STATE
The state of the routing, when there is an error in routing after executing thedoRoute
method.
-
Constructor Summary
Constructors Constructor Description Route()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
doRoute(org.apache.synapse.MessageContext synCtx, org.apache.synapse.SynapseLog synLog)
Routes the message in to the specifiedtarget
whihc can be one of thesequence
or else andendpoint
after checking whether the conditions specified in this route matches the provided message.org.apache.synapse.util.xpath.SynapseXPath
getExpression()
Pattern
getMatch()
org.apache.synapse.mediators.eip.Target
getTarget()
boolean
isBreakRouter()
boolean
isMatching(org.apache.synapse.MessageContext synCtx, org.apache.synapse.SynapseLog synLog)
Checks whether this route is matching for the given message or not.void
setBreakRouter(boolean breakRouter)
void
setExpression(org.apache.synapse.util.xpath.SynapseXPath expression)
void
setMatch(Pattern match)
void
setTarget(org.apache.synapse.mediators.eip.Target target)
-
-
-
Field Detail
-
ROUTE_NOT_MACHING_STATE
public static final int ROUTE_NOT_MACHING_STATE
The state of the
Route
after calling thedoRoute
method is this particular route over the specified message does not match the conditions specified in this route.
-
ROUTED_WITH_BREAK_STATE
public static final int ROUTED_WITH_BREAK_STATE
The state of the
Route
after calling thedoRoute
method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, and the message should not go though any more routes within this router.
-
ROUTED_WITH_CONTINUE_STATE
public static final int ROUTED_WITH_CONTINUE_STATE
The state of the
Route
after calling thedoRoute
method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, but the message may go through any other matching routes within this router for further routing.
-
ROUTED_AND_DROPPED_STATE
public static final int ROUTED_AND_DROPPED_STATE
The state of the
Route
after calling thedoRoute
method is; this particular route over the specified message matches the conditions specified in this route and hence the message is routed, at the same time the message must not go through any other matching routes within this router.
-
UNEXPECTED_ROUTING_STATE
public static final int UNEXPECTED_ROUTING_STATE
The state of the routing, when there is an error in routing after executing the
doRoute
method.
-
-
Method Detail
-
isMatching
public boolean isMatching(org.apache.synapse.MessageContext synCtx, org.apache.synapse.SynapseLog synLog)
Checks whether this route is matching for the given message or not. In general if the
expression
is provided without amatch
then the presence of a element or attribute in the message specified by theexpression
will be taken as matchingIf both the
expression
and thematch
is provided then the evaluated string value of theexpression
over the message will be matched againset the given regular expressionmatch
to test whether the string value is matching for the pattern or not- Parameters:
synCtx
- message to be matched to check the route condition- Returns:
- whether the route matches the given message or not
-
doRoute
public int doRoute(org.apache.synapse.MessageContext synCtx, org.apache.synapse.SynapseLog synLog)
Routes the message in to the specified
target
whihc can be one of thesequence
or else andendpoint
after checking whether the conditions specified in this route matches the provided message.Also if this particular router specifies the
breakRouter
to be false then the specified status will be returned to not to break the route and route further matchings in the router. Otherwise it will break the route- Parameters:
synCtx
- message to be routed- Returns:
- state of the routing and this can be one of the ROUTE_NOT_MACHING_STATE, or ROUTED_WITH_BREAK_STATE, or ROUTED_WITH_CONTINUE state.
- See Also:
isMatching(org.apache.synapse.MessageContext, SynapseLog)
-
getMatch
public Pattern getMatch()
-
setMatch
public void setMatch(Pattern match)
-
getExpression
public org.apache.synapse.util.xpath.SynapseXPath getExpression()
-
setExpression
public void setExpression(org.apache.synapse.util.xpath.SynapseXPath expression)
-
isBreakRouter
public boolean isBreakRouter()
-
setBreakRouter
public void setBreakRouter(boolean breakRouter)
-
getTarget
public org.apache.synapse.mediators.eip.Target getTarget()
-
setTarget
public void setTarget(org.apache.synapse.mediators.eip.Target target)
-
-