yast2-core
ScriptingAgent.h
Go to the documentation of this file.
1 // -*- c++ -*-
2 
3 /*
4  * Authors: Arvin Schnell <arvin@suse.de>
5  * Klaus Kaempf <kkaempf@suse.de>
6  * Stanislav Visnovsky <visnov@suse.cz>
7  * Maintainer: Arvin Schnell <arvin@suse.de>
8  */
9 
10 
11 #ifndef ScriptingAgent_h
12 #define ScriptingAgent_h
13 
14 #include <time.h>
15 #include <y2/Y2Component.h>
16 #include <scr/SCRAgent.h>
17 #include "SCRSubAgent.h"
18 
22 class ScriptingAgent : public SCRAgent
23 {
24 
25 public:
26 
30  ScriptingAgent ();
31 
32  // used only in agent-ini/testsuite...?
33  // TODO try to eliminate it
39  ScriptingAgent (const string& file);
40 
44  ~ScriptingAgent ();
45 
51  virtual YCPValue Read (const YCPPath &path, const YCPValue &arg = YCPNull (), const YCPValue &opt = YCPNull ());
52 
56  virtual YCPBoolean Write (const YCPPath &path, const YCPValue &value,
57  const YCPValue &arg = YCPNull ());
58 
62  virtual YCPList Dir (const YCPPath &path);
63 
67  virtual YCPValue Execute (const YCPPath &path, const YCPValue &value =
68  YCPNull (), const YCPValue &arg = YCPNull ());
69 
73  virtual YCPMap Error (const YCPPath &path);
74 
83  YCPValue otherCommand (const YCPTerm &term);
84 
90  virtual YCPBoolean RegisterAgent (const YCPPath &path, const YCPValue &value);
91 
95  virtual YCPBoolean UnregisterAgent (const YCPPath &path);
96 
100  virtual YCPBoolean UnregisterAllAgents ();
101 
105  virtual YCPBoolean UnmountAgent (const YCPPath &path);
106 
116  virtual YCPBoolean RegisterNewAgents ();
117 
118 
119 private:
120 
121  // once we have to do a sweep (read all scr files because of
122  // a Dir or we were not lucky with a path patch), set this flag so
123  // that we do not unnecessarily sweep again
125 
126  // FIXME rethink the caching
128  string name;
129  time_t last_changed;
130  };
131 
135  list<RegistrationDir> registration_dirs;
136 
140  void InitRegDirs ();
141 
146  typedef vector<SCRSubAgent*> SubAgents;
148 
149 
154  YCPValue MountAgent (const YCPPath &path);
155 
160 
165 
169  void Sweep ();
170 
175  void tryRegister (const YCPPath &path);
176 
181  SubAgents::const_iterator findSubagent (const YCPPath &path);
182 
188  SubAgents::const_iterator findAndRegisterSubagent (const YCPPath &path);
189 
193  YCPList dirSubagents (const YCPPath &path);
194 
205  YCPValue executeSubagentCommand (const char *command,
206  const YCPPath &path,
207  const YCPValue &arg = YCPNull (),
208  const YCPValue &optpar = YCPNull ());
209 
215  SubAgents::iterator findByPath (const YCPPath &path);
216 
222  void parseConfigFiles (const string &directory);
223 
228  void parseSingleConfigFile (const string &file);
229 
230 };
231 
232 
233 #endif // ScriptingAgent_h

Generated on a sunny day for yast2-core by doxygen 1.8.2