Y2ComponentBroker Class Reference

#include <Y2ComponentBroker.h>

List of all members.

Classes

struct  ltstr

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, bool force=false)
static Y2ComponentcreateClient (const char *name)
static Y2ComponentcreateServer (const char *name)
static Y2ComponentgetNamespaceComponent (const char *name)
static bool registerNamespaceException (const char *name_space, const char *component_name)

Static Private Member Functions

static Y2ComponentcreateComponent (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] = { 0, 0, 0, 0, 0 }
static bool stop_register = false
static map< string, string > namespace_exceptions


Member Enumeration Documentation

Constants for the different types of component creators.

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

References createComponent().

Referenced by Y2WFMComponent::CallFunction(), Y2WFMComponent::ClientExists(), getNamespaceComponent(), and main().

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.

References Y2ComponentCreator::createInLevel(), creators, Y2PathSearch::currentComponentLevel(), Y2PathSearch::GENERIC, initializeLists(), Y2ComponentCreator::isClientCreator(), Y2ComponentCreator::isServerCreator(), MAX_ORDER, Y2PathSearch::numberOfComponentLevels(), Y2PathSearch::searchPath(), stop_register, and y2debug.

Referenced by createClient(), and createServer().

Y2Component * Y2ComponentBroker::createServer ( const char *  name  )  [static]

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

References createComponent().

Referenced by getNamespaceComponent(), main(), SCRSubAgent::mount(), processfile(), and WFMSubAgent::start().

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

References createClient(), createServer(), creators, MAX_ORDER, namespace_exceptions, namespaces, Y2ComponentCreator::provideNamespace(), stop_register, y2debug, and y2warning.

Referenced by Y2WFMComponent::import(), Import::import(), and main().

void Y2ComponentBroker::initializeLists (  )  [static, private]

Initializes creators.

References creators, and MAX_ORDER.

Referenced by createComponent(), and registerComponentCreator().

void Y2ComponentBroker::registerComponentCreator ( const Y2ComponentCreator creator,
order_t  order,
bool  force = false 
) [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. It is very important that the compiled-in components must be created with the lowest order to prevent an infinitive loop of starting external components.
force override the stop_register flag. See order_t for the possible orders.

References creators, initializeLists(), and stop_register.

Referenced by Y2ComponentCreator::Y2ComponentCreator().

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.

References namespace_exceptions, namespaces, and y2error.

Referenced by main().


Member Data Documentation

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

Storage for the component creators.

Referenced by createComponent(), getNamespaceComponent(), initializeLists(), and registerComponentCreator().

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.

Referenced by getNamespaceComponent(), and registerNamespaceException().

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!

Referenced by createComponent(), getNamespaceComponent(), and registerComponentCreator().


The documentation for this class was generated from the following files:

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