limal-runlevel

Service.hpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                     _     _   _   _     __     _                     |
00004 |                    | |   | | | \_/ |   /  \   | |                    |
00005 |                    | |   | | | |_| |  / /\ \  | |                    |
00006 |                    | |__ | | | | | | / ____ \ | |__                  |
00007 |                    |____||_| |_| |_|/ /    \ \|____|                 |
00008 |                                                                      |
00009 |                             runlevel library                         |
00010 |                                                                      |
00011 |                                         (C) SUSE Linux Products GmbH |
00012 \----------------------------------------------------------------------/
00013 
00014   File:       Service.hpp
00015 
00016   Author:     Marius Tomaschewski
00017   Maintainer: Marius Tomaschewski
00018 
00019   Purpose:
00020 
00021 /-*/
00026 #ifndef   LIMAL_RUNLEVEL_SERVICE_HPP
00027 #define   LIMAL_RUNLEVEL_SERVICE_HPP
00028 
00029 #include <limal/runlevel/config.h>
00030 #include <blocxx/String.hpp>
00031 #include <blocxx/Array.hpp>
00032 #include <blocxx/Map.hpp>
00033 
00034 
00035 // -------------------------------------------------------------------
00036 namespace LIMAL_NAMESPACE
00037 {
00038 namespace RUNLEVEL_NAMESPACE
00039 {
00040 
00041 // -------------------------------------------------------------------
00046 blocxx::String
00047 getServiceScriptDir();
00048 
00049 
00050 // -------------------------------------------------------------------
00055 blocxx::Array<blocxx::String>
00056 getInstalledServiceNames();
00057 
00058 
00059 // -------------------------------------------------------------------
00063 typedef blocxx::Array<blocxx::String>               ServiceCmdArgs;
00064 
00065 
00069 typedef blocxx::Map<blocxx::String,blocxx::String>  ServiceEnvVars;
00070 
00071 
00072 // -------------------------------------------------------------------
00078 class Service
00079 {
00080 public:
00087         Service(const blocxx::String &name);
00088 
00092         ~Service();
00093 
00097         blocxx::String
00098         getServiceName() const;
00099 
00103         blocxx::String
00104         getScriptPath() const;
00105 
00109         blocxx::String
00110         getScriptName() const;
00111 
00112 
00117         bool
00118         isServiceInstalled() const;
00119 
00120 
00163         int
00164         executeScript(const ServiceCmdArgs   &cmdArgs,
00165                       blocxx::String         &stdOutput,
00166                       blocxx::String         &errOutput,
00167                       const ServiceEnvVars   &envVars,
00168                       const blocxx::String   &stdInput,
00169                       int                    timeoutSecs,
00170                       int                    outputLimit);
00171 
00172 
00187         int
00188         executeScript(const ServiceCmdArgs &cmdArgs);
00189 
00190 
00199         int
00200         executeScript(const ServiceCmdArgs   &cmdArgs,
00201                       blocxx::String         &stdOutput,
00202                       blocxx::String         &errOutput,
00203                       int                    &execStatus,
00204                       const ServiceEnvVars   &envVars,
00205                       const blocxx::String   &stdInput,
00206                       int                    timeoutSecs,
00207                       int                    outputLimit)
00208                       // BLOCXX_DEPRECATED
00209                       ;
00210 
00211 
00212 protected:
00219         void
00220         setScriptName(const blocxx::String &name);
00221 
00222 private:
00223         // disallow, we allways need a name.
00224         Service();
00225 
00226         blocxx::String  m_path;
00227         blocxx::String  m_name;
00228 };
00229 
00230 
00231 // -------------------------------------------------------------------
00232 }      // End of RUNLEVEL_NAMESPACE
00233 }      // End of LIMAL_NAMESPACE
00234 
00235 #endif // LIMAL_RUNLEVEL_SERVICE_HPP