limal-runlevel
Service.hpp
Go to the documentation of this file.
1 /*---------------------------------------------------------------------\
2 | |
3 | _ _ _ _ __ _ |
4 | | | | | | \_/ | / \ | | |
5 | | | | | | |_| | / /\ \ | | |
6 | | |__ | | | | | | / ____ \ | |__ |
7 | |____||_| |_| |_|/ / \ \|____| |
8 | |
9 | runlevel library |
10 | |
11 | (C) SUSE Linux Products GmbH |
12 \----------------------------------------------------------------------/
13 
14  File: Service.hpp
15 
16  Author: Marius Tomaschewski
17  Maintainer: Marius Tomaschewski
18 
19  Purpose:
20 
21 /-*/
26 #ifndef LIMAL_RUNLEVEL_SERVICE_HPP
27 #define LIMAL_RUNLEVEL_SERVICE_HPP
28 
29 #include <limal/runlevel/config.h>
30 #include <blocxx/String.hpp>
31 #include <blocxx/Array.hpp>
32 #include <blocxx/Map.hpp>
33 
34 
35 // -------------------------------------------------------------------
36 namespace LIMAL_NAMESPACE
37 {
38 namespace RUNLEVEL_NAMESPACE
39 {
40 
41 // -------------------------------------------------------------------
46 blocxx::String
48 
49 
50 // -------------------------------------------------------------------
55 blocxx::Array<blocxx::String>
57 
58 
59 // -------------------------------------------------------------------
63 typedef blocxx::Array<blocxx::String> ServiceCmdArgs;
64 
65 
69 typedef blocxx::Map<blocxx::String,blocxx::String> ServiceEnvVars;
70 
71 
72 // -------------------------------------------------------------------
78 class Service
79 {
80 public:
87  Service(const blocxx::String &name);
88 
92  ~Service();
93 
97  blocxx::String
98  getServiceName() const;
99 
103  blocxx::String
104  getScriptPath() const;
105 
109  blocxx::String
110  getScriptName() const;
111 
112 
117  bool
118  isServiceInstalled() const;
119 
120 
163  int
164  executeScript(const ServiceCmdArgs &cmdArgs,
165  blocxx::String &stdOutput,
166  blocxx::String &errOutput,
167  const ServiceEnvVars &envVars,
168  const blocxx::String &stdInput,
169  int timeoutSecs,
170  int outputLimit);
171 
172 
187  int
188  executeScript(const ServiceCmdArgs &cmdArgs);
189 
190 
199  int
200  executeScript(const ServiceCmdArgs &cmdArgs,
201  blocxx::String &stdOutput,
202  blocxx::String &errOutput,
203  int &execStatus,
204  const ServiceEnvVars &envVars,
205  const blocxx::String &stdInput,
206  int timeoutSecs,
207  int outputLimit)
208  // BLOCXX_DEPRECATED
209  ;
210 
211 
212 protected:
219  void
220  setScriptName(const blocxx::String &name);
221 
222 private:
223  // disallow, we allways need a name.
224  Service();
225 
226  blocxx::String m_path;
227  blocxx::String m_name;
228 };
229 
230 
231 // -------------------------------------------------------------------
232 } // End of RUNLEVEL_NAMESPACE
233 } // End of LIMAL_NAMESPACE
234 
235 #endif // LIMAL_RUNLEVEL_SERVICE_HPP