private static void HandleRequest(string[] split)
        {
            var request    = split.First();
            var parameters = split.Skip(1).ToArray();

            if (Environment.IsSystemCommand(request))
            {
                var command = Environment.GetSystemCommand(request);
                command.Execute(parameters);
            }
            else if (Environment.IsView(request))
            {
                var view = Environment.GetView(request);
                view.Print(parameters);
            }
            else
            {
                ICommandBuilder commandBuilder = Environment.GetShellCommand(request);
                ICommand        command        = commandBuilder.Build(parameters);

                Recorder.AddCommand(command);

                IPublishCommands commandPublisher = Environment.GetCommandPublisher();
                commandPublisher.Publish(command);
            }
        }
Exemple #2
0
        /// <summary>
        /// Publishes the set of <paramref name="commands"/> with only the default message headers.
        /// </summary>
        /// <param name="publisher">The command publisher.</param>
        /// <param name="aggregateId">The <see cref="Aggregate"/> identifier that will handle the specified <paramref name="commands"/>.</param>
        /// <param name="commands">The commands to be published.</param>
        public static void Publish(this IPublishCommands publisher, Guid aggregateId, IEnumerable <Command> commands)
        {
            Verify.NotNull(publisher, nameof(publisher));

            foreach (var command in commands.EmptyIfNull())
            {
                publisher.Publish(aggregateId, command);
            }
        }
        private static void HandleRequest(string[] split)
        {
            if (Environment.IsSystemCommand(split.First()))
            {
                var command = Environment.GetSystemCommand(split.First());
                command.Execute(split.Skip(1).ToArray());
            }
            else
            {
                ICommandBuilder commandBuilder = Environment.GetShellCommand(split.First());
                ICommand        command        = commandBuilder.Build(split.Skip(1).ToArray());

                Recorder.AddCommand(command);

                IPublishCommands commandPublisher = Environment.GetCommandPublisher();
                commandPublisher.Publish(command);
            }
        }
Exemple #4
0
 public CommandPublisherAuthorizer(IPublishCommands publisher, ICurrentUserSession currentUser)
 {
     this.publisher   = publisher;
     this.currentUser = currentUser;
 }
 /// <summary>
 /// Initializes a new instance of <see cref="CommandPublisherWrapper"/>
 /// </summary>
 /// <param name="bus">The command publisher to decorate.</param>
 /// <param name="statistics">The statistics class.</param>
 public CommandPublisherWrapper(IPublishCommands bus, Statistics statistics)
 {
     this.statistics = statistics;
     this.bus = bus;
 }
 public CommandPublisherAuthorizer(IPublishCommands publisher, ICurrentUserSession currentUser)
 {
     this.publisher = publisher;
     this.currentUser = currentUser;
 }
 public CommandRetry(IPublishCommands publisher)
 {
     this.publisher = publisher;
 }
Exemple #8
0
 public ScriptPlayer(IPublishCommands commandPublisher)
 {
     this.commandPublisher = commandPublisher;
 }
Exemple #9
0
 public CommandLogger(IPublishCommands publisher)
 {
     this.publisher = publisher;
 }
 public CommandRequestLogger(IPublishCommands publisher, ICurrentUserSession currentUser, Type requestLoggerType/* bad way of doing this*/)
 {
     this.publisher = publisher;
     this.currentUser = currentUser;
     this.requestLoggerType = requestLoggerType;
 }
 public CommandPublisherLoggerDecorator(IPublishCommands commandPublisher, ILog logger)
 {
     this.commandPublisher = commandPublisher;
     this.logger = logger;
 }
Exemple #12
0
        /// <summary>
        /// Publishes the specified <paramref name="command"/> with the enumerable set of custom message headers.
        /// </summary>
        /// <param name="publisher">The command publisher.</param>
        /// <param name="aggregateId">The <see cref="Aggregate"/> identifier that will handle the specified <paramref name="command"/>.</param>
        /// <param name="command">The command to be published.</param>
        /// <param name="headers">The set of message headers associated with the command.</param>
        public static void Publish(this IPublishCommands publisher, Guid aggregateId, Command command, IEnumerable <Header> headers)
        {
            Verify.NotNull(publisher, nameof(publisher));

            publisher.Publish(headers, new CommandEnvelope(aggregateId, command));
        }
Exemple #13
0
        /// <summary>
        /// Publishes the specified <paramref name="command"/> with only the default message headers.
        /// </summary>
        /// <param name="publisher">The command publisher.</param>
        /// <param name="aggregateId">The <see cref="Aggregate"/> identifier that will handle the specified <paramref name="command"/>.</param>
        /// <param name="command">The command to be published.</param>
        public static void Publish(this IPublishCommands publisher, Guid aggregateId, Command command)
        {
            Verify.NotNull(publisher, nameof(publisher));

            publisher.Publish(null, new CommandEnvelope(aggregateId, command));
        }
 public CommandPublisherRetryDecorator(IPublishCommands publisher)
 {
     this.publisher = publisher;
 }
Exemple #15
0
 /// <summary>
 /// Initializes a new instance of <see cref="CommandPublisherWrapper"/>
 /// </summary>
 /// <param name="bus">The command publisher to decorate.</param>
 /// <param name="statistics">The statistics class.</param>
 public CommandPublisherWrapper(IPublishCommands bus, Statistics statistics)
 {
     this.statistics = statistics;
     this.bus        = bus;
 }
 public ScriptPlayer(IPublishCommands commandPublisher)
 {
     this.commandPublisher = commandPublisher;
 }
 public CommandLogger(IPublishCommands publisher)
 {
     this.publisher = publisher;
 }
Exemple #18
0
 public CommandRetry(IPublishCommands publisher)
 {
     this.publisher = publisher;
 }