Public Member Functions | Protected Member Functions | Protected Attributes | Static Private Member Functions | Private Attributes

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.

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

Detailed Description

Definition at line 89 of file bea_medium.h.


Constructor & Destructor Documentation

bea_Medium::bea_Medium (  ) 

Definition at line 58 of file bea_medium.cpp.

References cmn_GetEnvVariable(), dbg_LOW, log_DBG_m, log_FUNC_m, m_doMediaLog, and medLogName_c().

    : m_mediumFamily(bmf_UNKNOWN),
      m_mediumType(bmt_UNKNOWN),
      m_worm(false),
      m_size(0),
      m_currentVolume(0),
      m_mediumMem(NULL),
      m_doMediaLog(true) {

    log_FUNC_m(bea_Medium);

    string medLog = cmn_GetEnvVariable(medLogName_c);

    if (medLog == "no" || medLog == "false" || medLog == "0") {

        log_DBG_m(dbg_LOW,
            medLogName_c << " = " << medLog << ": Media logging disabled.");

        m_doMediaLog = false;
    };

    // Refresh() must be called in the constructors of the
    // derived classes.
}

Here is the call graph for this function:

bea_Medium::~bea_Medium (  )  [virtual]

Definition at line 85 of file bea_medium.cpp.

References DeleteVolumes(), and log_FUNC_m.

Here is the call graph for this function:


Member Function Documentation

void bea_Medium::AddVolume ( bea_Volume *const   a_volume  )  [protected]

Definition at line 359 of file bea_medium.cpp.

References m_volumes.

Referenced by bea_DiskMedium::AppendVolume(), bea_DiskMedium::Refresh(), and bea_TapeMedium::RefreshTapeInfo().

                                                     {
    m_volumes.push_back(a_volume);
}

Here is the caller graph for this function:

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:

virtual void bea_Medium::ChangeVolume ( UInt32_t  a_volNum,
UInt32_t  a_block = 0 
) [pure virtual]
void bea_Medium::DeleteVolume ( bea_Volume *const   a_volume  )  [static, private]

Definition at line 367 of file bea_medium.cpp.

                                                        {
    delete a_volume;
}

void bea_Medium::DeleteVolumes (  )  [protected]

Definition at line 351 of file bea_medium.cpp.

References m_volumes.

Referenced by bea_DiskMedium::Refresh(), bea_TapeMedium::RefreshTapeInfo(), and ~bea_Medium().

                               {
    for_each(m_volumes.begin(), m_volumes.end(), bea_Medium::DeleteVolume);
    m_volumes.clear();
    m_volumes.reserve(50);
}

Here is the caller graph for this function:

bool bea_Medium::DoMediumLogging (  )  const

Definition at line 316 of file bea_medium.cpp.

References m_doMediaLog.

Referenced by bea_TapeMedium::ChangeVolume(), bea_DiskMedium::ChangeVolume(), and bea_Volume::DoMediumLogging().

                                       {
    return m_doMediaLog;
}

Here is the caller graph for this function:

virtual void bea_Medium::Format ( vector< UInt32_t a_volSizes,
bool  a_duplAITMode 
) [pure virtual]

Implemented in bea_DiskMedium, and bea_TapeMedium.

const string & bea_Medium::GetBarcode (  )  const
bea_Volume * bea_Medium::GetCurrentVolume (  ) 
UInt32_t bea_Medium::GetCurVolNumber (  )  const
UInt64_t bea_Medium::GetJobID (  )  const

Definition at line 310 of file bea_medium.cpp.

References m_jobID.

Referenced by bea_TapeMedium::ChangeVolume(), bea_DiskMedium::ChangeVolume(), bea_TapeMedium::Format(), bea_Volume::GetJobID(), and SetBarcode().

                                    {
    return m_jobID;
}

Here is the caller graph for this function:

UInt32_t bea_Medium::GetMediumFamily (  )  const

Definition at line 144 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().

                                           {
    return m_mediumFamily;
}

Here is the caller graph for this function:

bea_MediumMemory * bea_Medium::GetMediumMem (  ) 

Definition at line 297 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().

                                           {
//    log_FUNC_m(GetMediumMem);
    return m_mediumMem;
}

Here is the caller graph for this function:

UInt32_t bea_Medium::GetMediumType (  )  const

Definition at line 138 of file bea_medium.cpp.

References m_mediumType.

                                         {
    return m_mediumType;
}

Int32_t bea_Medium::GetRMFamily (  )  const

Definition at line 190 of file bea_medium.cpp.

References bmf_AIT, bmf_DDS, bmf_DISK, bmf_LTO, bmf_SAIT, bmf_VXA, and m_mediumFamily.

                                      {
    switch (m_mediumFamily) {
        case bmf_DDS :  return mf_DDS;
        case bmf_AIT :  return mf_AIT;
        case bmf_SAIT:  return mf_SAIT;
        case bmf_LTO :  return mf_LTO;
        case bmf_DISK:  return mf_DISK;
        case bmf_VXA:   return mf_VXA;
        default:        return mf_UNKNOWN;
    }
}

Int32_t bea_Medium::GetRMType (  )  const

Definition at line 150 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_LTO6, bmt_SAIT1, bmt_VXA320, m_mediumType, and m_worm.

Referenced by bea_RecallThread::Recall().

                                    {
    if (!m_worm) {
        switch (m_mediumType) {
            case bmt_DDS1:      return mt_DDS_1;
            case bmt_DDS2:      return mt_DDS_2;
            case bmt_DDS3:      return mt_DDS_3;
            case bmt_DDS4:      return mt_DDS_4;
            case bmt_AIT1:      return mt_AIT_1;
            case bmt_AIT2:      return mt_AIT_2;
            case bmt_AIT3:      return mt_AIT_3;
            case bmt_AIT5:      return mt_AIT_5;
            case bmt_SAIT1:     return mt_SAIT_1;
            case bmt_LTO :      return mt_LTO_1;
            case bmt_LTO2:      return mt_LTO_2;
            case bmt_LTO3:      return mt_LTO_3;
            case bmt_LTO4:      return mt_LTO_4;
            case bmt_LTO5:      return mt_LTO_5;
            case bmt_LTO6:      return mt_LTO_6;
            case bmt_DISK:      return mt_DISK;
            case bmt_VXA320:    return mt_VXA_320;
            default:            return mt_UNKNOWN;
        }
    }
    else {
        switch (m_mediumType) {
            case bmt_AIT1:  return mt_AIT_1_WORM;
            case bmt_AIT2:  return mt_AIT_2_WORM;
            case bmt_AIT3:  return mt_AIT_3_WORM;
            case bmt_AIT5:  return mt_AIT_5_WORM;
            case bmt_LTO3:  return mt_LTO_3_WORM;
            case bmt_LTO4:  return mt_LTO_4_WORM;
            case bmt_LTO5:  return mt_LTO_5_WORM;
            case bmt_LTO6:  return mt_LTO_6_WORM;
            default:        return mt_UNKNOWN;
        }
    }
}

Here is the caller graph for this function:

const string & bea_Medium::GetSerialNumber (  )  const

Definition at line 210 of file bea_medium.cpp.

References m_serialNum.

                                                {
    return m_serialNum;
}

UInt32_t bea_Medium::GetSize (  )  const

Definition at line 94 of file bea_medium.cpp.

References m_size.

Referenced by bea_DiskMedium::Format(), bea_DiskMedium::Refresh(), and bea_TapeMedium::RefreshTapeInfo().

                                   {
    return m_size;
}

Here is the caller graph for this function:

UInt32_t bea_Medium::GetSysVolNumber (  )  const

Definition at line 252 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().

                                           {
    if (m_volumes.size() == 0) {
        return 0;
    }
    //#warning Check if this works properly without MIC.
    // Warning: May implicitelly read from MIC.
    const bea_VolInfo_t& vi = m_volumes[0]->GetVolumeInfo();
    return vi.sysVolNum;
}

Here is the caller graph for this function:

bea_Volume * bea_Medium::GetVolume ( UInt32_t  a_volNum  ) 

Definition at line 222 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().

                                                   {
    if (a_volNum < 1) {
        log_FUNC_m(GetVolume);
        throw ivd_Error(ie_INVALID_ARG, "Volume numbers start with 1!");
    }

    if (m_volumes.size() == 0) {
        throw ivd_Error(
            ie_MEDIUM_MEDERR, "Medium doesn't contain any volumes.", true);
    }

    if (a_volNum > m_volumes.size()) {
        ostringstream sstr;
        sstr
            << "Medium volume index overflow: "
            << a_volNum << " > " << m_volumes.size();
        throw ivd_Error(ie_INVALID_ARG, sstr.str(), true);
    }

    return m_volumes.at(a_volNum-1);
}

Here is the caller graph for this function:

UInt32_t bea_Medium::GetVolumeCount (  )  const

Definition at line 216 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().

                                          {
    return m_volumes.size();
}

Here is the caller graph for this function:

bool bea_Medium::IsMediumMemDetected (  ) 

Definition at line 270 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().

                                     {
    log_FUNC_m(IsMediumMemDetected);
    if (m_mediumMem == NULL) {
        log_DBG_m(dbg_LOW, "Medium Memory object is NULL");
        return false;
    }
    else {
        return m_mediumMem->IsDetected();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool bea_Medium::IsMediumMemValid (  ) 

Definition at line 283 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().

                                  {
    log_FUNC_m(IsMediumMemValid);

    if (m_mediumMem == NULL) {
        log_DBG_m(dbg_LOW, "Medium Memory object is NULL");
        return false;
    }
    else {
        return m_mediumMem->IsValid();
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool bea_Medium::IsWORM (  )  const

Definition at line 204 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().

                              {
    return m_worm;
}

Here is the caller graph for this function:

virtual UInt32_t bea_Medium::ReadCurrentVolume (  )  [pure virtual]

Implemented in bea_DiskMedium, and bea_TapeMedium.

virtual void bea_Medium::Refresh (  )  [protected, pure virtual]

Implemented in bea_DiskMedium, and bea_TapeMedium.

void bea_Medium::SetBarcode ( const string &  a_barcode  ) 

Definition at line 99 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().

                                                   {
    log_FUNC_A_m(SetBarcode, "bc: " << a_barcode);

    if (m_barcode != a_barcode) {
        if (!m_barcode.empty()) {
            ostringstream sstr;
            sstr
                << "Barcode of this medium changed from "
                << m_barcode << " to " << a_barcode << ".";

            log_WriteEvent(
                evt_WARNING, sstr.str(), "", GetJobID(), m_barcode);
        };
        m_barcode = a_barcode;

        // Update CM with new barcode
        if (IsMediumMemValid()) {
            try {
                df_TCMMedium_t mr = m_mediumMem->GetMediumRecord();
                memcpy(mr.barcode, m_barcode.data(), m_barcode.length());
                mr.barcode[m_barcode.length()] = '\0';
                m_mediumMem->UpdateMediumRecord(mr);
            }
            catch (ivd_Exception &ie) {
                log_WRN_m(
                    "Updating barcode in cartridge memory failed (" << m_barcode << "): " << ie.GetFriendly());
            };
        }
    };
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bea_Medium::SetCurrentVolume ( UInt32_t  a_volNumber  )  [protected]

Definition at line 330 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().

                                                      {
    if (a_volNumber < 1) {
        log_FUNC_m(SetCurrentVolume);
        throw ivd_Error(ie_INVALID_ARG, "Volume numbers start with 1!");
    }
    m_currentVolume = a_volNumber;
}

Here is the caller graph for this function:

void bea_Medium::SetJobID ( UInt64_t  a_jobID  ) 

Definition at line 304 of file bea_medium.cpp.

References m_jobID.

                                          {
    m_jobID = a_jobID;
}

void bea_Medium::SetMediumMem ( bea_MediumMemory *const   a_mm  )  [protected]

Definition at line 345 of file bea_medium.cpp.

References m_mediumMem.

Referenced by bea_TapeMedium::bea_TapeMedium().

                                                          {
    m_mediumMem = a_mm;
}

Here is the caller graph for this function:

void bea_Medium::SetSize ( UInt32_t  a_size  )  [protected]

Definition at line 324 of file bea_medium.cpp.

References m_size.

Referenced by bea_DiskMedium::Refresh(), and bea_TapeMedium::RefreshTapeInfo().

                                        {
    m_size = a_size;
}

Here is the caller graph for this function:

void bea_Medium::SetWORM ( bool  a_isWorm  )  [protected]

Definition at line 339 of file bea_medium.cpp.

References m_worm.

Referenced by bea_TapeMedium::DetectAITWORM(), bea_TapeMedium::DetectLTOWORM(), bea_DiskMedium::Refresh(), and bea_TapeMedium::RefreshTapeInfo().

                                      {
    m_worm = a_isWorm;
}

Here is the caller graph for this function:


Member Data Documentation

Reimplemented in bea_DiskMedium, and bea_TapeMedium.

Definition at line 146 of file bea_medium.h.

string bea_Medium::m_barcode [protected]

Definition at line 151 of file bea_medium.h.

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

bool bea_Medium::m_doMediaLog [private]

Definition at line 157 of file bea_medium.h.

Referenced by bea_Medium(), and DoMediumLogging().

Definition at line 155 of file bea_medium.h.

Referenced by GetJobID(), and SetJobID().

Reimplemented in bea_TapeMedium.

Definition at line 154 of file bea_medium.h.

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

string bea_Medium::m_poolName [protected]

Definition at line 133 of file bea_medium.h.

string bea_Medium::m_serialNum [protected]

Definition at line 149 of file bea_medium.h.

Referenced by GetSize(), and SetSize().

Definition at line 152 of file bea_medium.h.

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

bool bea_Medium::m_worm [private]

Definition at line 148 of file bea_medium.h.

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


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