Exemplo n.º 1
0
        public StandardEngine(
            ISettingsManager settingsManager,
            IBranchManager branchManager,
            ICommandLineManager commandLineManager,
            IBannerManager bannerManager,
            IAppearanceManager appearanceManager,
            IErrorManager errorManager,
            IDialogsManager dialogsManager,
            IHelpManager helpManager,
            IAdvancedMenuManager advancedMenuManager,
            IEndpointManager endpointManager
            )
        {
            SettingsManager = settingsManager;
            BranchManager = branchManager;
            BannerManager = bannerManager;
            AppearanceManager = appearanceManager;
            CommandLineManager = commandLineManager;
            ErrorManager = errorManager;
            DialogsManager = dialogsManager;
            HelpManager = helpManager;
            AdvancedMenuManager = advancedMenuManager;
            EndpointManager = endpointManager;

            Identifier = Guid.NewGuid();
        }
Exemplo n.º 2
0
        private static T ReloadItem <T>(IEndpointManager <T> manager, IRequestResponse response)
            where T : CommonEndpointModel
        {
            if (response.Status == "success")
            {
                return(manager.Get((int)response.Payload.Id));
            }

            // FIXME - an error occured. Handle appropriately
            return(null);
        }
Exemplo n.º 3
0
        public BackendInfo(string backendId, IEndpointManager endpointManager, IProxyHttpClientFactory proxyHttpClientFactory)
        {
            Contracts.CheckNonEmpty(backendId, nameof(backendId));
            Contracts.CheckValue(endpointManager, nameof(endpointManager));
            Contracts.CheckValue(proxyHttpClientFactory, nameof(proxyHttpClientFactory));

            BackendId              = backendId;
            EndpointManager        = endpointManager;
            ProxyHttpClientFactory = proxyHttpClientFactory;

            DynamicState = CreateDynamicStateQuery();
        }
Exemplo n.º 4
0
        public HelpManager(IAppearanceManager appearanceManager, ISettingsManager settingsManager, IEndpointManager endpointManager)
        {
            _settingsManager = settingsManager;
            _endpointManager = endpointManager;
            _model = new HelpDialogModel(this, appearanceManager);
            SchemeHandlers = new Dictionary<string, IHelpSchemeHandler>
                {
                    {"archive", new ArchiveSchemeHandler()}
                };

            PreserveContentText = "Preserve this content in a new window when the utility exits.";
            DialogTitle = "Help Resources";
            InitialLeftOffset = -75;
            InitialTopOffset = -75;
        }
Exemplo n.º 5
0
        public DefaultAquilesCluster(CassandraClusterElement configuration)
        {
            this.KeySpaces = new Dictionary<string, AquilesKeyspace>();
            this.FriendlyName = configuration.FriendlyName;

            this.connectionFactory = ConnectionFactoryHelper.Create(configuration.Connection.FactoryType);
            this.connectionFactory.SpecialConnectionParameters = configuration.Connection.SpecialConnectionParameters;
            this.endpointManager = EndpointManagerHelper.Create(configuration.EndpointManager);
            this.connectionPool = ConnectionPoolHelper.Create(configuration.Connection.PoolType);
            this.connectionPool.Name = String.Format(CultureInfo.InvariantCulture, "{0}_Pool", this.FriendlyName);
            this.endpointManager.ConnectionFactory = this.connectionFactory;
            this.connectionPool.ConnectionFactory = this.connectionFactory;
            this.connectionPool.EndpointManager = this.endpointManager;
            this.connectionPool.SpecialConnectionParameters = configuration.Connection.SpecialConnectionParameters;
        }
        IDictionary<string, IHubProtocol> SetupProtocols(IEndpointManager endpointManager)
        {
            var protocols = new Dictionary<string, IHubProtocol>();
            foreach (var endpoint in endpointManager.Endpoints.Where(e => !protocols.Keys.Contains(e.Key)))
            {
                var hubProtocol = Create.New<IHubProtocol>();
                hubProtocol.Connection = new HubConnection(endpoint.Value.Uri)
                {
                    TraceLevel = TraceLevels.All,
                    TraceWriter = Console.Out
                };
                
                hubProtocol.Proxy = hubProtocol.Connection.CreateHubProxy("Messaging");
                protocols.Add(endpoint.Key, hubProtocol);
            }

            return protocols;
        }
Exemplo n.º 7
0
        protected void Initialize(IConnectionHandler connectionHandler,
                                  IMessageParser parser,
                                  IConnectionStorage connectionStorage,
                                  IEndpointManager endpointManager,
                                  IMessenger broadcaster,
                                  IModuleFramework moduleFramework,
                                  IModuleControl moduleControl,
                                  LogManager logManager)
        {
            if (Initialized)
            {
                throw new Exception("Server is already initialized!");
            }

            LogManager = logManager;
            log        = LogManager.GetLogger("Server");

            _network  = endpointManager;
            Framework = moduleFramework;

            Framework.Messenger = broadcaster;
            Framework.Server    = this;

            ConnectionHandler = connectionHandler;

            ConnectionStorage = connectionStorage;

            _network.ConnectionHandler = connectionHandler;
            _network.MessageParser     = parser;

            connectionHandler.Modules   = moduleControl;
            connectionHandler.Messenger = broadcaster;

            parser.Modules           = moduleControl;
            parser.ConnectionHandler = connectionHandler;

            broadcaster.Connections = connectionStorage;

            Initialized = true;
        }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BackendProber"/> class.
        /// HealthProber is the unit that checks the health state for all endpoints(replica) of a backend(service)
        /// HealthProbe would query the health controller of the endpoint and update the health state for every endpoint
        /// periodically base on the time interval user specified in backend.
        /// </summary>
        public BackendProber(string backendId, BackendConfig config, IEndpointManager endpointManager, IMonotonicTimer timer, ILogger <BackendProber> logger, IOperationLogger operationLogger, HttpClient httpClient, IRandomFactory randomFactory)
        {
            Contracts.CheckValue(backendId, nameof(backendId));
            Contracts.CheckValue(config, nameof(config));
            Contracts.CheckValue(endpointManager, nameof(endpointManager));
            Contracts.CheckValue(timer, nameof(timer));
            Contracts.CheckValue(logger, nameof(logger));
            Contracts.CheckValue(operationLogger, nameof(operationLogger));
            Contracts.CheckValue(httpClient, nameof(httpClient));
            Contracts.CheckValue(randomFactory, nameof(randomFactory));

            BackendId        = backendId;
            Config           = config;
            _endpointManager = endpointManager;
            _timer           = timer;
            _logger          = logger;
            _operationLogger = operationLogger;
            _randomFactory   = randomFactory;

            _healthControllerUrl = new Uri(Config.HealthCheckOptions.Path, UriKind.Relative);
            _healthCheckInterval = Config.HealthCheckOptions.Interval;

            _backendProbeHttpClient = httpClient;
        }
Exemplo n.º 9
0
 public ComputerNameRequest(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 10
0
 public ReportingRequest(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 11
0
        private void UpdateRuntimeEndpoints(IDictionary <string, BackendEndpoint> configEndpoints, IEndpointManager endpointManager)
        {
            var desiredEndpoints = new HashSet <string>(StringComparer.Ordinal);

            foreach (var configEndpoint in configEndpoints)
            {
                desiredEndpoints.Add(configEndpoint.Key);
                endpointManager.GetOrCreateItem(
                    itemId: configEndpoint.Key,
                    setupAction: endpoint =>
                {
                    if (endpoint.Config.Value?.Address != configEndpoint.Value.Address)
                    {
                        if (endpoint.Config.Value == null)
                        {
                            _logger.LogDebug("Endpoint {endpointId} has been added.", configEndpoint.Key);
                        }
                        else
                        {
                            _logger.LogDebug("Endpoint {endpointId} has changed.", configEndpoint.Key);
                        }
                        endpoint.Config.Value = new EndpointConfig(configEndpoint.Value.Address);
                    }
                });
            }

            foreach (var existingEndpoint in endpointManager.GetItems())
            {
                if (!desiredEndpoints.Contains(existingEndpoint.EndpointId))
                {
                    // NOTE 1: This is safe to do within the `foreach` loop
                    // because `IEndpointManager.GetItems` returns a copy of the list of endpoints.
                    //
                    // NOTE 2: Removing the endpoint from `IEndpointManager` is safe and existing
                    // backends will continue to work with their existing behavior (until those backends are updated)
                    // and the Garbage Collector won't destroy this backend object while it's referenced elsewhere.
                    _logger.LogDebug("Endpoint {endpointId} has been removed.", existingEndpoint.EndpointId);
                    endpointManager.TryRemoveItem(existingEndpoint.EndpointId);
                }
            }
        }
Exemplo n.º 12
0
 public MacAddressReport(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
 public RegistrationQueryStringRequest(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 14
0
 protected AbstractUserCampusContract(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 15
0
 protected AbstractUrlContract(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 16
0
 public WebServiceAppender(IEndpointManager endpointManager)
 {
     _endpointManager = endpointManager;
 }
Exemplo n.º 17
0
 public IdentityQueryRequest(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 18
0
 public ChannelProxyFactory(IEndpointManager endpointManager, IConnectionManager connectionManager)
 {
     _endpointManager = endpointManager;
     _connectionManager = connectionManager;
 }
Exemplo n.º 19
0
 public SynchronousLogRequest(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 20
0
 protected AbstractStatusInfoContract(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 21
0
 public StatusInfoRequest(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
 protected AbstractGetCertificateContract(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
 protected AbstractComputerNameContract(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
 protected AbstractLocationQueryContract(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 25
0
 public UserCampusRequest(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 26
0
 public LocationQueryRequest(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 27
0
 public static PhysicalAddress GetActiveMacAddress(IEndpointManager endpointManager)
 {
     var address = GetActiveIpAddress(endpointManager);
     var adapter = GetAdapterForIpAddress(address);
     return adapter == null ? null : adapter.GetPhysicalAddress();
 }
Exemplo n.º 28
0
        public static IPAddress GetActiveIpAddress(IEndpointManager endpointManager)
        {
            try
            {
                var primaryAdapter = GetPrimaryAdapter(endpointManager.GetDefaultHost());
                if (primaryAdapter == null)
                    return GetIpAddressFromDns();

                foreach (var entry in primaryAdapter.GetIPProperties().UnicastAddresses
                    .Where(entry => entry.Address.AddressFamily == AddressFamily.InterNetwork))
                {
                    return entry.Address;
                }

                throw new Exception("Could not determine client ip address");
            }
            catch (Exception e)
            {
                Log.WarnFormat("An exception occurred while attempting to get this computer's ip address from primary adapter: {0}", e.Message);
                return null;
            }
        }
 protected AbstractIdentityQueryContract(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 30
0
 public static NetworkInterface GetPrimaryAdapter(IEndpointManager endpointManager)
 {
     return GetPrimaryAdapter(endpointManager.GetDefaultHost());
 }
Exemplo n.º 31
0
 /// <inheritdoc/>
 public IBackendProber CreateBackendProber(string backendId, BackendConfig config, IEndpointManager endpointManager)
 {
     return(new BackendProber(backendId, config, endpointManager, _timer, _loggerFactory.CreateLogger <BackendProber>(), _operationLogger, _httpClientFactory.CreateHttpClient(), _randomFactory));
 }
Exemplo n.º 32
0
 public StandardTokens(ISettingsManager settingsManager, IEndpointManager endpointManager, IAppearanceManager appearanceManager)
 {
     _settingsManager = settingsManager;
     _endpointManager = endpointManager;
     _appearanceManager = appearanceManager;
 }
Exemplo n.º 33
0
 public RegisterComputerRequest(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
 protected AbstractAuthenticationContract(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
Exemplo n.º 35
0
 public GetCertificateRequest(IEndpointManager endpointManager)
     : base(endpointManager)
 {
 }
 public HubProtocolConnectionManager(IEndpointManager endpointManager)
 {
     Protocols = SetupProtocols(endpointManager);
     Connect();
 }