#ifndef __ARC_ENTITYRETRIEVERPLUGIN_H__ #define __ARC_ENTITYRETRIEVERPLUGIN_H__ /** \file * \brief Plugin, loader and argument classes for EntityRetriever specialisation. */ #include #include #include #include #include #include #include #include #include #include namespace Arc { /// Options controlling the query process template class EndpointQueryOptions { public: /// Options for querying Endpoint objects /** When an Endpoint does not have its interface name specified, all the supported interfaces can be tried. If preferred interface names are provided here, those will be tried first. \param[in] preferredInterfaceNames a list of the preferred InterfaceName strings \see EndpointQueryOptions the EntityRetriever (a.k.a. #ServiceEndpointRetriever) needs different options */ EndpointQueryOptions(const std::set& preferredInterfaceNames = std::set()) : preferredInterfaceNames(preferredInterfaceNames) {} const std::set& getPreferredInterfaceNames() const { return preferredInterfaceNames; } private: std::set preferredInterfaceNames; }; /// The EntityRetriever (a.k.a. #ServiceEndpointRetriever) needs different options template<> class EndpointQueryOptions { public: /// Options for recursivity, filtering of capabilities and rejecting services /** \param[in] recursive Recursive query means that if a service registry is discovered that will be also queried for additional services \param[in] capabilityFilter Only those services will be discovered which has at least one capability from this list. \param[in] rejectedServices If a service's URL contains any item from this list, the services will be not returned among the results. \param[in] preferredInterfaceNames Set of preferred interface names */ EndpointQueryOptions(bool recursive = false, const std::list& capabilityFilter = std::list(), const std::list& rejectedServices = std::list(), const std::set& preferredInterfaceNames = std::set() ) : recursive(recursive), capabilityFilter(capabilityFilter), rejectedServices(rejectedServices), preferredInterfaceNames(preferredInterfaceNames) {} bool recursiveEnabled() const { return recursive; } const std::list& getCapabilityFilter() const { return capabilityFilter; } const std::list& getRejectedServices() const { return rejectedServices; } const std::set& getPreferredInterfaceNames() const { return preferredInterfaceNames; } private: bool recursive; std::list capabilityFilter; std::list rejectedServices; std::set preferredInterfaceNames; }; /** * \ingroup accplugins * \headerfile EntityRetriever.h arc/compute/EntityRetriever.h */ template class EntityRetrieverPlugin : public Plugin { protected: EntityRetrieverPlugin(PluginArgument* parg): Plugin(parg) {}; public: virtual const std::list& SupportedInterfaces() const { return supportedInterfaces; }; virtual bool isEndpointNotSupported(const Endpoint&) const = 0; virtual EndpointQueryingStatus Query(const UserConfig&, const Endpoint& rEndpoint, std::list&, const EndpointQueryOptions& options) const = 0; static const std::string kind; protected: std::list supportedInterfaces; }; /** * \ingroup accplugins * \headerfile EntityRetriever.h arc/compute/EntityRetriever.h */ template class EntityRetrieverPluginLoader : public Loader { public: EntityRetrieverPluginLoader() : Loader(BaseConfig().MakeConfig(Config()).Parent()) {} ~EntityRetrieverPluginLoader(); EntityRetrieverPlugin* load(const std::string& name); static std::list getListOfPlugins(); const std::map *>& GetTargetInformationRetrieverPlugins() const { return plugins; } protected: std::map *> plugins; static Logger logger; }; /** * \ingroup accplugins * \headerfile EntityRetriever.h arc/compute/EntityRetriever.h */ class ServiceEndpointRetrieverPlugin : public EntityRetrieverPlugin { protected: ServiceEndpointRetrieverPlugin(PluginArgument* parg); virtual ~ServiceEndpointRetrieverPlugin() {} }; /** * \ingroup accplugins * \headerfile EntityRetriever.h arc/compute/EntityRetriever.h */ class TargetInformationRetrieverPlugin : public EntityRetrieverPlugin { protected: TargetInformationRetrieverPlugin(PluginArgument* parg); virtual ~TargetInformationRetrieverPlugin() {} }; /** * \ingroup accplugins * \headerfile EntityRetriever.h arc/compute/EntityRetriever.h */ class JobListRetrieverPlugin : public EntityRetrieverPlugin { protected: JobListRetrieverPlugin(PluginArgument* parg); virtual ~JobListRetrieverPlugin() {} }; /** * \ingroup accplugins * \headerfile EntityRetriever.h arc/compute/EntityRetriever.h */ typedef EntityRetrieverPluginLoader ServiceEndpointRetrieverPluginLoader; /** * \ingroup accplugins * \headerfile EntityRetriever.h arc/compute/EntityRetriever.h */ typedef EntityRetrieverPluginLoader TargetInformationRetrieverPluginLoader; /** * \ingroup accplugins * \headerfile EntityRetriever.h arc/compute/EntityRetriever.h */ typedef EntityRetrieverPluginLoader JobListRetrieverPluginLoader; } // namespace Arc #endif // __ARC_ENTITYRETRIEVERPLUGIN_H__