org.mmbase.util
Class XMLBuilderReader

java.lang.Object
  |
  +--org.mmbase.util.XMLBasicReader
        |
        +--org.mmbase.util.XMLBuilderReader

public class XMLBuilderReader
extends XMLBasicReader

This class is used to parse and retrieve data from a builder configuration file.

Version:
$Id: XMLBuilderReader.java,v 1.27 2002/10/25 20:56:24 michiel Exp $
Author:
Case Roole, Rico Jansen, Pierre van Rooden

Fields inherited from class org.mmbase.util.XMLBasicReader
document
 
Constructor Summary
XMLBuilderReader(java.lang.String filename)
          Creates an instance by reading a builder configuration (xml) file.
XMLBuilderReader(java.lang.String filename, MMBase mmb)
          Creates an instance by reading a builder configuration (xml) file.
 
Method Summary
 java.lang.String getBuilderExtends()
          Get the name of the builder that this builder extends
 java.lang.String getBuilderMaintainer()
          Retrieve the name of the maintainer of this builder
 int getBuilderVersion()
          Retrieve the (major) version number of this builder
 java.lang.String getClassFile()
          Get the class name to use for instantiating this builder.
 java.util.Hashtable getDescriptions()
          Get the descriptions of this builder
 java.util.Vector getFieldDefs()
          Get the field definitions of this builder.
 MMObjectBuilder getParentBuilder()
          Get the builder that this builder extends
 java.util.Hashtable getPluralNames()
          Get the plural names of this builder
 java.util.Hashtable getProperties()
          Get the properties of this builder
 int getSearchAge()
          Retrieves the Search Age.
 java.util.Hashtable getSingularNames()
          Get the singular (GUI) names of this builder
 java.lang.String getStatus()
          Get the status of this builder.
 boolean isInheritanceResolved()
          Is inheritance resolved? This method returns true if a call to resolveInheritance succeeded.
protected  boolean resolveInheritance()
          Resolves inheritance.
 
Methods inherited from class org.mmbase.util.XMLBasicReader
getChildElements, getChildElements, getChildElements, getChildElements, getDocumentBuilder, getDocumentBuilder, getDocumentBuilder, getDocumentBuilder, getDocumentBuilder, getDocumentBuilder, getElementAttributeValue, getElementAttributeValue, getElementByPath, getElementByPath, getElementName, getElementValue, getElementValue, getFileName, reinitLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLBuilderReader

public XMLBuilderReader(java.lang.String filename,
                        MMBase mmb)
Creates an instance by reading a builder configuration (xml) file.
Parameters:
filename - path to the builder configuration file to parse
mmb - The MMBase instance. Used to resolve inheritance of builders
Since:
MMBase-1.6

XMLBuilderReader

public XMLBuilderReader(java.lang.String filename)
Creates an instance by reading a builder configuration (xml) file. A parser created with this constructor does not resolve inheritance, but maintains the activity status as it is set in the file. This call should be used if only the actual information in the xml file is needed.
Parameters:
filename - path to the builder configuration file to parse
Method Detail

resolveInheritance

protected boolean resolveInheritance()
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.
Returns:
true if inheritance could be resolved, false if the .
Throws:
java.lang.RuntimeException - when the builder to extend from is not allowed as parent
Since:
MMBase-1.6
See Also:
isInheritanceResolved()

isInheritanceResolved

public boolean isInheritanceResolved()
Is inheritance resolved? This method returns true if a call to resolveInheritance succeeded. it returns false if resolveInheritance failed (returned false or threw an exception)
Returns:
true if inheritance could be resolved
Since:
MMBase-1.6
See Also:
resolveInheritance()

getStatus

public java.lang.String getStatus()
Get the status of this builder. Note that if inheritance cannot be resolved, this method always returns "inactive".
Returns:
a String decribing the status ("active" or "inactive")

getSearchAge

public int getSearchAge()
Retrieves the Search Age. The search age may be used by editors or search forms to determine the maximum age in days of an object to be searched (limiting the resultset of a search)
Returns:
the search age in days

getClassFile

public java.lang.String getClassFile()
Get the class name to use for instantiating this builder. Note that it is possible to specify a short-hand format in the builder configuration file. If only the classname (withoput package name) is given, the classname is expanded to fall into the org.mmbase.module.builders package.
Returns:
the classname to use.

getFieldDefs

public java.util.Vector getFieldDefs()
Get the field definitions of this builder. If applicable, this includes the fields inherited from a parent builder.
Returns:
a Vector of all Fields as FieldDefs

getProperties

public java.util.Hashtable getProperties()
Get the properties of this builder
Returns:
the properties in a Hashtable (as name-value pairs)

getDescriptions

public java.util.Hashtable getDescriptions()
Get the descriptions of this builder
Returns:
the descriptions in a Hashtable, accessible by language

getPluralNames

public java.util.Hashtable getPluralNames()
Get the plural names of this builder
Returns:
the plural names in a Hashtable, accessible by language

getSingularNames

public java.util.Hashtable getSingularNames()
Get the singular (GUI) names of this builder
Returns:
the singular names in a Hashtable, accessible by language

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

getBuilderExtends

public java.lang.String getBuilderExtends()
Get the name of the builder that this builder extends
Returns:
the name of the parent builder
Since:
MMBase-1.6

getBuilderVersion

public int getBuilderVersion()
Retrieve the (major) version number of this builder
Returns:
the version as an integer.

getBuilderMaintainer

public java.lang.String getBuilderMaintainer()
Retrieve the name of the maintainer of this builder
Returns:
the name fo the maintainer as a String


MMBase build 1.6.5.20030923