summaryrefslogtreecommitdiff
path: root/slips/src/app/Marina/Web/Handlers/RequestHandler.cs
blob: a2162effc22a816776397b786770826613073d70 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
using Marina.Infrastructure;
using Marina.Web.Http;

namespace Marina.Web.Handlers {
	public class RequestHandler : IRequestHandler {
		public RequestHandler( ISpecification< IHttpGateway > specification, ICommand command ) {
			_specification = specification;
			_command = command;
		}

		public bool IsSatisfiedBy( IHttpGateway item ) {
			return _specification.IsSatisfiedBy( item );
		}

		public void Execute() {
			_command.Execute( );
		}

		public static ISpecification< IHttpGateway > For( string commandName ) {
			return new RequestHandlerSpecification( commandName );
		}

		private readonly ISpecification< IHttpGateway > _specification;
		private readonly ICommand _command;
	}
}