org.mmbase.framework
Class ComponentRepository

java.lang.Object
  extended by org.mmbase.framework.ComponentRepository

public class ComponentRepository
extends Object

This (singleton) class maintains all Components which are registered in the current MMBase. Components can be configured by placing their configuration in 'config/components/'.

Since:
MMBase-1.9
Version:
$Id: ComponentRepository.java 41989 2010-04-20 16:45:39Z michiel $
Author:
Michiel Meeuwissen

Nested Class Summary
static class ComponentRepository.Ready
           
 
Field Summary
static String NAMESPACE_BLOCKTYPES
           
static String NAMESPACE_COMPONENT
           
(package private) static ComponentRepository repository
           
static String XSD_BLOCKTYPES
           
static String XSD_COMPONENT
           
 
Method Summary
protected  void clear()
           
 Block getBlock(String componentName, String blockName)
          Returns a certain block for a certain component.
 Block.Type[] getBlockClassification(String id)
          Converts a comma seperated list of blocks to an array of Block.Types.
 Component getComponent(String name)
          Acquires the component with given name, or null if no such component.
protected  Component getComponent(String name, Document doc)
          Given an XML, creates and configures one component.
 Collection<Component> getComponents()
          The available components.
 Block getDefaultBlock(String componentName)
          Returns a default block for a certain component.
 Collection<Component> getFailedComponents()
          The components which could not be instantiated or configured, due to some misconfiguration.
static ComponentRepository getInstance()
          Returns the (ready configured) instance of the repository
protected  boolean isConfigured()
           
protected  void readConfiguration(String child)
          Reads all component xmls
protected  boolean resolve()
          Tries to resolve unsatisified dependencies, in all components, by calling Component.resolve(VirtualComponent, Component) on all Component.getUnsatisfiedDependencies() of all components.
 void shutdown()
           
 Map<String,Component> toMap()
          An (unmodifiable) map representing the complete repository
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XSD_COMPONENT

public static final String XSD_COMPONENT
See Also:
Constant Field Values

NAMESPACE_COMPONENT

public static final String NAMESPACE_COMPONENT
See Also:
Constant Field Values

XSD_BLOCKTYPES

public static final String XSD_BLOCKTYPES
See Also:
Constant Field Values

NAMESPACE_BLOCKTYPES

public static final String NAMESPACE_BLOCKTYPES
See Also:
Constant Field Values

repository

static final ComponentRepository repository
Method Detail

getInstance

public static ComponentRepository getInstance()
Returns the (ready configured) instance of the repository


getBlockClassification

public Block.Type[] getBlockClassification(String id)
Converts a comma seperated list of blocks to an array of Block.Types. Possible 'weights' per block are ignored.


getComponents

public Collection<Component> getComponents()
The available components.


getFailedComponents

public Collection<Component> getFailedComponents()
The components which could not be instantiated or configured, due to some misconfiguration.

To Do:
failed collection seems to be unused, so this wil always return an empty set.

toMap

public Map<String,Component> toMap()
An (unmodifiable) map representing the complete repository


getComponent

public Component getComponent(String name)
Acquires the component with given name, or null if no such component.


getBlock

public Block getBlock(String componentName,
                      String blockName)
Returns a certain block for a certain component. Much like getComponent(String).Component.getBlock(String).

Returns:
a Block or null if given component has no such block.
Throws:
IllegalArgumentException - if no component with given name.

getDefaultBlock

public Block getDefaultBlock(String componentName)
Returns a default block for a certain component. Much like getComponent(String).Component.getDefaultBlock().

Throws:
IllegalArgumentException - if no component with given name.

resolve

protected boolean resolve()
Tries to resolve unsatisified dependencies, in all components, by calling Component.resolve(VirtualComponent, Component) on all Component.getUnsatisfiedDependencies() of all components.

Returns:
true if no unsatisfied dependencies remain.

shutdown

public void shutdown()

clear

protected void clear()

isConfigured

protected boolean isConfigured()

readConfiguration

protected void readConfiguration(String child)
Reads all component xmls


getComponent

protected Component getComponent(String name,
                                 Document doc)
                          throws SAXException,
                                 ClassNotFoundException,
                                 NoSuchMethodException,
                                 InstantiationException,
                                 IllegalAccessException,
                                 InvocationTargetException
Given an XML, creates and configures one component.

Throws:
SAXException
ClassNotFoundException
NoSuchMethodException
InstantiationException
IllegalAccessException
InvocationTargetException


MMBase 2.0-SNAPSHOT - null