public MemoryResponseStorageImpl()
        {
            Items = new List <MemoryResponseStorageItem>();
            IServiceManager    services = ServiceManager.GetInstance();
            IControllerManager manager  = services.GetService <IControllerManager>();

            manager.RegisterController(typeof(ResponseStorageController));
        }
        private void Initialize()
        {
            serviceManager  = ServiceManager.GetInstance();
            loggingService  = serviceManager.GetService <ILoggingService>();
            encodingService = serviceManager.GetService <IEncodingConverterService>();
            security        = serviceManager.GetService <ISecurityManagementService>();

            serverSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);

            IControllerManager manager = serviceManager.GetService <IControllerManager>();

            manager.RegisterController(typeof(ServerInfoController));

            if (telemetryServicesDisabled)
            {
                string alert = "WARNING!: Disabling telemetry services can bring some extra performance to the server (even if perhaps imperceptible). However it will not be possible to collect metrics to implement improvements in your code";
                Console.ForegroundColor = ConsoleColor.Yellow;
                Console.WriteLine(alert);
                Console.ForegroundColor = ConsoleColor.White;

                serviceManager.Unbind <ITelemetryManagement>();
                loggingService.WriteLog(alert, ServerLogType.ALERT);
            }
            else
            {
                ITelemetryManagement telemetry = serviceManager.GetService <ITelemetryManagement>();
                telemetry.Initialize();
            }

            IEFIManager efiManager = serviceManager.GetService <IEFIManager>();

            efiManager.LoadAll();

            if (_basicProcessorType != null)
            {
                EnableBasicServerProcessorModeInternal();
            }

            try
            {
                Console.WriteLine("Socket App Server - version " + new ServerInfo().ServerVersion);
            }
            catch { }

            Console.WriteLine($"Server started with {configuration.BufferSize} bytes for buffer size \n");
            Console.WriteLine($"Server Encoding: '{configuration.ServerEncoding.EncodingName}'");
            if (configuration.MaxThreadsCount > 0)
            {
                Console.WriteLine($"Server max threads count: " + configuration.MaxThreadsCount);
            }
        }
Beispiel #3
0
        public void EnableSecurity(IServerUserRepository userRepository, int tokenLifetime = 3, string tokenCryptPassword = "")
        {
            if (coreServer.IsLoadBalanceEnabled())
            {
                throw new InvalidOperationException("Authentication features cannot be enabled on a load balancing server");
            }

            if (securityEnabled)
            {
                throw new Exception("Aready enabled.");
            }

            controllerManager.RegisterController(typeof(AuthorizationController));
            interceptorManager.AddInterceptor(new SecurityTokenInterceptor());
            interceptorManager.AddInterceptor(new UserRoleValidationInterceptor());

            definitions = new BasicSecurityDefinitions(userRepository,
                                                       tokenLifetime,
                                                       tokenCryptPassword);

            securityEnabled = true;
        }
        /// <summary>
        /// Register a controller on the server
        /// </summary>
        /// <param name="controllerType">Concrete type of controller. It is mandatory to implement the "IController" interface</param>
        protected void RegisterController(Type controllerType)
        {
            IControllerManager manager = Services.GetService <IControllerManager>();

            manager.RegisterController(controllerType);
        }
Beispiel #5
0
        static void PrepareControllers(frmMain main)
        {
            IEFRepository      repository = new EFRepository();
            IControllerManager manager    = ControllerManager.GetInstance();

            manager.RegisterController(new LogEntriesController(repository, main));
            manager.RegisterController(new SummaryLogsController(repository, new frmSummarizeLogs()));
            manager.RegisterController(new PersonalNoteController(repository, new frmPersonalNotes()));
            manager.RegisterController(new ObjectiveController(repository, new frmObjectives()));
            manager.RegisterController(new LeaveController(repository, new frmLeaves()));
            manager.RegisterController(new DailyAttributeController(repository, new frmDailyAttribute()));
            manager.RegisterController(new HolidayController(repository, new frmHolidays()));
            manager.RegisterController(new DailyActivityController(repository, new frmDailyActivity()));
            manager.RegisterController(new CategoryController(repository, new frmCategory()));
            manager.RegisterController(new AttributeController(repository, new frmAttribute()));
            manager.RegisterController(new ActivityController(repository, new frmActivity()));
            manager.RegisterController(new StandardOperatingProcedureController(repository, new frmStandardOperatingProcedure()));
            manager.RegisterController(new SummaryHoursByCategoriesController(repository, new frmSummarizeHoursByCategories()));

            //Prepare data for main window before showing
            ((LogEntriesController)manager.GetControllerFromId(LogEntriesController.cID)).View.View_ViewReady(null);
        }