org.oddjob.arooa
Class ArooaFactory

java.lang.Object
  extended byorg.oddjob.arooa.ArooaFactory

public class ArooaFactory
extends java.lang.Object

Builds an object from XML. This highly configurable factory will either configure a component provided as the objectToConfigure or create a component using the class attribute or tag name of the document root.

If a documentStartHandler is provided the factory assumes the root object will also be provided.


Nested Class Summary
 class ArooaFactory.ComponentRoot
           
 
Constructor Summary
ArooaFactory()
           
 
Method Summary
 java.lang.Object build(java.io.File file)
          Build from a file.
 java.lang.Object build(org.xml.sax.InputSource inputSource)
          Build from an input source.
 java.lang.Object build(java.io.InputStream in)
          Build from an input stream of xml.
 java.lang.Object build(java.lang.String xml)
          Build from a string xml message.
 org.apache.commons.beanutils.BeanUtilsBean getBeanUtilsBean()
           
 ObjectFactory getComponentFactory()
           
 ArooaHandler getComponentHandler()
           
 ComponentProxyResolver getComponentProxyResolver()
           
 ComponentRegistry getComponentRegistry()
           
 ArooaHandler getDocumentStartHandler()
          Retrieve the document start handler.
 java.lang.String getDocumentTag()
           
 ArooaHandler getElementHandler()
           
 ArooaHandler getMappedHandler()
           
 PropertyProxyResolver getPropertProxyResolver()
           
 ArooaHandler getPropertyHandler()
           
 java.lang.String getSubstitutionPolicy()
           
 ObjectFactory getValueFactory()
           
 void setBeanUtilsBean(org.apache.commons.beanutils.BeanUtilsBean bub)
           
 void setComponentFactory(ObjectFactory componentFactory)
           
 void setComponentHandler(ArooaHandler componentHandler)
           
 void setComponentProxyResolver(ComponentProxyResolver componentProxyResolver)
           
 void setComponentRegistry(ComponentRegistry componentRegistry)
           
 void setDocumentStartHandler(ArooaHandler documentStartHandler)
          Set the document start handler.
 void setDocumentTag(java.lang.String documentTag)
           
 void setElementHandler(ArooaHandler elementHandler)
           
 void setMappedHandler(ArooaHandler mappedHandler)
           
 void setObjectToConfigure(java.lang.Object objectToConfigure)
           
 void setPropertProxyResolver(PropertyProxyResolver typeManager)
           
 void setPropertyHandler(ArooaHandler valueHandler)
           
 void setSubstitutionPolicy(java.lang.String substitutionPolicy)
           
 void setValueFactory(ObjectFactory valueFactory)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArooaFactory

public ArooaFactory()
Method Detail

build

public java.lang.Object build(java.io.File file)
Build from a file.

Parameters:
file - A file.
Returns:
The built object. May be null if a custom start handler was provided.

build

public java.lang.Object build(java.lang.String xml)
Build from a string xml message.

Parameters:
xml - The xml.
Returns:
The built object. May be null if a custom start handler was provided.

build

public java.lang.Object build(java.io.InputStream in)
Build from an input stream of xml.

Parameters:
in - The input stream.
Returns:
The built object. May be null if a custom start handler was provided.

build

public java.lang.Object build(org.xml.sax.InputSource inputSource)
Build from an input source.

Parameters:
inputSource - An input source.
Returns:
The built ojbect. May be null if a custom start handler was provided.

setComponentFactory

public void setComponentFactory(ObjectFactory componentFactory)
Parameters:
componentFactory - The componentFactory to set.

setComponentHandler

public void setComponentHandler(ArooaHandler componentHandler)
Parameters:
componentHandler - The componentHandler to set.

setComponentRegistry

public void setComponentRegistry(ComponentRegistry componentRegistry)
Parameters:
componentRegistry - The componentRegistry to set.

setDocumentTag

public void setDocumentTag(java.lang.String documentTag)
Parameters:
documentTag - The documentTag to set.

setElementHandler

public void setElementHandler(ArooaHandler elementHandler)
Parameters:
elementHandler - The elementHandler to set.

setSubstitutionPolicy

public void setSubstitutionPolicy(java.lang.String substitutionPolicy)
Parameters:
substitutionPolicy - The substitutionPolicy to set.

setPropertProxyResolver

public void setPropertProxyResolver(PropertyProxyResolver typeManager)
Parameters:
typeManager - The typeManager to set.

setValueFactory

public void setValueFactory(ObjectFactory valueFactory)
Parameters:
valueFactory - The valueFactory to set.

setPropertyHandler

public void setPropertyHandler(ArooaHandler valueHandler)
Parameters:
valueHandler - The valueHandler to set.

setObjectToConfigure

public void setObjectToConfigure(java.lang.Object objectToConfigure)
Parameters:
objectToConfigure - The objectToConfigure to set.

setMappedHandler

public void setMappedHandler(ArooaHandler mappedHandler)
Parameters:
mappedHandler - The mappedHandler to set.

getBeanUtilsBean

public org.apache.commons.beanutils.BeanUtilsBean getBeanUtilsBean()
Returns:
Returns the bub.

setBeanUtilsBean

public void setBeanUtilsBean(org.apache.commons.beanutils.BeanUtilsBean bub)
Parameters:
bub - The bub to set.

getComponentFactory

public ObjectFactory getComponentFactory()
Returns:
Returns the componentFactory.

getComponentHandler

public ArooaHandler getComponentHandler()
Returns:
Returns the componentHandler.

getComponentRegistry

public ComponentRegistry getComponentRegistry()
Returns:
Returns the componentRegistry.

getDocumentTag

public java.lang.String getDocumentTag()
Returns:
Returns the documentTag.

getElementHandler

public ArooaHandler getElementHandler()
Returns:
Returns the elementHandler.

getMappedHandler

public ArooaHandler getMappedHandler()
Returns:
Returns the mappedHandler.

getPropertyHandler

public ArooaHandler getPropertyHandler()
Returns:
Returns the propertyHandler.

getSubstitutionPolicy

public java.lang.String getSubstitutionPolicy()
Returns:
Returns the substitutionPolicy.

getPropertProxyResolver

public PropertyProxyResolver getPropertProxyResolver()
Returns:
Returns the typeManager.

getValueFactory

public ObjectFactory getValueFactory()
Returns:
Returns the valueFactory.

setDocumentStartHandler

public void setDocumentStartHandler(ArooaHandler documentStartHandler)
Set the document start handler. This will receive a onStartElement event with the doucment root tag and attributes. If a documentStartHandler is provided it is optional if an objectToConfigure is also be provided. If it isn't then none will be created.

Parameters:
documentStartHandler - The documentStartHandler to set.

getDocumentStartHandler

public ArooaHandler getDocumentStartHandler()
Retrieve the document start handler. This will

Returns:
Returns the documentStartHandler.

getComponentProxyResolver

public ComponentProxyResolver getComponentProxyResolver()

setComponentProxyResolver

public void setComponentProxyResolver(ComponentProxyResolver componentProxyResolver)