bea_Medium Class Reference
[IVD Back-End Agent]

#include <bea_medium.h>

Inheritance diagram for bea_Medium:

Inheritance graph
[legend]
Collaboration diagram for bea_Medium:

Collaboration graph
[legend]

List of all members.


Detailed Description

Definition at line 74 of file bea_medium.h.


Public Member Functions

 bea_Medium ()
virtual ~bea_Medium ()
UInt32_t GetSize () const
UInt32_t GetVolumeCount () const
bea_VolumeGetVolume (UInt32_t a_volNum)
bea_VolumeGetCurrentVolume ()
UInt32_t GetSysVolNumber () const
UInt32_t GetCurVolNumber () const
virtual void ChangeVolume (UInt32_t a_volNum, UInt32_t a_block=0)=0
virtual UInt32_t ReadCurrentVolume ()=0
virtual void Format (vector< UInt32_t > a_volSizes, bool a_duplAITMode)=0
virtual void AppendVolume (UInt32_t a_volSize)=0
void SetBarcode (const string &a_barcode)
const string & GetBarcode () const
UInt32_t GetMediumFamily () const
UInt32_t GetMediumType () const
Int32_t GetRMType () const
Int32_t GetRMFamily () const
const string & GetSerialNumber () const
bool IsWORM () const
bool IsMediumMemDetected ()
bool IsMediumMemValid ()
bea_MediumMemoryGetMediumMem ()
void SetJobID (UInt64_t a_jobID)
UInt64_t GetJobID () const
bool DoMediumLogging () const

Protected Member Functions

virtual void Refresh ()=0
void SetSize (UInt32_t a_size)
void SetCurrentVolume (UInt32_t a_volNumber)
void SetWORM (bool a_isWorm)
void SetMediumMem (bea_MediumMemory *const a_mm)
void DeleteVolumes ()
void AddVolume (bea_Volume *const a_volume)

Protected Attributes

string m_barcode
string m_serialNum
UInt32_t m_mediumFamily
UInt32_t m_mediumType
string m_poolName

Static Private Member Functions

static void DeleteVolume (bea_Volume *const a_volume)

Private Attributes

 log_CLASSID_m
bool m_worm
UInt32_t m_size
UInt32_t m_currentVolume
vector< bea_Volume * > m_volumes
bea_MediumMemorym_mediumMem
UInt64_t m_jobID
bool m_doMediaLog

Constructor & Destructor Documentation

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 }

Here is the call graph for this function:

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 }

Here is the call graph for this function:


Member Function Documentation

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 }

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

bea_Volume * bea_Medium::GetCurrentVolume (  ) 

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 }

Here is the caller graph for this function:

UInt32_t bea_Medium::GetCurVolNumber (  )  const

virtual void bea_Medium::ChangeVolume ( UInt32_t  a_volNum,
UInt32_t  a_block = 0 
) [pure virtual]

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().

Here is the caller graph for this function:

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

const string & bea_Medium::GetBarcode (  )  const

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 }

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

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 }

Here is the call graph for this function:

Here is the caller graph for this function:

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 }

Here is the caller graph for this function:

void bea_Medium::DeleteVolume ( bea_Volume *const   a_volume  )  [static, private]

Definition at line 350 of file bea_medium.cpp.

Referenced by DeleteVolumes().

00350                                                         {
00351     delete a_volume;
00352 }

Here is the caller graph for this function:


Member Data Documentation

string bea_Medium::m_barcode [protected]

string bea_Medium::m_serialNum [protected]

string bea_Medium::m_poolName [protected]

Definition at line 118 of file bea_medium.h.

Reimplemented in bea_DiskMedium, and bea_TapeMedium.

Definition at line 131 of file bea_medium.h.

bool bea_Medium::m_worm [private]

Definition at line 133 of file bea_medium.h.

Referenced by GetRMType(), IsWORM(), and SetWORM().

Definition at line 134 of file bea_medium.h.

Referenced by GetSize(), and SetSize().

Definition at line 136 of file bea_medium.h.

Referenced by GetCurrentVolume(), GetCurVolNumber(), and SetCurrentVolume().

Definition at line 137 of file bea_medium.h.

Referenced by AddVolume(), DeleteVolumes(), GetSysVolNumber(), GetVolume(), and GetVolumeCount().

Reimplemented in bea_TapeMedium.

Definition at line 139 of file bea_medium.h.

Referenced by GetMediumMem(), IsMediumMemDetected(), IsMediumMemValid(), SetBarcode(), and SetMediumMem().

Definition at line 140 of file bea_medium.h.

Referenced by GetJobID(), and SetJobID().

bool bea_Medium::m_doMediaLog [private]

Definition at line 142 of file bea_medium.h.

Referenced by bea_Medium(), and DoMediumLogging().


The documentation for this class was generated from the following files:

Generated on Mon Feb 27 18:59:43 2012 for OPENARCHIVE by  doxygen 1.5.6