org.apache.cocoon.forms.binding
Class JXPathBindingBase

java.lang.Object
  extended by org.apache.avalon.framework.logger.AbstractLogEnabled
      extended by org.apache.cocoon.forms.binding.JXPathBindingBase
All Implemented Interfaces:
LogEnabled, Binding
Direct Known Subclasses:
ComposedJXPathBindingBase, CustomJXPathBinding, DeleteNodeJXPathBinding, ImportJXPathBinding, InsertBeanJXPathBinding, InsertNodeJXPathBinding, JavaScriptJXPathBinding, MultiValueJXPathBinding, RepeaterJXPathBinding, SetAttributeJXPathBinding, SimpleRepeaterJXPathBinding, TempRepeaterJXPathBinding, TreeModelJXPath, ValueJXPathBinding

public abstract class JXPathBindingBase
extends AbstractLogEnabled
implements Binding

Provides a base class for hooking up Binding implementations that use the Jakarta Commons JXPath package.

Version:
$Id: JXPathBindingBase.html 1304258 2012-03-23 10:09:27Z ilgrosso $

Field Summary
protected  Map classes
          Cache of class definitions
protected  Binding parent
          Parent binding of this binding.
 
Constructor Summary
protected JXPathBindingBase(JXPathBindingBuilderBase.CommonAttributes commonAtts)
           
 
Method Summary
abstract  void doLoad(Widget frmModel, org.apache.commons.jxpath.JXPathContext jxpc)
          Performs the actual load binding regardless of the configured value of the "direction" attribute.
abstract  void doSave(Widget frmModel, org.apache.commons.jxpath.JXPathContext jxpc)
          Performs the actual save binding regardless of the configured value of the "direction" attribute.
 Binding getClass(String id)
          Gets a binding class.
 JXPathBindingBuilderBase.CommonAttributes getCommonAtts()
           
 Library getEnclosingLibrary()
          returns the local library for this tree of bindings
 String getId()
          Returns binding definition id.
 String getLocation()
          Gets source location of this binding.
 boolean isValid()
          checks for deep validity of this binding tree (taking into accound included libraries)
 void loadFormFromModel(Widget frmModel, org.apache.commons.jxpath.JXPathContext jxpc)
          Redefines the Binding action as working on a JXPathContext Type rather then on generic objects.
 void loadFormFromModel(Widget frmModel, Object objModel)
          Hooks up with the more generic Binding of any objectModel by wrapping it up in a JXPathContext object and then transfering control over to the new overloaded version of this method.
 void saveFormToModel(Widget frmModel, org.apache.commons.jxpath.JXPathContext jxpc)
          Redefines the Binding action as working on a JXPathContext Type rather then on generic objects.
 void saveFormToModel(Widget frmModel, Object objModel)
          Hooks up with the more generic Binding of any objectModel by wrapping it up in a JXPathContext object and then transfering control over to the new overloaded version of this method.
protected  Widget selectWidget(Widget parent, String id)
          Helper method that selects a child-widget with a given id from a parent.
 void setEnclosingLibrary(Library lib)
          sets the library this binding is a part of
 void setParent(Binding binding)
          Sets parent binding.
 
Methods inherited from class org.apache.avalon.framework.logger.AbstractLogEnabled
enableLogging, getLogger, setupLogger, setupLogger, setupLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

parent

protected Binding parent
Parent binding of this binding.


classes

protected Map classes
Cache of class definitions

Constructor Detail

JXPathBindingBase

protected JXPathBindingBase(JXPathBindingBuilderBase.CommonAttributes commonAtts)
Method Detail

getEnclosingLibrary

public Library getEnclosingLibrary()
Description copied from interface: Binding
returns the local library for this tree of bindings

Specified by:
getEnclosingLibrary in interface Binding
See Also:
Binding.getEnclosingLibrary()

setEnclosingLibrary

public void setEnclosingLibrary(Library lib)
Description copied from interface: Binding
sets the library this binding is a part of

Specified by:
setEnclosingLibrary in interface Binding
See Also:
Binding.setEnclosingLibrary(org.apache.cocoon.forms.binding.library.Library)

isValid

public boolean isValid()
Description copied from interface: Binding
checks for deep validity of this binding tree (taking into accound included libraries)

Specified by:
isValid in interface Binding
See Also:
Binding.isValid()

getCommonAtts

public JXPathBindingBuilderBase.CommonAttributes getCommonAtts()

getLocation

public String getLocation()
Gets source location of this binding.


setParent

public void setParent(Binding binding)
Sets parent binding.

Specified by:
setParent in interface Binding
Parameters:
binding - Parent of this binding.

getId

public String getId()
Returns binding definition id.

Specified by:
getId in interface Binding

getClass

public Binding getClass(String id)
Description copied from interface: Binding
Gets a binding class.

Specified by:
getClass in interface Binding
Parameters:
id - Id of binding class to get.
See Also:
Binding.getClass(java.lang.String)

selectWidget

protected Widget selectWidget(Widget parent,
                              String id)
Helper method that selects a child-widget with a given id from a parent.

Parameters:
parent - containing the child-widget to return.
id - of the childWidget to find, if this is null then the parent is returned.
Returns:
the selected widget
Throws:
RuntimeException - if the id is not null and points to a child-widget that cannot be found.

doLoad

public abstract void doLoad(Widget frmModel,
                            org.apache.commons.jxpath.JXPathContext jxpc)
                     throws BindingException
Performs the actual load binding regardless of the configured value of the "direction" attribute. Abstract method that subclasses need to implement for specific activity.

Throws:
BindingException

loadFormFromModel

public final void loadFormFromModel(Widget frmModel,
                                    org.apache.commons.jxpath.JXPathContext jxpc)
                             throws BindingException
Redefines the Binding action as working on a JXPathContext Type rather then on generic objects. Executes the actual loading via doLoad(Widget, JXPathContext) depending on the configured value of the "direction" attribute.

Throws:
BindingException

loadFormFromModel

public final void loadFormFromModel(Widget frmModel,
                                    Object objModel)
                             throws BindingException
Hooks up with the more generic Binding of any objectModel by wrapping it up in a JXPathContext object and then transfering control over to the new overloaded version of this method.

Specified by:
loadFormFromModel in interface Binding
Throws:
BindingException
See Also:
Binding.loadFormFromModel(org.apache.cocoon.forms.formmodel.Widget, java.lang.Object)

doSave

public abstract void doSave(Widget frmModel,
                            org.apache.commons.jxpath.JXPathContext jxpc)
                     throws BindingException
Performs the actual save binding regardless of the configured value of the "direction" attribute. Abstract method that subclasses need to implement for specific activity.

Throws:
BindingException

saveFormToModel

public final void saveFormToModel(Widget frmModel,
                                  org.apache.commons.jxpath.JXPathContext jxpc)
                           throws BindingException
Redefines the Binding action as working on a JXPathContext Type rather then on generic objects. Executes the actual saving via doSave(Widget, JXPathContext) depending on the configured value of the "direction" attribute.

Throws:
BindingException

saveFormToModel

public void saveFormToModel(Widget frmModel,
                            Object objModel)
                     throws BindingException
Hooks up with the more generic Binding of any objectModel by wrapping it up in a JXPathContext object and then transfering control over to the new overloaded version of this method.

Specified by:
saveFormToModel in interface Binding
Throws:
BindingException
See Also:
Binding.saveFormToModel(org.apache.cocoon.forms.formmodel.Widget, java.lang.Object)


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.