001: /*
002: This software is OSI Certified Open Source Software.
003: OSI Certified is a certification mark of the Open Source Initiative.
004:
005: The license (Mozilla version 1.0) can be read at the MMBase site.
006: See http://www.MMBase.org/license
007:
008: */
009: package org.mmbase.framework;
010:
011: import java.util.*;
012: import java.net.URI;
013: import org.mmbase.util.LocalizedString;
014: import org.mmbase.security.Action;
015:
016: /**
017: * A component is a piece of pluggable functionality that typically has dependencies on other
018: * components.
019: *
020: * A Component bundles {@link Block}s, {@link Action}s and {@link @Setting}.
021: *
022: * @author Michiel Meeuwissen
023: * @version $Id: Component.java,v 1.19 2008/02/22 14:05:57 michiel Exp $
024: * @since MMBase-1.9
025: */
026: public interface Component {
027:
028: /**
029: * Every component has a (universally) unique name
030: */
031: String getName();
032:
033: /**
034: * A component has a version number.
035: */
036: int getVersion();
037:
038: /**
039: * All (satisfied) depedencies of this Component. See als {@link
040: * #getUnsatisfiedDependencies}.
041: *
042: */
043: Collection<Component> getDependencies();
044:
045: /**
046: * The unsatisfied dependencies, so this should return an empty collection. Unless the framework
047: * is still initializing, because initially dependencies can be temporary added as 'unsatisfied'
048: * because perhaps this other component is simply <em>not yet</em> loaded. The
049: * ComponentRepository will call {@link #resolve(VirtualComponent, Component)} when a
050: * dependency is satisfied after all.
051: */
052: Collection<VirtualComponent> getUnsatisfiedDependencies();
053:
054: /**
055: * Used during bootstrapping. See also {@link #getUnsatisfiedDependencies()}
056: */
057: void resolve(VirtualComponent unsatified, Component satisfied);
058:
059: /**
060: * The description can contain further information about the component, mainly to be displayed
061: * in pages about components generally.
062: */
063: LocalizedString getDescription();
064:
065: /**
066: * An URI which may identify the configuration of this Component.
067: */
068: URI getUri();
069:
070: /**
071: * Configures the component, by XML.
072: * @param element A 'component' element from the 'components' XSD.
073: */
074: void configure(org.w3c.dom.Element element);
075:
076: /**
077: * An unmodifiable collection of all blocks associated with the component
078: */
079: Collection<Block> getBlocks();
080:
081: /**
082: * Gets a specific block. If there is no such block, then <code>null</code> is returned.
083: * @param name The name of the block. If this parameter is <code>null</code>, then {@link #getDefaultBlock} can
084: * be returned.
085: */
086: Block getBlock(String name);
087:
088: /**
089: * Gets the one block that is the 'default' block of this component
090: */
091: Block getDefaultBlock();
092:
093: /**
094: * The baseName of the resource bundle associated with i18n messages for this component.
095: * See {@link java.util.ResourceBundle#getBundle(String, Locale)}. The framework should decorate
096: * the request with this like fmt:bundle before rendinger a block.
097: */
098: String getBundle();
099:
100: /**
101: * An unmodifiable collection of all settings associated with this component
102: */
103: Collection<Setting<?>> getSettings();
104:
105: /**
106: * Retrieves a setting (a definition, not a value; for that, use
107: * {@link Framework#getSettingValue(Setting, Parameters)}) with a certain name. Or
108: * <code>null</code> if no such setting in this component.
109: */
110: Setting<?> getSetting(String name);
111:
112: /**
113: * A component may also define extra 'actions'.
114: */
115: Map<String, Action> getActions();
116:
117: }
|