Captures subordinated RouteConfiguration: a SubRouteConfiguration ImportParentActions and ImportParentDeclaredActionsAbove by default and defines a RoutePredicate.
Inheritance: RouteConfiguration
Example #1
0
 /// <summary>
 /// Declares a subordinated route.
 /// </summary>
 /// <param name="channel">Configuration of the route.</param>
 /// <returns>This <see cref="SubRouteConfiguration"/> to enable fluent syntax.</returns>
 public new SubRouteConfiguration DeclareRoute(SubRouteConfiguration channel)
 {
     base.DeclareRoute(channel);
     return(this);
 }
        SubRouteConfiguration FillSubRoute( IActivityMonitor monitor, XElement xml, SubRouteConfiguration sub )
        {
            using( monitor.OpenGroup( LogLevel.Trace, string.Format( "Reading subordinated channel '{0}'.", sub.Name ), null ) )
            {
                var matchOptions = (string)xml.Attribute( "MatchOptions" );
                var filter = (string)xml.Attribute( "TopicFilter" );
                var regex = (string)xml.Attribute( "TopicRegex" );
                if( (filter == null) == (regex == null) )
                {
                    throw new XmlException( "Subordinated Channel must define one TopicFilter or TopicRegex attribute (and not both)." + xml.GetLineColumnString() );
                }
                RegexOptions opt = RegexOptions.IgnoreCase | RegexOptions.CultureInvariant | RegexOptions.Multiline | RegexOptions.ExplicitCapture;
                if( !String.IsNullOrWhiteSpace( matchOptions ) )
                {
                    if( !Enum.TryParse( matchOptions, true, out opt ) )
                    {
                        var expected = String.Join( ", ", Enum.GetNames( typeof( RegexOptions ) ).Where( n => n != "None" ) );
                        throw new XmlException( "MatchOptions value must be a subset of: " + expected + xml.GetLineColumnString() );
                    }
                    monitor.SendLine( LogLevel.Trace, string.Format( "MatchOptions for Channel '{0}' is: {1}.", sub.Name, opt ), null );
                }
                else monitor.SendLine( LogLevel.Trace, string.Format( "MatchOptions for Channel '{0}' defaults to: IgnoreCase, CultureInvariant, Multiline, ExplicitCapture.", sub.Name ), null );

                sub.RoutePredicate = filter != null ? CreatePredicateFromWildcards( filter, opt ) : CreatePredicateRegex( regex, opt );

                FillRoute( monitor, xml, sub );
                return sub;
            }
        }
 /// <summary>
 /// Declares a subordinated route.
 /// </summary>
 /// <param name="channel">Configuration of the route.</param>
 /// <returns>This <see cref="SubRouteConfiguration"/> to enable fluent syntax.</returns>
 public new SubRouteConfiguration DeclareRoute( SubRouteConfiguration channel )
 {
     base.DeclareRoute( channel );
     return this;
 }
Example #4
0
 /// <summary>
 /// Declare a new subordinated route.
 /// </summary>
 /// <param name="route">The subordinated route configuration.</param>
 /// <returns>This object.</returns>
 public RouteConfiguration DeclareRoute(SubRouteConfiguration route)
 {
     _configurations.Add(new MetaDeclareRouteConfiguration(route));
     return(this);
 }
 /// <summary>
 /// Initializes a new <see cref="MetaDeclareRouteConfiguration"/> bound to a <see cref="SubRouteConfiguration"/>.
 /// </summary>
 /// <param name="route">Subordinated route configuration.</param>
 public MetaDeclareRouteConfiguration( SubRouteConfiguration route )
 {
     _route = route;
 }
Example #6
0
 /// <summary>
 /// Initializes a new <see cref="MetaDeclareRouteConfiguration"/> bound to a <see cref="SubRouteConfiguration"/>.
 /// </summary>
 /// <param name="route">Subordinated route configuration.</param>
 public MetaDeclareRouteConfiguration(SubRouteConfiguration route)
 {
     _route = route;
 }
Example #7
0
 /// <summary>
 /// Declare a new subordinated route.
 /// </summary>
 /// <param name="route">The subordinated route configuration.</param>
 /// <returns>This object.</returns>
 public RouteConfiguration DeclareRoute( SubRouteConfiguration route )
 {
     _configurations.Add( new MetaDeclareRouteConfiguration( route ) );
     return this;
 }