org.mmbase.util.xml
Class BuilderReader

java.lang.Object
  extended byorg.mmbase.util.xml.DocumentReader
      extended byorg.mmbase.util.XMLBasicReader
          extended byorg.mmbase.util.xml.BuilderReader
Direct Known Subclasses:
XMLBuilderReader

public class BuilderReader
extends XMLBasicReader

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,v 1.9 2004/02/09 13:50:36 pierre Exp $
Author:
Case Roole, Rico Jansen, Pierre van Rooden, Michiel Meeuwissen

Field Summary
static java.lang.String DTD_BUILDER
          DTD respource filename of the most recent Builder DTD
static java.lang.String DTD_BUILDER_1_0
          DTD resource filename of the Builder DTD version 1.0
static java.lang.String DTD_BUILDER_1_1
          DTD resource filename of the Builder DTD version 1.1
static java.lang.String PUBLIC_ID_BUILDER
          Public ID of the most recent Builder DTD
static java.lang.String PUBLIC_ID_BUILDER_1_0
          Public ID of the Builder DTD version 1.0
static java.lang.String PUBLIC_ID_BUILDER_1_1
          Public ID of the Builder DTD version 1.1
 
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
 
Constructor Summary
BuilderReader(org.xml.sax.InputSource source, MMBase mmb)
           
BuilderReader(java.lang.String filename)
          Creates an instance by reading a builder configuration (xml) file.
BuilderReader(java.lang.String fileName, MMBase mmb)
          Creates an instance by reading a builder configuration (xml) file.
 
Method Summary
 boolean equals(java.lang.Object o)
          
 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()
          Detremines if inheritance is resolved.
static void registerPublicIDs()
          Register the Public Ids for DTDs used by XMLBasicReader This method is called by XMLEntityResolver.
protected  boolean resolveInheritance()
          Resolves inheritance.
 boolean storageEquals(BuilderReader f)
          Whether this FieldDefs object is equal to another for storage purposes (so, ignoring gui and documentation fields)
 
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
 
Methods inherited from class org.mmbase.util.xml.DocumentReader
getFileName, getNodeTextValue, validate
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PUBLIC_ID_BUILDER_1_0

public static final java.lang.String PUBLIC_ID_BUILDER_1_0
Public ID of the Builder DTD version 1.0

See Also:
Constant Field Values

PUBLIC_ID_BUILDER_1_1

public static final java.lang.String PUBLIC_ID_BUILDER_1_1
Public ID of the Builder DTD version 1.1

See Also:
Constant Field Values

DTD_BUILDER_1_0

public static final java.lang.String DTD_BUILDER_1_0
DTD resource filename of the Builder DTD version 1.0

See Also:
Constant Field Values

DTD_BUILDER_1_1

public static final java.lang.String DTD_BUILDER_1_1
DTD resource filename of the Builder DTD version 1.1

See Also:
Constant Field Values

PUBLIC_ID_BUILDER

public static final java.lang.String PUBLIC_ID_BUILDER
Public ID of the most recent Builder DTD

See Also:
Constant Field Values

DTD_BUILDER

public static final java.lang.String DTD_BUILDER
DTD respource filename of the most recent Builder DTD

See Also:
Constant Field Values
Constructor Detail

BuilderReader

public BuilderReader(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

BuilderReader

public BuilderReader(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

BuilderReader

public BuilderReader(org.xml.sax.InputSource source,
                     MMBase mmb)
Since:
MMBase-1.7
Method Detail

registerPublicIDs

public static void registerPublicIDs()
Register the Public Ids for DTDs used by XMLBasicReader This method is called by XMLEntityResolver.


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()
Detremines if inheritance is 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

equals

public boolean equals(java.lang.Object o)

Since:
MMBase-1.7

storageEquals

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

Since:
MMBase-1.7


MMBase build 1.7.1.20041002