ARC SDK
BrokerPlugin.h
Go to the documentation of this file.
1 // -*- indent-tabs-mode: nil -*-
2 
3 #ifndef __ARC_BROKERPLUGIN_H__
4 #define __ARC_BROKERPLUGIN_H__
5 
10 #include <arc/loader/Loader.h>
11 #include <arc/loader/Plugin.h>
12 
13 namespace Arc {
14  class ExecutionTarget;
15  class JobDescription;
16  class Logger;
17  class URL;
18  class UserConfig;
19 
21 
25  class BrokerPluginArgument : public PluginArgument {
26  public:
27  BrokerPluginArgument(const UserConfig& uc) : uc(uc) {}
29  operator const UserConfig&() const { return uc; }
30  private:
31  const UserConfig& uc;
32  };
33 
35 
46  class BrokerPlugin : public Plugin {
47  public:
49  BrokerPlugin(BrokerPluginArgument* arg) : Plugin(arg), uc(*arg), j(NULL) {}
51  virtual bool operator() (const ExecutionTarget& lhs, const ExecutionTarget& rhs) const;
53  virtual bool match(const ExecutionTarget& et) const;
55  virtual void set(const JobDescription& _j) const;
56  protected:
57  const UserConfig& uc;
58  mutable const JobDescription* j;
59 
60  static Logger logger;
61  };
62 
64 
68  class BrokerPluginLoader : public Loader {
69  public:
75  BrokerPlugin* load(const UserConfig& uc, const std::string& name = "", bool keep_ownerskip = true);
77  BrokerPlugin* load(const UserConfig& uc, const JobDescription& j, const std::string& name = "", bool keep_ownerskip = true);
79  BrokerPlugin* copy(const BrokerPlugin* p, bool keep_ownerskip = true);
80 
81  private:
82  BrokerPlugin* load(const UserConfig& uc, const JobDescription* j, const std::string& name, bool keep_ownerskip);
83 
84  std::list<BrokerPlugin*> plugins;
85  };
86 
87 } // namespace Arc
88 
89 #endif // __ARC_BROKERPLUGIN_H__
Arc namespace contains all core ARC classes.
Definition: ArcConfig.h:11
BrokerPlugin * copy(const BrokerPlugin *p, bool keep_ownerskip=true)
Copy a BrokerPlugin.
User configuration class
Definition: UserConfig.h:196
~BrokerPluginLoader()
If keep_ownership in load() is true then BrokerPlugin objects are deleted.
Base class for BrokerPlugins implementing different brokering algorithms.
Definition: BrokerPlugin.h:46
A logger class.
Definition: Logger.h:493
BrokerPlugin * load(const UserConfig &uc, const std::string &name="", bool keep_ownerskip=true)
Load the BrokerPlugin with the given name.
Definition: JobDescription.h:842
Handles loading of the required BrokerPlugin plugin.
Definition: BrokerPlugin.h:68
ExecutionTarget.
Definition: ExecutionTarget.h:494
BrokerPluginLoader()
Load the base configuration of plugin locations etc.
virtual bool match(const ExecutionTarget &et) const
Returns true if the target is acceptable for the BrokerPlugin.
virtual bool operator()(const ExecutionTarget &lhs, const ExecutionTarget &rhs) const
Sorting operator - returns true if lhs a better target than rhs.
Internal class representing arguments passed to BrokerPlugin.
Definition: BrokerPlugin.h:25
BrokerPlugin(BrokerPluginArgument *arg)
Should never be called directly - instead use BrokerPluginLoader.load().
Definition: BrokerPlugin.h:49