Main Page | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Examples

Y2ComponentBroker Class Reference

Looks for and creates YaST2 components This class has no instances and only static methods. There are two reasons for this:. More...

#include <Y2ComponentBroker.h>

List of all members.

Public Types

enum  order_t {
  BUILTIN = 0, PLUGIN = 1, SCRIPT = 2, EXTERNAL_PROGRAM = 3,
  NETWORK = 4, MAX_ORDER = 5
}

Static Public Member Functions

void registerComponentCreator (const Y2ComponentCreator *creator, order_t order)
Y2ComponentcreateClient (const char *name)
Y2ComponentcreateServer (const char *name)
Y2ComponentgetNamespaceComponent (const char *name)
bool registerNamespaceException (const char *name_space, const char *component_name)

Static Private Member Functions

Y2ComponentcreateComponent (const char *name, bool look_for_clients)
void initializeLists ()

Static Private Attributes

map< const char *, const Y2Component *,
ltstr
namespaces
vector< const Y2ComponentCreator * > * creators [MAX_ORDER] = { 0, 0, 0, 0, 0 }
bool stop_register = false
map< string, string > namespace_exceptions


Detailed Description

Looks for and creates YaST2 components This class has no instances and only static methods. There are two reasons for this:.

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.


Member Enumeration Documentation

enum Y2ComponentBroker::order_t
 

Constants for the different types of component creators.

Enumeration values:
BUILTIN 
PLUGIN 
SCRIPT 
EXTERNAL_PROGRAM 
NETWORK 
MAX_ORDER 


Member Function Documentation

Y2Component * Y2ComponentBroker::createClient const char *  name  )  [static]
 

Is a wrapper for createComponent, but only looks for clients.

Y2Component * Y2ComponentBroker::createComponent const char *  name,
bool  look_for_clients
[static, private]
 

Tries to create or find a YaST2 component.

Parameters:
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.
Returns:
A pointer to the new component if one has been found, 0 if no component matching spec has been found.

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.

Parameters:
name the name of the requested namespace
Returns:
a component instance or 0 if unsuccessful

void Y2ComponentBroker::initializeLists  )  [static, private]
 

Initializes creators.

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.

Parameters:
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.

bool Y2ComponentBroker::registerNamespaceException const char *  name_space,
const char *  component_name
[static]
 

Register a new namespace exception to be used by getNamespaceComponent.

Parameters:
name_space the namespace to be changed
component_name the component which should provide the namespace
Returns:
true on success, false on failure (for example, a namespace is already instantiated by another component.


Member Data Documentation

vector< const Y2ComponentCreator * > * Y2ComponentBroker::creators = { 0, 0, 0, 0, 0 } [static, private]
 

Storage for the component creators.

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.

map< const char *, const Y2Component *, Y2ComponentBroker::ltstr > Y2ComponentBroker::namespaces [static, private]
 

bool Y2ComponentBroker::stop_register = false [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!


The documentation for this class was generated from the following files:
Generated on Fri Nov 9 18:15:24 2007 for yast2-core by doxygen 1.3.6