#include <bea_medium.h>


Definition at line 74 of file bea_medium.h.
| bea_Medium::bea_Medium | ( | ) |
Definition at line 44 of file bea_medium.cpp.
References cmn_GetEnvVariable(), dbg_LOW, log_DBG_m, log_FUNC_m, m_doMediaLog, and medLogName_c().
00045 : m_mediumFamily(bmf_UNKNOWN), 00046 m_mediumType(bmt_UNKNOWN), 00047 m_worm(false), 00048 m_size(0), 00049 m_currentVolume(0), 00050 m_mediumMem(NULL), 00051 m_doMediaLog(true) { 00052 00053 log_FUNC_m(bea_Medium); 00054 00055 string medLog = cmn_GetEnvVariable(medLogName_c); 00056 00057 if (medLog == "no" || medLog == "false" || medLog == "0") { 00058 00059 log_DBG_m(dbg_LOW, 00060 medLogName_c << " = " << medLog << ": Media logging disabled."); 00061 00062 m_doMediaLog = false; 00063 }; 00064 00065 // Refresh() must be called in the constructors of the 00066 // derived classes. 00067 }

| bea_Medium::~bea_Medium | ( | ) | [virtual] |
Definition at line 71 of file bea_medium.cpp.
References DeleteVolumes(), and log_FUNC_m.
00071 { 00072 log_FUNC_m(~bea_Medium); 00073 00074 DeleteVolumes(); 00075 }

| UInt32_t bea_Medium::GetSize | ( | ) | const |
Definition at line 80 of file bea_medium.cpp.
References m_size.
Referenced by bea_DiskMedium::Format(), bea_DiskMedium::Refresh(), and bea_TapeMedium::RefreshTapeInfo().
00080 { 00081 return m_size; 00082 }

| UInt32_t bea_Medium::GetVolumeCount | ( | ) | const |
Definition at line 199 of file bea_medium.cpp.
References m_volumes.
Referenced by bea_DiskMedium::AppendVolume(), bea_TapeMedium::Format(), bea_DiskMedium::Format(), bea_Volume::ReadVolInfoFromMediumMem(), and bea_TapeMedium::RefreshMemoryInfo().
00199 { 00200 return m_volumes.size(); 00201 }

| bea_Volume * bea_Medium::GetVolume | ( | UInt32_t | a_volNum | ) |
Definition at line 205 of file bea_medium.cpp.
References ie_INVALID_ARG, ie_MEDIUM_MEDERR, ivd_Error, log_FUNC_m, and m_volumes.
Referenced by bea_FRI::bea_FRI(), i_BackEndAgent_i::CloseMediumVolume(), bea_FRIThread::EraseSysVol(), bea_TapeMedium::Format(), bea_DiskMedium::Format(), GetCurrentVolume(), bea_MigrationThread::PrepareVolume(), i_BackEndAgent_i::ReadIDs(), and i_BackEndAgent_i::VerifyIDs().
00205 { 00206 if (a_volNum < 1) { 00207 log_FUNC_m(GetVolume); 00208 throw ivd_Error(ie_INVALID_ARG, "Volume numbers start with 1!"); 00209 } 00210 00211 if (m_volumes.size() == 0) { 00212 throw ivd_Error( 00213 ie_MEDIUM_MEDERR, "Medium doesn't contain any volumes.", true); 00214 } 00215 00216 if (a_volNum > m_volumes.size()) { 00217 ostringstream sstr; 00218 sstr 00219 << "Medium volume index overflow: " 00220 << a_volNum << " > " << m_volumes.size(); 00221 throw ivd_Error(ie_INVALID_ARG, sstr.str(), true); 00222 } 00223 00224 return m_volumes.at(a_volNum-1); 00225 }

| bea_Volume * bea_Medium::GetCurrentVolume | ( | ) |
Definition at line 229 of file bea_medium.cpp.
References GetVolume(), and m_currentVolume.
Referenced by bea_DupWriteThread::AppendVolume(), bea_TapeMedium::ChangeVolume(), bea_DiskMedium::ChangeVolume(), bea_FRI::CloseVolume(), bea_FRI::CreateFRI(), bea_FRI::PositionToStartOfFRI(), bea_MigrationThread::PrepareVolume(), bea_FRIThread::ProcessFromDataVol(), bea_FRIThread::ReadFromSysVol(), bea_DupReadThread::ReadMedVolume(), bea_RecallThread::Recall(), and bea_DupWriteThread::WriteMedVolume().
00229 { 00230 return GetVolume(m_currentVolume); 00231 }


| UInt32_t bea_Medium::GetSysVolNumber | ( | ) | const |
Definition at line 235 of file bea_medium.cpp.
References m_volumes, and bea_VolInfo_t::sysVolNum.
Referenced by bea_FRI::bea_FRI(), bea_FRI::CloseVolume(), bea_FRIThread::EraseSysVol(), and bea_FRIThread::ReadFromSysVol().
00235 { 00236 if (m_volumes.size() == 0) { 00237 return 0; 00238 } 00239 //#warning Check if this works properly without MIC. 00240 // Warning: May implicitelly read from MIC. 00241 const bea_VolInfo_t& vi = m_volumes[0]->GetVolumeInfo(); 00242 return vi.sysVolNum; 00243 }

| UInt32_t bea_Medium::GetCurVolNumber | ( | ) | const |
Definition at line 247 of file bea_medium.cpp.
References m_currentVolume.
Referenced by bea_Volume::Init(), bea_FRI::PositionToStartOfFRI(), bea_MigrationThread::PrepareVolume(), bea_TapeMedium::ReadCurrentVolume(), bea_DiskMedium::ReadCurrentVolume(), bea_TapeVolume::ReadEstimSizes(), bea_DiskVolume::ReadEstimSizes(), bea_DupReadThread::ReadMedVolume(), bea_Volume::ReadVolInfoFromHeader(), bea_RecallThread::Recall(), and bea_DupWriteThread::WriteMedVolume().
00247 { 00248 return m_currentVolume; 00249 }

Implemented in bea_DiskMedium, and bea_TapeMedium.
Referenced by bea_FRI::CloseVolume(), bea_FRIThread::EraseSysVol(), bea_Volume::Init(), bea_FRI::PositionToStartOfFRI(), bea_MigrationThread::PrepareVolume(), bea_FRIThread::ProcessFromDataVol(), bea_FRIThread::ReadFromSysVol(), i_BackEndAgent_i::ReadIDs(), bea_DupReadThread::ReadMedVolume(), bea_RecallThread::Recall(), and bea_DupWriteThread::WriteMedVolume().

| virtual UInt32_t bea_Medium::ReadCurrentVolume | ( | ) | [pure virtual] |
Implemented in bea_DiskMedium, and bea_TapeMedium.
| virtual void bea_Medium::Format | ( | vector< UInt32_t > | a_volSizes, | |
| bool | a_duplAITMode | |||
| ) | [pure virtual] |
Implemented in bea_DiskMedium, and bea_TapeMedium.
| virtual void bea_Medium::AppendVolume | ( | UInt32_t | a_volSize | ) | [pure virtual] |
Implemented in bea_DiskMedium, and bea_TapeMedium.
Referenced by bea_DupWriteThread::AppendVolume().

| void bea_Medium::SetBarcode | ( | const string & | a_barcode | ) |
Definition at line 85 of file bea_medium.cpp.
References df_TCMMedium_t::barcode, evt_WARNING, ivd_BaseException::GetFriendly(), GetJobID(), bea_MediumMemory::GetMediumRecord(), IsMediumMemValid(), log_FUNC_A_m, log_WriteEvent(), log_WRN_m, m_barcode, m_mediumMem, and bea_MediumMemory::UpdateMediumRecord().
Referenced by bea_DiskMedium::bea_DiskMedium(), bea_TapeDrive::Open(), and bea_DiskDrive::Open().
00085 { 00086 log_FUNC_A_m(SetBarcode, "bc: " << a_barcode); 00087 00088 if (m_barcode != a_barcode) { 00089 if (!m_barcode.empty()) { 00090 ostringstream sstr; 00091 sstr 00092 << "Barcode of this medium changed from " 00093 << m_barcode << " to " << a_barcode << "."; 00094 00095 log_WriteEvent( 00096 evt_WARNING, sstr.str(), "", GetJobID(), m_barcode); 00097 }; 00098 m_barcode = a_barcode; 00099 00100 // Update CM with new barcode 00101 if (IsMediumMemValid()) { 00102 try { 00103 df_TCMMedium_t mr = m_mediumMem->GetMediumRecord(); 00104 memcpy(mr.barcode, m_barcode.data(), m_barcode.length()); 00105 mr.barcode[m_barcode.length()] = '\0'; 00106 m_mediumMem->UpdateMediumRecord(mr); 00107 } 00108 catch (ivd_Exception &ie) { 00109 log_WRN_m( 00110 "Updating barcode in cartridge memory failed (" << m_barcode << "): " << ie.GetFriendly()); 00111 }; 00112 } 00113 }; 00114 }


| const string & bea_Medium::GetBarcode | ( | ) | const |
Definition at line 118 of file bea_medium.cpp.
References m_barcode.
Referenced by bea_DupWriteThread::AppendVolume(), bea_MigrationThread::CheckFRI(), bea_FRIThread::CheckFRI(), bea_FRIThread::EraseSysVol(), bea_TapeMedium::Format(), bea_MigrationThread::Migrate(), bea_MigrationThread::PrepareVolume(), bea_FRI::ReadFRIStart(), bea_Volume::ReadVolInfoFromHeader(), bea_TapeVolume::Rewind(), bea_DiskVolume::Rewind(), bea_VolumeReader::Run(), bea_TapeVolume::SeekBlock(), bea_DiskVolume::SeekBlock(), bea_TapeVolume::SeekEOD(), bea_DiskVolume::SeekEOD(), bea_TapeVolume::SeekFileMark(), bea_DiskVolume::SeekFileMark(), bea_Volume::UpdateMediumMem(), bea_MigrationThread::WriteBlock(), bea_TapeVolume::WriteFileMarks(), and bea_DiskVolume::WriteFileMarks().
00118 { 00119 return m_barcode; 00120 }

| UInt32_t bea_Medium::GetMediumFamily | ( | ) | const |
Definition at line 130 of file bea_medium.cpp.
References m_mediumFamily.
Referenced by bea_TapeMedium::AppendVolume(), bea_TapeMedium::Format(), bea_Volume::MustDumpFRI(), i_BackEndAgent_i::MustReadPosition(), and bea_TapeVolume::ReadEstimSizes().
00130 { 00131 return m_mediumFamily; 00132 }

| UInt32_t bea_Medium::GetMediumType | ( | ) | const |
Definition at line 124 of file bea_medium.cpp.
References m_mediumType.
00124 { 00125 return m_mediumType; 00126 }
| Int32_t bea_Medium::GetRMType | ( | ) | const |
Definition at line 136 of file bea_medium.cpp.
References bmt_AIT1, bmt_AIT2, bmt_AIT3, bmt_AIT5, bmt_DDS1, bmt_DDS2, bmt_DDS3, bmt_DDS4, bmt_DISK, bmt_LTO, bmt_LTO2, bmt_LTO3, bmt_LTO4, bmt_LTO5, bmt_SAIT1, bmt_VXA320, m_mediumType, m_worm, mt_AIT_1, mt_AIT_1_WORM, mt_AIT_2, mt_AIT_2_WORM, mt_AIT_3, mt_AIT_3_WORM, mt_AIT_5, mt_AIT_5_WORM, mt_DDS_1, mt_DDS_2, mt_DDS_3, mt_DDS_4, mt_DISK, mt_LTO_1, mt_LTO_2, mt_LTO_3, mt_LTO_3_WORM, mt_LTO_4, mt_LTO_4_WORM, mt_LTO_5, mt_SAIT_1, mt_UNKNOWN, and mt_VXA_320.
Referenced by bea_RecallThread::Recall().
00136 { 00137 if (!m_worm) { 00138 switch (m_mediumType) { 00139 case bmt_DDS1: return mt_DDS_1; 00140 case bmt_DDS2: return mt_DDS_2; 00141 case bmt_DDS3: return mt_DDS_3; 00142 case bmt_DDS4: return mt_DDS_4; 00143 case bmt_AIT1: return mt_AIT_1; 00144 case bmt_AIT2: return mt_AIT_2; 00145 case bmt_AIT3: return mt_AIT_3; 00146 case bmt_AIT5: return mt_AIT_5; 00147 case bmt_SAIT1: return mt_SAIT_1; 00148 case bmt_LTO : return mt_LTO_1; 00149 case bmt_LTO2: return mt_LTO_2; 00150 case bmt_LTO3: return mt_LTO_3; 00151 case bmt_LTO4: return mt_LTO_4; 00152 case bmt_LTO5: return mt_LTO_5; 00153 case bmt_DISK: return mt_DISK; 00154 case bmt_VXA320: return mt_VXA_320; 00155 default: return mt_UNKNOWN; 00156 } 00157 } 00158 else { 00159 switch (m_mediumType) { 00160 case bmt_AIT1: return mt_AIT_1_WORM; 00161 case bmt_AIT2: return mt_AIT_2_WORM; 00162 case bmt_AIT3: return mt_AIT_3_WORM; 00163 case bmt_AIT5: return mt_AIT_5_WORM; 00164 case bmt_LTO3: return mt_LTO_3_WORM; 00165 case bmt_LTO4: return mt_LTO_4_WORM; 00166 default: return mt_UNKNOWN; 00167 } 00168 } 00169 }

| Int32_t bea_Medium::GetRMFamily | ( | ) | const |
Definition at line 173 of file bea_medium.cpp.
References bmf_AIT, bmf_DDS, bmf_DISK, bmf_LTO, bmf_SAIT, bmf_VXA, m_mediumFamily, mf_AIT, mf_DDS, mf_DISK, mf_LTO, mf_SAIT, mf_UNKNOWN, and mf_VXA.
00173 { 00174 switch (m_mediumFamily) { 00175 case bmf_DDS : return mf_DDS; 00176 case bmf_AIT : return mf_AIT; 00177 case bmf_SAIT: return mf_SAIT; 00178 case bmf_LTO : return mf_LTO; 00179 case bmf_DISK: return mf_DISK; 00180 case bmf_VXA: return mf_VXA; 00181 default: return mf_UNKNOWN; 00182 } 00183 }
| const string & bea_Medium::GetSerialNumber | ( | ) | const |
Definition at line 193 of file bea_medium.cpp.
References m_serialNum.
00193 { 00194 return m_serialNum; 00195 }
| bool bea_Medium::IsWORM | ( | ) | const |
Definition at line 187 of file bea_medium.cpp.
References m_worm.
Referenced by bea_FRI::CreateFRI(), bea_FRI::DeleteFRIOnVolume(), bea_FRIThread::EraseSysVol(), bea_TapeMedium::Format(), and bea_Volume::Init().
00187 { 00188 return m_worm; 00189 }

| bool bea_Medium::IsMediumMemDetected | ( | ) |
Definition at line 253 of file bea_medium.cpp.
References dbg_LOW, bea_MediumMemory::IsDetected(), log_DBG_m, log_FUNC_m, m_mediumMem, and NULL.
Referenced by bea_Volume::UpdateMediumMem().
00253 { 00254 log_FUNC_m(IsMediumMemDetected); 00255 if (m_mediumMem == NULL) { 00256 log_DBG_m(dbg_LOW, "Medium Memory object is NULL"); 00257 return false; 00258 } 00259 else { 00260 return m_mediumMem->IsDetected(); 00261 } 00262 }


| bool bea_Medium::IsMediumMemValid | ( | ) |
Definition at line 266 of file bea_medium.cpp.
References dbg_LOW, bea_MediumMemory::IsValid(), log_DBG_m, log_FUNC_m, m_mediumMem, and NULL.
Referenced by bea_TapeDrive::Close(), bea_MigrationThread::PrepareVolume(), bea_FRI::ReadFRI(), bea_Volume::ReadVolInfoFromMediumMem(), bea_RecallThread::Recall(), SetBarcode(), and bea_Volume::UpdateMediumMem().
00266 { 00267 log_FUNC_m(IsMediumMemValid); 00268 00269 if (m_mediumMem == NULL) { 00270 log_DBG_m(dbg_LOW, "Medium Memory object is NULL"); 00271 return false; 00272 } 00273 else { 00274 return m_mediumMem->IsValid(); 00275 } 00276 }


| bea_MediumMemory * bea_Medium::GetMediumMem | ( | ) |
Definition at line 280 of file bea_medium.cpp.
References m_mediumMem.
Referenced by bea_TapeDrive::Close(), bea_FRI::ReadFRI(), bea_Volume::ReadVolInfoFromMediumMem(), bea_RecallThread::Recall(), and bea_Volume::UpdateMediumMem().
00280 { 00281 // log_FUNC_m(GetMediumMem); 00282 return m_mediumMem; 00283 }

| void bea_Medium::SetJobID | ( | UInt64_t | a_jobID | ) |
Definition at line 287 of file bea_medium.cpp.
References m_jobID.
00287 { 00288 m_jobID = a_jobID; 00289 }
| UInt64_t bea_Medium::GetJobID | ( | ) | const |
Definition at line 293 of file bea_medium.cpp.
References m_jobID.
Referenced by bea_TapeMedium::ChangeVolume(), bea_DiskMedium::ChangeVolume(), bea_TapeMedium::Format(), bea_Volume::GetJobID(), and SetBarcode().
00293 { 00294 return m_jobID; 00295 }

| bool bea_Medium::DoMediumLogging | ( | ) | const |
Definition at line 299 of file bea_medium.cpp.
References m_doMediaLog.
Referenced by bea_TapeMedium::ChangeVolume(), bea_DiskMedium::ChangeVolume(), and bea_Volume::DoMediumLogging().
00299 { 00300 return m_doMediaLog; 00301 }

| virtual void bea_Medium::Refresh | ( | ) | [protected, pure virtual] |
Implemented in bea_DiskMedium, and bea_TapeMedium.
| void bea_Medium::SetSize | ( | UInt32_t | a_size | ) | [protected] |
Definition at line 307 of file bea_medium.cpp.
References m_size.
Referenced by bea_DiskMedium::Refresh(), and bea_TapeMedium::RefreshTapeInfo().
00307 { 00308 m_size = a_size; 00309 }

| void bea_Medium::SetCurrentVolume | ( | UInt32_t | a_volNumber | ) | [protected] |
Definition at line 313 of file bea_medium.cpp.
References ie_INVALID_ARG, ivd_Error, log_FUNC_m, and m_currentVolume.
Referenced by bea_TapeMedium::ChangeVolume(), bea_DiskMedium::ChangeVolume(), bea_TapeMedium::ReadCurrentVolume(), and bea_DiskMedium::ReadCurrentVolume().
00313 { 00314 if (a_volNumber < 1) { 00315 log_FUNC_m(SetCurrentVolume); 00316 throw ivd_Error(ie_INVALID_ARG, "Volume numbers start with 1!"); 00317 } 00318 m_currentVolume = a_volNumber; 00319 }

| void bea_Medium::SetWORM | ( | bool | a_isWorm | ) | [protected] |
Definition at line 322 of file bea_medium.cpp.
References m_worm.
Referenced by bea_TapeMedium::DetectAITWORM(), bea_TapeMedium::DetectLTOWORM(), bea_DiskMedium::Refresh(), and bea_TapeMedium::RefreshTapeInfo().
00322 { 00323 m_worm = a_isWorm; 00324 }

| void bea_Medium::SetMediumMem | ( | bea_MediumMemory *const | a_mm | ) | [protected] |
Definition at line 328 of file bea_medium.cpp.
References m_mediumMem.
Referenced by bea_TapeMedium::bea_TapeMedium().
00328 { 00329 m_mediumMem = a_mm; 00330 }

| void bea_Medium::DeleteVolumes | ( | ) | [protected] |
Definition at line 334 of file bea_medium.cpp.
References DeleteVolume(), and m_volumes.
Referenced by bea_DiskMedium::Refresh(), bea_TapeMedium::RefreshTapeInfo(), and ~bea_Medium().
00334 { 00335 for_each(m_volumes.begin(), m_volumes.end(), bea_Medium::DeleteVolume); 00336 m_volumes.clear(); 00337 m_volumes.reserve(50); 00338 }


| void bea_Medium::AddVolume | ( | bea_Volume *const | a_volume | ) | [protected] |
Definition at line 342 of file bea_medium.cpp.
References m_volumes.
Referenced by bea_DiskMedium::AppendVolume(), bea_DiskMedium::Refresh(), and bea_TapeMedium::RefreshTapeInfo().
00342 { 00343 m_volumes.push_back(a_volume); 00344 }

| void bea_Medium::DeleteVolume | ( | bea_Volume *const | a_volume | ) | [static, private] |
Definition at line 350 of file bea_medium.cpp.
Referenced by DeleteVolumes().

string bea_Medium::m_barcode [protected] |
Definition at line 114 of file bea_medium.h.
Referenced by bea_TapeMedium::ChangeVolume(), bea_DiskMedium::ChangeVolume(), GetBarcode(), bea_DiskMedium::Refresh(), bea_TapeMedium::RefreshMemoryInfo(), bea_TapeMedium::RefreshTapeInfo(), and SetBarcode().
string bea_Medium::m_serialNum [protected] |
Definition at line 115 of file bea_medium.h.
Referenced by GetSerialNumber(), bea_DiskMedium::Refresh(), bea_TapeMedium::RefreshMemoryInfo(), and bea_TapeMedium::RefreshTapeInfo().
UInt32_t bea_Medium::m_mediumFamily [protected] |
Definition at line 116 of file bea_medium.h.
Referenced by bea_TapeMedium::bea_TapeMedium(), GetMediumFamily(), GetRMFamily(), bea_DiskMedium::Refresh(), and bea_TapeMedium::RefreshTapeInfo().
UInt32_t bea_Medium::m_mediumType [protected] |
Definition at line 117 of file bea_medium.h.
Referenced by bea_TapeMedium::Format(), GetMediumType(), GetRMType(), bea_DiskMedium::Refresh(), and bea_TapeMedium::RefreshTapeInfo().
string bea_Medium::m_poolName [protected] |
Definition at line 118 of file bea_medium.h.
bea_Medium::log_CLASSID_m [private] |
bool bea_Medium::m_worm [private] |
UInt32_t bea_Medium::m_size [private] |
UInt32_t bea_Medium::m_currentVolume [private] |
Definition at line 136 of file bea_medium.h.
Referenced by GetCurrentVolume(), GetCurVolNumber(), and SetCurrentVolume().
vector<bea_Volume*> bea_Medium::m_volumes [private] |
Definition at line 137 of file bea_medium.h.
Referenced by AddVolume(), DeleteVolumes(), GetSysVolNumber(), GetVolume(), and GetVolumeCount().
bea_MediumMemory* bea_Medium::m_mediumMem [private] |
Reimplemented in bea_TapeMedium.
Definition at line 139 of file bea_medium.h.
Referenced by GetMediumMem(), IsMediumMemDetected(), IsMediumMemValid(), SetBarcode(), and SetMediumMem().
UInt64_t bea_Medium::m_jobID [private] |
bool bea_Medium::m_doMediaLog [private] |
1.5.6