public OneWayRequestSuite()
            : base(40, 20)
        {
            IoC.Container = new Agatha.Unity.Container();

            serviceLayerConfiguration = new ServiceLayerConfiguration(Assembly.GetExecutingAssembly(), Assembly.GetExecutingAssembly(), IoC.Container)
                                            {
                                                BusinessExceptionType = typeof(BusinessException),
                                                SecurityExceptionType = typeof(SecurityException),
                                                CacheManagerImplementation = typeof(CacheManagerSpy)
                                            };
            serviceLayerConfiguration.Initialize();

            // i want to take advantage of the automatic initialization, so i'm just resolving the requestprocessor instead of creating it
            requestProcessor = IoC.Container.Resolve<IRequestProcessor>();
            // the cache manager is a singleton so i can just resolve it and it'll be the same one the request processor uses
            cacheManager = (CacheManagerSpy)IoC.Container.Resolve<ICacheManager>();

            firstOneWayRequestHandler = MockRepository.GenerateMock<IOneWayRequestHandler<FirstOneWayRequest>>();
            secondOneWayRequestHandler = MockRepository.GenerateMock<IOneWayRequestHandler<SecondOneWayRequest>>();
            thirdOneWayRequestHandler = MockRepository.GenerateMock<IOneWayRequestHandler<ThirdOneWayRequest>>();

            IoC.Container.RegisterInstance(firstOneWayRequestHandler);
            IoC.Container.RegisterInstance(secondOneWayRequestHandler);
            IoC.Container.RegisterInstance(thirdOneWayRequestHandler);
        }
        public void Initialize()
        {
            serviceLayerConfiguration = new ServiceLayerConfiguration(IoC.Container)
            {
                AsyncRequestProcessorImplementation = AsyncRequestProcessorImplementation,
                BusinessExceptionType          = BusinessExceptionType,
                RequestProcessorImplementation = RequestProcessorImplementation,
                SecurityExceptionType          = SecurityExceptionType
            };

            foreach (var assembly in requestHandlerAssemblies)
            {
                serviceLayerConfiguration.AddRequestHandlerAssembly(assembly);
            }

            foreach (var assembly in requestsAndResponseAssemblies)
            {
                serviceLayerConfiguration.AddRequestAndResponseAssembly(assembly);
            }

            serviceLayerConfiguration.Initialize();

            IoC.Container.Register(typeof(IAsyncRequestDispatcher), AsyncRequestDispatcherImplementation, Lifestyle.Transient);
            IoC.Container.Register(typeof(IAsyncRequestDispatcherFactory), AsyncRequestDispatcherFactoryImplementation, Lifestyle.Singleton);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="DtcTransactionRequestProcessor"/> class.
 /// </summary>
 /// <param name="serviceLayerConfiguration">The service layer configuration.</param>
 /// <param name="cacheManager">The cache manager.</param>
 /// <param name="sessionProvider">The session provider.</param>
 public DtcTransactionRequestProcessor(
     ServiceLayerConfiguration serviceLayerConfiguration,
     ICacheManager cacheManager,
     ISessionProvider sessionProvider )
     : base(serviceLayerConfiguration, cacheManager)
 {
     _sessionProvider = sessionProvider;
 }
Example #4
0
 protected void Application_Start(object sender, EventArgs e)
 {
     var c = new ServiceLayerConfiguration(
         Assembly.Load("AgathaSample.Services"),
         Assembly.Load("AgathaSample.Common"),
         new Container(KernelContainer.Kernel))
                 {
                     SecurityExceptionType = typeof (SecurityException)
                 };
     c.Initialize();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="PerformanceLoggingRequestProcessor"/> class.
 /// </summary>
 /// <param name="serviceLayerConfiguration">The service layer configuration.</param>
 /// <param name="cacheManager">The cache manager.</param>
 /// <param name="configurationPropertiesProvider">The configuration properties provider.</param>
 /// <param name="sessionProvider">The session provider.</param>
 public PerformanceLoggingRequestProcessor(
     ServiceLayerConfiguration serviceLayerConfiguration, 
     ICacheManager cacheManager, 
     IConfigurationPropertiesProvider configurationPropertiesProvider, 
     ISessionProvider sessionProvider )
     : base(serviceLayerConfiguration, cacheManager, sessionProvider)
 {
     _configurationPropertiesProvider = configurationPropertiesProvider;
     _webServiceCallPerformanceLimitInMilliseconds =
         _configurationPropertiesProvider.GetPropertyInt ( SettingKeyNames.WebServiceCallPerformanceLimitInMilliseconds );
     _requestHandlerPerformanceLimitInMilliseconds =
         _configurationPropertiesProvider.GetPropertyInt ( SettingKeyNames.AgathaRequestHandlerPerformanceLimitInMilliseconds );
 }
Example #6
0
        private void SetDefaultImplementations()
        {
            RequestDispatcherImplementation             = typeof(RequestDispatcher);
            RequestDispatcherFactoryImplementation      = typeof(RequestDispatcherFactory);
            RequestProcessorImplementation              = typeof(RequestProcessor);
            AsyncRequestDispatcherImplementation        = typeof(AsyncRequestDispatcher);
            AsyncRequestDispatcherFactoryImplementation = typeof(AsyncRequestDispatcherFactory);
            AsyncRequestProcessorImplementation         = typeof(AsyncRequestProcessor);
            CacheManagerImplementation  = typeof(CacheManager);
            CacheProviderImplementation = typeof(InMemoryCacheProvider);

            IoC.Container             = container ?? (IContainer)Activator.CreateInstance(ContainerImplementation);
            serviceLayerConfiguration = new ServiceLayerConfiguration(IoC.Container);
        }
 public PerformanceLoggingRequestProcessor(ServiceLayerConfiguration serviceLayerConfiguration, IRequestProcessingErrorHandler errorHandler)
     : base(serviceLayerConfiguration, errorHandler)
 {
 }
Example #8
0
 public RequestProcessor(ServiceLayerConfiguration serviceLayerConfiguration, ICacheManager cacheManager)
 {
     this.serviceLayerConfiguration = serviceLayerConfiguration;
     this.cacheManager = cacheManager;
 }
Example #9
0
 public RequestProcessor(ServiceLayerConfiguration serviceLayerConfiguration)
 {
     this.serviceLayerConfiguration = serviceLayerConfiguration;
 }
Example #10
0
 /// <summary>
 /// Initializes a new instance of the <see cref="RequestProcessorBase"/> class.
 /// </summary>
 /// <param name="serviceLayerConfiguration">The service layer configuration.</param>
 /// <param name="cacheManager">The cache manager.</param>
 protected RequestProcessorBase(ServiceLayerConfiguration serviceLayerConfiguration, ICacheManager cacheManager)
 {
     _serviceLayerConfiguration = serviceLayerConfiguration;
     _cacheManager = cacheManager;
 }
 public RequestProcessingErrorHandler(ServiceLayerConfiguration serviceLayerConfiguration)
 {
     this.serviceLayerConfiguration = serviceLayerConfiguration;
 }
 public PerformanceLoggingRequestProcessor(ServiceLayerConfiguration serviceLayerConfiguration, ICacheManager cacheManager)
     : base(serviceLayerConfiguration, cacheManager)
 {
 }
 public PerformanceLoggingRequestProcessor(ServiceLayerConfiguration serviceLayerConfiguration, IRequestProcessingErrorHandler errorHandler) : base(serviceLayerConfiguration, errorHandler)
 {
 }
Example #14
0
 public RequestProcessor(ServiceLayerConfiguration serviceLayerConfiguration, IRequestProcessingErrorHandler errorHandler)
 {
     this.serviceLayerConfiguration = serviceLayerConfiguration;
     this.errorHandler = errorHandler;
 }
Example #15
0
        /// <summary>
        /// Configures the agatha.
        /// </summary>
        /// <param name="appContainer">The app container.</param>
        protected virtual void ConfigureAgatha(IContainer appContainer)
        {
            var structureMapContainer = new Agatha.StructureMap.Container ( appContainer );
            IoC.Container = structureMapContainer;

            var assemblyLocator = appContainer.GetInstance<IAssemblyLocator> ();
            var infrastructureAssemblies = assemblyLocator.LocateInfrastructureAssemblies();

            var genericsToApply = new Dictionary<Type, Type> ();
            foreach (var infrastructureAssembly in infrastructureAssemblies)
            {
                var genericsToApplyInAssebmly = KnownTypeHelper.GetGenerics ( infrastructureAssembly );

                foreach ( KeyValuePair<Type, Type> keyValuePair in genericsToApplyInAssebmly )
                {
                    genericsToApply.Add(keyValuePair.Key, keyValuePair.Value);
                }
            }

            var serviceLayerConfiguration = new ServiceLayerConfiguration ( structureMapContainer );

            var serviceAssemblies = assemblyLocator.LocateWebServiceAssemblies();

            foreach ( var assembly in serviceAssemblies )
            {
                var assemblyRef = assembly;
                Logger.Debug ( "Registering Requests, Responses, Handlers, and Dtos for Assembly: {0}", assemblyRef );

                KnownTypeHelper.RegisterNonGenericRequestsAndResponses ( assembly );
                serviceLayerConfiguration.AddRequestHandlerAssembly ( assembly );

                KnownTypeProvider.RegisterDerivedTypesOf<AbstractDataTransferObject> ( assembly.GetTypes ().Where ( t => !t.IsGenericType ) );

                KnownTypeHelper.RegisterGenerics ( genericsToApply, assembly );
            }

            KnownTypeProvider.Register<TerminologyConcept> ();
            KnownTypeProvider.Register<TerminologyProperty> ();
            KnownTypeProvider.Register<TerminologyPropertyType> ();
            KnownTypeProvider.Register<TerminologyVocabulary> ();

            // register the agatha interceptors
            serviceLayerConfiguration.RegisterRequestHandlerInterceptor<SecurityInterceptor>();
            serviceLayerConfiguration.RegisterRequestHandlerInterceptor<RuleViolationEventInterceptor> ();

            serviceLayerConfiguration.RequestProcessorImplementation = typeof ( Service.PerformanceLoggingRequestProcessor );
            serviceLayerConfiguration.Initialize ();

            RegisterIRequestHandlerOfGetRequestDtoByKey ( appContainer );
            CallKnownTypeProviders ( appContainer );
        }
Example #16
0
 public RequestProcessor(ServiceLayerConfiguration serviceLayerConfiguration)
 {
     this.serviceLayerConfiguration = serviceLayerConfiguration;
 }
 private static void RegisterAgathaFramework(IUnityContainer container)
 {
     var agathaContainer = new Agatha.Unity.Container(container); //UnityAgathaContainer(container);
     var agathaServiceLayer = new ServiceLayerConfiguration(agathaContainer);
     foreach (var assembly in AssemblyUtils.LoadMEDSEEKAssemblies(ServiceContext.HostSettings.ApplicationPath))
     {
         var types = AssemblyUtils.GetTypes(assembly);
         if (types.Any(t => typeof(Agatha.Common.Request).IsAssignableFrom(t)))
         {
             agathaServiceLayer.AddRequestAndResponseAssembly(assembly);
         }
         else if (types.Any(t => typeof(RequestHandler).IsAssignableFrom(t)))
         {
             agathaServiceLayer.AddRequestHandlerAssembly(assembly);
         }
     }
     agathaServiceLayer.BusinessExceptionType = typeof(BusinessException);
     agathaServiceLayer.RequestProcessorImplementation = typeof(TransactionalRequestProcessor);
     agathaServiceLayer.CacheManagerImplementation = typeof(RequestProcessorCacheManager);
     agathaServiceLayer.CacheProviderImplementation = typeof(RequestProcessorCacheProvider);
     agathaServiceLayer.Initialize();
     container.RegisterType(typeof(IWcfRequestProcessor), typeof(WcfRequestProcessor));
 }
 public RequestProcessingErrorHandler(ServiceLayerConfiguration serviceLayerConfiguration)
 {
     this.serviceLayerConfiguration = serviceLayerConfiguration;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TransactionalRequestProcessor" /> class.
 /// </summary>
 /// <param name="serviceLayerConfiguration">The service layer configuration.</param>
 /// <param name="cacheManager">The cache manager.</param>
 /// <param name="userContextFactory">The user context factory.</param>
 /// <param name="orgUnitContextStorage">The org unit context storage.</param>
 public TransactionalRequestProcessor(ServiceLayerConfiguration serviceLayerConfiguration, ICacheManager cacheManager, IUserContextFactory userContextFactory, IOrgUnitContextStorage orgUnitContextStorage)
     : base(serviceLayerConfiguration, cacheManager)
 {
     _userContextFactory = userContextFactory;
     _orgUnitContextStorage = orgUnitContextStorage;
 }
Example #20
0
 public RequestProcessor(ServiceLayerConfiguration serviceLayerConfiguration, IRequestProcessingErrorHandler errorHandler)
 {
     this.serviceLayerConfiguration = serviceLayerConfiguration;
     this.errorHandler = errorHandler;
 }
        public void Initialize()
        {
            serviceLayerConfiguration = new ServiceLayerConfiguration(IoC.Container)
            {
                AsyncRequestProcessorImplementation = AsyncRequestProcessorImplementation,
                BusinessExceptionType = BusinessExceptionType,
                RequestProcessorImplementation = RequestProcessorImplementation,
                SecurityExceptionType = SecurityExceptionType
            };

            foreach (var assembly in requestHandlerAssemblies)
                serviceLayerConfiguration.AddRequestHandlerAssembly(assembly);

            foreach (var assembly in requestsAndResponseAssemblies)
                serviceLayerConfiguration.AddRequestAndResponseAssembly(assembly);

            serviceLayerConfiguration.Initialize();

            IoC.Container.Register(typeof(IAsyncRequestDispatcher), AsyncRequestDispatcherImplementation, Lifestyle.Transient);
            IoC.Container.Register(typeof(IAsyncRequestDispatcherFactory), AsyncRequestDispatcherFactoryImplementation, Lifestyle.Singleton);
        }