fi.hut.tml.xsmiles.mlfc.xbl2
Class BindingHandler

java.lang.Object
  extended byfi.hut.tml.xsmiles.mlfc.xbl2.BindingHandler

public class BindingHandler
extends java.lang.Object

Author:
Juho Vuohelainen, Jukka Julku, Mikko Vestola

Constructor Summary
BindingHandler(XSmilesDocumentImpl doc)
          Default constructor
 
Method Summary
 void addBinding(BindingElementImpl be, XSmilesElementImpl xe)
          Add a binding between BindingElementImpl be and XSmilesElementImpl xe.
 void addBindingDocumentPI(XMLDocument doc)
          Adds an XML document to the PI binding documents.
 BindingElementImpl addBindingDynamically(java.lang.String bindingURI, XSmilesElementImpl elem)
          This method adds binding dynamically to an element.
 void addExtendingBindings(BindingElementImpl binding, java.util.ArrayList chain, XSmilesElementImpl element)
          This method bounds the given binding and the bindings it extends from (explicit inheritance chain) to the given element in the right order (the base binding of the explicit inheritance chain is bound first).
 void applyBindings()
          Apply bindings for all XSmilesElementImpls in the order they were added.
 void applyBindings(XSmilesElementImpl xe)
          Apply bindings for specified XSmilesElementImpl in the order they were added.
protected  void applyBindings(XSmilesElementImpl xe, java.util.Vector v)
          Apply XSmilesElementImpl binding for all BindingElementImpls in Vector in the order they were added.
 java.util.ArrayList getAllBindings()
          Returns all the binding elements in a list loaded in this document.
 java.util.Vector getBindingDocumentsPI()
          Returns all the external binding documents loaded with the processing instruction.
 java.util.Vector getBindings(BindingElementImpl be)
          Get all bindings for BindingElementImpl be as a Vector of XSmilesElementImpls.
 java.util.Vector getBindings(XSmilesElementImpl xe)
          Get all bindings for XSmilesElementImpl xe as a Vector BindingHandlerImpls.
 void removeBinding(BindingElementImpl be, XSmilesElementImpl xe)
           
 void start()
          Starts the bindinghandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BindingHandler

public BindingHandler(XSmilesDocumentImpl doc)
Default constructor

Method Detail

getAllBindings

public java.util.ArrayList getAllBindings()
Returns all the binding elements in a list loaded in this document.

Returns:
List containing all bindings loaded in the document. Every binding may not be bound to an element. The order of the bindings are that in which order the appeared in the document (first the bindings imported with the PI and then inline bindings).

getBindingDocumentsPI

public java.util.Vector getBindingDocumentsPI()
Returns all the external binding documents loaded with the processing instruction.

Returns:
Vector containing external XML documents

addBindingDocumentPI

public void addBindingDocumentPI(XMLDocument doc)
Adds an XML document to the PI binding documents.

Parameters:
doc - XML document to be added
See Also:
getBindingDocumentsPI()

start

public void start()
Starts the bindinghandler. Finds the elements that the bindings will be bound to and finally applies the bindings in the right order.


addBindingDynamically

public BindingElementImpl addBindingDynamically(java.lang.String bindingURI,
                                                XSmilesElementImpl elem)
This method adds binding dynamically to an element. It is supposed to be called after the document has been loaded and all the binding elements in the document have been loaded.

Parameters:
bindingURI - The binding URI (absolute or relative) that is going to be bound to the element.
elem - The element that the binding is going to be bound to.
Returns:
Returns the binding element if the URI is a correct reference to a binding element. Null, it the URI does not refer to any binding element.

addExtendingBindings

public void addExtendingBindings(BindingElementImpl binding,
                                 java.util.ArrayList chain,
                                 XSmilesElementImpl element)
This method bounds the given binding and the bindings it extends from (explicit inheritance chain) to the given element in the right order (the base binding of the explicit inheritance chain is bound first). The method checks that does the binding inherit other bindings that must be first bound to the element and calls the addBinging() method in the BindingHandler class to all these bindings.

Parameters:
binding - The binding element that will be bound to the element
chain - The chain (ArrayList) of bindings that are already in the explicit inheritance chain of the binding. Set to null when first calling this method.
element - The element to which the binding will been bound to
See Also:
addBinding(BindingElementImpl, XSmilesElementImpl)

addBinding

public void addBinding(BindingElementImpl be,
                       XSmilesElementImpl xe)
Add a binding between BindingElementImpl be and XSmilesElementImpl xe. Does nothing if either one is null.

Parameters:
be -
xe -

getBindings

public java.util.Vector getBindings(XSmilesElementImpl xe)
Get all bindings for XSmilesElementImpl xe as a Vector BindingHandlerImpls. Modifying the returned Vector does not modify the actual bindings.

Parameters:
xe -
Returns:

getBindings

public java.util.Vector getBindings(BindingElementImpl be)
Get all bindings for BindingElementImpl be as a Vector of XSmilesElementImpls. Modifying the returned Vector does not modify the actual bindings.

Parameters:
be -
Returns:

applyBindings

public void applyBindings()
Apply bindings for all XSmilesElementImpls in the order they were added.


applyBindings

public void applyBindings(XSmilesElementImpl xe)
Apply bindings for specified XSmilesElementImpl in the order they were added.

Parameters:
xe -

applyBindings

protected void applyBindings(XSmilesElementImpl xe,
                             java.util.Vector v)
Apply XSmilesElementImpl binding for all BindingElementImpls in Vector in the order they were added.

Parameters:
v -

removeBinding

public void removeBinding(BindingElementImpl be,
                          XSmilesElementImpl xe)


X-Smiles 1.2