Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Private Member Functions | Private Attributes
ARex::LoggerClient Class Reference

#include <client.h>

Collaboration diagram for ARex::LoggerClient:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LoggerClient (void)
 ~LoggerClient (void)
bool Initialized (void)
bool ReportV2 (const char *url, std::list< JobRecord > &info)

Private Member Functions

bool SameContact (const char *url)
bool NewURL (const char *url)

Private Attributes

Arc::URL url
Arc::ClientSOAPclient

Detailed Description

Definition at line 18 of file client.h.


Constructor & Destructor Documentation

Definition at line 15 of file client.cpp.

                              :client(NULL) {
}

Definition at line 18 of file client.cpp.

                                {
  if(client) delete client;
}

Member Function Documentation

Definition at line 22 of file client.cpp.

                                   {
  return (client != NULL);
}
bool ARex::LoggerClient::NewURL ( const char *  url) [private]

Definition at line 38 of file client.cpp.

                                          {
  if(url_ == NULL) return false;
  try {
    if(url) {
      Arc::URL u(url_);
      if((u.Protocol() == url.Protocol()) &&
         (u.Host() == url.Host()) &&
         (u.Port() == url.Port()) &&
         (u.Path() == url.Path())) {
        url=u;
      } else { // reinitialize for different server
        url=u; if(client) delete client; client=NULL;
      };
    } else { // initialize for first connection
      url=Arc::URL(url_); if(client) delete client; client=NULL;
    };
  } catch (std::exception e) {
    if(client) delete client; client=NULL;
    return false;
  };
  if(client == NULL) {
//    std::string soap_url = url->Protocol()+"://"+url->Host()+":"+tostring(url->Port());
    Arc::MCCConfig cfg;
    client = new Arc::ClientSOAP(cfg,url,60);
  };
  return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

bool ARex::LoggerClient::ReportV2 ( const char *  url,
std::list< JobRecord > &  info 
)

Definition at line 66 of file client.cpp.

                                                                     {
  if(!NewURL(url_)) return false;
  if(info.size() <= 0) return true;
  Arc::NS ns;
  ns[""]="http://www.nordugrid.org/ws/schemas/ARCLoggerV2";
  Arc::PayloadSOAP req(ns);
  req.NewChild("add");
  for(std::list<JobRecord>::iterator i = info.begin();i!=info.end();++i) {
    req.NewChild(*i);
  };
Arc::Logger::rootLogger.setThreshold(Arc::DEBUG);
  Arc::PayloadSOAP* resp = NULL;
  Arc::MCC_Status r = client->process(&req,&resp);
Arc::Logger::rootLogger.setThreshold(Arc::WARNING);
  if((!r) || (!resp)) {
    odlog(INFO)<<"Failed to pass information to database"<<std::endl;
//    if(LogTime::Level() > FATAL) soap_print_fault(&soap, stderr);
//    client->disconnect();
    return false;;
  } else if( (!((*resp)["addResponse"]["result"])) ||
             (!((*resp)["addResponse"]["result"]["Code"])) ) {
    std::string s; resp->Child().GetXML(s);
    if(s.empty()) {
      odlog(INFO)<<"Record refused."<<std::endl;
    } else {
      odlog(INFO)<<"Record refused. Response: "<<s<<std::endl;
    };
    return false;
  } else if((*resp)["addResponse"]["result"]["Code"] != "NoError") {
    odlog(INFO)<<"Record refused. Error code: "<<(*resp)["addResponse"]["result"]["Code"]<<std::endl;
    return false;
  };
  return true;
}

Here is the call graph for this function:

bool ARex::LoggerClient::SameContact ( const char *  url) [private]

Definition at line 26 of file client.cpp.

                                               {
  if(!url) return false;
  try {
    Arc::URL u(url_);
    return((u.Protocol() == url.Protocol()) && 
           (u.Host() == url.Host()) && 
           (u.Port() == url.Port()));
  } catch (std::exception e) {
    return false;
  };
}

Here is the call graph for this function:


Member Data Documentation

Definition at line 21 of file client.h.

Definition at line 20 of file client.h.


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