/// <summary> /// Инициализация и настройска элементов системы. /// </summary> protected override void DoInitialize() { try { LoadConfiguration(); Logger.Info("Инициализация..."); opcConnection = new OpcConnectionHolder(configuration.opcConfiguration); opcConnection.SetHolderName(OPCHOLDER); opcConnection.SetCallback(this); oracleConnection = new OracleConnectionHolder(configuration.oracleConfiguration); oracleConnection.SetHolderName(ORACLEHOLDER); oracleConnection.SetCallback(this); wagsSqlConnection = new MsSqlConnectionHolder(configuration.wagsSqlConfiguration); wagsSqlConnection.SetHolderName(WAGSSQLHOLDER); wagsSqlConnection.SetCallback(this); bufferSqlConnection = new MsSqlConnectionHolder(configuration.bufSqlConfiguration); bufferSqlConnection.SetHolderName(BUFSQLHOLDER); bufferSqlConnection.SetCallback(this); wagstaffCurrdata = new DataReader(); wagstaffCurrdata.SetCallback(this); wagstaffCurrdata.SetConfiguration(configuration.WagstaffCurdataConfiguration); wagstaffCurrdata.SetOpcConnectionHolder(opcConnection); wagstaffActivator = new DataReaderActivator(); wagstaffActivator.SetOpcConnection(opcConnection); wagstaffActivator.SetDataReader(wagstaffCurrdata); wagstaffActivator.SetActivationItemName("[WAGT0]SYS_PV_StatePos"); mixerCurrData = new DataReader(); mixerCurrData.SetCallback(this); mixerCurrData.SetConfiguration(configuration.MixerCurrdataConfiguration); mixerCurrData.SetOpcConnectionHolder(opcConnection); its = new DataWriter(); its.SetOracleConnectionHolder(oracleConnection); buffer = new DataBuffer(); configuration.SetOracleConnection(oracleConnection); // для инициализации buffer.SetConfiguration(configuration); buffer.SetSqlConnection(bufferSqlConnection); buffer.SetDataWriter(its); buffer.SetAttemptsInterval(5 * 60 * 1000); // в миллисекундах castScheduleExport = new CastScheduleExport(); castScheduleExport.SetCheckingInterval(60 * 1000); castScheduleExport.SetOracleConnection(oracleConnection); castScheduleExport.SetSqlConnection(wagsSqlConnection); recipeImport = new RecipeImport(); recipeImport.SetCheckingInterval(60 * 1000); recipeImport.SetOracleConnection(oracleConnection); recipeImport.SetSqlConnection(wagsSqlConnection); opcConnection.OpenConnection(); oracleConnection.OpenConnection(); bufferSqlConnection.OpenConnection(); wagsSqlConnection.OpenConnection(); } catch (Exception ex) { Logger.Error(ex); } }
/// <summary> /// Установить DataWriter, в который производить попытки пересылки данных. /// </summary> /// <param name="aWriter">DataWriter.</param> public void SetDataWriter(DataWriter aWriter) { dataWriter = aWriter; }