RStudio Launcher Plugin SDK  1.1.3
A software development kit for creating plugins that work the the RStudio Launcher.
AbstractPluginApi.hpp
1 /*
2  * AbstractPluginApi.hpp
3  *
4  * Copyright (C) 2019-20 by RStudio, PBC
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
7  * documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
8  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to
9  * permit persons to whom the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
12  * Software.
13  *
14  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
15  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
16  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
17  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
18  *
19  */
20 
21 #ifndef LAUNCHER_PLUGINS_ABSTRACT_PLUGIN_API_HPP
22 #define LAUNCHER_PLUGINS_ABSTRACT_PLUGIN_API_HPP
23 
24 #include <Noncopyable.hpp>
25 
26 #include <PImpl.hpp>
27 #include <comms/AbstractLauncherCommunicator.hpp>
28 #include <jobs/AbstractJobRepository.hpp>
29 
30 namespace rstudio {
31 namespace launcher_plugins {
32 
33 class Error;
34 
35 namespace api {
36 
37 class IJobSource;
38 
39 } // namespace api
40 } // namespace launcher_plugins
41 } // namespace rstudio
42 
43 namespace rstudio {
44 namespace launcher_plugins {
45 namespace api {
46 
50 class AbstractPluginApi : public Noncopyable, public std::enable_shared_from_this<AbstractPluginApi>
51 {
52 public:
56  virtual ~AbstractPluginApi() = default;
57 
63  Error initialize();
64 
65 protected:
72  explicit AbstractPluginApi(std::shared_ptr<comms::AbstractLauncherCommunicator> in_launcherCommunicator);
73 
74 private:
83  virtual jobs::JobRepositoryPtr createJobRepository(
84  const jobs::JobStatusNotifierPtr& in_jobStatusNotifier) const = 0;
85 
95  virtual std::shared_ptr<IJobSource> createJobSource(
96  jobs::JobRepositoryPtr in_jobRepository,
97  jobs::JobStatusNotifierPtr in_jobStatusNotifier) const = 0;
98 
105  virtual Error doInitialize() = 0;
106 
107  // The private implementation of AbstractPluginApi
108  PRIVATE_IMPL(m_abstractPluginImpl);
109 };
110 
111 } // namespace api
112 } // namespace launcher_plugins
113 } // namespace rstudio
114 
115 #endif
rstudio::launcher_plugins::api::AbstractPluginApi::initialize
Error initialize()
This method initializes the abstract plugin API.
rstudio::launcher_plugins::api::AbstractPluginApi::AbstractPluginApi
AbstractPluginApi(std::shared_ptr< comms::AbstractLauncherCommunicator > in_launcherCommunicator)
Constructor.
rstudio::launcher_plugins::Error
Class which represents an error.
Definition: Error.hpp:174
rstudio::launcher_plugins::api::AbstractPluginApi::~AbstractPluginApi
virtual ~AbstractPluginApi()=default
Virtual destructor.
rstudio::launcher_plugins::Noncopyable
Class which can be inherited from to disallow copying of its child classes.
Definition: Noncopyable.hpp:34
rstudio::launcher_plugins::api::AbstractPluginApi
Base class for the Launcher Plugin API.
Definition: AbstractPluginApi.hpp:50