Back to index

nordugrid-arc-nox  1.1.0~rc6
Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Private Member Functions | Private Attributes
ISIS::ISIService Class Reference

#include <isis.h>

Inheritance diagram for ISIS::ISIService:
Inheritance graph
[legend]
Collaboration diagram for ISIS::ISIService:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 ISIService (Arc::Config *cfg)
virtual ~ISIService (void)
virtual Arc::MCC_Status process (Arc::Message &in, Arc::Message &out)
 Method for processing of requests and responses.
virtual bool RegistrationCollector (Arc::XMLNode &doc)
 Service specific registartion collector, used for generate service registartions.
virtual void AddSecHandler (Config *cfg, ArcSec::SecHandler *sechandler, const std::string &label="")
 Add security components/handlers to this MCC.
virtual std::string getID ()
 Service may implement own service identitifer gathering method.

Protected Member Functions

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

Protected Attributes

std::map< std::string,
std::list< ArcSec::SecHandler * > > 
sechandlers_
 Set of labeled authentication and authorization handlers.

Static Protected Attributes

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

Private Member Functions

Arc::MCC_Status make_soap_fault (Arc::Message &outmsg, const std::string &reason="")
void make_soap_fault (Arc::XMLNode &response, const std::string &reason="")
void BootStrap (int retry_count)
void Neighbors_Calculate (std::multimap< std::string, Arc::ISIS_description >::const_iterator it, int count)
void Neighbors_Update ()
std::string PeerID (Arc::XMLNode &regentry)
std::string Cert (Arc::XMLNode &regentry)
std::string Key (Arc::XMLNode &regentry)
std::string Proxy (Arc::XMLNode &regentry)
std::string CaDir (Arc::XMLNode &regentry)
bool CheckAuth (const std::string &action, Arc::Message &inmsg, Arc::XMLNode &response)
bool CheckAuth (const std::string &action, Arc::Message &inmsg, Arc::Message &outmsg)
Arc::MCC_Status Query (Arc::XMLNode &request, Arc::XMLNode &response)
Arc::MCC_Status Register (Arc::XMLNode &request, Arc::XMLNode &response)
Arc::MCC_Status RemoveRegistrations (Arc::XMLNode &request, Arc::XMLNode &response)
Arc::MCC_Status GetISISList (Arc::XMLNode &request, Arc::XMLNode &response)
Arc::MCC_Status Connect (Arc::XMLNode &request, Arc::XMLNode &response)

Private Attributes

Arc::Logger logger_
std::string endpoint_
Arc::Period valid
Arc::Period remove
int retry
int sparsity
std::string my_key
std::string my_cert
std::string my_proxy
std::string my_cadir
std::string my_cafile
bool KillThread
int ThreadsCount
std::vector< Arc::XMLNode * > garbage_collector
Arc::XmlDatabasedb_
Arc::NS ns_
std::vector
< Arc::ISIS_description
infoproviders_
std::string bootstrapISIS
std::string my_hash
std::multimap< std::string,
Arc::ISIS_description
hash_table
bool neighbors_update_needed
bool available_provider
bool connection_lock
int neighbors_count
bool neighbors_lock
std::vector
< Arc::ISIS_description
neighbors_
Neighbor_Container not_availables_neighbors_
Arc::InformationContainer infodoc_

Detailed Description

Definition at line 27 of file isis.h.


Constructor & Destructor Documentation

Definition at line 343 of file isis.cpp.

                                        :RegisteredService(cfg),logger_(Arc::Logger::rootLogger, "ISIS"),valid("PT1D"),remove("PT1D"),db_(NULL),neighbors_update_needed(false),available_provider(false),neighbors_count(0),neighbors_lock(false),connection_lock(false) {

        logger_.msg(Arc::VERBOSE, "Parsing configuration parameters");

        // Endpoint url from the configuration
        endpoint_=(std::string)((*cfg)["endpoint"]);
        logger_.msg(Arc::VERBOSE, "Endpoint: %s", endpoint_);
        if ( endpoint_.empty()){
           logger_.msg(Arc::ERROR, "Empty endpoint element in the configuration!");
           return;
        }
         // Key from the configuration
         my_key=(std::string)((*cfg)["KeyPath"]);
         if (!my_key.empty()) logger_.msg(Arc::VERBOSE, "KeyPath: %s", my_key);

         // Cert from the configuration
         my_cert=(std::string)((*cfg)["CertificatePath"]);
         if (!my_cert.empty()) logger_.msg(Arc::VERBOSE, "CertificatePath: %s", my_cert);

         // Proxy from the configuration
         my_proxy=(std::string)((*cfg)["ProxyPath"]);
         if (!my_proxy.empty()) logger_.msg(Arc::VERBOSE, "ProxyPath: %s", my_proxy);

         // CaDir from the configuration
         my_cadir=(std::string)((*cfg)["CACertificatesDir"]);
         if (!my_cadir.empty()) logger_.msg(Arc::VERBOSE, "CACertificatesDir: %s", my_cadir);

         // CA Certificate Path from the configuration
         my_cafile=(std::string)((*cfg)["CACertificatePath"]);
         if (!my_cafile.empty()) logger_.msg(Arc::VERBOSE, "CACertficatePath: %s", my_cafile);

         // Checking for credentials
         if (my_key.empty() && my_proxy.empty()){
             logger_.msg(Arc::WARNING, "Missing or empty KeyPath element in the configuration!");
         }
         if (my_cert.empty() && my_proxy.empty()){
             logger_.msg(Arc::WARNING, "Misisng or empty CertificatePath element in the configuration!");
         }
         if (my_proxy.empty() && (my_cert.empty() || my_key.empty()) ){
             logger_.msg(Arc::WARNING, "Missing or empty ProxyPath element in the configuration!");
         }
         if (my_cadir.empty() && my_cafile.empty()){
             logger_.msg(Arc::WARNING, "Missing or empty CACertificatesDir element in the configuration!");
             logger_.msg(Arc::WARNING, "Missing or empty CACertificatePath element in the configuration!");
         }

        // Assigning service description - Glue2 document should go here.
        infodoc_.Assign(Arc::XMLNode(
        "<?xml version=\"1.0\"?><Domains xmlns=\"http://schemas.ogf.org/glue/2008/05/spec_2.0_d41_r01\"><AdminDomain Distributed=\"\"><Services><Service Name=\"\" ID=\"\" Validity=\"\" OtherInfo=\"\"><Associations /><Endpoint><HealthState>ok</HealthState><ServingState>production</ServingState></Endpoint><Capability>information.provenance</Capability></Service></Services></AdminDomain></Domains>"
        ),true);


        if ((bool)(*cfg)["retry"]) {
            if (!((std::string)(*cfg)["retry"]).empty()) {
                if(EOF == sscanf(((std::string)(*cfg)["retry"]).c_str(), "%d", &retry) || retry < 1)
                {
                    logger_.msg(Arc::ERROR, "Configuration error. Retry: \"%s\" is not a valid value. Default value will be used.",(std::string)(*cfg)["retry"]);
                    retry = 5;
                }
            } else retry = 5;
        } else retry = 5;

        logger_.msg(Arc::VERBOSE, "Retry: %d", retry);

        if ((bool)(*cfg)["sparsity"]) {
            if (!((std::string)(*cfg)["sparsity"]).empty()) {
                if(EOF == sscanf(((std::string)(*cfg)["sparsity"]).c_str(), "%d", &sparsity) || sparsity < 2)
                {
                    logger_.msg(Arc::ERROR, "Configuration error. Sparsity: \"%s\" is not a valid value. Default value will be used.",(std::string)(*cfg)["sparsity"]);
                    sparsity = 2;
                }
            } else sparsity = 2;
        } else sparsity = 2;

        logger_.msg(Arc::VERBOSE, "Sparsity: %d", sparsity);

        ThreadsCount = 0;
        KillThread = false;

        // Set up ETValid if there is any in the configuration
        if ((bool)(*cfg)["ETValid"]) {
            if (!((std::string)(*cfg)["ETValid"]).empty()) {
                Arc::Period validp((std::string)(*cfg)["ETValid"]);
                if(validp.GetPeriod() <= 0) {
                    logger_.msg(Arc::ERROR, "Configuration error. ETValid: \"%s\" is not a valid value. Default value will be used.",(std::string)(*cfg)["ETValid"]);
                } else {
                    valid.SetPeriod( validp.GetPeriod() );
                }
            } else logger_.msg(Arc::ERROR, "Configuration error. ETValid is empty. Default value will be used.");
        } else logger_.msg(Arc::VERBOSE, "ETValid: Default value will be used.");

        logger_.msg(Arc::VERBOSE, "ETValid: %d seconds", valid.GetPeriod());

        // Set up ETRemove if there is any in the configuration
        if ((bool)(*cfg)["ETRemove"]) {
            if (!((std::string)(*cfg)["ETRemove"]).empty()) {
                Arc::Period removep((std::string)(*cfg)["ETRemove"]);
                if(removep.GetPeriod() <= 0) {
                    logger_.msg(Arc::ERROR, "Configuration error. ETRemove: \"%s\" is not a valid value. Default value will be used.",(std::string)(*cfg)["ETRemove"]);
                } else {
                    remove.SetPeriod( removep.GetPeriod() );
                }
            } else logger_.msg(Arc::ERROR, "Configuration error. ETRemove is empty. Default value will be used.");
        } else logger_.msg(Arc::VERBOSE, "ETRemove: Default value will be used.");

        logger_.msg(Arc::VERBOSE, "ETRemove: %d seconds", remove.GetPeriod());

        ns_["isis"] = "http://www.nordugrid.org/schemas/isis/2008/08";

        std::string db_path = (std::string)(*cfg)["DBPath"];
        if (db_path.empty()) {
            logger_.msg(Arc::ERROR, "Invalid database path definition");
            return;
        }

        // Create ServiceURL hash
        FileCacheHash md5;
        // calculate my hash from the endpoint URL
        my_hash = md5.getHash(endpoint_);

        // Init database
        db_ = new Arc::XmlDatabase(db_path, "isis");

        // Exit if the database was unable to initialize
        if ( !(*db_) ) {
            exit(EXIT_FAILURE);
        }

        // -DB cleaning
        std::map<std::string, Arc::XMLNodeList> result;
        db_->queryAll("/*", result);
        std::map<std::string, Arc::XMLNodeList>::iterator it;
        for (it = result.begin(); it != result.end(); it++) {
             if (it->second.size() == 0) {
                continue;
             }
             db_->del(it->first);
        }

        // Connection to the cloud in 6 steps.
        // 1. step: Put it's own EndpoingURL(s) from configuration in the set of neighbors for testing purpose.
        int i=0;
        while ((bool)(*cfg)["InfoProvider"][i]) {
            if ( endpoint_ != (std::string)(*cfg)["InfoProvider"][i]["URL"] ) {
               if ((std::string)(*cfg)["InfoProvider"][i]["URL"] == "") {
                  available_provider = true;
                  logger_.msg(Arc::WARNING, "The InfoProvider URL is empty.");
               } else {
                 Arc::ISIS_description isisdesc;
                 isisdesc.url = (std::string)(*cfg)["InfoProvider"][i]["URL"];
                 infoproviders_.push_back(isisdesc);
               }
            }
            i++;
        }
        // 2.-6. steps are in the BootStrap function.
        BootStrap(retry);

        // Create Soft-State database threads
        // Valid thread creation
        Soft_State* valid_data;
        // This data will be freed in the soft_state_thread function that periodically checks whether the ISIS is stoped
        // or not, and if yes, then destroy itself and free the relevant pointer.
        valid_data = new Soft_State();
        valid_data->function = "ETValid";
        valid_data->sleep = ((int)valid.GetPeriod())/2;
        valid_data->query = "//RegEntry/MetaSrcAdv[count(Expiration)=1]/ServiceID";
        valid_data->database = db_;
        valid_data->kill_thread = &KillThread;
        valid_data->threads_count = &ThreadsCount;
        valid_data->available_provider_ = &available_provider;
        valid_data->providers = &infoproviders_;
        valid_data->neighbors_update_needed_ = &neighbors_update_needed;
        Arc::CreateThreadFunction(&soft_state_thread, valid_data);


        // Remove thread creation
        Soft_State* remove_data;
        // This data will be freed in the soft_state_thread function that periodically checks whether the ISIS is stoped
        // or not, and if yes, then destroy itself and free the relevant pointer.
        remove_data = new Soft_State();
        remove_data->function = "ETRemove";
        remove_data->sleep = ((int)remove.GetPeriod())/2;
        remove_data->query = "//RegEntry/MetaSrcAdv[count(Expiration)=0]/ServiceID";
        remove_data->database = db_;
        remove_data->kill_thread = &KillThread;
        remove_data->threads_count = &ThreadsCount;
        Arc::CreateThreadFunction(&soft_state_thread, remove_data);

    }

Here is the call graph for this function:

ISIS::ISIService::~ISIService ( void  ) [virtual]

Definition at line 534 of file isis.cpp.

                               {
        // RemoveRegistration message send to neighbors with in my serviceID.
        std::map<std::string, Arc::XMLNodeList> result;
        std::string query_string = "/RegEntry/SrcAdv/EPR[ Address = '";
        query_string += endpoint_;
        query_string += "']";
        db_->queryAll(query_string, result);
        std::map<std::string, Arc::XMLNodeList>::iterator it;
        for (it = result.begin(); it != result.end(); it++) {
            if (it->second.size() == 0 || it->first == "" ) {
                continue;
            }
            Arc::XMLNode data;
            //The next function calling is db_->get(ServiceID, RegistrationEntry);
            db_->get(it->first, data);
            std::string serviceid((std::string)data["MetaSrcAdv"]["ServiceID"]);
            if ( !serviceid.empty() ) {
               Arc::NS reg_ns;
               reg_ns["isis"] = ISIS_NAMESPACE;

               Arc::XMLNode remove_message(reg_ns,"isis:RemoveRegistrations");
               remove_message.NewChild("ServiceID") = serviceid;
               remove_message.NewChild("MessageGenerationTime") = Current_Time();
               Arc::ISIS_description isis;
               isis.url = endpoint_;
               isis.key = my_key;
               isis.cert = my_cert;
               isis.proxy = my_proxy;
               isis.cadir = my_cadir;
               isis.cafile = my_cafile;
               std::multimap<std::string,Arc::ISIS_description> local_hash_table;
               local_hash_table = hash_table;
               logger_.msg(Arc::VERBOSE, "RemoveRegistrations message sent to neighbors.");
               SendToNeighbors(remove_message, neighbors_, logger_, isis, &not_availables_neighbors_,endpoint_,local_hash_table);
            }
            break;
        }

        KillThread = true;
        //Waiting until the all RemoveRegistration message send to neighbors.
        sleep(10);
        for (unsigned int i=0; i< garbage_collector.size(); i++) {
            if(garbage_collector[i]) delete garbage_collector[i];
        }
        while (ThreadsCount > 0){
            logger_.msg(Arc::VERBOSE, "ISIS (%s) has %d more thread%s", endpoint_, ThreadsCount, ThreadsCount>1?"s.":".");
            sleep(10);
        }

        if (db_ != NULL) {
            delete db_;
        }
        logger_.msg(Arc::VERBOSE, "ISIS (%s) destroyed.", endpoint_);
    }

Here is the call graph for this function:


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:

void ISIS::ISIService::BootStrap ( int  retry_count) [private]

Definition at line 1128 of file isis.cpp.

                                              {
        // 2. step: goto InfoProviderISIS (one of the list)
        if ( infoproviders_.size() != 0 ){
            std::srand(time(NULL));
            Arc::ISIS_description rndProvider = infoproviders_[std::rand() % infoproviders_.size()];

            std::map<std::string,int> retry_;
            for( unsigned int i=0; i< infoproviders_.size(); i++ ) {
               retry_[ infoproviders_[i].url ] = retry_count;
            }

            // 3. step: Send Query SOAP message to the providerISIS with Filter
            Arc::PayloadSOAP *response = NULL;
            Arc::MCCConfig mcc_cfg;
            mcc_cfg.AddPrivateKey(my_key);
            mcc_cfg.AddCertificate(my_cert);
            mcc_cfg.AddProxy(my_proxy);
            mcc_cfg.AddCADir(my_cadir);
            mcc_cfg.AddCAFile(my_cafile);
            // Create and send "Query" request
            Arc::NS message_ns;
            message_ns[""] = "http://www.nordugrid.org/schemas/isis/2007/06";
            message_ns["wsa"] = "http://www.w3.org/2005/08/addressing";
            message_ns["glue2"] = GLUE2_D42_NAMESPACE;
            message_ns["isis"] = ISIS_NAMESPACE;
            Arc::PayloadSOAP req(message_ns);

            req.NewChild("Query");
            req["Query"].NewChild("QueryString") = "/RegEntry/SrcAdv[ Type = 'org.nordugrid.infosys.isis']";
            Arc::MCC_Status status;

            std::vector<Arc::ISIS_description> temporary_provider;
            temporary_provider = infoproviders_;
            bool isavailable = false;
            while ( !isavailable && retry_.size() > 0 ) {
                Arc::ClientSOAP client_entry(mcc_cfg, rndProvider.url, 60);
                logger_.msg(Arc::VERBOSE, "Sending Query message to the InfoProvider (%s) and waiting for the response.", rndProvider.url );
                status= client_entry.process(&req,&response);

                if ( (!status.isOk()) || (!response) || (response->IsFault()) ) {
                   logger_.msg(Arc::INFO, "Query failed at %s, choosing new InfoProvider.", rndProvider.url);
                   retry_[rndProvider.url]--;
                   if ( retry_[rndProvider.url] < 1 ) {
                      retry_.erase(rndProvider.url);
                      for (unsigned int i=0; i<temporary_provider.size(); i++){
                          if (temporary_provider[i].url == rndProvider.url){
                             temporary_provider.erase(temporary_provider.begin()+i);
                             break;
                          }
                      }
                      logger_.msg(Arc::INFO, "Remove ISIS (%s) from the list of InfoProviders.", rndProvider.url);
                   }
                   // new provider search
                   if ( temporary_provider.size() > 0 )
                      rndProvider = temporary_provider[std::rand() % temporary_provider.size()];
                } else {
                   logger_.msg(Arc::VERBOSE, "Status (%s): OK", rndProvider.url );
                   isavailable = true;
                   bootstrapISIS = rndProvider.url;
                };
            }
            available_provider = isavailable;

            // 4. step: Hash table and neighbors filling
            std::vector<Service_data> find_servicedatas;
            for (unsigned int i=0; bool( (*response)["QueryResponse"]["RegEntry"][i]); i++ ) {
                std::string serviceid = (std::string)(*response)["QueryResponse"]["RegEntry"][i]["MetaSrcAdv"]["ServiceID"];
                if ( serviceid.empty() )
                    continue;
                std::string serviceurl = (std::string)(*response)["QueryResponse"]["RegEntry"][i]["SrcAdv"]["EPR"]["Address"];
                if ( serviceurl.empty() )
                    serviceurl = serviceid;
                Service_data sdata;
                sdata.serviceID = serviceid;
                sdata.service.url = serviceurl;
                Arc::XMLNode regentry = (*response)["QueryResponse"]["RegEntry"][i];
                /*sdata.service.cert = Cert(regentry);
                sdata.service.key = Key(regentry);
                sdata.service.proxy = Proxy(regentry);
                sdata.service.cadir = CaDir(regentry);*/
                sdata.peerID = PeerID(regentry);
                find_servicedatas.push_back( sdata );
            }
            if(response) delete response;

            if ( available_provider )
                hash_table.clear();
            for (unsigned int i=0; i < find_servicedatas.size(); i++) {
                // add the hash and the service info into the hash table
                hash_table.insert( std::pair<std::string,Arc::ISIS_description>( find_servicedatas[i].peerID, find_servicedatas[i].service) );
            }

            neighbors_count = 0;
            if ( !isavailable) {
               if ( neighbors_.size() >0 ){
                  Neighbors_Update();
               }
               logger_.msg(Arc::VERBOSE, "No InfoProvider is available." );
            }
            else if ( hash_table.size() == 0 ) {
               if ( neighbors_.size() >0 ){
                  Neighbors_Update();
               }
               logger_.msg(Arc::VERBOSE, "The hash table is empty. New cloud has been created." );
            } else {
               // log(2)x = (log(10)x)/(log(10)2)
               // and the largest integral value that is not greater than x.
               neighbors_count = (int)ceil(log10(hash_table.size())/log10(sparsity));
               if (neighbors_count == 0)
                  neighbors_count = 1;

               // neighbors vector filling
               std::multimap<std::string,Arc::ISIS_description>::const_iterator it = hash_table.upper_bound(my_hash);
               Neighbors_Calculate(it, neighbors_count);
               logger_.msg(Arc::VERBOSE, "Neighbors count: %d", neighbors_.size() );

               // 5. step: Connect message send to one ISIS of the neighbors
               Arc::PayloadSOAP connect_req(message_ns);
               connect_req.NewChild("Connect").NewChild("URL") = endpoint_;

               bool isavailable_connect = false;
               bool no_more_isis = false;
               unsigned int current = 0;
               Arc::PayloadSOAP *response_c = NULL;
               while ( !isavailable_connect && !no_more_isis) {
                   int retry_connect = retry;
                   // Try to connect one ISIS of the neighbors list
                   while ( !isavailable_connect && retry_connect>0) {
                       if (neighbors_[current].url == endpoint_) {
                           retry_connect = 0;
                           continue;
                       }
                       Arc::ClientSOAP connectclient_entry(mcc_cfg, neighbors_[current].url, 60);
                       logger_.msg(Arc::VERBOSE, "Sending Connect request to the ISIS(%s) and waiting for the response.", neighbors_[current].url );

                       status= connectclient_entry.process(&connect_req,&response_c);
                       if ( (!status.isOk()) || (!response_c) || (response_c->IsFault()) ) {
                          logger_.msg(Arc::INFO, "Connect status (%s): Failed", neighbors_[current].url );
                          retry_connect--;
                       } else {
                          logger_.msg(Arc::VERBOSE, "Connect status (%s): OK", neighbors_[current].url );
                          isavailable_connect = true;
                       };
                   }

                   if ( current+1 == neighbors_.size() ) {
                      no_more_isis = true;
                      not_availables_neighbors_.push(neighbors_[current].url);
                      logger_.msg(Arc::VERBOSE, "No more available ISIS in the neighbors list." );
                   } else if (!isavailable_connect) {
                      if ( !not_availables_neighbors_.contains(neighbors_[current].url) )
                        not_availables_neighbors_.push(neighbors_[current].url);
                      current++;
                   }
               }

               if ( isavailable_connect ){
                  // 6. step: response data processing (DB sync, Config saving)
                  // Remove url just in case - implemented in the Neighbor_Container class
                  not_availables_neighbors_.remove(neighbors_[current].url);

                  // -DB syncronisation
                  // serviceIDs in my DB
                  std::vector<std::string> ids;
                  std::map<std::string, Arc::XMLNodeList> result;
                  db_->queryAll("/RegEntry", result);
                  std::map<std::string, Arc::XMLNodeList>::iterator it_db;
                  for (it_db = result.begin(); it_db != result.end(); it_db++) {
                      if (it_db->second.size() == 0) {
                          continue;
                      }
                      ids.push_back(it_db->first);
                  }

                  Arc::NS reg_ns;
                  reg_ns["isis"] = ISIS_NAMESPACE;

                  Arc::XMLNode sync_datas(reg_ns,"isis:Register");
                  Arc::XMLNode header = sync_datas.NewChild("isis:Header");

                  header.NewChild("MessageGenerationTime") = Current_Time();

                  for (unsigned int i=0; bool((*response_c)["ConnectResponse"]["Database"]["RegEntry"][i]); i++ ){
                      Arc::XMLNode regentry_xml;
                      (*response_c)["ConnectResponse"]["Database"]["RegEntry"][i].New(regentry_xml);
                      std::string id = regentry_xml["MetaSrcAdv"]["ServiceID"];
                      if ( find(ids.begin(), ids.end(), id) == ids.end() ){
                         db_->put( id, regentry_xml);
                      } else {
                         // ID is in the DataBase.
                         Arc::XMLNode data_;
                         //The next function calling is db_->get(ServiceID, RegistrationEntry);
                         db_->get(id, data_);
                         if ( Arc::Time((std::string)data_["MetaSrcAdv"]["GenTime"]) <=
                              Arc::Time((std::string)regentry_xml["MetaSrcAdv"]["GenTime"])){
                            db_->put( id, regentry_xml);
                         } else {
                            // add data to syncronisation data
                            sync_datas.NewChild(data_);
                         }
                          ids.erase(find(ids.begin(),ids.end(),id));
                      }
                  }

                  // with almost one probability the neighbor update will necessary after connection
                  neighbors_update_needed = true;

                  for (unsigned int i=0; i<ids.size(); i++){
                      Arc::XMLNode data_;
                      //The next function calling is db_->get(ServiceID, RegistrationEntry);
                      db_->get(ids[i], data_);
                      sync_datas.NewChild(data_);
                  }
                  if ( bool(sync_datas["RegEntry"]) ){
                     Arc::ISIS_description isis;
                     isis.url = endpoint_;
                     isis.key = my_key;
                     isis.cert = my_cert;
                     isis.proxy = my_proxy;
                     isis.cadir = my_cadir;
                     isis.cafile = my_cafile;
                     std::multimap<std::string,Arc::ISIS_description> local_hash_table;
                     local_hash_table = hash_table;
                     SendToNeighbors(sync_datas, neighbors_, logger_, isis, &not_availables_neighbors_,endpoint_,local_hash_table);
                  }
                  logger_.msg(Arc::VERBOSE, "Database mass updated." );
               }
               if (response_c) delete response_c;
            }
        } else {
            Neighbors_Update();
        }
        return;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

std::string ISIS::ISIService::CaDir ( Arc::XMLNode regentry) [private]

Definition at line 1115 of file isis.cpp.

                                                    {
        std::string cadir;
        for (int j=0; bool(regentry["SrcAdv"]["SSPair"][j]); j++ ){
            if ("CaDir" == (std::string)regentry["SrcAdv"]["SSPair"][j]["Name"]){
               cadir = (std::string)regentry["SrcAdv"]["SSPair"][j]["Value"];
               break;
            } else {
               continue;
            }
        }
        return cadir;
    }
std::string ISIS::ISIService::Cert ( Arc::XMLNode regentry) [private]

Definition at line 1076 of file isis.cpp.

                                                   {
        std::string cert;
        for (int j=0; bool(regentry["SrcAdv"]["SSPair"][j]); j++ ){
            if ("Cert" == (std::string)regentry["SrcAdv"]["SSPair"][j]["Name"]){
               cert = (std::string)regentry["SrcAdv"]["SSPair"][j]["Value"];
               break;
            } else {
               continue;
            }
        }
        return cert;
    }
bool ISIS::ISIService::CheckAuth ( const std::string &  action,
Arc::Message inmsg,
Arc::XMLNode response 
) [private]

Definition at line 811 of file isis.cpp.

                                                                                              {
        inmsg.Auth()->set("ISIS",new ISISSecAttr(action));
        if(!ProcessSecHandlers(inmsg,"incoming")) {
            logger_.msg(Arc::ERROR, "Security check failed in ISIS for incoming message");
            make_soap_fault(response, "Not allowed");
            return false;
        };
        return true;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

bool ISIS::ISIService::CheckAuth ( const std::string &  action,
Arc::Message inmsg,
Arc::Message outmsg 
) [private]

Definition at line 801 of file isis.cpp.

                                                                                             {
        inmsg.Auth()->set("ISIS",new ISISSecAttr(action));
        if(!ProcessSecHandlers(inmsg,"incoming")) {
            logger_.msg(Arc::ERROR, "Security check failed in ISIS for incoming message");
            make_soap_fault(outmsg, "Not allowed");
            return false;
        };
        return true;
    }

Here is the call graph for this function:

Arc::MCC_Status ISIS::ISIService::Connect ( Arc::XMLNode request,
Arc::XMLNode response 
) [private]

Definition at line 776 of file isis.cpp.

                                                                               {
        logger_.msg(Arc::VERBOSE, "Connect received");

        // Database Dump
        response.NewChild("Database");
        std::map<std::string, Arc::XMLNodeList> result;
        db_->queryAll("/RegEntry", result);
        std::map<std::string, Arc::XMLNodeList>::iterator it;
        for (it = result.begin(); it != result.end(); it++) {
            if (it->second.size() == 0) {
               continue;
            }
            Arc::XMLNode data_;
            //The next function calling is db_->get(ServiceID, RegistrationEntry);
            db_->get(it->first, data_);
            // add data to output
            response["Database"].NewChild(data_);
        }

        response.NewChild("Config");
        response.NewChild("EndpointURL") = endpoint_;

        return Arc::MCC_Status(Arc::STATUS_OK);
    }

Here is the call graph for this function:

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 ""; };
Arc::MCC_Status ISIS::ISIService::GetISISList ( Arc::XMLNode request,
Arc::XMLNode response 
) [private]

Definition at line 763 of file isis.cpp.

                                                                                   {
        logger_.msg(Arc::VERBOSE, "GetISISList received");
        // If the neighbors_ vector is empty, then return with the own
        // address else with the list of neighbors.
        if (neighbors_.size() == 0 ) {
            response.NewChild("EPR") = endpoint_;
        }
        for (std::vector<Arc::ISIS_description>::iterator it = neighbors_.begin(); it < neighbors_.end(); it++) {
            response.NewChild("EPR") = (*it).url;
        }
        return Arc::MCC_Status(Arc::STATUS_OK);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

std::string ISIS::ISIService::Key ( Arc::XMLNode regentry) [private]

Definition at line 1089 of file isis.cpp.

                                                  {
        std::string key;
        for (int j=0; bool(regentry["SrcAdv"]["SSPair"][j]); j++ ){
            if ("Key" == (std::string)regentry["SrcAdv"]["SSPair"][j]["Name"]){
               key = (std::string)regentry["SrcAdv"]["SSPair"][j]["Value"];
               break;
            } else {
               continue;
            }
        }
        return key;
    }
Arc::MCC_Status ISIS::ISIService::make_soap_fault ( Arc::Message outmsg,
const std::string &  reason = "" 
) [private]

Definition at line 953 of file isis.cpp.

                                                                                        {
        Arc::PayloadSOAP* outpayload = new Arc::PayloadSOAP(ns_,true);
        Arc::SOAPFault* fault = outpayload?outpayload->Fault():NULL;
        if(fault) {
            fault->Code(Arc::SOAPFault::Receiver);
            if(reason.empty()) {
                fault->Reason("Failed processing request");
            } else {
                fault->Reason(reason);
            }
        }

        outmsg.Payload(outpayload);
        return Arc::MCC_Status(Arc::STATUS_OK);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

void ISIS::ISIService::make_soap_fault ( Arc::XMLNode response,
const std::string &  reason = "" 
) [private]

Definition at line 969 of file isis.cpp.

                                                                                 {
        Arc::SOAPEnvelope fault(ns_,true);
        if(fault) {
            fault.Fault()->Code(Arc::SOAPFault::Receiver);
            if(reason.empty()) {
                fault.Fault()->Reason("Failed processing request");
            } else {
                fault.Fault()->Reason(reason);
            }
            response.Replace(fault.Child());
        }
    }

Here is the call graph for this function:

void ISIS::ISIService::Neighbors_Calculate ( std::multimap< std::string, Arc::ISIS_description >::const_iterator  it,
int  count 
) [private]

Definition at line 1035 of file isis.cpp.

                                                                                                                {
        int sum_step = 1;
        neighbors_.clear();
        for (int i=0; i<count; i++) {
            if (it == hash_table.end())
               it = hash_table.begin();
            neighbors_.push_back(it->second);
            //calculate the next neighbors
            for (int step=0; step<sum_step; step++){
               it++;
               if (it == hash_table.end())
                  it = hash_table.begin();
            }
            sum_step = sum_step*sparsity;
        }
        return;
    }

Here is the caller graph for this function:

Definition at line 988 of file isis.cpp.

                                      {
        // wait until the neighbors list in used
        while ( neighbors_lock ) {
           //sleep(10);
        }

        // neighbors lock start
        neighbors_lock = true;

        // -hash_table recalculate
        hash_table.clear();
        std::map<std::string, Arc::XMLNodeList> result;
        db_->queryAll("/RegEntry/SrcAdv[ Type = 'org.nordugrid.infosys.isis']", result);
        std::map<std::string, Arc::XMLNodeList>::iterator query_it;
        for (query_it = result.begin(); query_it != result.end(); query_it++) {
             if (query_it->second.size() == 0) {
                continue;
             }
             Arc::XMLNode data_;
             //The next function calling is db_->get(ServiceID, RegistrationEntry);
             db_->get(query_it->first, data_);
             Arc::XMLNode regentry = data_;
             Arc::ISIS_description service;
             service.url = (std::string)data_["SrcAdv"]["EPR"]["Address"];
             if ( service.url.empty() )
                service.url = query_it->first;
             hash_table.insert( std::pair<std::string,Arc::ISIS_description>( PeerID(regentry), service) );
        }

        // neighbors count update
        // log(2)x = (log(10)x)/(log(10)2)
        int new_neighbors_count = 0;
        if ( hash_table.size() > 0){
            new_neighbors_count = (int)ceil(log10(hash_table.size())/log10(sparsity));
        }
        logger_.msg(Arc::VERBOSE, "Neighbors count recalculate from %d to %d (at ISIS %s)", neighbors_count, new_neighbors_count, endpoint_);

        // neighbors vector filling
        std::multimap<std::string,Arc::ISIS_description>::const_iterator it = hash_table.upper_bound(my_hash);
        Neighbors_Calculate(it, new_neighbors_count);
        neighbors_count = new_neighbors_count;

        // neighbors lock end
        neighbors_lock = false;
        return;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

std::string ISIS::ISIService::PeerID ( Arc::XMLNode regentry) [private]

Definition at line 1053 of file isis.cpp.

                                                     {
        std::string peerid;
        for (int j=0; bool(regentry["SrcAdv"]["SSPair"][j]); j++ ){
            if ("peerID" == (std::string)regentry["SrcAdv"]["SSPair"][j]["Name"]){
               peerid = (std::string)regentry["SrcAdv"]["SSPair"][j]["Value"];
               break;
            } else {
               continue;
            }
        }

        if ( peerid.empty() ){
            FileCacheHash md5;
            // calculate hash from the endpoint URL or serviceID
            if ( bool(regentry["SrcAdv"]["EPR"]["Address"]) ){
               peerid = md5.getHash((std::string)regentry["SrcAdv"]["EPR"]["Address"]);
            } else {
               peerid = md5.getHash((std::string)regentry["MetaSrcAdv"]["ServiceID"]);
            }
        }
        return peerid;
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Arc::MCC_Status ISIS::ISIService::process ( Arc::Message request,
Arc::Message response 
) [virtual]

Method for processing of requests and responses.

This method is called by preceeding MCC in chain when a request needs to be processed. This method must call similar method of next MCC in chain unless any failure happens. Result returned by call to next MCC should be processed and passed back to previous MCC. In case of failure this method is expected to generate valid error response and return it back to previous MCC without calling the next one.

Parameters:
requestThe request that needs to be processed.
responseA Message object that will contain the response of the request when the method returns.
Returns:
An object representing the status of the call.

Implements Arc::MCCInterface.

Definition at line 833 of file isis.cpp.

                                                                           {

        // Return with fault if the service wasn't initialized and configured properly.
        if ( db_ == NULL ) return make_soap_fault(outmsg);

        if ( neighbors_count == 0 || (!available_provider && infoproviders_.size() > 0) ) {
            if ( !connection_lock ) {
                connection_lock = true;
                BootStrap(1);
                connection_lock = false;
            }
            neighbors_update_needed = false;
        } else if ( neighbors_count > 0 && neighbors_.size() == not_availables_neighbors_.count() ){
            // Reposition itself in the peer-to-peer network
            // if disconnected from every neighbors then reconnect to
            // the network
            FileCacheHash md5;
            my_hash = md5.getHash(my_hash);
            if ( !connection_lock ) {
                connection_lock = true;
                BootStrap(retry);
                connection_lock = false;
            }
            neighbors_update_needed = false;
        } else if (neighbors_update_needed) {
            Neighbors_Update();
            neighbors_update_needed = false;
        }

        // 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, "Communication error: input is not SOAP");
            return make_soap_fault(outmsg);
        }

        Arc::PayloadSOAP* outpayload = new Arc::PayloadSOAP(ns_);
        Arc::PayloadSOAP& res = *outpayload;
        Arc::MCC_Status ret = Arc::MCC_Status(Arc::STATUS_OK);
        // TODO: needed agereement on what is service id
        std::string client_id = inmsg.Attributes()->get("TLS:IDENTITYDN");

        // If the requested operation was: Register
        if (MatchXMLName((*inpayload).Child(0), "Register")) {
            Arc::XMLNode r = res.NewChild("isis:RegisterResponse");
            Arc::XMLNode register_ = (*inpayload).Child(0);
            if(CheckAuth(IsOwnID(register_,RegisterXMLPath,client_id)?"service":"isis", inmsg, r)) {
                ret = Register(register_, r);
            }
        }
        // If the requested operation was: Query
        else if (MatchXMLName((*inpayload).Child(0), "Query")) {
            Arc::XMLNode r = res.NewChild("isis:QueryResponse");
            if(CheckAuth("client", inmsg, r)) {
                Arc::XMLNode query_ = (*inpayload).Child(0);
                ret = Query(query_, r);
            }
        }
        // If the requested operation was: RemoveRegistrations
        else if (MatchXMLName((*inpayload).Child(0), "RemoveRegistrations")) {
            Arc::XMLNode r = res.NewChild("isis:RemoveRegistrationsResponse");
            Arc::XMLNode remove_ = (*inpayload).Child(0);
            if(CheckAuth(IsOwnID(remove_,RemoveXMLPath,client_id)?"service":"isis", inmsg, r)) {
                ret = RemoveRegistrations(remove_, r);
            }
        }
        // If the requested operation was: GetISISList
        else if (MatchXMLName((*inpayload).Child(0), "GetISISList")) {
            Arc::XMLNode r = res.NewChild("isis:GetISISListResponse");
            Arc::XMLNode isislist_= (*inpayload).Child(0);
            if(CheckAuth("client", inmsg, r)) {
                Arc::XMLNode isislist_= (*inpayload).Child(0);
                ret = GetISISList(isislist_, r);
            }
        }
        // If the requested operation was: Connect
        else if (MatchXMLName((*inpayload).Child(0), "Connect")) {
            Arc::XMLNode r = res.NewChild("isis:ConnectResponse");
            Arc::XMLNode connect_= (*inpayload).Child(0);
            if(CheckAuth("isis", inmsg, r)) {
                ret = Connect(connect_, r);
            }
        }

        else if(MatchXMLNamespace((*inpayload).Child(0),"http://docs.oasis-open.org/wsrf/rp-2")) {
            if(CheckAuth("client", inmsg, outmsg)) {
                // Update infodoc_
                Arc::XMLNode workingcopy;
                infodoc_.Acquire().New(workingcopy);
                workingcopy["AdminDomain"].Attribute("Distributed") = "True";
                workingcopy["AdminDomain"]["Services"]["Service"].Attribute("Name") = "ISIS";
                workingcopy["AdminDomain"]["Services"]["Service"].Attribute("ID") = endpoint_;
                workingcopy["AdminDomain"]["Services"]["Service"].Attribute("CreationTime") = Current_Time();
                workingcopy["AdminDomain"]["Services"]["Service"].Attribute("Validity") = "600";
                std::stringstream sparsity_string;
                sparsity_string << "isis_sparsity=" << sparsity;
                workingcopy["AdminDomain"]["Services"]["Service"].Attribute("OtherInfo") = sparsity_string.str();
                // TODO: Update infodoc_
                infodoc_.Release();
                infodoc_.Assign(workingcopy, true);
                // TODO: do not copy out_ to outpayload.
                Arc::SOAPEnvelope* out_ = infodoc_.Process(*inpayload);
                if(out_) {
                    *outpayload=*out_;
                    delete out_;
                } else {
                    if (outpayload) delete outpayload;
                    return make_soap_fault(outmsg);
                }
            }
        }

        outmsg.Payload(outpayload);
        return ret;
    }

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:

std::string ISIS::ISIService::Proxy ( Arc::XMLNode regentry) [private]

Definition at line 1102 of file isis.cpp.

                                                    {
        std::string proxy;
        for (int j=0; bool(regentry["SrcAdv"]["SSPair"][j]); j++ ){
            if ("Proxy" == (std::string)regentry["SrcAdv"]["SSPair"][j]["Name"]){
               proxy = (std::string)regentry["SrcAdv"]["SSPair"][j]["Value"];
               break;
            } else {
               continue;
            }
        }
        return proxy;
    }
Arc::MCC_Status ISIS::ISIService::Query ( Arc::XMLNode request,
Arc::XMLNode response 
) [private]

Definition at line 605 of file isis.cpp.

                                                                             {
        std::string querystring_ = request["QueryString"];
        logger_.msg(Arc::VERBOSE, "Query received: %s", querystring_);
        if (querystring_.empty()) {
            Arc::SOAPEnvelope fault(ns_, true);
            if (fault) {
                fault.Fault()->Code(Arc::SOAPFault::Sender);
                fault.Fault()->Reason("Invalid query (It is empty.)");
                response.Replace(fault.Child());
            }
            return Arc::MCC_Status();
        }

        std::map<std::string, Arc::XMLNodeList> result;
        db_->queryAll(querystring_, result);
        std::map<std::string, Arc::XMLNodeList>::iterator it;
        for (it = result.begin(); it != result.end(); it++) {
            if (it->second.size() == 0) {
                continue;
            }
            Arc::XMLNode data_;
            //The next function calling is db_->get(ServiceID, RegistrationEntry);
            try {
                db_->get(it->first, data_);
            } catch ( std::exception &e ) {
                Arc::SOAPEnvelope fault(ns_, true);
                if (fault) {
                    fault.Fault()->Code(Arc::SOAPFault::Sender);
                    fault.Fault()->Reason("Invalid query (not supported expression)");
                    fault.Fault()->Reason(e.what());
                    response.Replace(fault.Child());
                }
                return Arc::MCC_Status();
            }
            // add data to output
            response.NewChild(data_);
        }
        return Arc::MCC_Status(Arc::STATUS_OK);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

Arc::MCC_Status ISIS::ISIService::Register ( Arc::XMLNode request,
Arc::XMLNode response 
) [private]

Definition at line 645 of file isis.cpp.

                                                                                {
        int i=0;
        while ((bool) request["RegEntry"][i]) {
            Arc::XMLNode regentry_ = request["RegEntry"][i++];
            logger_.msg(Arc::VERBOSE, "Register received: ID=%s; EPR=%s; MsgGenTime=%s",
                (std::string) regentry_["MetaSrcAdv"]["ServiceID"], (std::string) regentry_["SrcAdv"]["EPR"]["Address"],
                (std::string) request["Header"]["MessageGenerationTime"]);

            //search and check in the database
            Arc::XMLNode db_regentry;
            //The next function calling is db_->get(ServiceID, RegistrationEntry);
            db_->get((std::string) regentry_["MetaSrcAdv"]["ServiceID"], db_regentry);

            Arc::Time new_gentime((std::string) regentry_["MetaSrcAdv"]["GenTime"]);
            if ( !bool(db_regentry) ||
                ( bool(db_regentry) && Arc::Time((std::string)db_regentry["MetaSrcAdv"]["GenTime"]) < new_gentime ) ) {
               Arc::XMLNode regentry_xml;
               regentry_.New(regentry_xml);
               db_->put((std::string) regentry_["MetaSrcAdv"]["ServiceID"], regentry_xml);
            }
            else {
               regentry_.Destroy();
            }
        }
        //Send to neighbors the Registration(s).
        Arc::ISIS_description isis;
        isis.url = endpoint_;
        isis.key = my_key;
        isis.cert = my_cert;
        isis.proxy = my_proxy;
        isis.cadir = my_cadir;
        isis.cafile = my_cafile;
        if ( bool(request["RegEntry"]) ) {
            std::multimap<std::string,Arc::ISIS_description> local_hash_table;
            local_hash_table = hash_table;
            SendToNeighbors(request, neighbors_, logger_, isis,&not_availables_neighbors_,endpoint_,local_hash_table);
            for (int i=0; bool(request["RegEntry"][i]); i++) {
                Arc::XMLNode regentry = request["RegEntry"][i];
                if ( (std::string)regentry["SrcAdv"]["Type"] == "org.nordugrid.infosys.isis" && 
                     hash_table.find(PeerID(regentry)) == hash_table.end()) {
                    // Search the hash value in the request message
                    Neighbors_Update();
                }
           }
        }

        return Arc::MCC_Status(Arc::STATUS_OK);
    }

Here is the call graph for this function:

Here is the caller graph for this function:

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 from Arc::Service.

Definition at line 589 of file isis.cpp.

                                                          {
          // RegEntry element generation
          Arc::XMLNode empty(ns_, "RegEntry");
          empty.New(doc);

          doc.NewChild("SrcAdv");
          doc.NewChild("MetaSrcAdv");

          doc["SrcAdv"].NewChild("Type") = "org.nordugrid.infosys.isis";
          Arc::XMLNode peerID = doc["SrcAdv"].NewChild("SSPair");
          peerID.NewChild("Name") = "peerID";
          peerID.NewChild("Value") = my_hash;

          return true;
    }

Here is the call graph for this function:

Definition at line 694 of file isis.cpp.

                                                                                           {
        int i=0;
        while ((bool) request["ServiceID"][i]) {
            std::string service_id = (std::string) request["ServiceID"][i];
            logger_.msg(Arc::VERBOSE, "RemoveRegistrations received: ID=%s", service_id);

            //search and check in the database
            Arc::XMLNode regentry;
            //The next function calling is db_->get(ServiceID, RegistrationEntry);
            db_->get(service_id, regentry);
            if ( bool(regentry) ) {
               std::string type = (std::string)regentry["SrcAdv"]["Type"];
               if ( type == "org.nordugrid.infosys.isis") {
                  std::string url = (std::string)regentry["SrcAdv"]["EPR"]["Address"];
                  // the remove service is my provider or not
                  for (unsigned int j=0; j < infoproviders_.size(); j++ ) {
                     if ( infoproviders_[j].url == url ) {
                        available_provider = false;
                        break;
                     }
                  }
                  neighbors_update_needed = true;
               }
               Arc::Time old_gentime((std::string)regentry["MetaSrcAdv"]["GenTime"]);
               Arc::Time new_gentime((std::string)request["MessageGenerationTime"]);
               if ( old_gentime >= new_gentime &&  !bool(regentry["MetaSrcAdv"]["Expiration"])) {
                  //Removed the ServiceID from the RemoveRegistrations message.
                  request["ServiceID"][i].Destroy();
               }
               else {
                  //update the database
                  Arc::XMLNode new_data(ns_, "RegEntry");
                  new_data.NewChild("MetaSrcAdv").NewChild("ServiceID") = service_id;
                  new_data["MetaSrcAdv"].NewChild("GenTime") = (std::string)request["MessageGenerationTime"];
                  db_->put(service_id, new_data);
               }
            }
            else {
               //add this element in the database
               Arc::XMLNode new_data(ns_, "RegEntry");
               new_data.NewChild("MetaSrcAdv").NewChild("ServiceID") = service_id;
               new_data["MetaSrcAdv"].NewChild("GenTime") = (std::string)request["MessageGenerationTime"];
               db_->put(service_id, new_data);
            }
            i++;
        }

        // Send RemoveRegistration message to the other(s) neighbors ISIS.
        Arc::ISIS_description isis;
        isis.url = endpoint_;
        isis.key = my_key;
        isis.cert = my_cert;
        isis.proxy = my_proxy;
        isis.cadir = my_cadir;
        isis.cafile = my_cafile;
        if ( bool(request["ServiceID"]) ){
           std::multimap<std::string,Arc::ISIS_description> local_hash_table;
           local_hash_table = hash_table;
           SendToNeighbors(request, neighbors_, logger_, isis, &not_availables_neighbors_,endpoint_,local_hash_table);
           for (int i=0; bool(request["ServiceID"][i]); i++) {
              // Search the hash value in my database
              Arc::XMLNode data;
              //The next function calling is db_->get(ServiceID, RegistrationEntry);
              db_->get((std::string)request["ServiceID"][i], data);
           }
        }
        return Arc::MCC_Status(Arc::STATUS_OK);
    }

Here is the call graph for this function:

Here is the caller graph for this function:


Member Data Documentation

Definition at line 58 of file isis.h.

std::string ISIS::ISIService::bootstrapISIS [private]

Definition at line 53 of file isis.h.

Definition at line 59 of file isis.h.

Definition at line 47 of file isis.h.

std::string ISIS::ISIService::endpoint_ [private]

Definition at line 31 of file isis.h.

Definition at line 45 of file isis.h.

std::multimap<std::string,Arc::ISIS_description> ISIS::ISIService::hash_table [private]

Definition at line 55 of file isis.h.

Definition at line 79 of file isis.h.

Definition at line 52 of file isis.h.

Definition at line 42 of file isis.h.

Logger Arc::Service::logger [static, protected, inherited]

Logger object used to print messages generated by this class.

Reimplemented in Echo::Service_Echo, Arc::Service_JavaWrapper, SPService::Service_SP, Compiler::Service_Compiler, Hopi::Hopi, and Arc::Service_PythonWrapper.

Definition at line 43 of file Service.h.

Definition at line 30 of file isis.h.

std::string ISIS::ISIService::my_cadir [private]

Definition at line 39 of file isis.h.

std::string ISIS::ISIService::my_cafile [private]

Definition at line 40 of file isis.h.

std::string ISIS::ISIService::my_cert [private]

Definition at line 37 of file isis.h.

std::string ISIS::ISIService::my_hash [private]

Definition at line 54 of file isis.h.

std::string ISIS::ISIService::my_key [private]

Definition at line 36 of file isis.h.

std::string ISIS::ISIService::my_proxy [private]

Definition at line 38 of file isis.h.

Definition at line 64 of file isis.h.

Definition at line 62 of file isis.h.

Definition at line 63 of file isis.h.

Definition at line 57 of file isis.h.

Definition at line 65 of file isis.h.

Definition at line 48 of file isis.h.

Definition at line 33 of file isis.h.

int ISIS::ISIService::retry [private]

Definition at line 34 of file isis.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.

Definition at line 35 of file isis.h.

Definition at line 43 of file isis.h.

Definition at line 32 of file isis.h.


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