yast2-core
Classes | Public Types | Static Public Member Functions | Static Private Member Functions | Static Private Attributes | List of all members
Y2ComponentBroker Class Reference

#include <Y2ComponentBroker.h>

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 *, ltstrnamespaces
 
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 
)
staticprivate

Tries to create or find a YaST2 component.

Parameters
specSpecifies which component to find.
look_for_clientsSet 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. Pointer returned by this function is owned by ComponentCreator so do not delete it at your own.
See also
Y2ComponentCreator::create for details what ComponentCreator must return

References Y2ComponentCreator::createInLevel(), creators, Y2PathSearch::currentComponentLevel(), Y2PathSearch::GENERIC, initializeLists(), Y2ComponentCreator::isClientCreator(), Y2ComponentCreator::isServerCreator(), level, MAX_ORDER, Y2PathSearch::numberOfComponentLevels(), order, 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
namethe name of the requested namespace
Returns
a component instance or 0 if unsuccessful

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

Referenced by Debugger::findSymbol(), Import::import(), and main().

void Y2ComponentBroker::initializeLists ( )
staticprivate

Initializes creators.

References creators, MAX_ORDER, and 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
creatorthe component creator the register
orderThe 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.
forceoverride the stop_register flag. See order_t for the possible orders.

References creators, initializeLists(), order, 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_spacethe namespace to be changed
component_namethe 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 }
staticprivate

Storage for the component creators.

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

map< string, string > Y2ComponentBroker::namespace_exceptions
staticprivate

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

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.8.11