Beispiel #1
0
        public OrchestratorService()
        {
            Int32.TryParse(ConfigurationManager.AppSettings[config.AppConfigSettingsConstants.DashboardCleanupTime], out _dashboardCleanupTime);
            Int32.TryParse(ConfigurationManager.AppSettings[config.AppConfigSettingsConstants.CronSchedule], out _cronSchedule);
            // Set up
            _allConfigs                  = new ThreadSafeWorkStack();
            _extractors                  = new ThreadSafeExtractorList();
            _workStack                   = new ThreadSafeWorkStack();
            _activeExtractions           = new ThreadSafeWorkStack();
            _completedExtractions        = new ThreadSafeWorkStack();
            _erroredExtractions          = new ThreadSafeWorkStack();
            _myHostName                  = ConfigurationManager.AppSettings[config.AppConfigSettingsConstants.OrchestratorHostName];
            _report.OrchestratorHostName = _myHostName;
            _listeningPort               = Convert.ToInt32(ConfigurationManager.AppSettings[config.AppConfigSettingsConstants.OrchestratorListeningPort]);
            _myIp = IPv4Helper.getIPv4Address();

            // Determine what type of SQL database we are using
            String sqlProvider      = ConfigurationManager.AppSettings[config.AppConfigSettingsConstants.SqlProvider];
            String connectionString = ConfigurationManager.AppSettings[config.AppConfigSettingsConstants.SqlConnectionString];

            _sqlDao = new SqlDaoFactory().getSqlDao(new SqlConnectionFactory().getConnection(sqlProvider, connectionString));

            // make own unique list of sitecodes
            VistaDao vistaDao = new VistaDao();

            string[] sitecode = new string[vistaDao.SiteCodes.Count];
            vistaDao.SiteCodes.CopyTo(sitecode, 0);
            _vhaSites = new List <string>(sitecode);

            if (_vhaSites == null || _vhaSites.Count == 0)
            {
                _report.addException(new ApplicationException("Failed to open the VHA site file!"));
                throw new ApplicationException("Failed to open the VHA site file!");
            }
        }
Beispiel #2
0
        void setHostName(SocketContainer srv)
        {
            String configHostName = ConfigurationManager.AppSettings[config.AppConfigSettingsConstants.ServerHostName];

            if (!String.IsNullOrEmpty(configHostName))
            {
                srv.HostName = configHostName;
            }
            else
            {
                srv.HostName = IPv4Helper.getIPv4Address().ToString(); // want IP address for hostname
            }
        }
Beispiel #3
0
        /// <summary>
        /// Connect to a specified endpoint
        /// </summary>
        /// <param name="hostname">The hostname to connect to</param>
        /// <param name="port">The port the host is listening on</param>
        public void connect(string hostname, int port)
        {
            // if args not supplied then set to config file values
            if (String.IsNullOrEmpty(hostname))
            {
                hostname = _serverIp.ToString();
            }
            if (port == 0)
            {
                port = _serverPort;
            }
            IPAddress remoteHost = IPv4Helper.getIPv4Address();

            TcpClient client = new TcpClient();

            client.Connect(hostname, port);
            _connection = client;
        }