Public Member Functions | Private Member Functions | Private Attributes

bea_FRIThread Class Reference
[IVD Back-End Agent]

#include <bea_fri.h>

Inheritance diagram for bea_FRIThread:
Inheritance graph
[legend]
Collaboration diagram for bea_FRIThread:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 bea_FRIThread (i_BackEndAgent_i &a_bea, bea_Drive *const a_drive, const i_VolInfoList_t &a_volumes, UInt32_t a_sysVolNum, bool a_create, bool a_recovery=true, i_SysVolAction_e a_svAction=i_SV_NOTHING)
 bea_FRIThread (i_BackEndAgent_i &a_bea, bea_Drive *const a_drive, const i_VolInfoList_t &a_volumes, UInt32_t a_sysVolNum, bool a_create, const i_BoolList_t &a_openVolList, bool a_recovery=true, i_SysVolAction_e a_svAction=i_SV_NOTHING, bool a_recreateInto=false, cmn_Path a_intoPath="")
virtual ~bea_FRIThread ()
virtual void Run (void *arg)
void EraseSysVol ()
string SetWorkDir ()
void CreateFRI (bea_Volume *const a_vol, bool a_closed, cmn_Path &a_workDir)
bool IsClosed (bea_Volume *const a_vol)
bool CheckFRI (bea_Volume *const a_vol, bea_Medium *a_med, cmn_Path &a_workDir)
void ReadFRI (bea_Volume *const a_vol, cmn_Path &a_workDir)

Private Member Functions

void ReadFromSysVol ()
void ProcessFromDataVol ()

Private Attributes

 log_CLASSID_m
i_BackEndAgent_im_bea
bea_Drive *const m_drive_p
i_VolInfoList_t m_volumes
UInt32_t m_sysVolNum
bool m_create
const i_BoolList_t m_openVolList
bool m_recovery
i_SysVolAction_e m_svAction
bool m_recreateInto
cmn_Path m_intoPath
i_CompletionStatus_e m_status

Detailed Description

Definition at line 89 of file bea_fri.h.


Constructor & Destructor Documentation

bea_FRIThread::bea_FRIThread ( i_BackEndAgent_i a_bea,
bea_Drive *const   a_drive,
const i_VolInfoList_t a_volumes,
UInt32_t  a_sysVolNum,
bool  a_create,
bool  a_recovery = true,
i_SysVolAction_e  a_svAction = i_SV_NOTHING 
)

Definition at line 55 of file bea_frithread.cpp.

References cmn_ThreadCounter::Inc(), log_FUNC_m, m_bea, and i_BackEndAgent_i::m_threadCounter.

  : m_bea(a_bea),
    m_drive_p(a_drive_p),
    m_volumes(a_volumes),
    m_sysVolNum(a_sysVolNum),
    m_create(a_create),
    m_recovery(a_recovery),
    m_svAction(a_svAction),
    m_recreateInto(false),
    m_status(i_UNKNOWN)
   {

    log_FUNC_m(bea_FRIThread);
    
    m_bea.m_threadCounter.Inc();
}

Here is the call graph for this function:

bea_FRIThread::bea_FRIThread ( i_BackEndAgent_i a_bea,
bea_Drive *const   a_drive,
const i_VolInfoList_t a_volumes,
UInt32_t  a_sysVolNum,
bool  a_create,
const i_BoolList_t a_openVolList,
bool  a_recovery = true,
i_SysVolAction_e  a_svAction = i_SV_NOTHING,
bool  a_recreateInto = false,
cmn_Path  a_intoPath = "" 
)

Definition at line 82 of file bea_frithread.cpp.

References cmn_CreatePathNoException(), dbg_DETAIL, dbg_NORM, cmn_ThreadCounter::Inc(), cmn_Path::IsEmpty(), log_DBG_m, log_FUNC_m, log_WRN_m, m_bea, m_intoPath, m_recreateInto, and i_BackEndAgent_i::m_threadCounter.

  : m_bea(a_bea),
    m_drive_p(a_drive_p),
    m_volumes(a_volumes),
    m_sysVolNum(a_sysVolNum),
    m_create(a_create),
    m_openVolList(a_openVolList),
    m_recovery(a_recovery),
    m_svAction(a_svAction),
    m_recreateInto(a_recreateInto),
    m_intoPath(a_intoPath),
    m_status(i_UNKNOWN) {

    log_FUNC_m(bea_FRIThread);

    // Create path
    if ((!m_intoPath.IsEmpty()) && (a_recreateInto)) {
        UInt32_t res = cmn_CreatePathNoException(m_intoPath);
        log_DBG_m(dbg_NORM, "Path " << m_intoPath << " created.");
        log_DBG_m(dbg_NORM, "m_recreateInto " << boolalpha << m_recreateInto);
        if (res != 0) {
            log_WRN_m("Creating Path failed.")
        }
    }
    else {
        log_DBG_m(dbg_DETAIL, "Recreate into option not set or into path empty.")
    }
    m_bea.m_threadCounter.Inc();
}

Here is the call graph for this function:

bea_FRIThread::~bea_FRIThread (  )  [virtual]

Definition at line 124 of file bea_frithread.cpp.

References dbg_LOW, cmn_ThreadCounter::Dec(), i_BackEndAgent_i::GetBEANumber(), i_BackEndAgent_i::GetJob(), i_HW_ERROR, i_MEDIUM_ERROR, ipc_EXEC_m, i_BackEndAgent_i::IsAborted(), log_DBG_m, log_FUNC_m, m_bea, m_recovery, m_status, and i_BackEndAgent_i::m_threadCounter.

                              {

    log_FUNC_m(~bea_FRIThread);

    if (m_recovery) {
        // Complete job
        if (m_status != i_MEDIUM_ERROR && m_status != i_HW_ERROR) {
            log_DBG_m(dbg_LOW,
                "Non hardware and non medium errors are not reported to job.");
            m_status = i_SUCCEDED;
        }
        try {
            if (m_bea.IsAborted()) {
                log_DBG_m(dbg_LOW, "FRI job aborted. Won't contact job.");
            }
            else {
                ipc_EXEC_m(
                    if( !CORBA::is_nil(m_bea.GetJob()) ) {
                        log_DBG_m(dbg_LOW, "Completion status: " << m_status);
                        i_Job_var job = m_bea.GetJob();
                        job->MediumOperationComplete(m_bea.GetBEANumber(), m_status);
                    };
                );
            }
        }
        catch(...) {
            // Ignore all exceptions at this point.
        }
    }
    else {
        log_DBG_m(dbg_LOW,
            "Not in recovery more --> Will not call MediumOperationComplete().");
    }
    m_bea.m_threadCounter.Dec();
}

Here is the call graph for this function:


Member Function Documentation

bool bea_FRIThread::CheckFRI ( bea_Volume *const   a_vol,
bea_Medium a_med,
cmn_Path a_workDir 
)

Definition at line 580 of file bea_frithread.cpp.

References cmn_UUID_t::Clear(), dbg_LOW, bea_FRI::DeleteFRIOnVolume(), evt_WARNING, i_BackEndAgent_i::GetBarcode(), bea_Medium::GetBarcode(), ivd_BaseException::GetFriendly(), i_BackEndAgent_i::GetJobID(), bea_Volume::GetVolumeID(), bea_Volume::GetVolumeNumber(), cmn_UUID_t::IsNull(), log_DBG_m, log_ERR_m, log_FUNC_m, log_WriteEvent(), log_WRN_m, m_bea, m_create, bea_FRI::PositionToStartOfFRI(), and bea_FRI::ReadFRIStart().

Referenced by ProcessFromDataVol().

                                                                                            {
    log_FUNC_m(CheckFRI);

    bea_FRI fri(m_bea, a_vol, a_workDir);
    
    try {
        // Position to the beginning of FRI or the end of medium
        bool atFRI = fri.PositionToStartOfFRI();
        if (!m_create && !atFRI) {
            log_DBG_m(dbg_LOW,
                "No FRI on volume to be read: " << a_vol->GetVolumeNumber());
            return true;
        }
    }
    catch (const ivd_Exception& ie) {
        log_ERR_m(
            "Can't position to FRI: " <<
            a_med->GetBarcode() << "/" << a_vol->GetVolumeNumber() << endl <<
            ". Error: " << ie.GetFriendly() << endl <<
            " Will try with next volume on the medium.");

            return true;
    }

    cmn_UUID_t volUUID;
    volUUID.Clear();
    if (fri.ReadFRIStart(volUUID) == true) {
        log_WRN_m("FRI filemark on volume, but no FRI. " <<
        a_med->GetBarcode() << "/" << a_vol->GetVolumeNumber() << endl <<
        " Will try with next volume on the medium.");
        return true;
    }

    if (volUUID.IsNull()) {
        log_DBG_m(dbg_LOW, "No volume UUID read. Continue.");
        return true;
    }
    else if (a_vol->GetVolumeID() != volUUID) {
        ostringstream sstr;
        sstr
            << "Vol " << a_vol->GetVolumeNumber() << ": "
            << "Found FRI of wrong volume. Expected ID: "
            << a_vol->GetVolumeID() << ", found "
            << volUUID;

        log_WriteEvent(evt_WARNING, sstr.str(), "FRI",
            m_bea.GetJobID(), m_bea.GetBarcode() );

        fri.DeleteFRIOnVolume();
        return true;
    }
    log_DBG_m(dbg_LOW, "OK.");
    return false;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bea_FRIThread::CreateFRI ( bea_Volume *const   a_vol,
bool  a_closed,
cmn_Path a_workDir 
)

Definition at line 551 of file bea_frithread.cpp.

References bea_FRI::CreateFRI(), friAppendRecreated_c(), log_FUNC_m, m_bea, and m_recreateInto.

Referenced by ProcessFromDataVol().

                                                                                         {
    log_FUNC_m(CreateFRI);
    bea_FRI fri(m_bea, a_vol, a_workDir, m_recreateInto, friAppendRecreated_c);
    fri.CreateFRI(a_closed);
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bea_FRIThread::EraseSysVol (  ) 

Definition at line 471 of file bea_frithread.cpp.

References bea_Medium::ChangeVolume(), dbg_LOW, i_BackEndAgent_i::GetBarcode(), bea_Medium::GetBarcode(), i_BackEndAgent_i::GetJobID(), bea_Drive::GetMedium(), bea_Medium::GetSysVolNumber(), bea_Medium::GetVolume(), i_SV_OVERWRITE, i_SV_REPLACE, bea_Medium::IsWORM(), log_DBG_m, log_FUNC_m, log_WriteEvent(), m_bea, m_create, m_drive_p, m_svAction, i_BackEndAgent_i::SysVolErased(), and i_BackEndAgent_i::WasSysVolErased().

Referenced by ProcessFromDataVol().

                                {
    log_FUNC_m(EraseSysVol);
    bea_Medium* med = m_drive_p->GetMedium();
    if (m_create && !m_bea.WasSysVolErased()) {
        if (med->IsWORM()) {
            log_DBG_m(dbg_LOW, "System volume on WORM medium won't be erased.");
        }
        else if (m_svAction == i_SV_OVERWRITE) {
            if (med->GetSysVolNumber() > 0) {

// TODO: Check system volume ID!

                ostringstream sstr;
                sstr
                    << "Erasing system volume on medium "
                    << med->GetBarcode();

                log_WriteEvent(sstr.str(), "FRI",
                    m_bea.GetJobID(), m_bea.GetBarcode() );

                bea_Volume *const sv = med->GetVolume(med->GetSysVolNumber());
                med->ChangeVolume(med->GetSysVolNumber());
                sv->Rewind();
                sv->SeekFileMark(1);
                sv->Erase();

                m_bea.SysVolErased();
            }
        }
        else if (m_svAction == i_SV_REPLACE) {
            // ***************************************
            // Replace shall copy the contents of
            // current system volume to the disk
            // and replace only those FRIs that 
            // have been created.
            // Current implementation behaves just like
            // i_SV_OVERWRITE.
            // ***************************************
            if (med->GetSysVolNumber() > 0) {

// TODO: Check system volume ID!

                ostringstream sstr;
                sstr
                    << "Erasing system volume on medium "
                    << med->GetBarcode();

                log_WriteEvent(sstr.str(), "FRI",
                    m_bea.GetJobID(), m_bea.GetBarcode() );

                bea_Volume *const sv = med->GetVolume(med->GetSysVolNumber());
                med->ChangeVolume(med->GetSysVolNumber());
                sv->Rewind();
                sv->SeekFileMark(1);
                sv->Erase();

                m_bea.SysVolErased();
            }
        }
    }
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool bea_FRIThread::IsClosed ( bea_Volume *const   a_vol  ) 

Definition at line 558 of file bea_frithread.cpp.

References i_BackEndAgent_i::GetBarcode(), i_BackEndAgent_i::GetRM(), bea_Volume::GetVolumeNumber(), ipc_EXEC_m, log_FUNC_m, m_bea, m_openVolList, and rmdb_MEDVOL_FULL.

Referenced by ProcessFromDataVol().

                                                   {
    log_FUNC_m(IsClosed);
    bool closed(false);
    // Check the passed list of volumes first
    if (m_openVolList.length() > a_vol->GetVolumeNumber()) {
        closed = !m_openVolList[a_vol->GetVolumeNumber()];
    }
    else {
        i_MediumVol_t_var rmvol;
        ipc_EXEC_m(
            i_ResourceManager_var rm = m_bea.GetRM();
            rmvol = rm->SelectMediumVol(
                CORBA::string_dup(m_bea.GetBarcode().c_str()),
                a_vol->GetVolumeNumber());
        );
        closed = (rmvol->status & rmdb_MEDVOL_FULL) == rmdb_MEDVOL_FULL;
    }
    return closed;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bea_FRIThread::ProcessFromDataVol (  )  [private]

Definition at line 360 of file bea_frithread.cpp.

References bea_Medium::ChangeVolume(), CheckFRI(), cmn_Num2Str(), CreateFRI(), dbg_DETAIL, dbg_LOW, EraseSysVol(), error(), i_BackEndAgent_i::GetBarcode(), i_BackEndAgent_i::GetBEANumber(), bea_Medium::GetCurrentVolume(), bea_FRI::GetFRIStartPosition(), i_BackEndAgent_i::GetJob(), i_BackEndAgent_i::GetJobID(), bea_Drive::GetMedium(), bea_Volume::GetStartOfDataPosition(), bea_Volume::GetVolumeID(), bea_Volume::GetVolumeNumber(), ie_FATAL_ERROR, ipc_EXEC_m, i_BackEndAgent_i::IsAborted(), IsClosed(), log_DBG_m, log_FUNC_m, log_WRN_m, m_bea, m_create, m_drive_p, m_recovery, m_recreateInto, m_volumes, bea_FRI::PositionToStartOfFRI(), ReadFRI(), bea_Volume::ReadVolInfoFromHeader(), SetWorkDir(), and i_BackEndAgent_i::WaitForResources().

Referenced by Run().

                                       {
    log_FUNC_m(ProcessFromDataVol);

    if (m_create || m_recreateInto) {
        log_DBG_m(dbg_LOW,
            "Started creating FRI from data volumes. Job ID: " << m_bea.GetJobID());
    }
    else {
        log_DBG_m(dbg_LOW,
            "Started reading FRI from data volumes. Job ID: " << m_bea.GetJobID());
    };

    m_bea.WaitForResources();

    if (m_bea.IsAborted()) {
        log_DBG_m(dbg_LOW, "Job aborted. Exit.");
        return;
    };

    if (!m_recreateInto){
        EraseSysVol();
    }

    i_Job_var job = m_bea.GetJob();
    bea_Medium* med = m_drive_p->GetMedium();

    for (UInt32_t i = 0; i < m_volumes.length(); i++) {
        if (m_volumes[i].volNum == -1) {
            log_DBG_m(dbg_DETAIL, "Skipping FRI. Already processed..");
            continue;
        };

        if (m_bea.IsAborted()) {
            log_DBG_m(dbg_DETAIL, "Operation aborted.");
            break;
        }

        med->ChangeVolume(m_volumes[i].volNum);

        bea_Volume *const vol = med->GetCurrentVolume();
        cmn_UUID_t volid = cmn_UUID_t(string(m_volumes[i].medVolID));

        vol->ReadVolInfoFromHeader();
        if (vol->GetVolumeID() != volid) {
            log_WRN_m(
                m_bea.GetBarcode() << ":" << (i+1) <<
                " Reading FRI. Volume UUID doesn't match. Expected: " << volid <<
                " read: " << vol->GetVolumeID() );
            continue;

// TODO: Should an exception be thrown in this case?
        };

        cmn_Path workDir =   SetWorkDir();
        log_DBG_m(dbg_DETAIL, "Using workDir: " << workDir);
        
        bool closed = IsClosed(vol);
        
        if (m_create || m_recreateInto) {
            CreateFRI(vol, closed, workDir);
        }
        if (!m_create || m_recreateInto) {
            
            bool error = CheckFRI(vol, med, workDir);
            
            if (error) {
                continue;
            }
            ReadFRI(vol, workDir);
        }
        
        if (m_recovery) {
            UInt32_t lastDataPos(0);
            bea_FRI fri(m_bea, vol, workDir);
            fri.PositionToStartOfFRI();
            if (fri.GetFRIStartPosition() > vol->GetStartOfDataPosition()) {
                lastDataPos = fri.GetFRIStartPosition() - 2;
            }
            else if (closed) {
                log_MARKLINE_m;
                throw ivd_InternalError(
                    ie_FATAL_ERROR,
                    "Invalid FRI start position of closed volume: " +
                    cmn_Num2Str(fri.GetFRIStartPosition()) );
            }

            log_DBG_m(dbg_LOW,
                "Calling FRIReadSuccess(" <<
                m_bea.GetBEANumber() << ", " << lastDataPos << ")" );

            ipc_EXEC_m( 
                job->FRIReadSuccess(
                    m_bea.GetBEANumber(),
                    vol->GetVolumeNumber(),
                    lastDataPos);
            );
        }

        // *********************************
        // WARNING:
        //         Volume number abused to indicate
        //         that the volume was already processed.
        //
        // *********************************
        m_volumes[i].volNum = -1;
    }
    log_DBG_m(dbg_LOW, "Completed reading/creating FRI.");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bea_FRIThread::ReadFRI ( bea_Volume *const   a_vol,
cmn_Path a_workDir 
)

Definition at line 638 of file bea_frithread.cpp.

References evt_WARNING, friAppendDataVol_c(), i_BackEndAgent_i::GetBarcode(), i_BackEndAgent_i::GetJobID(), bea_Volume::GetPosition(), bea_Volume::GetVolumeID(), bea_Volume::GetVolumeNumber(), log_FUNC_m, log_WriteEvent(), m_bea, m_recreateInto, bea_FRI::ReadFRI(), and bea_Volume::SeekBlock().

Referenced by ProcessFromDataVol().

                                                                        {
    log_FUNC_m(ReadFRI);
    
    bea_FRI fri(m_bea, a_vol, a_workDir, m_recreateInto, friAppendDataVol_c);
    
    // Seek back to the start of FRI
    a_vol->SeekBlock(a_vol->GetPosition() - 1);

    bool filemark = fri.ReadFRI(a_vol->GetVolumeID());

    if (filemark) {
        ostringstream sstr;
        sstr
            << "Vol " << a_vol->GetVolumeNumber() << ": "
            << "Found unexpected file mark after the FRI.";

        log_WriteEvent(evt_WARNING, sstr.str(), "FRI",
            m_bea.GetJobID(), m_bea.GetBarcode() );

        // TODO: Delete FRI on data volume if filemark?
    }

    // TODO: Shall exceptions from ReadFRI (medium/HW errors) be caught
    //       and continue with FRI on the next volume.

    
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bea_FRIThread::ReadFromSysVol (  )  [private]

Definition at line 218 of file bea_frithread.cpp.

References bea_Medium::ChangeVolume(), cmn_UUID_t::Clear(), dbg_DETAIL, dbg_LOW, friAppendSysVol_c(), i_BackEndAgent_i::GetBEANumber(), bea_Medium::GetCurrentVolume(), ivd_BaseException::GetError(), i_BackEndAgent_i::GetJob(), i_BackEndAgent_i::GetJobID(), bea_Drive::GetMedium(), bea_Volume::GetPosition(), bea_Medium::GetSysVolNumber(), ipc_EXEC_m, i_BackEndAgent_i::IsAborted(), cmn_UUID_t::IsNull(), bea_Volume::IsSysVolume(), log_DBG_m, log_FUNC_m, m_bea, m_drive_p, m_recreateInto, m_sysVolNum, m_volumes, bea_FRI::ReadFRI(), bea_FRI::ReadFRIStart(), bea_Volume::ReadVolInfoFromHeader(), bea_Volume::Rewind(), bea_Volume::SeekBlock(), bea_Volume::SeekFileMark(), SetWorkDir(), and i_BackEndAgent_i::WaitForResources().

Referenced by Run().

                                   {
    log_FUNC_m(ReadFromSysVol);

    log_DBG_m(dbg_LOW,
        "Started reading FRI from system volume. Job ID: " << m_bea.GetJobID());

    m_bea.WaitForResources();

    if (m_bea.IsAborted()) {
        log_DBG_m(dbg_LOW, "Job aborted. Exit.");
        return;
    };

    bea_Medium* med = m_drive_p->GetMedium();
    if (med->GetSysVolNumber() != 0) {
        // Try the on-medium info first
        med->ChangeVolume(med->GetSysVolNumber());
    }
    else if (m_sysVolNum > 0) {
        // Try the passed number second
        med->ChangeVolume(m_sysVolNum);
        med->GetCurrentVolume()->ReadVolInfoFromHeader();
    }

    bea_Volume *const vol = med->GetCurrentVolume();
    if (!vol->IsSysVolume()) {
        log_DBG_m(dbg_LOW, "No system volume on the medium.");
        return;
    }

    vol->Rewind();

    cmn_Path workDir = SetWorkDir();

    log_DBG_m(dbg_DETAIL, "Using workDir: " << workDir);

    bea_FRI fri(m_bea, vol, workDir, m_recreateInto, friAppendSysVol_c);
    bool detectedFM(false);

    i_Job_var job = m_bea.GetJob();

    cmn_UUID_t volUUID;
    volUUID.Clear();

    vector<UInt32_t> readFRIs;

    while (!m_bea.IsAborted()) {
        // Read block and parse the contents to get the
        // media volume UUID.
        if (volUUID.IsNull()) {
            // Starting position is first block (medium Header)
            // Skip header and go to first FRI
            // Then skip FRI one by one (until finding the right one)
            log_DBG_m(dbg_LOW, "Seeking to next FRI...");
            try {
                vol->SeekFileMark(1);
            }
            catch (const ivd_Error& ie) {
                if (ie.GetError() == ie_MEDIUM_EOD) {
                    log_DBG_m(dbg_LOW, "End of volume. Stop reading.");
                    break;
                }
                else {
                    throw;
                }
            }
        }

        if (fri.ReadFRIStart(volUUID) == true) {
            log_DBG_m(dbg_LOW, "End of volume. Stop reading.");
            break;
        }
        if (volUUID.IsNull()) {
            //thats not the right FRI
            //process next
            continue;
        }

        // Find volume number in requested list.
        Int32_t volIndex(-1);
        for (UInt32_t i = 0; i < m_volumes.length(); ++i) {
            if (volUUID == cmn_UUID_t(string(m_volumes[i].medVolID)) ) {
                volIndex = i;
                break;
            }
        };

        if (volIndex == -1) {
            log_DBG_m(dbg_LOW, "Skipping FRI. Not on the list.");
            volUUID.Clear();
        }
        else {
            if (m_volumes[volIndex].volNum == -1) {
                // WORM medium might contain multiple copies of FRI for the same
                // volume if they are recreated for any reason.
                log_DBG_m(dbg_LOW, "Already processed at least once. Overwriting.");
            }
            log_DBG_m(dbg_LOW, "Reading FRI.");
            vol->SeekBlock(vol->GetPosition() - 1);
            detectedFM = fri.ReadFRI(volUUID);

            if (!detectedFM) {
                log_DBG_m(dbg_LOW, "End of volume. Stop reading.");
                break;
            }

            // More than one instance of the FRI can reside on system volume
            // FRIReadSuccess can't be called immediatelly.
            if (m_volumes[volIndex].volNum != -1) {
                readFRIs.push_back(m_volumes[volIndex].volNum);
            }

            // *********************************
            // WARNING:
            //         Volume number abused to indicate
            //         that the volume was already processed.
            //
            // *********************************
            m_volumes[volIndex].volNum = -1;

        }
    }; // while

    if (!m_bea.IsAborted()) {
        // Inform job about successfully read FRIs.
        for (UInt32_t i = 0; i < readFRIs.size(); ++i) {
            ipc_EXEC_m(
                log_DBG_m(dbg_LOW,
                    "Calling FRIReadSuccess(" <<
                    m_bea.GetBEANumber() << ", " <<
                    readFRIs[i] << "," << 0 << ")" );

                job->FRIReadSuccess(m_bea.GetBEANumber(), readFRIs[i], 0);
            );
        }
    }

    log_DBG_m(dbg_LOW, "Sucessfully completed reading/creating FRI.");
}

Here is the call graph for this function:

Here is the caller graph for this function:

void bea_FRIThread::Run ( void *  arg  )  [virtual]

Reimplemented from cmn_Thread.

Definition at line 162 of file bea_frithread.cpp.

References bea_OPREAD, dbg_DETAIL, dbg_LOW, evt_ERROR, i_BackEndAgent_i::GetBarcode(), i_BackEndAgent_i::GetJobID(), i_BackEndAgent_i::HandleError(), i_SUCCEDED, log_DBG_m, log_FUNC_m, log_WriteEvent(), m_bea, m_create, m_recovery, m_recreateInto, m_status, ProcessFromDataVol(), and ReadFromSysVol().

                                 {
    log_FUNC_m(Run);

    try {
        if (!m_recreateInto){
            if (!m_create) {
                ReadFromSysVol();
            }
            ProcessFromDataVol();
        } else {
            ReadFromSysVol();
            ProcessFromDataVol();
        }
        m_status = i_SUCCEDED;
        log_DBG_m(dbg_LOW, "Completed FRI handling.");
    }
    catch(ivd_Error &ie) {
        m_status = m_bea.HandleError(ie, bea_OPREAD);
        if (!m_recovery) {
            log_DBG_m(dbg_DETAIL,
                "Not in recovery. Throw the exception down the stack.");
            throw;
        }
    }
    catch(const std::exception& ie) {
        ostringstream sstr;
        sstr << "Operation failed: " << ie.what();
        log_WriteEvent(evt_ERROR, sstr.str(), "",
            m_bea.GetJobID(), m_bea.GetBarcode() );

        if (m_status == i_SUCCEDED) {
            m_status = i_UNKNOWN;
        }
        if (!m_recovery) {
            log_DBG_m(dbg_DETAIL,
                "Not in recovery. Throw the exception down the stack.");
            throw;
        }
    }
    catch(...) {
        log_WriteEvent(evt_ERROR, "Operation failed. Unknown error.", "",
            m_bea.GetJobID(), m_bea.GetBarcode() );

        if (m_status == i_SUCCEDED) {
            m_status = i_UNKNOWN;
        }
        if (!m_recovery) {
            log_DBG_m(dbg_DETAIL,
                "Not in recovery. Throw the exception down the stack.");
            throw;
        }
    }
}

Here is the call graph for this function:

string bea_FRIThread::SetWorkDir (  ) 

Definition at line 535 of file bea_frithread.cpp.

References cmn_Global::dirs, ivd_Directories::fri, g_cmn, log_FUNC_m, m_intoPath, m_recovery, m_recreateInto, and ivd_Directories::tmp.

Referenced by ProcessFromDataVol(), and ReadFromSysVol().

                                 {
    log_FUNC_m(SetWorkDir);
    
    if (m_recreateInto){
        return m_intoPath;
    } else {
        if (m_recovery) {
            return g_cmn.dirs.tmp + cmn_Path("fri");
        } else {
            return g_cmn.dirs.fri;        
        } 
    }
    
}

Here is the caller graph for this function:


Member Data Documentation

Reimplemented from cmn_Thread.

Definition at line 126 of file bea_fri.h.

bool bea_FRIThread::m_create [private]

Definition at line 136 of file bea_fri.h.

Referenced by CheckFRI(), EraseSysVol(), ProcessFromDataVol(), and Run().

Definition at line 132 of file bea_fri.h.

Referenced by EraseSysVol(), ProcessFromDataVol(), and ReadFromSysVol().

Definition at line 142 of file bea_fri.h.

Referenced by bea_FRIThread(), and SetWorkDir().

Definition at line 137 of file bea_fri.h.

Referenced by IsClosed().

bool bea_FRIThread::m_recovery [private]

Definition at line 138 of file bea_fri.h.

Referenced by ProcessFromDataVol(), Run(), SetWorkDir(), and ~bea_FRIThread().

Definition at line 144 of file bea_fri.h.

Referenced by Run(), and ~bea_FRIThread().

Definition at line 139 of file bea_fri.h.

Referenced by EraseSysVol().

Definition at line 135 of file bea_fri.h.

Referenced by ReadFromSysVol().

Definition at line 134 of file bea_fri.h.

Referenced by ProcessFromDataVol(), and ReadFromSysVol().


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