public override string ProcessCommandInternal(IRequestParser command) { var username = command.Parameters[0]; var password = command.Parameters[1]; return(this.ProcessLogin(username, password)); }
/// <summary> /// Initializes a new instance of the <see cref="HomeController" /> class. /// </summary> /// <param name="homeHandler">The home handler.</param> /// <param name="parser">The context builder.</param> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="homeHandler" /> is null.</exception> /// <exception cref="System.ArgumentNullException">Thrown when the <paramref name="parser" /> is null.</exception> public HomeController(IHomeHandler homeHandler, IRequestParser parser) { Ensure.Argument.IsNotNull(homeHandler, "homeHandler"); Ensure.Argument.IsNotNull(parser, "parser"); _homeHandler = homeHandler; _parser = parser; }
public HomeAutomationCommunication(IRequestParser requestParser, IResponseBuilder responseBuilder, IConnectionHandler connectionHandler, IServiceLocator serviceLocator) { _requestParser = requestParser; _responseBuilder = responseBuilder; _requestHandlerTypes = GetRequestHandlerTypes(); _connectionHandler = connectionHandler; _serviceLocator = serviceLocator; }
public override string ProcessCommandInternal(IRequestParser command) { var vehicleIndex = int.Parse(command.Parameters[0]) - 1; var commentIndex = int.Parse(command.Parameters[1]) - 1; var username = command.Parameters[2]; return(this.ProcessRemoveComment(vehicleIndex, commentIndex, username)); }
public Dispatcher(IRequestParser parser, IConHostFactory conHostFactory, ILogger <Dispatcher> logger) { _conHostFactory = Guard.NotNull(conHostFactory, nameof(conHostFactory)); _parser = Guard.NotNull(parser, nameof(parser)); _logger = Guard.NotNull(logger, nameof(logger)); _timer = new Timer(OnTimerTick, null, TimeSpan.FromMinutes(10), TimeSpan.FromMinutes(10)); }
public override string ProcessCommandInternal(IRequestParser command) { var content = command.Parameters[0]; var author = command.Parameters[1]; var vehicleIndex = int.Parse(command.Parameters[2]) - 1; return(this.ProcessAddComment(content, vehicleIndex, author)); }
public ExecutingCommandEndpoint( IRequestParser <TDto> requestParser, ICommandFactory <TDto, TResponse> todoCommandFactory, IResponseInProgressFactory <TResponse> responseInProgressFactory) { _requestParser = requestParser; _todoCommandFactory = todoCommandFactory; _responseInProgressFactory = responseInProgressFactory; }
public void RequestParser() { IRequestParser instance = Factory.RequestParser; Assert.That(instance, Is.TypeOf <RequestParser>()); RequestParser requestParser = (RequestParser)instance; Assert.That(requestParser.EntityRepository, Is.Not.Null); }
public override string ProcessCommandInternal(IRequestParser command) { var type = command.Parameters[0]; var make = command.Parameters[1]; var model = command.Parameters[2]; var price = decimal.Parse(command.Parameters[3]); var additionalParam = command.Parameters[4]; var typeEnum = (VehicleType)Enum.Parse(typeof(VehicleType), type, true); return(this.ProcessAddVehicle(typeEnum, make, model, price, additionalParam)); }
public HttpPostMiddleware( HttpRequestDelegate next, IRequestExecutorResolver executorResolver, IHttpResultSerializer resultSerializer, IRequestParser requestParser, NameString schemaName) { _next = next; _executorResolver = executorResolver; _resultSerializer = resultSerializer; _requestParser = requestParser; _schemaName = schemaName; executorResolver.RequestExecutorEvicted += EvictRequestExecutor; }
public string ProcessCommand(IRequestParser command) { if (this.CanHandle(command)) { return(this.ProcessCommandInternal(command)); } if (this.successor != null) { return(this.successor.ProcessCommand(command)); } return(string.Format(InvalidCommand, command.Name)); }
/// <summary> /// Initializes a new instance of the <see cref="ImageSharpMiddleware"/> class. /// </summary> /// <param name="next">The next middleware in the pipeline.</param> /// <param name="options">The middleware configuration options.</param> /// <param name="loggerFactory">An <see cref="ILoggerFactory"/> instance used to create loggers.</param> /// <param name="requestParser">An <see cref="IRequestParser"/> instance used to parse image requests for commands.</param> /// <param name="resolvers">A collection of <see cref="IImageProvider"/> instances used to resolve images.</param> /// <param name="processors">A collection of <see cref="IImageWebProcessor"/> instances used to process images.</param> /// <param name="cache">An <see cref="IImageCache"/> instance used for caching images.</param> /// <param name="cacheHash">An <see cref="ICacheHash"/>instance used for calculating cached file names.</param> /// <param name="commandParser">The command parser</param> /// <param name="formatUtilities">Contains various format helper methods based on the current configuration.</param> public ImageSharpMiddleware( RequestDelegate next, IOptions <ImageSharpMiddlewareOptions> options, ILoggerFactory loggerFactory, IRequestParser requestParser, IEnumerable <IImageProvider> resolvers, IEnumerable <IImageWebProcessor> processors, IImageCache cache, ICacheHash cacheHash, CommandParser commandParser, FormatUtilities formatUtilities) { Guard.NotNull(next, nameof(next)); Guard.NotNull(options, nameof(options)); Guard.NotNull(loggerFactory, nameof(loggerFactory)); Guard.NotNull(requestParser, nameof(requestParser)); Guard.NotNull(resolvers, nameof(resolvers)); Guard.NotNull(processors, nameof(processors)); Guard.NotNull(cache, nameof(cache)); Guard.NotNull(cacheHash, nameof(cacheHash)); Guard.NotNull(commandParser, nameof(commandParser)); Guard.NotNull(formatUtilities, nameof(formatUtilities)); this.next = next; this.options = options.Value; this.requestParser = requestParser; this.providers = resolvers as IImageProvider[] ?? resolvers.ToArray(); this.processors = processors as IImageWebProcessor[] ?? processors.ToArray(); this.cache = cache; this.cacheHash = cacheHash; this.commandParser = commandParser; this.parserCulture = this.options.UseInvariantParsingCulture ? CultureInfo.InvariantCulture : CultureInfo.CurrentCulture; var commands = new HashSet <string>(); foreach (IImageWebProcessor processor in this.processors) { foreach (string command in processor.Commands) { commands.Add(command); } } this.knownCommands = commands; this.logger = loggerFactory.CreateLogger <ImageSharpMiddleware>(); this.formatUtilities = formatUtilities; }
private IList <IRequestParser> ReadCommands() { var commands = new List <IRequestParser>(); var currentLine = inputOutputProvider.Read(); while (!string.IsNullOrEmpty(currentLine)) { IRequestParser currentCommand = this.dealershipFactory.CreateRequestParser(currentLine); commands.Add(currentCommand); currentLine = inputOutputProvider.Read(); } return(commands); }
public override string ProcessCommandInternal(IRequestParser command) { var username = command.Parameters[0]; var firstName = command.Parameters[1]; var lastName = command.Parameters[2]; var password = command.Parameters[3]; var role = Role.Normal; if (command.Parameters.Count > 4) { role = (Role)Enum.Parse(typeof(Role), command.Parameters[4]); } return(this.ProcessRegisterUser(username, firstName, lastName, password, role)); }
/// <summary> /// Initializes a new instance of the <see cref="ImageSharpMiddleware"/> class. /// </summary> /// <param name="next">The next middleware in the pipeline.</param> /// <param name="options">The middleware configuration options.</param> /// <param name="loggerFactory">An <see cref="ILoggerFactory"/> instance used to create loggers.</param> /// <param name="memoryAllocator">An <see cref="MemoryAllocator"/> instance used to allocate arrays transporting encoded image data.</param> /// <param name="requestParser">An <see cref="IRequestParser"/> instance used to parse image requests for commands.</param> /// <param name="resolvers">A collection of <see cref="IImageProvider"/> instances used to resolve images.</param> /// <param name="processors">A collection of <see cref="IImageWebProcessor"/> instances used to process images.</param> /// <param name="cache">An <see cref="IImageCache"/> instance used for caching images.</param> /// <param name="cacheHash">An <see cref="ICacheHash"/>instance used for calculating cached file names.</param> /// <param name="formatUtilities">Contains various format helper methods based on the current configuration.</param> public ImageSharpMiddleware( RequestDelegate next, IOptions <ImageSharpMiddlewareOptions> options, ILoggerFactory loggerFactory, MemoryAllocator memoryAllocator, IRequestParser requestParser, IEnumerable <IImageProvider> resolvers, IEnumerable <IImageWebProcessor> processors, IImageCache cache, ICacheHash cacheHash, FormatUtilities formatUtilities) { Guard.NotNull(next, nameof(next)); Guard.NotNull(options, nameof(options)); Guard.NotNull(loggerFactory, nameof(loggerFactory)); Guard.NotNull(memoryAllocator, nameof(memoryAllocator)); Guard.NotNull(requestParser, nameof(requestParser)); Guard.NotNull(resolvers, nameof(resolvers)); Guard.NotNull(processors, nameof(processors)); Guard.NotNull(cache, nameof(cache)); Guard.NotNull(cacheHash, nameof(cacheHash)); Guard.NotNull(AsyncLock, nameof(AsyncLock)); this.next = next; this.options = options.Value; this.memoryAllocator = memoryAllocator; this.requestParser = requestParser; this.providers = resolvers as IImageProvider[] ?? resolvers.ToArray(); this.processors = processors as IImageWebProcessor[] ?? processors.ToArray(); this.cache = cache; this.cacheHash = cacheHash; var commands = new HashSet <string>(); foreach (IImageWebProcessor processor in this.processors) { foreach (string command in processor.Commands) { commands.Add(command); } } this.knownCommands = commands; this.logger = loggerFactory.CreateLogger <ImageSharpMiddleware>(); this.formatUtilities = formatUtilities; }
/// <summary> /// Initializes a new instance of the <see cref="ImageSharpMiddleware"/> class. /// </summary> /// <param name="next">The next middleware in the pipeline.</param> /// <param name="options">The middleware configuration options.</param> /// <param name="loggerFactory">An <see cref="ILoggerFactory"/> instance used to create loggers.</param> /// <param name="memoryAllocator">An <see cref="MemoryAllocator"/> instance used to allocate arrays transporting encoded image data.</param> /// <param name="requestParser">An <see cref="IRequestParser"/> instance used to parse image requests for commands.</param> /// <param name="resolvers">A collection of <see cref="IImageProvider"/> instances used to resolve images.</param> /// <param name="processors">A collection of <see cref="IImageWebProcessor"/> instances used to process images.</param> /// <param name="cache">An <see cref="IImageCache"/> instance used for caching images.</param> /// <param name="cacheHash">An <see cref="ICacheHash"/>instance used for calculating cached file names.</param> /// <param name="asyncKeyLock">An <see cref="IAsyncKeyLock"/> instance used for providing locking during processing.</param> public ImageSharpMiddleware( RequestDelegate next, IOptions <ImageSharpMiddlewareOptions> options, ILoggerFactory loggerFactory, MemoryAllocator memoryAllocator, IRequestParser requestParser, IEnumerable <IImageProvider> resolvers, IEnumerable <IImageWebProcessor> processors, IImageCache cache, ICacheHash cacheHash, IAsyncKeyLock asyncKeyLock) { Guard.NotNull(next, nameof(next)); Guard.NotNull(options, nameof(options)); Guard.NotNull(loggerFactory, nameof(loggerFactory)); Guard.NotNull(memoryAllocator, nameof(memoryAllocator)); Guard.NotNull(requestParser, nameof(requestParser)); Guard.NotNull(resolvers, nameof(resolvers)); Guard.NotNull(processors, nameof(processors)); Guard.NotNull(cache, nameof(cache)); Guard.NotNull(cache, nameof(cacheHash)); Guard.NotNull(asyncKeyLock, nameof(asyncKeyLock)); this.next = next; this.options = options.Value; this.memoryAllocator = memoryAllocator; this.requestParser = requestParser; this.resolvers = resolvers; this.processors = processors; this.cache = cache; this.cacheHash = cacheHash; this.asyncKeyLock = asyncKeyLock; var commands = new List <string>(); foreach (IImageWebProcessor processor in this.processors) { commands.AddRange(processor.Commands); } this.knownCommands = commands; this.logger = loggerFactory.CreateLogger <ImageSharpMiddleware>(); }
public ResponseProvider(IRequestParser requestParser, IHttpResponseFactory responseFactory, IHandler headHandler) { if (requestParser == null) { throw new ArgumentNullException(nameof(requestParser)); } if (responseFactory == null) { throw new ArgumentNullException(nameof(responseFactory)); } if (headHandler == null) { throw new ArgumentNullException(nameof(headHandler)); } this._requestParser = requestParser; this._responseFactory = responseFactory; this._headHandler = headHandler; }
/// <summary>Constructor</summary> /// <param name="secretStore">Vault Secret Store</param> /// <param name="contextParser">Owin Context Parser</param> public VaultBasicAuthenticationSecretParser(IVaultSecretStore secretStore, IRequestParser contextParser) { this.secretStore = secretStore.ThrowIfNull(nameof(secretStore)); this.contextParser = contextParser.ThrowIfNull(nameof(contextParser)); }
public override string ProcessCommandInternal(IRequestParser command) { this.userProvider.LoggedUser = null; this.userProvider.Users = new List <IUser>(); return("Reset compleate."); }
public override bool CanHandle(IRequestParser command) { return(command.Name.Equals("Reset")); }
public override string ProcessCommandInternal(IRequestParser command) { return(this.ProcessLogout()); }
// Dependency Inversion and Liskov Substitution Principles public ResponseProvider( IRequestParser requestParser, IRequestProccessor requestProccessor) { this.requestParser = requestParser; this.requestProccessor = requestProccessor; }
public override string ProcessCommandInternal(IRequestParser command) { return(this.ProcessShowAllUsers()); }
public override bool CanHandle(IRequestParser command) { return(command.Name.Equals("AddVehicle")); }
public override string ProcessCommandInternal(IRequestParser command) { var username = command.Parameters[0]; return(this.ShowUserVehicles(username)); }
public ResponseProvider(IHandler handler, IHttpResponseFactory responseFactory, IRequestParser requestParser) { this.httpResponseFactory = responseFactory; this.handler = handler; this.requestParser = requestParser; }
public DefaultStyxEngine(IHandshakeNegotiator handshakeNegotiator, ILogger logger, IRequestParser requestParser) { _handshakeNegotiator = handshakeNegotiator; _logger = logger; _requestParser = requestParser; }
public ClientRequestProcessor(ICommandLocator commandLocator, IRequestParser requestParser) { _commandLocator = commandLocator; _requestParser = requestParser; }
public MailGunWebhooksController(IRequestParser requestParser) { _requestParser = requestParser; }
public abstract string ProcessCommandInternal(IRequestParser command);
public abstract bool CanHandle(IRequestParser command);