org.mmbase.framework
Class BasicComponent

Package class diagram package BasicComponent
java.lang.Object
  extended by org.mmbase.framework.BasicComponent
All Implemented Interfaces:
Component

public class BasicComponent
extends Object
implements Component

A component is a piece of pluggable functionality that typically has dependencies on other components, and may be requested several blocks.

Since:
MMBase-1.9
Version:
$Id: BasicComponent.java 42560 2010-06-15 09:22:41Z michiel $
Author:
Michiel Meeuwissen

Field Summary
protected  Collection<Component> dependencies
           
protected  Collection<VirtualComponent> unsatisfied
           
 
Constructor Summary
BasicComponent(String name)
           
 
Method Summary
 void configure(Element el)
          Configures the component, by XML.
 Map<String,Action> getActions()
          A component may also define extra 'actions'.
 Block getBlock(String name)
          Gets a specific block.
 Collection<Block> getBlocks()
          An unmodifiable collection of all blocks associated with the component
 String getBundle()
          The baseName of the resource bundle associated with i18n messages for this component.
 Block getDefaultBlock()
          Gets the one block that is the 'default' block of this component
 Collection<Component> getDependencies()
          All (satisfied) depedencies of this Component.
 LocalizedString getDescription()
          The description can contain further information about the component, mainly to be displayed in pages about components generally.
 Manifest getManifest()
          EXPERIMENTAL.
 String getName()
          Every component has a (universally) unique name
 Setting<?> getSetting(String name)
          Retrieves a setting (a definition, not a value; for that, use Framework.getSettingValue(Setting, org.mmbase.util.functions.Parameters)) with a certain name.
 Collection<Setting<?>> getSettings()
          An unmodifiable collection of all settings associated with this component
 Collection<VirtualComponent> getUnsatisfiedDependencies()
          The unsatisfied dependencies, so this should return an empty collection.
 URI getUri()
          An URI which may identify the configuration of this Component.
 float getVersion()
          A component has a version number.
protected  void init()
          Called on initializion.
 void resolve(VirtualComponent unsat, Component comp)
          Used during bootstrapping.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

dependencies

protected final Collection<Component> dependencies

unsatisfied

protected final Collection<VirtualComponent> unsatisfied
Constructor Detail

BasicComponent

public BasicComponent(String name)
Method Detail

init

protected void init()
Called on initializion. Default implementation is empty.


getName

public String getName()
Description copied from interface: Component
Every component has a (universally) unique name

Specified by:
getName in interface Component

getUri

public URI getUri()
Description copied from interface: Component
An URI which may identify the configuration of this Component.

Specified by:
getUri in interface Component

getVersion

public float getVersion()
Description copied from interface: Component
A component has a version number.

Specified by:
getVersion in interface Component

getDescription

public LocalizedString getDescription()
Description copied from interface: Component
The description can contain further information about the component, mainly to be displayed in pages about components generally.

Specified by:
getDescription in interface Component

getManifest

public Manifest getManifest()
EXPERIMENTAL. The Manifest of the jar in which this component is defined.

Since:
MMBase-1.9.1

configure

public void configure(Element el)
Description copied from interface: Component
Configures the component, by XML.

Specified by:
configure in interface Component
Parameters:
el - A 'component' element from the 'components' XSD.

getBlocks

public Collection<Block> getBlocks()
Description copied from interface: Component
An unmodifiable collection of all blocks associated with the component

Specified by:
getBlocks in interface Component

getBlock

public Block getBlock(String name)
Description copied from interface: Component
Gets a specific block. If there is no such block, then null is returned.

Specified by:
getBlock in interface Component
Parameters:
name - The name of the block. If this parameter is null, then Component.getDefaultBlock() can be returned.

getDefaultBlock

public Block getDefaultBlock()
Description copied from interface: Component
Gets the one block that is the 'default' block of this component

Specified by:
getDefaultBlock in interface Component

toString

public String toString()
Overrides:
toString in class Object

getBundle

public String getBundle()
Description copied from interface: Component
The baseName of the resource bundle associated with i18n messages for this component. See ResourceBundle.getBundle(String, Locale). The framework should decorate the request with this like fmt:bundle would do before rendinger a block.

Specified by:
getBundle in interface Component

getSettings

public Collection<Setting<?>> getSettings()
Description copied from interface: Component
An unmodifiable collection of all settings associated with this component

Specified by:
getSettings in interface Component

getSetting

public Setting<?> getSetting(String name)
Description copied from interface: Component
Retrieves a setting (a definition, not a value; for that, use Framework.getSettingValue(Setting, org.mmbase.util.functions.Parameters)) with a certain name. Or null if no such setting in this component.

Specified by:
getSetting in interface Component

getDependencies

public Collection<Component> getDependencies()
Description copied from interface: Component
All (satisfied) depedencies of this Component. See als Component.getUnsatisfiedDependencies().

Specified by:
getDependencies in interface Component

getUnsatisfiedDependencies

public Collection<VirtualComponent> getUnsatisfiedDependencies()
Description copied from interface: Component
The unsatisfied dependencies, so this should return an empty collection. Unless the framework is still initializing, because initially dependencies can be temporary added as 'unsatisfied' because perhaps this other component is simply not yet loaded. The ComponentRepository will call Component.resolve(VirtualComponent, Component) when a dependency is satisfied after all.

Specified by:
getUnsatisfiedDependencies in interface Component

getActions

public Map<String,Action> getActions()
Description copied from interface: Component
A component may also define extra 'actions'.

Specified by:
getActions in interface Component

resolve

public void resolve(VirtualComponent unsat,
                    Component comp)
Description copied from interface: Component
Used during bootstrapping. Marks an unsatisfied dependency as satisfied. Moves object from the result of Component.getUnsatisfiedDependencies() to Component.getDependencies().

Specified by:
resolve in interface Component
Parameters:
unsat - The VirtualComponent object that used to be unsatisfied
comp - The object representing the same component, but now as an actual Component.


MMBase2 Bridge 2.0-SNAPSHOT - 2013-03-30T06:34