Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes
Compiler::Service_Compiler Class Reference

This service need in the server config a "compiler:scriptfile_url" element. More...

#include <compiler.h>

Inheritance diagram for Compiler::Service_Compiler:
Inheritance graph
Collaboration diagram for Compiler::Service_Compiler:
Collaboration graph

List of all members.

Public Member Functions

 Service_Compiler (Arc::Config *cfg)
 Constructor accepts configuration describing content of scriptfile_url.
virtual ~Service_Compiler (void)
virtual Arc::MCC_Status process (Arc::Message &, Arc::Message &)
 Service request processing routine.
std::string Get_Script_Url ()
virtual void AddSecHandler (Config *cfg, ArcSec::SecHandler *sechandler, const std::string &label="")
 Add security components/handlers to this MCC.
virtual bool RegistrationCollector (XMLNode &doc)
 Service specific registartion collector, used for generate service registartions.
virtual std::string getID ()
 Service may implement own service identitifer gathering method.

Protected Member Functions

Arc::MCC_Status make_fault (Arc::Message &outmsg)
bool ProcessSecHandlers (Message &message, const std::string &label="") const
 Executes security handlers of specified queue.

Protected Attributes

std::string script_url_
Arc::NS ns_
std::map< std::string,
std::list< ArcSec::SecHandler * > > 
 Set of labeled authentication and authorization handlers.

Static Protected Attributes

static Arc::Logger logger
 Logger object used to print messages generated by this class.

Detailed Description

This service need in the server config a "compiler:scriptfile_url" element.

It is the scriptfile place, wherefrom it will be download the JSDL.

Definition at line 14 of file compiler.h.

Constructor & Destructor Documentation

Constructor accepts configuration describing content of scriptfile_url.

Definition at line 554 of file compiler.cpp.

                                                :Service(cfg) {

Definition at line 559 of file compiler.cpp.


Member Function Documentation

void Arc::Service::AddSecHandler ( Config cfg,
ArcSec::SecHandler sechandler,
const std::string &  label = "" 
) [virtual, inherited]

Add security components/handlers to this MCC.

For more information please see description of MCC::AddSecHandler

Definition at line 14 of file Service.cpp.

    if(sechandler) {
        sechandlers_[label].push_back(sechandler); //need polishing to put the SecHandlerFactory->getinstance here
        XMLNode cn = (*cfg)["SecHandler"];
        Config cfg_(cn);

Here is the caller graph for this function:

Definition at line 28 of file compiler.h.

{return script_url_;}       

Here is the caller graph for this function:

virtual std::string Arc::Service::getID ( ) [inline, virtual, inherited]

Service may implement own service identitifer gathering method.

This method return identifier of service which is used for registering it Information Services.

Reimplemented in ARex::ARexService.

Definition at line 69 of file Service.h.

{ return ""; };

Definition at line 562 of file compiler.cpp.

  Arc::PayloadSOAP* outpayload = new Arc::PayloadSOAP(ns_,true);
  Arc::SOAPFault* fault = outpayload->Fault();
  if(fault) {
    fault->Reason("Failed processing request");
  return Arc::MCC_Status(Arc::GENERIC_ERROR);

Here is the call graph for this function:

Here is the caller graph for this function:

Arc::MCC_Status Service_Compiler::process ( Arc::Message inmsg,
Arc::Message outmsg 
) [virtual]

Service request processing routine.

Implements Arc::MCCInterface.

Definition at line 573 of file compiler.cpp.

   // Both input and output are supposed to be SOAP 
   // Extracting payload
   Arc::PayloadSOAP* inpayload = NULL;
   try {
     inpayload = dynamic_cast<Arc::PayloadSOAP*>(inmsg.Payload());
   } catch(std::exception& e) { };
   if(!inpayload) {
     logger.msg(Arc::ERROR, "Input is not SOAP");
     return make_fault(outmsg);
   // Analyzing request 
   Arc::XMLNode compiler_op = (*inpayload)["compiler"];
   if(!compiler_op) {
     logger.msg(Arc::ERROR, "Request is not supported - %s", compiler_op.Name());
     return make_fault(outmsg);
   std::string xml;
   inpayload->GetDoc(xml, true);
   std::cout << "XML: "<< xml << std::endl;
   Arc::PayloadSOAP* outpayload = new Arc::PayloadSOAP(ns_);
   Arc::XMLNode outpayload_node = outpayload->NewChild("compiler:compilerResponse");

   //info from the ISIS
   logger.msg(Arc::VERBOSE, "Info from the ISIS");
   std::vector<CompileInfo> Site_List;
   Site_List = Info_from_ISIS(compiler_op, *this);

   //job submit
   logger.msg(Arc::VERBOSE, "job(s) submit");
   std::vector<std::string> jobid_request;
   std::vector<CompileInfo>::iterator it; 
   for ( it=Site_List.begin() ; it < Site_List.end(); it++ ){
       jobid_request.push_back(job_submit((*it).job_name, (*it).site_url, (*it).script_url, (*it).sources,
                                         (*it).architecture,  (*it).makefile_name, (*it).cpu_number,
                                         (*it).parameters, (*it).tar, 
                                         (*it).compiler, (*it).march  ));
       if( jobid_request.back() == "" ){
              std::string message = "Wrong Job submitting!      URL: " + (*it).site_url;
              message =  message + "     Achitecture: " + (*it).architecture;
              outpayload_node.NewChild("compiler:error")= message;
              logger.msg(Arc::ERROR, "Wrong Job submitting!      URL: " + (*it).site_url);
              logger.msg(Arc::ERROR, "     Achitecture: " + (*it).architecture);
   //current time (GMT)
   std::time_t rawtime;
   std::time ( &rawtime );  //current time
   tm * ptm;
   ptm = gmtime ( &rawtime );

   std::stringstream out;
   int year = ptm->tm_year;
   year = year +1900;
   int mon = ptm->tm_mon;
   out << "GMT  "<< year << "."  << mon << "." << ptm->tm_mday;
   out << "    " << ptm->tm_hour<< ":" << ptm->tm_min <<  ":" << ptm->tm_sec;
   std::string hear = "All Job(s) submited:    "+ out.str();
   logger.msg(Arc::VERBOSE, hear);
   //output file(s) copy to the added directory
   logger.msg(Arc::VERBOSE, "Result(s) download");
   logger.msg(Arc::VERBOSE, "Download Place: " + compiler_op["make"]["download_place"]);
        std::string urlstr;
        std::vector<CompileInfo>::iterator it1;
        std::string Current_Architecture("");
        while( !jobid_request.empty() ){
             logger.msg(Arc::VERBOSE, "Download cycle: start");              
              if(it1 != Site_List.begin())
              Current_Architecture = (*it1).architecture;
              logger.msg(Arc::VERBOSE, "Current Arhitecture: "+Current_Architecture);
             //Job ID checking
             if( jobid_request.back() == "" ){
                   logger.msg(Arc::VERBOSE, "Empty Job ID. Go to the next Job ID.");
             //Wait until the job is Finished
             while ( !Job_Status_Finished( jobid_request.back() ) ){
                   std::string message="Waiting 15 seconds";
                   logger.msg(Arc::VERBOSE, message);
             Arc::XMLNode jobxml(jobid_request.back());
                    throw std::invalid_argument(std::string("Could not process Job ID from ")+jobid_request.back());
             urlstr=(std::string)(jobxml["ReferenceParameters"]["JobSessionDir"]); // TODO: clever service address extraction
            std::string local_dir(compiler_op["make"]["download_place"]);   // for example: /home/user/tmp/s/
            if ( Current_Architecture != "")
               local_dir=  local_dir + Current_Architecture + "/";  
            logger.msg(Arc::VERBOSE, "Download url:  " + urlstr);
            logger.msg(Arc::VERBOSE, "Download path:  " + local_dir);
              throw std::invalid_argument("Missing service URL");
            Arc::URL download_url(urlstr);
              throw std::invalid_argument(std::string("Can't parse service URL ")+urlstr);
            Arc::MCCConfig download_cfg;
                 //    if(!tool.proxy_path.empty()) download_cfg.AddProxy(tool.proxy_path);
                 //    if(!tool.key_path.empty()) download_cfg.AddPrivateKey(tool.key_path);
                 //    if(!tool.cert_path.empty()) download_cfg.AddCertificate(tool.cert_path);
                 //    if(!tool.ca_dir.empty()) download_cfg.AddCADir(tool.ca_dir);
                 //    download_cfg.GetOverlay(tool.config_path);
            Arc::Compiler_AREXClient download_ac(download_url,download_cfg);
            bool r = get_file(*(download_ac.SOAP()),download_url, local_dir);
            if(!r) throw std::invalid_argument("Failed to download files!");
            logger.msg(Arc::VERBOSE, "Download cycle: end");
   catch (std::exception& err){
         std::cerr << "ERROR: " << err.what() << std::endl;
         return  Arc::MCC_Status(Arc::GENERIC_ERROR,"compiler","");
   //download end

   std::time ( &rawtime );  //current time
   ptm = gmtime ( &rawtime );

   std::stringstream out_finish;
   year = ptm->tm_year +1900;
   mon = ptm->tm_mon;
   out_finish << "GMT  "<< year << "."  << mon << "." << ptm->tm_mday;
   out_finish << "    " << ptm->tm_hour<< ":" << ptm->tm_min <<  ":" << ptm->tm_sec;

   logger.msg(Arc::VERBOSE, "Finished the compile:  " + out_finish.str() );
   std::string say = compiler_op["make"]["name"];
   hear = "Finished the compile: " + out_finish.str();
   //the response
   logger.msg(Arc::VERBOSE, "               The SOAP message send and return");

   Arc::MCC_Status return_Status(Arc::STATUS_OK, "compiler" , "this is the explanation" );
   return return_Status;

Here is the call graph for this function:

bool Arc::Service::ProcessSecHandlers ( Message message,
const std::string &  label = "" 
) const [protected, inherited]

Executes security handlers of specified queue.

For more information please see description of MCC::ProcessSecHandlers

Definition at line 22 of file Service.cpp.

    std::map<std::string,std::list<ArcSec::SecHandler*> >::const_iterator q = sechandlers_.find(label);
    if(q == sechandlers_.end()) {
        logger.msg(DEBUG, "No security processing/check requested for '%s'", label);
        return true;

    std::list<ArcSec::SecHandler*>::const_iterator h = q->second.begin();
    for(;h!=q->second.end();++h) {
        const ArcSec::SecHandler* handler = *h;
        if(handler) if(!(handler->Handle(&message))) {
            logger.msg(DEBUG, "Security processing/check for '%s' failed", label);
            return false;
    logger.msg(DEBUG, "Security processing/check for '%s' passed", label);
    return true;

Here is the call graph for this function:

Here is the caller graph for this function:

bool Arc::Service::RegistrationCollector ( XMLNode doc) [virtual, inherited]

Service specific registartion collector, used for generate service registartions.

In implemented service this method should generate GLUE2 document with part of service description which service wishes to advertise to Information Services.

Reimplemented in ARex::ARexService, ISIS::ISIService, GridScheduler::GridSchedulerService, Echo::Service_Echo, ArcSec::Charon, Paul::PaulService, ArcSec::Service_Delegation, SPService::Service_SP, ArcSec::Service_SLCS, Hopi::Hopi, and Arc::Service_PythonWrapper.

Definition at line 41 of file Service.cpp.

    logger.msg(WARNING, "Empty registration collector");

Here is the call graph for this function:

Member Data Documentation

Logger object used to print messages generated by this class.

Reimplemented from Arc::Service.

Definition at line 20 of file compiler.h.

Definition at line 18 of file compiler.h.

std::string Compiler::Service_Compiler::script_url_ [protected]

Definition at line 17 of file compiler.h.

std::map<std::string,std::list<ArcSec::SecHandler*> > Arc::Service::sechandlers_ [protected, inherited]

Set of labeled authentication and authorization handlers.

MCC calls sequence of handlers at specific point depending on associated identifier. in most aces those are "in" and "out" for incoming and outgoing messages correspondingly.

Definition at line 40 of file Service.h.

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