#include <ui_MsgWriter.h>

Definition at line 30 of file ui_MsgWriter.h.
Public Member Functions | |
| ui_MsgWriter (const cmn_Path &a_fileOut, i_UIMessageServer_ptr a_uims, bool a_removeUimsInDestructor=true) | |
| ui_MsgWriter (i_UIMessageServer_ptr a_uims, bool a_removeUimsInDestructor=true) | |
| ~ui_MsgWriter () | |
| cmn_Path | GetStreamPath () |
| void | SetStreamPath (const cmn_Path &a_streamPath) |
| void | DisplayResult (const i_UIResult_t &a_res) |
| void | DisplayError (const string &a_error) |
| void | DisplayWarning (const string &a_error) |
| void | DisplayMessage (const string &a_message, bool a_addTime=true) |
| void | RemoveUI () |
| i_UIMessageServer_ptr | GetMessageServer () |
| void | TruncFile () |
| void | OpenFile (const cmn_Path &a_fileOut) |
| void | CloseFile () |
Public Attributes | |
| log_CLASSID_m | |
Private Attributes | |
| i_UIMessageServer_var | m_ui |
| cmn_File | m_streamOut |
| bool | m_streamActive |
| bool | m_uiActive |
| bool | m_removeUimsInDestructor |
| ui_MsgWriter::ui_MsgWriter | ( | const cmn_Path & | a_fileOut, | |
| i_UIMessageServer_ptr | a_uims, | |||
| bool | a_removeUimsInDestructor = true | |||
| ) |
Definition at line 41 of file ui_MsgWriter.cpp.
References dbg_NORM, log_DBG_m, log_FUNC_A_m, m_ui, m_uiActive, and OpenFile().
00045 : 00046 m_uiActive(!CORBA::is_nil(a_uims)), 00047 m_removeUimsInDestructor(a_removeUimsInDestructor) 00048 { 00049 log_FUNC_A_m(ui_MsgWriter, "removeUimsInDestructor " << boolalpha << 00050 a_removeUimsInDestructor); 00051 00052 OpenFile(a_fileOut); 00053 00054 if (m_uiActive) { 00055 log_DBG_m(dbg_NORM,"a_uims active."); 00056 m_ui = i_UIMessageServer::_duplicate(a_uims); 00057 } 00058 00059 } //============================================================================//

| ui_MsgWriter::ui_MsgWriter | ( | i_UIMessageServer_ptr | a_uims, | |
| bool | a_removeUimsInDestructor = true | |||
| ) |
Definition at line 63 of file ui_MsgWriter.cpp.
References dbg_NORM, log_DBG_m, log_FUNC_A_m, m_ui, and m_uiActive.
00064 : 00065 m_streamActive(false), 00066 m_uiActive(!CORBA::is_nil(a_uims)), 00067 m_removeUimsInDestructor(a_removeUimsInDestructor) 00068 { 00069 log_FUNC_A_m(ui_MsgWriter, "removeUimsInDestructor " << boolalpha << 00070 a_removeUimsInDestructor); 00071 00072 if (m_uiActive) { 00073 log_DBG_m(dbg_NORM,"a_uims active."); 00074 m_ui = i_UIMessageServer::_duplicate(a_uims); 00075 } 00076 } //============================================================================//
| ui_MsgWriter::~ui_MsgWriter | ( | ) |
Definition at line 80 of file ui_MsgWriter.cpp.
References CloseFile(), dbg_LOW, ipc_EXEC_m, log_DBG_m, log_FUNC_m, m_removeUimsInDestructor, and RemoveUI().
00080 { 00081 log_FUNC_m(~ui_MsgWriter); 00082 00083 try { 00084 CloseFile(); 00085 ipc_EXEC_m( 00086 if (m_removeUimsInDestructor) { 00087 RemoveUI(); 00088 } 00089 ); 00090 } 00091 catch (ivd_Exception& e) { 00092 log_DBG_m(dbg_LOW, e ); 00093 } 00094 catch (ivd_InternalError& e) { 00095 log_DBG_m(dbg_LOW, e ); 00096 } 00097 catch (...) { 00098 log_DBG_m(dbg_LOW, "unknown exception cought" ); 00099 } 00100 00101 00102 // else if (m_uiActiv) { 00103 // CORBA::release(m_ui); 00104 // } 00105 }

| cmn_Path ui_MsgWriter::GetStreamPath | ( | ) | [inline] |
Definition at line 54 of file ui_MsgWriter.h.
References cmn_File::GetFullPathRef().
Referenced by i_MediumCheckJob_i::CompleteJob().
00054 { return m_streamOut.GetFullPathRef(); };


| void ui_MsgWriter::SetStreamPath | ( | const cmn_Path & | a_streamPath | ) | [inline] |
Definition at line 55 of file ui_MsgWriter.h.
References cmn_File::SetFullPath().
00055 { 00056 m_streamOut.SetFullPath(a_streamPath); 00057 };

| void ui_MsgWriter::DisplayResult | ( | const i_UIResult_t & | a_res | ) |
Definition at line 109 of file ui_MsgWriter.cpp.
References ipc_EXEC_m, log_FUNC_m, m_streamActive, m_ui, and m_uiActive.
00109 { 00110 log_FUNC_m(DisplayResult); 00111 if (m_streamActive) { 00112 // m_streamOut << a_res; 00113 } 00114 if (m_uiActive) { 00115 try { 00116 ipc_EXEC_m( 00117 m_ui->DisplayResult(a_res); 00118 ); 00119 } 00120 catch (...) { 00121 m_uiActive = false; 00122 } 00123 } 00124 }
| void ui_MsgWriter::DisplayError | ( | const string & | a_error | ) |
Definition at line 128 of file ui_MsgWriter.cpp.
References ipc_EXEC_m, log_FUNC_m, m_streamActive, m_streamOut, m_ui, m_uiActive, and cmn_File::WriteF().
Referenced by i_MediumDupl_i::CheckTargetMedium(), i_AdminJob_i::CloseVolume(), i_MaintFriJob_i::CompleteJob(), i_AdminJob_i::DetectVolumeHeader(), i_AdminJob_i::DoInitialize(), i_RecreatedIVDFSJob_i::Execute(), i_MediumCheckJob_i::Execute(), i_FSCCheckJob_i::Execute(), i_AdminJob_i::Format(), i_AdminJob_i::Initialize(), i_AdminJob_i::InitializeSingleVolume(), i_AdminJob_i::OperateLA(), i_MediumDupl_i::Process(), i_AdminJob_i::RecreateFRIandMIC(), i_AdminJob_i::StartBEA(), and i_MaintFriJob_i::~i_MaintFriJob_i().
00128 { 00129 log_FUNC_m(DisplayError); 00130 if (m_streamActive) { 00131 string msgStr = a_error; 00132 msgStr.append("\n"); 00133 m_streamOut.WriteF(msgStr.c_str(), msgStr.length()); 00134 } 00135 if (m_uiActive) { 00136 try { 00137 ipc_EXEC_m( 00138 m_ui->DisplayError(a_error.c_str()); 00139 ); 00140 } 00141 catch (...) { 00142 m_uiActive = false; 00143 } 00144 } 00145 }


| void ui_MsgWriter::DisplayWarning | ( | const string & | a_error | ) |
Definition at line 149 of file ui_MsgWriter.cpp.
References ipc_EXEC_m, log_FUNC_m, m_streamActive, m_streamOut, m_ui, m_uiActive, and cmn_File::WriteF().
Referenced by pm_JobMgr::CheckFSCvsIVDFS(), i_AdminJob_i::CheckVolumesForFriMicJob(), i_MaintFriJob_i::CompleteJob(), i_RecreatedIVDFSJob_i::Execute(), i_AdminJob_i::Format(), i_RedundantCopyJob_i::i_RedundantCopyJob_i(), i_AdminJob_i::Initialize(), i_AdminJob_i::InitializeSingleVolume(), i_MaintFriJob_i::PrepareMedium(), and i_AdminJob_i::~i_AdminJob_i().
00149 { 00150 log_FUNC_m(DisplayWarning); 00151 if (m_streamActive) { 00152 string msgStr = a_error; 00153 msgStr.append("\n"); 00154 m_streamOut.WriteF(msgStr.c_str(), msgStr.length()); 00155 } 00156 if (m_uiActive) { 00157 try { 00158 ipc_EXEC_m( 00159 m_ui->DisplayWarning(a_error.c_str()); 00160 ); 00161 } 00162 catch (...) { 00163 m_uiActive = false; 00164 } 00165 } 00166 }


| void ui_MsgWriter::DisplayMessage | ( | const string & | a_message, | |
| bool | a_addTime = true | |||
| ) |
Definition at line 170 of file ui_MsgWriter.cpp.
References cmn_Time::c_Time2YMDhms(), dbg_DETAIL, ipc_EXEC_m, log_DBG_m, log_FUNC_m, m_streamActive, m_streamOut, m_ui, m_uiActive, and cmn_File::WriteF().
Referenced by i_MediumDupl_i::AssignResources(), TreeWalk::CheckDir(), FileInfoCache::CheckFiles(), i_MaintFriJob_i::CheckReadFri(), i_MediumDupl_i::CheckTargetMedium(), i_AdminJob_i::CheckVolumesForFormatAndInit(), i_AdminJob_i::CheckVolumesForVolumeClose(), i_FSC_i::CheckWithMedVolume(), i_AdminJob_i::CloseVolume(), i_ReorgJob_i::CompleteJob(), i_MediumDupl_i::CompleteJob(), i_MediumCheckJob_i::CompleteJob(), i_FSC_i::DelExpiredFiles(), i_AdminJob_i::DetectVolumeHeader(), fsc_VolumeCheck::DisplayMessage(), i_AdminJob_i::DoInitialize(), i_ReorgScanJob_i::Execute(), i_ReorgJob_i::Execute(), i_RedundantCopyJob_i::Execute(), i_RecreatedIVDFSJob_i::Execute(), i_MediumDupl_i::Execute(), i_MediumCheckJob_i::Execute(), i_DelExpiredFilesJob_i::Execute(), i_AdminJob_i::Execute(), fsc_nsFSrecovery::FlushBlock(), fsc_ColectorExpFile::FlushPackage(), i_AdminJob_i::Format(), i_MaintFriJob_i::i_MaintFriJob_i(), i_MediumCheckJob_i::i_MediumCheckJob_i(), i_MediumDupl_i::i_MediumDupl_i(), i_RecoveryJob_i::i_RecoveryJob_i(), i_RedundantCopyJob_i::i_RedundantCopyJob_i(), i_ReorgJob_i::i_ReorgJob_i(), i_ThreadJob_i::i_ThreadJob_i(), i_AdminJob_i::Initialize(), i_ReorgJob_i::InitializeSingleVolume(), i_AdminJob_i::InitializeSingleVolume(), i_ReorgJob_i::InitializeVolumes(), i_AdminJob_i::InitJob(), i_FSC_i::IVDFSRecovery(), i_ReorgJob_i::MediumOperationComplete(), i_RedundantCopyJob_i::MediumOperationComplete(), i_MediumDupl_i::MediumOperationComplete(), i_MaintFriJob_i::MediumOperationComplete(), i_ReorgJob_i::MigrateFiles(), i_RedundantCopyJob_i::MigrateFiles(), nsc_ScanForIVDFSRecovery(), i_AdminJob_i::OperateLA(), i_MediumDupl_i::PreFormat(), i_RedundantCopyJob_i::Prepare(), i_MediumDupl_i::Process(), i_MaintFriJob_i::Process(), i_RecoveryJob_i::ProcessFRI(), i_MediumCheckJob_i::ProcessFRI(), i_ReorgJob_i::ReadSourceVolume(), i_ReorgJob_i::RecallFiles(), i_RedundantCopyJob_i::RecallFiles(), i_AdminJob_i::RecreateFRIandMIC(), TreeWalk::Report(), fsc_VolumeCheck::RestDataHandle(), i_AdminJob_i::StartBEA(), TreeWalk::TreeWalk(), i_AdminJob_i::~i_AdminJob_i(), i_MaintFriJob_i::~i_MaintFriJob_i(), i_RedundantCopyJob_i::~i_RedundantCopyJob_i(), and i_ThreadJob_i::~i_ThreadJob_i().
00170 { 00171 log_FUNC_m(DisplayMessage); 00172 00173 ostringstream msg; 00174 00175 if (a_addTime) { 00176 cmn_Time nowTime; 00177 msg << "[" << nowTime.c_Time2YMDhms() << "] " << a_message; 00178 } 00179 else { 00180 msg << a_message; 00181 } 00182 00183 if (m_streamActive) { 00184 string msgStr = msg.str().append("\n"); 00185 m_streamOut.WriteF(msgStr.c_str(), msgStr.length()); 00186 00187 } 00188 if (m_uiActive) { 00189 try { 00190 log_DBG_m(dbg_DETAIL," msg: " << a_message); 00191 ipc_EXEC_m( 00192 m_ui->DisplayMessage(CORBA::string_dup(msg.str().c_str())); 00193 ); 00194 } 00195 catch(ivd_Exception& e) { 00196 log_DBG_m(dbg_DETAIL, e << ": Message server not accessible."); 00197 m_uiActive = false; 00198 } 00199 catch (...) { 00200 log_DBG_m(dbg_DETAIL, "Message server not accessible."); 00201 m_uiActive = false; 00202 } 00203 } 00204 }

| void ui_MsgWriter::RemoveUI | ( | ) |
Definition at line 208 of file ui_MsgWriter.cpp.
References dbg_DETAIL, ipc_EXEC_m, log_DBG_m, log_FUNC_m, m_ui, and m_uiActive.
Referenced by ~ui_MsgWriter().
00208 { 00209 log_FUNC_m(RemoveUI); 00210 00211 if (m_uiActive) { 00212 try { 00213 ipc_EXEC_m( 00214 m_ui->Remove(); 00215 ); 00216 } 00217 catch (...) { 00218 // empty 00219 } 00220 log_DBG_m(dbg_DETAIL, "CORBA UI stopped"); 00221 } 00222 m_uiActive = false; 00223 }

| i_UIMessageServer_ptr ui_MsgWriter::GetMessageServer | ( | ) |
Definition at line 227 of file ui_MsgWriter.cpp.
References log_FUNC_m, and m_ui.
Referenced by i_FSCCheckJob_i::Execute().
00227 { 00228 log_FUNC_m(GetMessageServer); 00229 try { 00230 if (!CORBA::is_nil(m_ui) && !m_ui->_non_existent()){ 00231 i_UIMessageServer_ptr ui = i_UIMessageServer::_duplicate(m_ui); 00232 return ui; 00233 } else { 00234 return i_UIMessageServer::_nil(); 00235 } 00236 } catch (...) { 00237 //ignore all errors, just return nil 00238 return i_UIMessageServer::_nil(); 00239 } 00240 }

| void ui_MsgWriter::TruncFile | ( | ) |
Definition at line 244 of file ui_MsgWriter.cpp.
References dbg_DETAIL, cmn_File::GetFullPathRef(), cmn_File::IsOpen(), log_DBG_m, log_FUNC_m, m_streamOut, OpenFile(), and cmn_File::TruncF().
00244 { 00245 log_FUNC_m(TruncFile); 00246 if (!m_streamOut.IsOpen()) { 00247 OpenFile(m_streamOut.GetFullPathRef()); 00248 } 00249 00250 m_streamOut.TruncF(); 00251 log_DBG_m(dbg_DETAIL, "Trunc file " << m_streamOut.GetFullPathRef()); 00252 }

| void ui_MsgWriter::OpenFile | ( | const cmn_Path & | a_fileOut | ) |
Definition at line 256 of file ui_MsgWriter.cpp.
References dbg_DETAIL, fom_OPEN_ALWAYS, fom_WRITE, log_DBG_m, log_FUNC_m, m_streamActive, m_streamOut, cmn_File::OpenF(), cmn_File::SeekEndF(), and cmn_File::SetFullPath().
Referenced by i_MediumCheckJob_i::i_MediumCheckJob_i(), TruncFile(), and ui_MsgWriter().
00256 { 00257 log_FUNC_m(OpenFile); 00258 if (!a_fileOut.empty()) { 00259 m_streamOut.SetFullPath(a_fileOut); 00260 } 00261 try { 00262 m_streamOut.OpenF(fom_OPEN_ALWAYS | fom_WRITE); 00263 m_streamOut.SeekEndF(); 00264 m_streamActive = true; 00265 } catch (...) { 00266 m_streamActive = false; 00267 } 00268 log_DBG_m(dbg_DETAIL, "Open file " << a_fileOut << 00269 " status " << m_streamActive); 00270 }


| void ui_MsgWriter::CloseFile | ( | ) |
Definition at line 274 of file ui_MsgWriter.cpp.
References cmn_File::CloseF(), m_streamActive, and m_streamOut.
Referenced by ~ui_MsgWriter().
00274 { 00275 if (m_streamActive) { 00276 m_streamActive = false; 00277 m_streamOut.CloseF(); 00278 } 00279 }


Definition at line 42 of file ui_MsgWriter.h.
i_UIMessageServer_var ui_MsgWriter::m_ui [private] |
Definition at line 45 of file ui_MsgWriter.h.
Referenced by DisplayError(), DisplayMessage(), DisplayResult(), DisplayWarning(), GetMessageServer(), RemoveUI(), and ui_MsgWriter().
cmn_File ui_MsgWriter::m_streamOut [private] |
Definition at line 46 of file ui_MsgWriter.h.
Referenced by CloseFile(), DisplayError(), DisplayMessage(), DisplayWarning(), OpenFile(), and TruncFile().
bool ui_MsgWriter::m_streamActive [private] |
Definition at line 48 of file ui_MsgWriter.h.
Referenced by CloseFile(), DisplayError(), DisplayMessage(), DisplayResult(), DisplayWarning(), and OpenFile().
bool ui_MsgWriter::m_uiActive [private] |
Definition at line 49 of file ui_MsgWriter.h.
Referenced by DisplayError(), DisplayMessage(), DisplayResult(), DisplayWarning(), RemoveUI(), and ui_MsgWriter().
bool ui_MsgWriter::m_removeUimsInDestructor [private] |
1.5.6