00001
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef _CAPROCSTATREQ_H_
00031 #define _CAPROCSTATREQ_H_
00032
00033
00034
00035
00036 #include <sstream>
00037
00038
00039 #include <corba_statusC.h>
00040
00041
00042 #include "corbalog.h"
00043 #include "corba_utility.h"
00044 #include "caglobal.h"
00045
00046
00047
00048
00049
00050 namespace OSB_CORBA {
00051 using corba::cadmin::StatusRequestId;
00052 using corba::common::CfgErrorSeq;
00053
00055 const int aerRqsNotAvail = 402;
00056
00057
00058
00082 template<typename Id>
00083 bool fwdStatusRequest(
00084 const std::string& ifc,
00085 const std::string& module,
00086 Id contrId,
00087 StatusRequestId srId,
00088 CfgErrorSeq& errors
00089 );
00090 }
00091
00092
00093
00094 namespace OSB_CORBA {
00095
00096 template<typename Id>
00097 bool fwdStatusRequest(
00098 const std::string& ifc,
00099 const std::string& module,
00100 Id id,
00101 StatusRequestId srId,
00102 CfgErrorSeq& errors
00103 )
00104 try {
00105 using namespace corba::cadmin;
00106
00107 StatusReqResult ret = srqNotAvail;
00108 try {
00109 CaGlobal::RequestServer* rs = caGlobal.requestServer();
00110 ret = rs->procStatusRequest(srId, errors);
00111 }
00112 catch (const CaGlobal::NoRqsAvail& ex) {
00113
00114 size_t numErr = errors.length();
00115 errors.length(numErr+1);
00116
00117 OSB_APP::AppError e(aerRqsNotAvail, ex.args());
00118 errors[numErr] = osbToCfgError(e);
00119 }
00120
00121
00122
00123 std::ostringstream os;
00124 os << id << ": status request " << srId.id;
00125
00126 bool rc = true;
00127 switch (ret) {
00128 case srqSuccess:
00129 os << " applied.";
00130 break;
00131 case srqProcessed:
00132 os << " done by RQS.";
00133 break;
00134 case srqNotAvail:
00135 case srqSkipped:
00136 os << " skipped.";
00137 break;
00138 case srqError:
00139 os << " failed.";
00140 rc = false;
00141 break;
00142 };
00143 logMsg(DBG1, ifc, module, os);
00144
00145 return rc;
00146 }
00147 catch (const OSB_LIB::BaseError& ex) {
00148 size_t numErr = errors.length();
00149 errors.length(numErr+1);
00150 errors[numErr] = osbToCfgError(ex);
00151
00152 return false;
00153 }
00154 }
00155 #endif // #ifndef _CAPROCSTATREQ_H_