Back to index

nordugrid-arc-nox  1.1.0~rc6
TargetRetrieverBES.cpp
Go to the documentation of this file.
00001 // -*- indent-tabs-mode: nil -*-
00002 
00003 #ifdef HAVE_CONFIG_H
00004 #include <config.h>
00005 #endif
00006 
00007 /*
00008 #include <arc/ArcConfig.h>
00009 #include <arc/Logger.h>
00010 #include <arc/StringConv.h>
00011 #include <arc/Thread.h>
00012 #include <arc/URL.h>
00013 #include <arc/XMLNode.h>
00014 #include <arc/client/ExecutionTarget.h>
00015 #include <arc/message/MCC.h>
00016 #include <arc/data/DataHandle.h>
00017 #include <glibmm/stringutils.h>
00018 
00019 #include "AREXClient.h"
00020 */
00021 #include <arc/client/TargetGenerator.h>
00022 
00023 #include "TargetRetrieverBES.h"
00024 
00025 namespace Arc {
00026 
00027   const std::string alphanum("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789");
00028 
00029   Logger TargetRetrieverBES::logger(TargetRetriever::logger, "BES");
00030 
00031   TargetRetrieverBES::TargetRetrieverBES(const UserConfig& usercfg,
00032                                          const URL& url, ServiceType st)
00033     : TargetRetriever(usercfg, url, st, "BES") {}
00034 
00035   TargetRetrieverBES::~TargetRetrieverBES() {}
00036 
00037   Plugin* TargetRetrieverBES::Instance(PluginArgument *arg) {
00038     TargetRetrieverPluginArgument *trarg =
00039       dynamic_cast<TargetRetrieverPluginArgument*>(arg);
00040     if (!trarg)
00041       return NULL;
00042     return new TargetRetrieverBES(*trarg, *trarg, *trarg);
00043   }
00044 
00045   void TargetRetrieverBES::GetTargets(TargetGenerator& mom, int targetType,
00046                                        int detailLevel) {
00047 
00048     logger.msg(VERBOSE, "TargetRetriverBES initialized with %s service url: %s",
00049                serviceType, url.str());
00050 
00051     switch (serviceType) {
00052     case COMPUTING:
00053       if (mom.AddService(url)) {
00054         ExecutionTarget target;
00055         target.GridFlavour = flavour;
00056         target.Cluster = url;
00057         target.url = url;
00058         target.InterfaceName = flavour;
00059         target.Implementor = "NorduGrid";
00060         target.DomainName = url.Host();
00061         target.HealthState = "ok";
00062         mom.AddTarget(target);
00063         mom.RetrieverDone();
00064       }
00065       break;
00066     case INDEX:
00067       mom.RetrieverDone();
00068       break;
00069     }
00070   }
00071 
00072 } // namespace Arc