#include <Y2Component.h>
Inheritance diagram for Y2Component:
Public Member Functions | |
Y2Component () | |
virtual | ~Y2Component () |
virtual string | name () const =0 |
virtual YCPValue | evaluate (const YCPValue &command) |
virtual void | result (const YCPValue &result) |
virtual void | setServerOptions (int argc, char **argv) |
virtual Y2Namespace * | import (const char *name_space) |
virtual YCPValue | doActualWork (const YCPList &arglist, Y2Component *user_interface) |
virtual SCRAgent * | getSCRAgent () |
virtual bool | remote () const |
Each component may be realized by a binary program (under Linux: ELF), by a process listening to an internet-domain socket, by a shared library plugin in ELF format (ending in .so), by a YCP script that is executed by the Workflowmanager (WFM), or by a C++ class that is linked to the Generic YaST2 Frontend (GF).
When you want to implement a component you need to subclass Y2Component and define the virtual functions (some of them only for a client component, some of them only for a server component). Furthermore you need to subclass Y2ComponentCreator and create a global variable from this class.
When you implement a component that needs the services of another component then you ask the Y2ComponentBroker to get a handle to it. That handle is of type Y2Component. Once you have got the handle, you can use it communicate with the component, regardless whether it is realized by a program, a plugin or what so ever.
See Y2ComponentBroker for examples.
|
|
|
Base class must have virtual destructor. |
|
This function must be overridden by an actual client. Here the client does its actual work.
Reimplemented in Y2PluginComponent, Y2ProgramComponent, Y2SerialComponent, Y2StdioComponent, and Y2WFMComponent. |
|
Starts the server, if it is not already started and does what a server is good for: Gets a command, evaluates (or executes) it and returns the result.
Reimplemented in Y2AgentComp< Agent >, Y2PluginComponent, Y2ProgramComponent, Y2SerialComponent, and Y2StdioComponent. |
|
Returns the SCRAgent of the Y2Component or NULL, if it doesn't have one. Note: This might trigger the creation of the Interpreter and Agent associated with the Y2Component. For plugins, this might trigger the loading of the plugin as well. Reimplemented in Y2AgentComp< Agent >, and Y2PluginComponent. |
|
Try to import a given namespace. This method is used for transparent handling of namespaces (YCP modules) through whole YaST. NOTICE: there is no reverse operation to import. Semantics of YCP modules is there is a single instance and it is available from the first import until the end of YaST run.
Reimplemented in TestY2Component, TestY2Component, Y2WFMComponent, and TestY2Component. |
|
Returns the name of the module. Implemented in Y2AgentComp< Agent >, Y2PluginComponent, Y2ProgramComponent, Y2SerialComponent, Y2StdioComponent, TestY2Component, TestY2Component, YUIComponent, Y2WFMComponent, and TestY2Component. |
|
Reimplemented in Y2ProgramComponent. |
|
Tells this server, that the client doesn't need it's services any longer and that the exit code of the client is result. This method is only defined, if the component is a server. Reimplemented in Y2PluginComponent, Y2ProgramComponent, Y2SerialComponent, Y2StdioComponent, and YUIComponent. |
|
Sets the commandline options of the server.
Reimplemented in Y2PluginComponent, Y2ProgramComponent, Y2SerialComponent, Y2StdioComponent, and YUIComponent. |