cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m..@apache.org
Subject cvs commit: cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding InsertBeanJXPathBinding.java InsertNodeJXPathBinding.java RepeaterJXPathBindingBuilder.java JXPathBindingBase.java ContextJXPathBindingBuilder.java SetAttributeJXPathBinding.java DeleteNodeJXPathBinding.java ValueJXPathBinding.java JavaScriptJXPathBinding.java JXpathBindingBuilderBase.java ValueJXPathBindingBuilder.java ContextJXPathBinding.java SimpleRepeaterJXPathBindingBuilder.java SimpleRepeaterJXPathBinding.java JavaScriptJXPathBindingBuilder.java AggregateJXPathBinding.java RepeaterJXPathBinding.java SetAttributeJXPathBindingBuilder.java ComposedJXPathBindingBase.java DeleteNodeJXPathBindingBuilder.java InsertNodeJXPathBindingBuilder.java AggregateJXPathBindingBuilder.java InsertBeanJXPathBindingBuilder.java
Date Thu, 18 Dec 2003 07:57:21 GMT
mpo         2003/12/17 23:57:21

  Modified:    src/blocks/woody/java/org/apache/cocoon/woody/binding
                        InsertBeanJXPathBinding.java
                        InsertNodeJXPathBinding.java
                        RepeaterJXPathBindingBuilder.java
                        JXPathBindingBase.java
                        ContextJXPathBindingBuilder.java
                        SetAttributeJXPathBinding.java
                        DeleteNodeJXPathBinding.java
                        ValueJXPathBinding.java
                        JavaScriptJXPathBinding.java
                        JXpathBindingBuilderBase.java
                        ValueJXPathBindingBuilder.java
                        ContextJXPathBinding.java
                        SimpleRepeaterJXPathBindingBuilder.java
                        SimpleRepeaterJXPathBinding.java
                        JavaScriptJXPathBindingBuilder.java
                        AggregateJXPathBinding.java
                        RepeaterJXPathBinding.java
                        SetAttributeJXPathBindingBuilder.java
                        ComposedJXPathBindingBase.java
                        DeleteNodeJXPathBindingBuilder.java
                        InsertNodeJXPathBindingBuilder.java
                        AggregateJXPathBindingBuilder.java
                        InsertBeanJXPathBindingBuilder.java
  Log:
  Adding support for @lenient on all attributes.
  The value of lenient should be one of ''(unset=default)|'true'|'false' and indicates
  which (if any) leniency setting this binding will apply on the jxpath context.
  By default the leniency on the top-level of the binding is set to true.
  Reasoning and discussion for this feature are here:
  http://marc.theaimsgroup.com/?t=107160688300009&r=1&w=2
  
  Revision  Changes    Path
  1.4       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/InsertBeanJXPathBinding.java
  
  Index: InsertBeanJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/InsertBeanJXPathBinding.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InsertBeanJXPathBinding.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ InsertBeanJXPathBinding.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -75,8 +75,8 @@
       /**
        * Constructs InsertBeanJXPathBinding
        */
  -    public InsertBeanJXPathBinding(boolean loadEnabled, boolean saveEnabled, String className,
String addMethod) {
  -        super(loadEnabled, saveEnabled);
  +    public InsertBeanJXPathBinding(JXpathBindingBuilderBase.CommonAttributes commonAtts,
String className, String addMethod) {
  +        super(commonAtts);
           this.className = className;
           this.addMethodName = addMethod;
       }
  
  
  
  1.4       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/InsertNodeJXPathBinding.java
  
  Index: InsertNodeJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/InsertNodeJXPathBinding.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InsertNodeJXPathBinding.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ InsertNodeJXPathBinding.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -75,8 +75,8 @@
       /**
        * Constructs InsertNodeJXPathBinding
        */
  -    public InsertNodeJXPathBinding(boolean loadEnabled, boolean saveEnabled, DocumentFragment
domTemplate) {
  -        super(loadEnabled, saveEnabled);
  +    public InsertNodeJXPathBinding(JXpathBindingBuilderBase.CommonAttributes commonAtts,
DocumentFragment domTemplate) {
  +        super(commonAtts);
           this.template = domTemplate;
       }
   
  
  
  
  1.8       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/RepeaterJXPathBindingBuilder.java
  
  Index: RepeaterJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/RepeaterJXPathBindingBuilder.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- RepeaterJXPathBindingBuilder.java	16 Dec 2003 15:05:54 -0000	1.7
  +++ RepeaterJXPathBindingBuilder.java	18 Dec 2003 07:57:21 -0000	1.8
  @@ -102,7 +102,7 @@
           JXPathBindingManager.Assistant assistant) throws BindingException {
   
           try {
  -            DirectionAttributes directionAtts = JXpathBindingBuilderBase.getDirectionAttributes(bindingElm);

  +            CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(bindingElm);

               
               String repeaterId = DomHelper.getAttribute(bindingElm, "id");
               String parentPath =
  @@ -159,7 +159,7 @@
   
               RepeaterJXPathBinding repeaterBinding =
                   new RepeaterJXPathBinding(
  -                    directionAtts.loadEnabled, directionAtts.saveEnabled,
  +                    commonAtts,
                       repeaterId, parentPath, rowPath, rowPathForInsert,
                       uniqueRowId, uniqueRowIdPath,
                       convertor, convertorLocale, 
  
  
  
  1.6       +24 -27    cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/JXPathBindingBase.java
  
  Index: JXPathBindingBase.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/JXPathBindingBase.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- JXPathBindingBase.java	16 Dec 2003 15:05:54 -0000	1.5
  +++ JXPathBindingBase.java	18 Dec 2003 07:57:21 -0000	1.6
  @@ -52,10 +52,8 @@
   
   import org.apache.avalon.framework.logger.LogEnabled;
   import org.apache.avalon.framework.logger.Logger;
  -import org.apache.cocoon.util.jxpath.DOMFactory;
   import org.apache.cocoon.woody.formmodel.Widget;
   import org.apache.commons.jxpath.JXPathContext;
  -import org.w3c.dom.Node;
   
   /**
    * Provides a base class for hooking up Binding implementations that use the 
  @@ -70,23 +68,17 @@
       private Logger logger;
       
       /**
  -     * Flag indicating if the nested load-binding on this level should be performed.
  +     * Object holding the values of the common objects on all Bindings.
        */
  -    private final boolean loadEnabled;
  +    private final JXpathBindingBuilderBase.CommonAttributes commonAtts;
       
  -    /**
  -     * Flag indicating if the nested save-binding on this level should be performed.
  -     */    
  -    private final boolean saveEnabled;
  -
   
       private JXPathBindingBase() {
  -        this(true, true);
  +        this(JXpathBindingBuilderBase.CommonAttributes.DEFAULT);
       }
       
  -    protected JXPathBindingBase(boolean loadEnabled, boolean saveEnabled) {
  -        this.loadEnabled = loadEnabled;
  -        this.saveEnabled = saveEnabled;
  +    protected JXPathBindingBase(JXpathBindingBuilderBase.CommonAttributes commonAtts) {
  +        this.commonAtts = commonAtts;
       }
       
       /**
  @@ -102,7 +94,8 @@
        * depending on the value of {@see #loadEnabled}
        */
       public final void loadFormFromModel(Widget frmModel, JXPathContext jxpc) {
  -        if (this.loadEnabled) {
  +        applyLeniency(jxpc);
  +        if (this.commonAtts.loadEnabled) {
               doLoad(frmModel, jxpc);
           }    
       }
  @@ -117,16 +110,7 @@
               throw new NullPointerException("null object passed to loadFormFromModel() method");
           }
   
  -        JXPathContext jxpc;
  -        if (!(objModel instanceof JXPathContext)) {
  -            jxpc = JXPathContext.newContext(objModel);
  -            
  -            if (objModel instanceof Node) {
  -                jxpc.setFactory(new DOMFactory());
  -            }
  -        } else {
  -            jxpc = (JXPathContext) objModel;
  -        }
  +        JXPathContext jxpc = makeJXPathContext(objModel);
           loadFormFromModel(frmModel, jxpc);
       }
   
  @@ -143,7 +127,8 @@
        * depending on the value of {@see #saveEnabled}
        */
       public final void saveFormToModel(Widget frmModel, JXPathContext jxpc) throws BindingException{
  -        if (this.saveEnabled) {
  +        applyLeniency(jxpc);
  +        if (this.commonAtts.saveEnabled) {
               doSave(frmModel, jxpc);
           }    
       }
  @@ -158,13 +143,25 @@
               throw new NullPointerException("null object passed to saveFormToModel() method");
           }
   
  +        JXPathContext jxpc = makeJXPathContext(objModel);
  +        saveFormToModel(frmModel, jxpc);
  +    }
  +
  +    private void applyLeniency(JXPathContext jxpc) {
  +        if (this.commonAtts.leniency != null) {
  +            jxpc.setLenient(this.commonAtts.leniency.booleanValue());
  +        }
  +    }
  +    
  +    private JXPathContext makeJXPathContext(Object objModel) {
           JXPathContext jxpc;
           if (!(objModel instanceof JXPathContext)) {
               jxpc = JXPathContext.newContext(objModel);
  +            jxpc.setLenient(true);
           } else {
  -            jxpc = (JXPathContext) objModel;
  +            jxpc = (JXPathContext) objModel;            
           }
  -        saveFormToModel(frmModel, jxpc);
  +        return jxpc;
       }
   
       /**
  
  
  
  1.4       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/ContextJXPathBindingBuilder.java
  
  Index: ContextJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/ContextJXPathBindingBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ContextJXPathBindingBuilder.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ ContextJXPathBindingBuilder.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -74,12 +74,12 @@
           JXPathBindingManager.Assistant assistant) throws BindingException {
   
           try {
  -            DirectionAttributes directionAtts = JXpathBindingBuilderBase.getDirectionAttributes(bindingElm);
            
  +            CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(bindingElm);
            
               String xpath = DomHelper.getAttribute(bindingElm, "path");
   
               JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
   
  -            ContextJXPathBinding contextBinding = new ContextJXPathBinding(directionAtts.loadEnabled,
directionAtts.saveEnabled, xpath, childBindings);
  +            ContextJXPathBinding contextBinding = new ContextJXPathBinding(commonAtts,
xpath, childBindings);
               return contextBinding;
           } catch (BindingException e) {
               throw e;
  
  
  
  1.4       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/SetAttributeJXPathBinding.java
  
  Index: SetAttributeJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/SetAttributeJXPathBinding.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SetAttributeJXPathBinding.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ SetAttributeJXPathBinding.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -69,8 +69,8 @@
       /**
        * Constructs SetAttributeJXPathBinding
        */
  -    public SetAttributeJXPathBinding(boolean loadEnabled, boolean saveEnabled, String attName,
String attValue) {
  -        super(loadEnabled, saveEnabled);
  +    public SetAttributeJXPathBinding(JXpathBindingBuilderBase.CommonAttributes commonAtts,
String attName, String attValue) {
  +        super(commonAtts);
           this.name = attName;
           this.value = attValue;
       }
  
  
  
  1.3       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/DeleteNodeJXPathBinding.java
  
  Index: DeleteNodeJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/DeleteNodeJXPathBinding.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- DeleteNodeJXPathBinding.java	16 Dec 2003 15:05:54 -0000	1.2
  +++ DeleteNodeJXPathBinding.java	18 Dec 2003 07:57:21 -0000	1.3
  @@ -64,8 +64,8 @@
    */
   public class DeleteNodeJXPathBinding extends JXPathBindingBase {
       
  -    public DeleteNodeJXPathBinding(boolean loadEnabled, boolean saveEnabled) {
  -        super(loadEnabled, saveEnabled);
  +    public DeleteNodeJXPathBinding(JXpathBindingBuilderBase.CommonAttributes commonAtts)
{
  +        super(commonAtts);
       }
   
       public void doLoad(Widget frmModel, JXPathContext jxpc) {
  
  
  
  1.8       +3 -3      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/ValueJXPathBinding.java
  
  Index: ValueJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/ValueJXPathBinding.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ValueJXPathBinding.java	16 Dec 2003 15:05:54 -0000	1.7
  +++ ValueJXPathBinding.java	18 Dec 2003 07:57:21 -0000	1.8
  @@ -98,12 +98,12 @@
        *
        * @param convertor may be null
        */
  -    public ValueJXPathBinding(boolean loadEnabled, boolean saveEnabled, String widgetId,
String xpath, JXPathBindingBase[] updateBindings,
  +    public ValueJXPathBinding(JXpathBindingBuilderBase.CommonAttributes commonAtts, String
widgetId, String xpath, JXPathBindingBase[] updateBindings,
                                 Convertor convertor, Locale convertorLocale) {
  -        super(loadEnabled, saveEnabled);
  +        super(commonAtts);
           this.fieldId = widgetId;
           this.xpath = xpath;
  -        this.updateBinding = new ComposedJXPathBindingBase(true, true, updateBindings);
  +        this.updateBinding = new ComposedJXPathBindingBase(JXpathBindingBuilderBase.CommonAttributes.DEFAULT,
updateBindings);
           this.convertor = convertor;
           this.convertorLocale = convertorLocale;
       }
  
  
  
  1.4       +3 -3      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/JavaScriptJXPathBinding.java
  
  Index: JavaScriptJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/JavaScriptJXPathBinding.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- JavaScriptJXPathBinding.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ JavaScriptJXPathBinding.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -75,8 +75,8 @@
       private final Script loadScript;
       private final Script saveScript;
       
  -    public JavaScriptJXPathBinding(boolean loadEnabled, boolean saveEnabled, String id,
String path, Script loadScript, Script saveScript) {        
  -        super(loadEnabled && (loadScript != null), saveEnabled && (saveScript
!= null));
  +    public JavaScriptJXPathBinding(JXpathBindingBuilderBase.CommonAttributes commonAtts,
String id, String path, Script loadScript, Script saveScript) {        
  +        super(commonAtts);
           this.id = id;
           this.path = path;
           this.loadScript = loadScript;
  
  
  
  1.5       +58 -21    cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/JXpathBindingBuilderBase.java
  
  Index: JXpathBindingBuilderBase.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/JXpathBindingBuilderBase.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- JXpathBindingBuilderBase.java	16 Dec 2003 15:05:54 -0000	1.4
  +++ JXpathBindingBuilderBase.java	18 Dec 2003 07:57:21 -0000	1.5
  @@ -68,8 +68,6 @@
   public abstract class JXpathBindingBuilderBase implements LogEnabled {
   
       private Logger logger;
  -    private static final int LOAD_DIRECTION = 0;
  -    private static final int SAVE_DIRECTION = 1;
   
       /**
        * Receives the Avalon logger to use.
  @@ -101,20 +99,42 @@
           JXPathBindingManager.Assistant assistant) throws BindingException;
   
       /**
  -     * Helper method for interpreting the direction="" attribute which is supported
  -     * on each of the Bindings.  Direction can hold one of the following values:
  -     * <ol><li><code>load</code>: This binding will only load.</li>
  -     * <li><code>save</code>: This binding will only save.</li>
  -     * <li><code>both</code>: This binding will perform both operations.</li>
  +     * Helper method for interpreting the common attributes which are supported
  +     * on each of the Bindings.  These are
  +     * <br>
  +     * <code>@direction</code> can hold one of the following values:
  +     * <ol><li><code>'load'</code>: This binding will only load.</li>
  +     * <li><code>'save'</code>: This binding will only save.</li>
  +     * <li><code>'both'</code>: This binding will perform both operations.</li>
  +     * </ol>
  +     * <br>
  +     * <code>@lenient</code> can either be:
  +     * <ol><li><code>'true'</code>: This binding will set the jxpath
context to 
  +     * be lenient towards the usage of inexisting paths on the back-end model.</li>
  +     * <li><code>'false'</code>: This binding will set the jxpath context
to be 
  +     * strict and throwing exceptions for the usage of inexisting paths on the 
  +     * back-end model.</li>
  +     * <li><code>(unset)</code>: This binding will not change the leniency
behaviour
  +     * on the jxpath this binding receives from his parent binding.</li>
        * </ol>
        * @param bindingElm
  -     * @return an instance of DirectionAttributes
  +     * @return an instance of CommonAttributes
        * @throws BindingException
        */
  -     static DirectionAttributes getDirectionAttributes(Element bindingElm) throws BindingException
{
  +     static CommonAttributes getCommonAttributes(Element bindingElm) throws BindingException
{
           try {
  -            String direction = DomHelper.getAttribute(bindingElm, "direction", "both");
                      
  -            return new DirectionAttributes(direction);
  +            //TODO: should we evetually remove this?
  +            //throw an error if people are still using the old-style @read-only
  +            if (DomHelper.getAttributeAsBoolean(bindingElm, "read-only", false)) {
  +                throw new BindingException("Error in binding file " + DomHelper.getLocation(bindingElm)

  +                        + "\nThe usage of the attribute @read-only has been depricated
in favour of @direction.");
  +            }
  +            
  +            String direction = DomHelper.getAttribute(bindingElm, "direction", "both");
  +            
  +            String leniency = DomHelper.getAttribute(bindingElm, "lenient", null);
  +            
  +            return new CommonAttributes(direction, leniency);
           } catch (BindingException e) {
               throw e;
           } catch (Exception e) {
  @@ -123,25 +143,29 @@
        }
       
        /**
  -      * DirectionAttributes is a simple helper class for holding the distinct data
  +      * CommonAttributes is a simple helper class for holding the distinct data
         * member fields indicating the activity of the sepearate load and save 
         * actions of a given binding.
         */
  -     static class DirectionAttributes{
  +     static class CommonAttributes{
           final boolean loadEnabled;
           final boolean saveEnabled;
  +        final Boolean leniency;
           
  -        DirectionAttributes(String direction){
  -            this(isLoadEnabled(direction), isSaveEnabled(direction));
  -        }
  +        final static CommonAttributes DEFAULT = new CommonAttributes(true, true, null);

           
  -        DirectionAttributes(boolean loadEnabled, boolean saveEnabled){
  -                this.loadEnabled = loadEnabled;
  +        CommonAttributes(String direction, String leniency){
  +            this(isLoadEnabled(direction), isSaveEnabled(direction), decideLeniency(leniency));
  +        }
  +
  +        CommonAttributes(boolean loadEnabled, boolean saveEnabled, Boolean leniency){
  +            this.loadEnabled = loadEnabled;
               this.saveEnabled = saveEnabled;
  +            this.leniency = leniency;
           }
           
           /** 
  -         * Interprets the value of the direction attribute into activity of the load action.
  +         * Interpretes the value of the direction attribute into activity of the load action.
            * @param direction
            * @return true if direction is either set to "both" or "load"
            */
  @@ -150,12 +174,25 @@
           }
           
           /** 
  -         * Interprets the value of the direction attribute into activity of the save action.
  -         * @param direction
  +         * Interpretes the value of the direction attribute into activity of the save action.
  +         * @param direction value of the @direction attribute
            * @return true if direction is either set to "both" or "save"
            */
           private static boolean isSaveEnabled(String direction) {            
               return "both".equals(direction) || "save".equals(direction);
           }       
  +
  +        
  +        /**
  +         * Interpretes the value of the lenient attribute into a Boolean object 
  +         * allowing three-state logic (true/false/unset)
  +         * @param leniency value of the @lenient attribute
  +         * @return null if the leniency parameter is String, otherwise the 
  +         */
  +        private static Boolean decideLeniency(String leniency) {
  +            if (leniency == null) return null;
  +            return new Boolean(leniency);
  +        }
  +        
       }
   }
  
  
  
  1.4       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/ValueJXPathBindingBuilder.java
  
  Index: ValueJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/ValueJXPathBindingBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ValueJXPathBindingBuilder.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ ValueJXPathBindingBuilder.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -82,7 +82,7 @@
       public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant
assistant) throws BindingException {
   
           try {
  -            DirectionAttributes directionAtts = JXpathBindingBuilderBase.getDirectionAttributes(bindingElm);

  +            CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(bindingElm);

               String xpath = DomHelper.getAttribute(bindingElm, "path");
               String widgetId = DomHelper.getAttribute(bindingElm, "id");
   
  @@ -104,7 +104,7 @@
               }
   
               ValueJXPathBinding fieldBinding =
  -                    new ValueJXPathBinding(directionAtts.loadEnabled, directionAtts.saveEnabled,

  +                    new ValueJXPathBinding(commonAtts, 
                               widgetId, xpath, updateBindings, convertor, convertorLocale);
   
               return fieldBinding;
  
  
  
  1.6       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/ContextJXPathBinding.java
  
  Index: ContextJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/ContextJXPathBinding.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ContextJXPathBinding.java	16 Dec 2003 15:05:54 -0000	1.5
  +++ ContextJXPathBinding.java	18 Dec 2003 07:57:21 -0000	1.6
  @@ -69,8 +69,8 @@
       /**
        * Constructs ContextJXPathBinding for the specified xpath sub-context
        */
  -    public ContextJXPathBinding(boolean loadEnabled, boolean saveEnabled, String contextPath,
JXPathBindingBase[] childBindings) {
  -        super(loadEnabled, saveEnabled, childBindings);
  +    public ContextJXPathBinding(JXpathBindingBuilderBase.CommonAttributes commonAtts, String
contextPath, JXPathBindingBase[] childBindings) {
  +        super(commonAtts, childBindings);
           this.xpath = contextPath;
       }
   
  
  
  
  1.5       +3 -3      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/SimpleRepeaterJXPathBindingBuilder.java
  
  Index: SimpleRepeaterJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/SimpleRepeaterJXPathBindingBuilder.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleRepeaterJXPathBindingBuilder.java	16 Dec 2003 15:05:54 -0000	1.4
  +++ SimpleRepeaterJXPathBindingBuilder.java	18 Dec 2003 07:57:21 -0000	1.5
  @@ -74,7 +74,7 @@
           JXPathBindingManager.Assistant assistant) throws BindingException {
   
           try {
  -            DirectionAttributes directionAtts = JXpathBindingBuilderBase.getDirectionAttributes(bindingElem);

  +            CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(bindingElem);

               
               String repeaterId = DomHelper.getAttribute(bindingElem, "id");
               String parentPath = DomHelper.getAttribute(bindingElem, "parent-path");
  @@ -84,8 +84,8 @@
   
               JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElem);
   
  -            return new SimpleRepeaterJXPathBinding( directionAtts.loadEnabled, directionAtts.saveEnabled,
repeaterId, parentPath, rowPath, clearOnLoad, deleteIfEmpty,
  -                new ComposedJXPathBindingBase(true, true, childBindings));
  +            return new SimpleRepeaterJXPathBinding( commonAtts, repeaterId, parentPath,
rowPath, clearOnLoad, deleteIfEmpty,
  +                new ComposedJXPathBindingBase(JXpathBindingBuilderBase.CommonAttributes.DEFAULT,
childBindings));
           } catch (BindingException e) {
               throw e;
           } catch (Exception e) {
  
  
  
  1.5       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/SimpleRepeaterJXPathBinding.java
  
  Index: SimpleRepeaterJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/SimpleRepeaterJXPathBinding.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- SimpleRepeaterJXPathBinding.java	16 Dec 2003 15:05:54 -0000	1.4
  +++ SimpleRepeaterJXPathBinding.java	18 Dec 2003 07:57:21 -0000	1.5
  @@ -77,8 +77,8 @@
       private final boolean deleteIfEmpty;
   
       public SimpleRepeaterJXPathBinding(
  -            boolean loadEnabled, boolean saveEnabled, String repeaterId, String repeaterPath,
String rowPath, boolean clearOnLoad, boolean deleteIfEmpty, JXPathBindingBase rowBinding)
{
  -        super(loadEnabled, saveEnabled);
  +            JXpathBindingBuilderBase.CommonAttributes commonAtts, String repeaterId, String
repeaterPath, String rowPath, boolean clearOnLoad, boolean deleteIfEmpty, JXPathBindingBase
rowBinding) {
  +        super(commonAtts);
           this.repeaterId = repeaterId;
           this.repeaterPath = repeaterPath;
           this.rowPath = rowPath;
  
  
  
  1.3       +5 -5      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/JavaScriptJXPathBindingBuilder.java
  
  Index: JavaScriptJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/JavaScriptJXPathBindingBuilder.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- JavaScriptJXPathBindingBuilder.java	16 Dec 2003 15:05:54 -0000	1.2
  +++ JavaScriptJXPathBindingBuilder.java	18 Dec 2003 07:57:21 -0000	1.3
  @@ -93,24 +93,24 @@
   
       public JXPathBindingBase buildBinding(Element element, Assistant assistant) throws
BindingException {
           try {
  -            DirectionAttributes directionAtts = JXpathBindingBuilderBase.getDirectionAttributes(element);

  +            CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(element);

               
               String id = DomHelper.getAttribute(element, "id");
               String path = DomHelper.getAttribute(element, "path");
               
               Script loadScript = null;
  -            if (directionAtts.loadEnabled) {
  +            if (commonAtts.loadEnabled) {
                   Element loadElem = DomHelper.getChildElement(element, BindingManager.NAMESPACE,
"load-form");
                   loadScript = JavaScriptHelper.buildScript(loadElem);
               }
               
               Script saveScript = null;
  -            if (directionAtts.saveEnabled) {
  +            if (commonAtts.saveEnabled) {
                   Element saveElem = DomHelper.getChildElement(element, BindingManager.NAMESPACE,
"save-form");
                   saveScript = JavaScriptHelper.buildScript(saveElem);
               }
   
  -            return new JavaScriptJXPathBinding(directionAtts.loadEnabled, directionAtts.saveEnabled,
id, path, loadScript, saveScript);
  +            return new JavaScriptJXPathBinding(commonAtts, id, path, loadScript, saveScript);
   
           } catch(Exception e) {
               throw new BindingException("Cannot build binding at " + DomHelper.getLocation(element),
e);
  
  
  
  1.5       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/AggregateJXPathBinding.java
  
  Index: AggregateJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/AggregateJXPathBinding.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AggregateJXPathBinding.java	16 Dec 2003 15:05:54 -0000	1.4
  +++ AggregateJXPathBinding.java	18 Dec 2003 07:57:21 -0000	1.5
  @@ -75,8 +75,8 @@
        * @param xpath
        * @param childBindings
        */
  -    public AggregateJXPathBinding(boolean loadEnabled, boolean saveEnabled, String widgetId,
String xpath, JXPathBindingBase[] childBindings) {
  -        super(loadEnabled, saveEnabled, childBindings);
  +    public AggregateJXPathBinding(JXpathBindingBuilderBase.CommonAttributes commonAtts,
String widgetId, String xpath, JXPathBindingBase[] childBindings) {
  +        super(commonAtts, childBindings);
           this.widgetId = widgetId;
           this.xpath = xpath;
       }
  
  
  
  1.12      +7 -7      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/RepeaterJXPathBinding.java
  
  Index: RepeaterJXPathBinding.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/RepeaterJXPathBinding.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- RepeaterJXPathBinding.java	16 Dec 2003 15:05:54 -0000	1.11
  +++ RepeaterJXPathBinding.java	18 Dec 2003 07:57:21 -0000	1.12
  @@ -87,26 +87,26 @@
       /**
        * Constructs RepeaterJXPathBinding
        */
  -    public RepeaterJXPathBinding(boolean loadEnabled, boolean saveEnabled, 
  +    public RepeaterJXPathBinding(JXpathBindingBuilderBase.CommonAttributes commonAtts,

                                    String repeaterId, String repeaterPath, 
                                    String rowPath, String rowPathForInsert,
                                    String uniqueRowId, String uniqueRowPath, 
                                    JXPathBindingBase[] childBindings,
                                    JXPathBindingBase insertBinding, JXPathBindingBase[] deleteBindings)
{
  -        this(loadEnabled, saveEnabled, repeaterId, repeaterPath, rowPath, rowPathForInsert,
uniqueRowId, uniqueRowPath, null, null, childBindings, insertBinding, deleteBindings);
  +        this(commonAtts, repeaterId, repeaterPath, rowPath, rowPathForInsert, uniqueRowId,
uniqueRowPath, null, null, childBindings, insertBinding, deleteBindings);
       }
   
       /**
        * Constructs RepeaterJXPathBinding
        */
  -    public RepeaterJXPathBinding(boolean loadEnabled, boolean saveEnabled, 
  +    public RepeaterJXPathBinding(JXpathBindingBuilderBase.CommonAttributes commonAtts,

                                    String repeaterId, String repeaterPath, 
                                    String rowPath, String rowPathForInsert,
                                    String uniqueRowId, String uniqueRowPath, 
                                    Convertor convertor, Locale convertorLocale, 
                                    JXPathBindingBase[] childBindings,
                                    JXPathBindingBase insertBinding, JXPathBindingBase[] deleteBindings)
{
  -        super(loadEnabled, saveEnabled);
  +        super(commonAtts);
           this.repeaterId = repeaterId;
           this.repeaterPath = repeaterPath;
           this.rowPath = rowPath;
  @@ -114,12 +114,12 @@
           this.uniqueRowId = uniqueRowId;
           this.uniqueRowIdPath = uniqueRowPath;
           this.uniqueFieldBinding =
  -            new ValueJXPathBinding(true, true, uniqueRowId, uniqueRowPath, null, convertor,
convertorLocale);
  +            new ValueJXPathBinding(JXpathBindingBuilderBase.CommonAttributes.DEFAULT, uniqueRowId,
uniqueRowPath, null, convertor, convertorLocale);
           this.uniqueRowIdConvertor = convertor;
           this.uniqueRowIdConvertorLocale = convertorLocale;
  -        this.rowBinding = new ComposedJXPathBindingBase(true, true, childBindings);
  +        this.rowBinding = new ComposedJXPathBindingBase(JXpathBindingBuilderBase.CommonAttributes.DEFAULT,
childBindings);
           this.insertRowBinding = insertBinding;
  -        this.deleteRowBinding = new ComposedJXPathBindingBase(true, true, deleteBindings);
  +        this.deleteRowBinding = new ComposedJXPathBindingBase(JXpathBindingBuilderBase.CommonAttributes.DEFAULT,
deleteBindings);
       }
   
   
  
  
  
  1.4       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/SetAttributeJXPathBindingBuilder.java
  
  Index: SetAttributeJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/SetAttributeJXPathBindingBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SetAttributeJXPathBindingBuilder.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ SetAttributeJXPathBindingBuilder.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -76,13 +76,13 @@
           JXPathBindingManager.Assistant assistant) throws BindingException {
   
           try {
  -            DirectionAttributes directionAtts = JXpathBindingBuilderBase.getDirectionAttributes(bindingElm);

  +            CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(bindingElm);

               
               String attName = DomHelper.getAttribute(bindingElm, "name");
               String attValue = DomHelper.getAttribute(bindingElm, "value");
   
               SetAttributeJXPathBinding attBinding =
  -                new SetAttributeJXPathBinding(directionAtts.loadEnabled, directionAtts.saveEnabled,
attName, attValue);
  +                new SetAttributeJXPathBinding(commonAtts, attName, attValue);
   
               return attBinding;
           } catch (BindingException e) {
  
  
  
  1.4       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/ComposedJXPathBindingBase.java
  
  Index: ComposedJXPathBindingBase.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/ComposedJXPathBindingBase.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ComposedJXPathBindingBase.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ ComposedJXPathBindingBase.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -67,8 +67,8 @@
        * 
        * @param childBindings sets the array of childBindings
        */
  -    protected ComposedJXPathBindingBase(boolean loadEnabled, boolean saveEnabled, JXPathBindingBase[]
childBindings) {
  -        super(loadEnabled, saveEnabled);
  +    protected ComposedJXPathBindingBase(JXpathBindingBuilderBase.CommonAttributes commonAtts,
JXPathBindingBase[] childBindings) {
  +        super(commonAtts);
           this.subBindings = childBindings;
       }
   
  
  
  
  1.4       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/DeleteNodeJXPathBindingBuilder.java
  
  Index: DeleteNodeJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/DeleteNodeJXPathBindingBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- DeleteNodeJXPathBindingBuilder.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ DeleteNodeJXPathBindingBuilder.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -70,8 +70,8 @@
        * Creates an instance of {@link DeleteNodeJXPathBinding}.
        */
       public JXPathBindingBase buildBinding(Element bindingElm, Assistant assistant) throws
BindingException {
  -        DirectionAttributes directionAtts = JXpathBindingBuilderBase.getDirectionAttributes(bindingElm);

  +        CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(bindingElm);

           
  -        return new DeleteNodeJXPathBinding(directionAtts.loadEnabled, directionAtts.saveEnabled);
  +        return new DeleteNodeJXPathBinding(commonAtts);
       }
   }
  
  
  
  1.6       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/InsertNodeJXPathBindingBuilder.java
  
  Index: InsertNodeJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/InsertNodeJXPathBindingBuilder.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- InsertNodeJXPathBindingBuilder.java	16 Dec 2003 15:05:54 -0000	1.5
  +++ InsertNodeJXPathBindingBuilder.java	18 Dec 2003 07:57:21 -0000	1.6
  @@ -82,7 +82,7 @@
           JXPathBindingManager.Assistant assistant) throws BindingException {
   
           try {
  -            DirectionAttributes directionAtts = JXpathBindingBuilderBase.getDirectionAttributes(bindingElm);

  +            CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(bindingElm);

               
               DocumentFragment domTemplate = null;
   
  @@ -126,7 +126,7 @@
                   }
               }
   
  -            return new InsertNodeJXPathBinding(directionAtts.loadEnabled, directionAtts.saveEnabled,
domTemplate);
  +            return new InsertNodeJXPathBinding(commonAtts, domTemplate);
           } catch (Exception e) {
               throw new BindingException("Error building the insert-node binding defined
at " + DomHelper.getLocation(bindingElm), e);
           }
  
  
  
  1.4       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/AggregateJXPathBindingBuilder.java
  
  Index: AggregateJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/AggregateJXPathBindingBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AggregateJXPathBindingBuilder.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ AggregateJXPathBindingBuilder.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -70,13 +70,13 @@
       public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant
assistant)
               throws BindingException {
           try {
  -            DirectionAttributes directionAtts = JXpathBindingBuilderBase.getDirectionAttributes(bindingElm);

  +            CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(bindingElm);

               String xpath = DomHelper.getAttribute(bindingElm, "path");
               String widgetId = DomHelper.getAttribute(bindingElm, "id");
   
               JXPathBindingBase[] childBindings = assistant.makeChildBindings(bindingElm);
   
  -            AggregateJXPathBinding aggregateBinding = new AggregateJXPathBinding(directionAtts.loadEnabled,
directionAtts.saveEnabled, widgetId, xpath, childBindings);
  +            AggregateJXPathBinding aggregateBinding = new AggregateJXPathBinding(commonAtts,
widgetId, xpath, childBindings);
               return aggregateBinding;
           } catch (BindingException e) {
               throw e;
  
  
  
  1.4       +2 -2      cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/InsertBeanJXPathBindingBuilder.java
  
  Index: InsertBeanJXPathBindingBuilder.java
  ===================================================================
  RCS file: /home/cvs/cocoon-2.1/src/blocks/woody/java/org/apache/cocoon/woody/binding/InsertBeanJXPathBindingBuilder.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- InsertBeanJXPathBindingBuilder.java	16 Dec 2003 15:05:54 -0000	1.3
  +++ InsertBeanJXPathBindingBuilder.java	18 Dec 2003 07:57:21 -0000	1.4
  @@ -73,14 +73,14 @@
       public JXPathBindingBase buildBinding(Element bindingElm, Assistant assistant) throws
BindingException {
   
           try {
  -            DirectionAttributes directionAtts = JXpathBindingBuilderBase.getDirectionAttributes(bindingElm);

  +            CommonAttributes commonAtts = JXpathBindingBuilderBase.getCommonAttributes(bindingElm);

               
               String className =
                   DomHelper.getAttribute(bindingElm, "classname");
               String addMethod =
                   DomHelper.getAttribute(bindingElm, "addmethod");
   
  -            return new InsertBeanJXPathBinding(directionAtts.loadEnabled, directionAtts.saveEnabled,
className, addMethod);
  +            return new InsertBeanJXPathBinding(commonAtts, className, addMethod);
           } catch (BindingException e) {
               throw e;
           } catch (Exception e) {
  
  
  

Mime
View raw message