org.objectweb.easybeans.xmlconfig.mapping
Class XMLMappingBuilder

java.lang.Object
  extended by org.objectweb.easybeans.xmlconfig.mapping.XMLMappingBuilder

public class XMLMappingBuilder
extends java.lang.Object

Allows to build the Mapping object for a set of classes.

Author:
Florent Benoit

Field Summary
private static java.lang.String ATTRIBUTE_ELEMENT
          Name of the <attribute> element.
private static java.lang.String CLASS_ELEMENT
          Name of the <class> element.
private static java.lang.String MAPPING_NS
          Namespace used for the mapping file (for validation).
private  java.net.URL mappingURL
          URL that reference the mapping file.
private static java.lang.String PACKAGE_ELEMENT
          Name of the <package> element.
private  XMLMapping xmlMapping
          The mapping used for the given namespace.
 
Constructor Summary
XMLMappingBuilder(java.net.URL mappingURL)
          Builds a new mapping builder.
 
Method Summary
private  void addClassMapping(org.w3c.dom.NodeList classList, java.lang.String packageName, boolean packageParent)
          Add the mapping for the given list of class elements.
 void build()
          Build the XMLMapping object by analyzing the mapping file.
 XMLMapping getXmlMapping()
          Gets the XML mapping object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAPPING_NS

private static final java.lang.String MAPPING_NS
Namespace used for the mapping file (for validation).

See Also:
Constant Field Values

PACKAGE_ELEMENT

private static final java.lang.String PACKAGE_ELEMENT
Name of the <package> element.

See Also:
Constant Field Values

CLASS_ELEMENT

private static final java.lang.String CLASS_ELEMENT
Name of the <class> element.

See Also:
Constant Field Values

ATTRIBUTE_ELEMENT

private static final java.lang.String ATTRIBUTE_ELEMENT
Name of the <attribute> element.

See Also:
Constant Field Values

mappingURL

private java.net.URL mappingURL
URL that reference the mapping file.


xmlMapping

private XMLMapping xmlMapping
The mapping used for the given namespace.

Constructor Detail

XMLMappingBuilder

public XMLMappingBuilder(java.net.URL mappingURL)
Builds a new mapping builder.

Parameters:
mappingURL - the given url that reference the mapping file.
Method Detail

build

public void build()
           throws XMLConfigurationException
Build the XMLMapping object by analyzing the mapping file.

Throws:
XMLConfigurationException - if there is a failure when analyzing the XML file.

addClassMapping

private void addClassMapping(org.w3c.dom.NodeList classList,
                             java.lang.String packageName,
                             boolean packageParent)
Add the mapping for the given list of class elements.

Parameters:
classList - the list of elements
packageName - the name of the package to use as prefix.
packageParent - if true, package as parent node is accepted, else it is denied.

getXmlMapping

public XMLMapping getXmlMapping()
Gets the XML mapping object.

Returns:
the mapping object between classname/alias and their mapping description.