Back to index

nordugrid-arc-nox  1.1.0~rc6
get_factory_attributes_document.cpp
Go to the documentation of this file.
00001 #ifdef HAVE_CONFIG_H
00002 #include <config.h>
00003 #endif
00004 
00005 #include <arc/StringConv.h>
00006 #include <arc/message/SOAPEnvelope.h>
00007 #include <arc/ws-addressing/WSA.h>
00008 #include "job.h"
00009 
00010 #include "arex.h"
00011 
00012 namespace ARex {
00013 
00014 
00015 Arc::MCC_Status ARexService::GetFactoryAttributesDocument(ARexGMConfig& config,Arc::XMLNode in,Arc::XMLNode out) {
00016   /*
00017   GetFactoryAttributesDocument
00018 
00019   GetFactoryAttributesDocumentResponse
00020     FactoryResourceAttributesDocument
00021       BasicResourceAttributesDocument (optional)
00022       IsAcceptingNewActivities (boolean)
00023       CommonName (optional,string)
00024       LongDescription (optional,string)
00025       TotalNumberOfActivities (long)
00026       ActivityReference (wsa:EndpointReferenceType,unbounded)
00027       TotalNumberOfContainedResources (long)
00028       ContainedResource (anyType,unbounded)
00029       NamingProfile (anyURI,unbounded)
00030       BESExtension (anyURI,unbounded)
00031       LocalResourceManagerType (anyURI)
00032       OperatingSystem (optional,string)
00033   */
00034   {
00035     std::string s;
00036     in.GetXML(s);
00037     logger.msg(Arc::VERBOSE, "GetFactoryAttributesDocument: request = \n%s", s);
00038   };
00039   Arc::XMLNode doc = out.NewChild("bes-factory:FactoryResourceAttributesDocument");
00040   //doc.NewChild("bes-factory:BasicResourceAttributesDocument");
00041   doc.NewChild("bes-factory:IsAcceptingNewActivities")="true";
00042   //doc.NewChild("bes-factory:CommonName")=common_name_;
00043   //doc.NewChild("bes-factory:LongDescription")=long_description_;
00044   std::list<std::string> jobs = ARexJob::Jobs(config,logger_);
00045   doc.NewChild("bes-factory:TotalNumberOfActivities")=Arc::tostring(jobs.size());
00046   for(std::list<std::string>::iterator j = jobs.begin();j!=jobs.end();++j) {
00047     Arc::WSAEndpointReference identifier(doc.NewChild("bes-factory:ActivityReference"));
00048     // Make job's ID
00049     identifier.Address(config.Endpoint()); // address of service
00050     identifier.ReferenceParameters().NewChild("a-rex:JobID")=(*j);
00051     identifier.ReferenceParameters().NewChild("a-rex:JobSessionDir")=config.Endpoint()+"/"+(*j);
00052   };
00053   doc.NewChild("bes-factory:TotalNumberOfContainedResources")=Arc::tostring(0);
00054   doc.NewChild("bes-factory:NamingProfile")="http://schemas.ggf.org/bes/2006/08/bes/naming/BasicWSAddressing";
00055   doc.NewChild("bes-factory:BESExtension")="http://www.nordugrid.org/schemas/a-rex";
00056   doc.NewChild("bes-factory:LocalResourceManagerType")=lrms_name_;
00057   doc.NewChild("bes-factory:OperatingSystem")=os_name_;
00058   {
00059     std::string s;
00060     out.GetXML(s);
00061     logger.msg(Arc::VERBOSE, "GetFactoryAttributesDocument: response = \n%s", s);
00062   };
00063   return Arc::MCC_Status(Arc::STATUS_OK);
00064 }
00065 
00066 } // namespace ARex
00067