org.mmbase.util.xml
Class BuilderReader

java.lang.Object
  extended by org.mmbase.util.xml.DocumentReader
      extended by org.mmbase.util.xml.AbstractBuilderReader<CoreField>
          extended by org.mmbase.util.xml.BuilderReader

public class BuilderReader
extends AbstractBuilderReader<CoreField>

Used to parse and retrieve data from a builder configuration file. The parser support builders for builder dtd 1.1.

Since:
MMBase 1.7
Version:
$Id: BuilderReader.java 42238 2010-05-18 17:14:26Z michiel $
Author:
Case Roole, Rico Jansen, Pierre van Rooden, Michiel Meeuwissen

Field Summary
 
Fields inherited from class org.mmbase.util.xml.AbstractBuilderReader
DTD_BUILDER, DTD_BUILDER_1_0, DTD_BUILDER_1_1, inheritanceResolved, inputPositions, NAMESPACE_BUILDER, NAMESPACE_BUILDER_2_0, PUBLIC_ID_BUILDER, PUBLIC_ID_BUILDER_1_0, PUBLIC_ID_BUILDER_1_1, searchPositions, XSD_BUILDER_2_0
 
Fields inherited from class org.mmbase.util.xml.DocumentReader
document, DTD_ERROR, DTD_ERROR_1_0, FILENOTFOUND, PUBLIC_ID_ERROR, PUBLIC_ID_ERROR_1_0, utilProperties
 
Constructor Summary
BuilderReader(Document doc, MMBase mmb)
           
BuilderReader(InputSource source, MMBase mmb)
           
 
Method Summary
protected  void decodeFieldAttributes(Element field, CoreField def)
           
protected  void decodeFieldDef(Element field, CoreField def, DataTypeCollector collector)
          Alter a specified, named FieldDef object using information obtained from the buidler configuration.
 List<CoreField> getFields()
          Get the field definitions of this builder.
 List<CoreField> getFields(MMObjectBuilder builder, DataTypeCollector collector)
          Get the field definitions of this builder.
 Set<Function> getFunctions(MMObjectBuilder builder)
           
 List<Index> getIndices(MMObjectBuilder builder)
          Get the named indices of this builder.
 MMObjectBuilder getParentBuilder()
          Get the builder that this builder extends
protected  String getParentClassName()
           
protected  String getParentMaintainer()
           
protected  Map<String,String> getParentProperties()
           
protected  int getParentSearchAge()
           
protected  int getParentVersion()
           
protected  boolean hasParent()
           
static void main(String[] argv)
          For testing only
protected  boolean resolveInheritance()
          Resolves inheritance.
 boolean storageEquals(BuilderReader f)
          Whether this builderreader object is equal to another for storage purposes (so, ignoring gui and documentation fields)
 
Methods inherited from class org.mmbase.util.xml.AbstractBuilderReader
decodeDataType, decodeDataTypeLater, equals, getBuilderLoader, getClassName, getDataTypes, getDescriptions, getEditorPos, getExtends, getLocalizedDescription, getLocalizedPluralName, getLocalizedSingularName, getMaintainer, getName, getPluralNames, getProperties, getSearchAge, getSingularNames, getStatus, getVersion, hashCode, isInheritanceResolved, mergeElementLists, registerPublicIDs, registerSystemIDs, resolveInheritanceByXML, toString
 
Methods inherited from class org.mmbase.util.xml.DocumentReader
appendChild, getAttribute, getChildElements, getChildElements, getChildElements, getChildElements, getDocument, getDocumentBuilder, getDocumentBuilder, getDocumentBuilder, getDocumentBuilder, getElementAttributeValue, getElementAttributeValue, getElementByPath, getElementByPath, getElementName, getElementValue, getElementValue, getNodeTextValue, getNodeTextValue, getRootElement, getSystemId, hasAttribute, setNodeTextValue, setPrefix, setSystemId, toDocument, validate, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BuilderReader

public BuilderReader(InputSource source,
                     MMBase mmb)
Since:
MMBase-1.7

BuilderReader

public BuilderReader(Document doc,
                     MMBase mmb)
Since:
MMBase-1.8
Method Detail

decodeFieldDef

protected void decodeFieldDef(Element field,
                              CoreField def,
                              DataTypeCollector collector)
Alter a specified, named FieldDef object using information obtained from the buidler configuration. Only GUI information is retrieved and stored (name and type of the field sg=hould already be specified).

Parameters:
field - The element containing the field information according to the buidler xml format
def - The field definition to alter
Since:
MMBase-1.6

decodeFieldAttributes

protected void decodeFieldAttributes(Element field,
                                     CoreField def)
Since:
MMBase-1.8.6

resolveInheritance

protected boolean resolveInheritance()
Description copied from class: AbstractBuilderReader
Resolves inheritance. If a builder 'extends' another builder, the parser attempts to retrieve a reference to this builder (using getParentBuilder). Note that if inheritance cannot be resolved, the builder cannot be activated. This method returns false if the builder to extend from is inactive. It throws a RuntimeException is the builder to extend from is not allowed as an parent builder.

Specified by:
resolveInheritance in class AbstractBuilderReader<CoreField>
Returns:
true if inheritance could be resolved, false if the .
See Also:
AbstractBuilderReader.isInheritanceResolved()

getParentSearchAge

protected int getParentSearchAge()
Specified by:
getParentSearchAge in class AbstractBuilderReader<CoreField>

getParentClassName

protected String getParentClassName()
Specified by:
getParentClassName in class AbstractBuilderReader<CoreField>

getFields

public List<CoreField> getFields()
Description copied from class: AbstractBuilderReader
Get the field definitions of this builder. If applicable, this includes the fields inherited from a parent builder.

Specified by:
getFields in class AbstractBuilderReader<CoreField>
Returns:
a List of all Fields as CoreField

getFields

public List<CoreField> getFields(MMObjectBuilder builder,
                                 DataTypeCollector collector)
Get the field definitions of this builder. If applicable, this includes the fields inherited from a parent builder.

Parameters:
builder - the MMObjectBuilder to which the fields will be added
collector - the datatype collector used to access the datatypes available for the fields to read.
Returns:
a List of all Fields as CoreField
Since:
MMBase-1.8

getIndices

public List<Index> getIndices(MMObjectBuilder builder)
Get the named indices of this builder. Note that the 'default' index (set with the 'key' attribute) is also included in this list (with the name Index.MAIN).

Parameters:
builder - the MMObjectBuilder to which the fields will be added
Returns:
a List of all Indices

getFunctions

public Set<Function> getFunctions(MMObjectBuilder builder)
Since:
MMBase-1.8

getParentBuilder

public MMObjectBuilder getParentBuilder()
Get the builder that this builder extends

Returns:
the parent as an MMObjectBuilder, or null if not specified or unresolved
Since:
MMBase-1.6

hasParent

protected boolean hasParent()
Specified by:
hasParent in class AbstractBuilderReader<CoreField>

getParentProperties

protected Map<String,String> getParentProperties()
Specified by:
getParentProperties in class AbstractBuilderReader<CoreField>

getParentVersion

protected int getParentVersion()
Specified by:
getParentVersion in class AbstractBuilderReader<CoreField>

getParentMaintainer

protected String getParentMaintainer()
Specified by:
getParentMaintainer in class AbstractBuilderReader<CoreField>

storageEquals

public boolean storageEquals(BuilderReader f)
Whether this builderreader object is equal to another for storage purposes (so, ignoring gui and documentation fields)

Since:
MMBase-1.7

main

public static void main(String[] argv)
                 throws Exception
For testing only

Throws:
Exception


MMBase 2.0-SNAPSHOT - null