#include <Y2ComponentBroker.h>
Public Types | |
| enum | order_t { BUILTIN = 0, PLUGIN = 1, SCRIPT = 2, EXTERNAL_PROGRAM = 3, NETWORK = 4, MAX_ORDER = 5 } |
Static Public Member Functions | |
| static void | registerComponentCreator (const Y2ComponentCreator *creator, order_t order) |
| static Y2Component * | createClient (const char *name) |
| static Y2Component * | createServer (const char *name) |
| static Y2Component * | getNamespaceComponent (const char *name) |
| static bool | registerNamespaceException (const char *name_space, const char *component_name) |
Static Private Member Functions | |
| static Y2Component * | createComponent (const char *name, bool look_for_clients) |
| static void | initializeLists () |
Static Private Attributes | |
| static map< const char *, const Y2Component *, ltstr > | namespaces |
| static vector< const Y2ComponentCreator * > * | creators [MAX_ORDER] |
| static bool | stop_register |
| static map< string, string > | namespace_exceptions |
Classes | |
| struct | ltstr |
a) Only one component broker is needed
b) The data must be accessable before the first global constructor is called
The component broker is the one, that you can ask for if you need a certain component. Components are specified by names. A component name is an arbitrary string. The component broker does not statically know what kinds components exist. During global constructor call time (before main), the constructors of the ComponentCreator classes register themselves to the component broker.
| void Y2ComponentBroker::registerComponentCreator | ( | const Y2ComponentCreator * | creator, | |
| order_t | order | |||
| ) | [static] |
Enters a component creator into the list of component creators. Is called by Y2ComponentCreator::Y2ComponentCreator.
| creator | the component creator the register | |
| order | The orders define the order how the creators are looked up. A creator with a lower order is looked up before one with a higher order. Very important is, that the compiled in components must be created with the lowest order to prevent in infinitive loop of starting external components. See order_t for the possible orders. |
| Y2Component * Y2ComponentBroker::createComponent | ( | const char * | name, | |
| bool | look_for_clients | |||
| ) | [static, private] |
Tries to create or find a YaST2 component.
| spec | Specifies which component to find. | |
| look_for_clients | Set this to true, if you are looking for clients. If set to false only servers are created. |
| Y2Component * Y2ComponentBroker::createClient | ( | const char * | name | ) | [static] |
Is a wrapper for createComponent, but only looks for clients.
| Y2Component * Y2ComponentBroker::createServer | ( | const char * | name | ) | [static] |
Is a wrapper for createComponent, but only looks for servers.
| Y2Component * Y2ComponentBroker::getNamespaceComponent | ( | const char * | name | ) | [static] |
Provide a component, which implements the given namespace.
| name | the name of the requested namespace |
| bool Y2ComponentBroker::registerNamespaceException | ( | const char * | name_space, | |
| const char * | component_name | |||
| ) | [static] |
Register a new namespace exception to be used by getNamespaceComponent.
| name_space | the namespace to be changed | |
| component_name | the component which should provide the namespace |
| void Y2ComponentBroker::initializeLists | ( | ) | [static, private] |
Initializes creators.
map< const char *, const Y2Component *, Y2ComponentBroker::ltstr > Y2ComponentBroker::namespaces [static, private] |
vector< const Y2ComponentCreator * > * Y2ComponentBroker::creators [static, private] |
Storage for the component creators.
bool Y2ComponentBroker::stop_register [static, private] |
This flag stops the registry of components at the broker. It must be set to true before any plugin (dynamic loadable library) is loaded!
map< string, string > Y2ComponentBroker::namespace_exceptions [static, private] |
A map containing a namespace exceptions. This will be honoured in getNamespaceComponent to give an explicit preference for a namespace to be created by a preffered component.
1.5.0