fr.inria.ketuk
Class BMProcessor

java.lang.Object
  |
  +--fr.inria.ketuk.BMProcessor
Direct Known Subclasses:
BMIncrProcessor

public class BMProcessor
extends java.lang.Object

A processor of the Beans markups

Author:
Claude Pasquier

Field Summary
protected  org.w3c.dom.Document _bmDoc
          The bean markup document
protected static java.lang.ClassLoader _cl
          An instance of the default class loader
protected  java.util.Hashtable _registeredBeans
          The list of registered beans
protected static java.util.Vector _registerList
          The list of registered methods specified in config.xml
protected  java.lang.Object _rootBean
          the root of the generated beans
protected  XBLinks _xblinks
          The set of links used to assure the mapping
 
Method Summary
protected  void error(java.lang.String mess)
          Error processing
protected  void error(java.lang.String mess, java.lang.Object param)
          Error processing
protected  TypedObject executeAdd(org.w3c.dom.Element addElt, java.lang.Object currentBean)
          Processes a add element
protected  TypedObject getArray(org.w3c.dom.Element arrayElt, java.lang.Object currentBean)
          Gets a Array
protected  TypedObject getBean(org.w3c.dom.Element beanElt, java.lang.Object currentBean)
          Constructs a bean from a 'bean' tag
 java.lang.Object getBeanObject()
          Returns the root of the bean hierarchy
 org.w3c.dom.Document getBMDocument()
          Returns the bean markup document
protected  TypedObject getCast(org.w3c.dom.Element castElt, java.lang.Object currentBean)
          Gets a Cast
protected  TypedObject getField(org.w3c.dom.Element fieldElt, java.lang.Object currentBean)
          Gets a field
protected  TypedObject getMethod(org.w3c.dom.Element methodElt, java.lang.Object currentBean)
          Applies a function specified in a XML bean specification.
protected  TypedObject getObject(org.w3c.dom.Node node, java.lang.Object currentBean)
          Gets an object
protected  TypedObject getProperty(org.w3c.dom.Element propertyElt, java.lang.Object currentBean)
          Gets a property
protected  TypedObject getScript(org.w3c.dom.Element scriptElt, java.lang.Object currentBean)
          Processes a script element
protected  TypedObject getString(org.w3c.dom.Element stringElt, java.lang.Object currentBean)
          Gets a string
 void process()
          Process the bean markup document to obtain a root bean
 java.lang.Object processBM(org.w3c.dom.Document bmDoc, java.util.Hashtable beansRegistry)
          Process the bean markup document
 java.lang.Object processBM(org.w3c.dom.Document bmDoc, java.util.Hashtable beansRegistry, java.lang.Object contextBean, java.net.URL contextURL)
          Process the bean markup document specified in the source, given a contextURL, a contextBean and a list or registered beans
protected  java.lang.Object processBM(org.w3c.dom.Element bmElement, java.util.Hashtable beansRegistry)
          Process the bean markup document
protected  java.lang.Object processBM(org.w3c.dom.Element bmElement, java.util.Hashtable beansRegistry, java.lang.Object contextBean, java.net.URL contextURL)
          Process the bean markup document
 java.lang.Object processBM(java.lang.String source)
          Process the bean markup document specified in the source
protected  java.lang.Object processBM(java.lang.String source, java.util.Hashtable beansRegistry, java.lang.Object contextBean, java.net.URL contextURL)
          Process the bean markup document specified in the source, given a contextURL, a contextBean and a list or registered beans
 java.lang.Object processBM(java.lang.String source, java.net.URL contextURL)
          Process the bean markup document specified in the source, given a contextURL
 void setBMDocument(org.w3c.dom.Document bmDoc)
          Sets the bean markup document
protected  TypedObject setEventBinding(org.w3c.dom.Element eventElt, java.lang.Object currentBean)
          Sets a new event binding to the bean
protected  TypedObject setField(org.w3c.dom.Element fieldElt, java.lang.Object currentBean)
          Sets a field
protected  TypedObject setFireEvent(org.w3c.dom.Element fireEventElt, java.lang.Object currentBean)
          Processes a fire-event element
protected  TypedObject setListener(org.w3c.dom.Element listenElt, java.lang.Object currentBean)
          Processes a script element
protected  TypedObject setProperty(org.w3c.dom.Element propertyElt, java.lang.Object currentBean)
          Sets a property as specified by the 'property' parameter element
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_bmDoc

protected org.w3c.dom.Document _bmDoc
The bean markup document

_rootBean

protected java.lang.Object _rootBean
the root of the generated beans

_cl

protected static java.lang.ClassLoader _cl
An instance of the default class loader

_registeredBeans

protected java.util.Hashtable _registeredBeans
The list of registered beans

_xblinks

protected XBLinks _xblinks
The set of links used to assure the mapping

_registerList

protected static java.util.Vector _registerList
The list of registered methods specified in config.xml
Method Detail

getBMDocument

public org.w3c.dom.Document getBMDocument()
Returns the bean markup document

setBMDocument

public void setBMDocument(org.w3c.dom.Document bmDoc)
Sets the bean markup document

getBeanObject

public java.lang.Object getBeanObject()
Returns the root of the bean hierarchy

process

public void process()
             throws BMException
Process the bean markup document to obtain a root bean

processBM

public java.lang.Object processBM(java.lang.String source)
                           throws BMException
Process the bean markup document specified in the source
Parameters:
source - the source of the bean markup document

processBM

public java.lang.Object processBM(java.lang.String source,
                                  java.net.URL contextURL)
                           throws BMException
Process the bean markup document specified in the source, given a contextURL
Parameters:
source - the source of the bean markup document
contextURL - the context url used to find the source

processBM

protected java.lang.Object processBM(java.lang.String source,
                                     java.util.Hashtable beansRegistry,
                                     java.lang.Object contextBean,
                                     java.net.URL contextURL)
                              throws BMException
Process the bean markup document specified in the source, given a contextURL, a contextBean and a list or registered beans
Parameters:
source - the source of the bean markup document
beansRegistry - the list of registered beans
contextBean - the contextBean
contextURL - the context url used to find the source

processBM

public java.lang.Object processBM(org.w3c.dom.Document bmDoc,
                                  java.util.Hashtable beansRegistry)
                           throws BMException
Process the bean markup document
Parameters:
bmDoc - the source beans markup document
beansRegistry - the list of registered beans

processBM

public java.lang.Object processBM(org.w3c.dom.Document bmDoc,
                                  java.util.Hashtable beansRegistry,
                                  java.lang.Object contextBean,
                                  java.net.URL contextURL)
                           throws BMException
Process the bean markup document specified in the source, given a contextURL, a contextBean and a list or registered beans
Parameters:
source - the source of the bean markup document
beansRegistry - the list of registered beans
contextBean - the contextBean
contextURL - the context url used to find the source

processBM

protected java.lang.Object processBM(org.w3c.dom.Element bmElement,
                                     java.util.Hashtable beansRegistry)
                              throws BMException
Process the bean markup document
Parameters:
bmElement - the Element representing the bean
beansRegistry - the list of registered beans

processBM

protected java.lang.Object processBM(org.w3c.dom.Element bmElement,
                                     java.util.Hashtable beansRegistry,
                                     java.lang.Object contextBean,
                                     java.net.URL contextURL)
                              throws BMException
Process the bean markup document
Parameters:
bmElement - the Element representing the bean
beansRegistry - the list of registered beans
contextBean - the contextBean
contextURL - the context url used to find the source

getBean

protected TypedObject getBean(org.w3c.dom.Element beanElt,
                              java.lang.Object currentBean)
                       throws BMException
Constructs a bean from a 'bean' tag
Parameters:
beanElt - the Element representing the bean
contextBean - the contextBean

setProperty

protected TypedObject setProperty(org.w3c.dom.Element propertyElt,
                                  java.lang.Object currentBean)
                           throws BMException
Sets a property as specified by the 'property' parameter element
Parameters:
propertyElt - the element representing the property
currentBean - the bean that is curently instanciated
Returns:
the value returned when setting the property

getObject

protected TypedObject getObject(org.w3c.dom.Node node,
                                java.lang.Object currentBean)
                         throws BMException
Gets an object
Parameters:
node - the node representing the object to read
currentBean - the bean that is curently instanciated
Returns:
the created object

getProperty

protected TypedObject getProperty(org.w3c.dom.Element propertyElt,
                                  java.lang.Object currentBean)
                           throws BMException
Gets a property
Parameters:
propertyElt - the element representing the property to read
currentBean - the bean that is curently instanciated
Returns:
the value returned when getting the property

getString

protected TypedObject getString(org.w3c.dom.Element stringElt,
                                java.lang.Object currentBean)
                         throws BMException
Gets a string
Parameters:
stringElt - the element representing the string to read
currentBean - the bean that is curently instanciated
Returns:
the created object

getField

protected TypedObject getField(org.w3c.dom.Element fieldElt,
                               java.lang.Object currentBean)
                        throws BMException
Gets a field
Parameters:
fieldElt - the element representing the object to read
currentBean - the bean that is curently instanciated
Returns:
the value of a field

setField

protected TypedObject setField(org.w3c.dom.Element fieldElt,
                               java.lang.Object currentBean)
                        throws BMException
Sets a field
Parameters:
fieldElt - the element representing the object to read
currentBean - the bean that is curently instanciated
Returns:
the value returned when setting the field

setEventBinding

protected TypedObject setEventBinding(org.w3c.dom.Element eventElt,
                                      java.lang.Object currentBean)
                               throws BMException
Sets a new event binding to the bean
Parameters:
eventElt - the element describing the event binding
currentBean - the bean currently instanciated
Returns:
the value returned when setting the event

getMethod

protected TypedObject getMethod(org.w3c.dom.Element methodElt,
                                java.lang.Object currentBean)
                         throws BMException
Applies a function specified in a XML bean specification.
Parameters:
methodElt - the component to which the method must be applied
currentBean - the bean currently instanciated
Returns:
the object created by a call to the method

getCast

protected TypedObject getCast(org.w3c.dom.Element castElt,
                              java.lang.Object currentBean)
                       throws BMException
Gets a Cast
Parameters:
castElt - the element representing the object to read
currentBean - the bean that is curently instanciated
Returns:
the created object

getArray

protected TypedObject getArray(org.w3c.dom.Element arrayElt,
                               java.lang.Object currentBean)
                        throws BMException
Gets a Array
Parameters:
arrayElt - the element representing the array to read
currentBean - the bean that is curently instanciated
Returns:
the created object

setFireEvent

protected TypedObject setFireEvent(org.w3c.dom.Element fireEventElt,
                                   java.lang.Object currentBean)
                            throws BMException
Processes a fire-event element
Parameters:
fireEventElt - the component to which the fire-event
currentBean - the bean currently instanciated
Returns:
the object created by the processing of the element

executeAdd

protected TypedObject executeAdd(org.w3c.dom.Element addElt,
                                 java.lang.Object currentBean)
                          throws BMException
Processes a add element
Parameters:
addElt - the element representing the add
currentBean - the bean currently instanciated
Returns:
the object created by the processing of the element

getScript

protected TypedObject getScript(org.w3c.dom.Element scriptElt,
                                java.lang.Object currentBean)
                         throws BMException
Processes a script element
Parameters:
scriptElt - the component representing the script
currentBean - the bean currently instanciated
Returns:
the object created by the processing of the element

setListener

protected TypedObject setListener(org.w3c.dom.Element listenElt,
                                  java.lang.Object currentBean)
                           throws BMException
Processes a script element
Parameters:
listenElt - the component representing the listener
currentBean - the bean currently instanciated
Returns:
the object created by the processing of the element

error

protected void error(java.lang.String mess)
              throws BMException
Error processing
Parameters:
mess - the message of the error

error

protected void error(java.lang.String mess,
                     java.lang.Object param)
              throws BMException
Error processing
Parameters:
mess - the message of the error
param - a parameter to the error message