yast2-core
|
SuSE Configuration Repository Agent. More...
#include <SCRAgent.h>
Public Member Functions | |
SCRAgent () | |
virtual | ~SCRAgent () |
virtual YCPValue | Read (const YCPPath &path, const YCPValue &arg=YCPNull(), const YCPValue &opt=YCPNull())=0 |
virtual YCPBoolean | Write (const YCPPath &path, const YCPValue &value, const YCPValue &arg=YCPNull())=0 |
virtual YCPList | Dir (const YCPPath &path)=0 |
virtual YCPValue | Execute (const YCPPath &path, const YCPValue &=YCPNull(), const YCPValue &=YCPNull()) |
virtual YCPMap | Error (const YCPPath &) |
virtual YCPBoolean | RegisterAgent (const YCPPath &path, const YCPValue &) |
virtual YCPBoolean | UnregisterAgent (const YCPPath &path) |
virtual YCPBoolean | UnregisterAllAgents () |
virtual YCPBoolean | UnmountAgent (const YCPPath &) |
virtual YCPBoolean | RegisterNewAgents () |
virtual YCPValue | otherCommand (const YCPTerm &term) |
virtual const char * | root () const |
void | setAsCurrentSCR () |
string | targetPath (const string &path) const |
Static Public Member Functions | |
static YCPValue | readconf (const char *filename) |
static SCRAgent * | instance () |
Public Attributes | |
SCRAgent * | mainscragent |
Static Private Attributes | |
static SCRAgent * | current_scr = 0 |
static YCPMap | unspecified_error |
returned by Error More... | |
SuSE Configuration Repository Agent.
An SCRAgent is an information agent. It handles a subtree of the whole SRC data tree of the system. You can look upon it as a database that is similar to a filesystem. Data is grouped in a tree. But type of the data being stored are not files but YCP values.
SCRAgent::SCRAgent | ( | ) |
Initializes the base class.
References YCPMap::add(), current_scr, YCPMap::size(), and unspecified_error.
|
virtual |
Cleans up. Furthermore baseclass must have a virtual destructor.
References current_scr.
Get a list of all subtrees.
Implemented in AnyAgent, ProcessAgent, DummyAgent, IniAgent, ScriptingAgent, ModulesAgent, SystemAgent, and ResolverAgent.
Referenced by SCRDir().
Get a detailed error description if a previous command failed
Reimplemented in ScriptingAgent.
References unspecified_error.
Referenced by SCRError().
|
inlinevirtual |
Execute a command
Reimplemented in ProcessAgent, ScriptingAgent, DummyAgent, and SystemAgent.
References toString(), and ycp2error.
Referenced by Y2WFMComponent::Execute(), instance(), SCRExecute(), SCRExecute2(), and SCRExecute3().
|
static |
References current_scr, Execute(), and path.
Referenced by SCRDir(), SCRError(), SCRExecute(), SCRExecute2(), SCRExecute3(), SCRRead3(), SCRRegisterAgentS(), SCRRegisterAgentT(), SCRRegisterNewAgents(), SCRUnmountAgent(), SCRUnregisterAgent(), SCRUnregisterAllAgents(), SCRWrite2(), and SCRWrite3().
Execute other commands. Return 0 if the command is not defined in your Agent.
Reimplemented in AnyAgent, ProcessAgent, ScriptingAgent, DummyAgent, IniAgent, ModulesAgent, and ResolverAgent.
Referenced by RegisterNewAgents(), and run_agent_instance().
|
pure virtual |
Reads data. Destroy the result after use.
path | Specifies what part of the subtree should be read. The path is specified relatively to Root()! |
Implemented in AnyAgent, ProcessAgent, IniAgent, DummyAgent, ScriptingAgent, ModulesAgent, SystemAgent, and ResolverAgent.
Referenced by Y2AgentComp< Agent >::Read(), Y2WFMComponent::Read(), and SCRRead3().
|
static |
Reads the scr config file and returns the term. It skips all lines upto (including) the first starting with a ".", which is the path where the agant gets mounted (by the ScriptingAgent).
References file, Parser::parse(), parser, y2debug, ycp2error, and YCode::yeTerm.
Referenced by SCRSubAgent::mount(), and run_agent_instance().
|
inlinevirtual |
Register an agent
Reimplemented in ScriptingAgent.
References toString(), and ycp2error.
Referenced by SCRRegisterAgentS(), and SCRRegisterAgentT().
|
inlinevirtual |
Register new agents
Reimplemented in ScriptingAgent.
References otherCommand(), and ycp2error.
Referenced by SCRRegisterNewAgents().
|
virtual |
Filesystem root on which to operate. It is useful for agents during installation to operate on different root (FATE#314695).
Reimplemented in IniAgent, and ScriptingAgent.
References mainscragent, and root().
Referenced by dump_value(), SCRSubAgent::mount(), program_stream(), root(), IniAgent::setLastRoot(), and targetPath().
|
inline |
References current_scr, and targetPath().
Referenced by Y2WFMComponent::createDefaultSCR().
string SCRAgent::targetPath | ( | const string & | path | ) | const |
Helper to compute complete path including target root.
path | must start with a slash |
References path, root(), and y2error.
Referenced by dump_value(), file_stream(), ModulesAgent::otherCommand(), ResolverAgent::Read(), AnyAgent::readFile(), setAsCurrentSCR(), ResolverAgent::Write(), AnyAgent::Write(), and ResolverAgent::~ResolverAgent().
|
inlinevirtual |
|
inlinevirtual |
Unregister an agent
Reimplemented in ScriptingAgent.
References toString(), and ycp2error.
Referenced by SCRUnregisterAgent().
|
inlinevirtual |
Unregister all agents
Reimplemented in ScriptingAgent.
References ycp2error.
Referenced by SCRUnregisterAllAgents().
|
pure virtual |
Writes data. Destroy the result after use.
Implemented in AnyAgent, ProcessAgent, IniAgent, DummyAgent, ScriptingAgent, ModulesAgent, SystemAgent, and ResolverAgent.
Referenced by SCRWrite2(), SCRWrite3(), and Y2WFMComponent::Write().
|
staticprivate |
Referenced by instance(), SCRAgent(), setAsCurrentSCR(), and ~SCRAgent().
SCRAgent* SCRAgent::mainscragent |
A pointer to the SCRAgent (which normally is the ScriptingAgent) that created this SCRAgent. It can be used to call other SCRAgents directly from C++. You must check if it is not 0.
Referenced by SCRSubAgent::mount(), root(), and IniAgent::setLastRoot().
|
staticprivate |
returned by Error
Referenced by Error(), and SCRAgent().