Beispiel #1
0
 public FinalReceiver( IGrandOutputSink common, HandlerBase[] handlers, IRouteConfigurationLock configLock )
 {
     Debug.Assert( handlers != null );
     CommonSink = common;
     Handlers = handlers;
     ConfigLock = configLock;
 }
Beispiel #2
0
 public FinalReceiver(IGrandOutputSink common, HandlerBase[] handlers, IRouteConfigurationLock configLock)
 {
     Debug.Assert(handlers != null);
     CommonSink = common;
     Handlers   = handlers;
     ConfigLock = configLock;
 }
Beispiel #3
0
 internal StandardChannel( IGrandOutputSink commonSink, EventDispatcher dispatcher, IRouteConfigurationLock configLock, HandlerBase[] handlers, string configurationName, GrandOutputChannelConfigData configData )
 {
     _dispatcher = dispatcher;
     _receiver = new EventDispatcher.FinalReceiver( commonSink, handlers, configLock );
     _receiverNoCommonSink = new EventDispatcher.FinalReceiver( null, handlers, configLock );
     _configurationName = configurationName;
     if( configData != null ) _minimalFilter = configData.MinimalFilter;
 }
Beispiel #4
0
        protected override HandlerBase DoCreate(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionConfiguration c)
        {
            var a = c.GetType().GetTypeInfo().GetCustomAttribute <HandlerTypeAttribute>();

            if (a == null)
            {
                throw new CKException("A [HandlerType(typeof(H))] attribute (where H is a CK.Monitoring.GrandOutputHandlers.HandlerBase class) is missing on class '{0}'.", c.GetType().FullName);
            }
            return((HandlerBase)Activator.CreateInstance(a.HandlerType, c));
        }
Beispiel #5
0
 /// <summary>
 /// Must be implemented to create the final route class that encapsulates the array of actions of a route.
 /// </summary>
 /// <param name="monitor">Monitor to use if needed to comment route creation.</param>
 /// <param name="configLock">
 /// Configuration lock. It must not be solicited during the creation of the route: a route that delays
 /// its work can keep a reference to it and use it as needed.
 /// </param>
 /// <param name="actions">Array of actions for the route.</param>
 /// <param name="configurationName">The <see cref="RouteConfiguration"/> name.</param>
 /// <param name="configData">Configuration data of the route.</param>
 /// <param name="routePath">Path to this route: parent route objects are already created.</param>
 /// <returns>Final route actions encapsulation.</returns>
 internal protected abstract TRoute DoCreateFinalRoute(IActivityMonitor monitor, IRouteConfigurationLock configLock, TAction[] actions, string configurationName, object configData, IReadOnlyList <TRoute> routePath);
Beispiel #6
0
 /// <summary>
 /// Must me implemented to create a sequence action.
 /// </summary>
 /// <param name="monitor">Monitor to use if needed.</param>
 /// <param name="configLock">
 /// Configuration lock. It must not be solicited during the creation of the sequence: a sequence that delays
 /// its work can keep a reference to it and use it as needed.
 /// </param>
 /// <param name="c">Configuration of the sequence action.</param>
 /// <param name="children">Array of already created children action.</param>
 /// <returns>A sequence action.</returns>
 protected abstract TAction DoCreateSequence(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionSequenceConfiguration c, TAction[] children);
Beispiel #7
0
 /// <summary>
 /// Must me implemented to create a parallel action.
 /// </summary>
 /// <param name="monitor">Monitor to use if needed.</param>
 /// <param name="configLock">
 /// Configuration lock. It must not be solicited during the creation of the parallel: if the parallel delays
 /// its work, it can keep a reference to it and use it as needed.
 /// </param>
 /// <param name="c">Configuration of the parallel action.</param>
 /// <param name="children">Array of already created children action.</param>
 /// <returns>A parallel action.</returns>
 protected abstract TAction DoCreateParallel(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionParallelConfiguration c, TAction[] children);
Beispiel #8
0
 /// <summary>
 /// Must be implemented to create a <typeparamref name="TAction"/> from a <see cref="ActionConfiguration"/> object
 /// that is guaranteed to not be a composite (a parallel or a sequence).
 /// </summary>
 /// <param name="monitor">Monitor to use if needed.</param>
 /// <param name="configLock">
 /// Configuration lock. It must not be solicited during the creation of the action: an action that delay
 /// its work can keep a reference to it and use it when needed.
 /// </param>
 /// <param name="c">Configuration of the action.</param>
 /// <returns>The created action.</returns>
 protected abstract TAction DoCreate(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionConfiguration c);
Beispiel #9
0
 protected internal override IChannel DoCreateFinalRoute(IActivityMonitor monitor, IRouteConfigurationLock configLock, HandlerBase[] actions, string configurationName, object configData, IReadOnlyList <IChannel> routePath)
 {
     return(new StandardChannel(_grandOutput.CommonSink, _dispatcher, configLock, actions, configurationName, (GrandOutputChannelConfigData)configData));
 }
Beispiel #10
0
 protected override HandlerBase DoCreateSequence(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionSequenceConfiguration c, HandlerBase[] children)
 {
     return(new SequenceHandler(c, children));
 }
Beispiel #11
0
 protected override HandlerBase DoCreateParallel(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionParallelConfiguration c, HandlerBase[] children)
 {
     return(new ParallelHandler(c, children));
 }
Beispiel #12
0
 internal FinalRoute(IRouteConfigurationLock useLock, ITestIt[] actions, string name)
 {
     _useLock = useLock;
     Actions  = actions;
     _name    = name;
 }
Beispiel #13
0
 internal StandardChannel(IGrandOutputSink commonSink, EventDispatcher dispatcher, IRouteConfigurationLock configLock, HandlerBase[] handlers, string configurationName, GrandOutputChannelConfigData configData)
 {
     _dispatcher           = dispatcher;
     _receiver             = new EventDispatcher.FinalReceiver(commonSink, handlers, configLock);
     _receiverNoCommonSink = new EventDispatcher.FinalReceiver(null, handlers, configLock);
     _configurationName    = configurationName;
     if (configData != null)
     {
         _minimalFilter = configData.MinimalFilter;
     }
 }
Beispiel #14
0
 protected override FinalRoute DoCreateFinalRoute(IActivityMonitor monitor, IRouteConfigurationLock configLock, ITestIt[] actions, string configurationName, object configData, IReadOnlyList <FinalRoute> parentPath)
 {
     return(new FinalRoute(configLock, actions, configurationName));
 }
Beispiel #15
0
 protected override ITestIt DoCreateSequence(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionSequenceConfiguration c, ITestIt[] children)
 {
     return(new TestSequence(monitor, c, children));
 }
Beispiel #16
0
 protected override ITestIt DoCreateParallel(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionParallelConfiguration c, ITestIt[] children)
 {
     return(new TestParallel(monitor, c, children));
 }
Beispiel #17
0
            protected override ITestIt DoCreate(IActivityMonitor monitor, IRouteConfigurationLock configLock, ActionConfiguration c)
            {
                ActionTypeAttribute a = c.GetType().GetTypeInfo().GetCustomAttribute <ActionTypeAttribute>();

                return((ITestIt)Activator.CreateInstance(a.ActionType, monitor, c));
            }