cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r450255 [3/3] - in /cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding: ./ library/
Date Tue, 26 Sep 2006 23:48:46 GMT
Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SetAttributeJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,6 +17,7 @@
 package org.apache.cocoon.forms.binding;
 
 import org.apache.cocoon.forms.util.DomHelper;
+
 import org.w3c.dom.Element;
 
 /**
@@ -31,9 +32,7 @@
  *
  * @version $Id$
  */
-public class SetAttributeJXPathBindingBuilder
-    extends JXPathBindingBuilderBase {
-
+public class SetAttributeJXPathBindingBuilder extends JXPathBindingBuilderBase {
 
     /**
      * Creates an instance of {@link SetAttributeJXPathBinding} according to
@@ -50,24 +49,23 @@
             String attValue = DomHelper.getAttribute(bindingElm, "value", null);
 
             // do inheritance
-            SetAttributeJXPathBinding otherBinding = (SetAttributeJXPathBinding)assistant.getContext().getSuperBinding();
-            if(otherBinding!=null) {
-            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
-            	
-            	if(attName==null)
-            		attName = otherBinding.getId();
-            	if(attValue==null)
-            		attValue = otherBinding.getValue();
+            SetAttributeJXPathBinding otherBinding = (SetAttributeJXPathBinding) assistant.getContext().getSuperBinding();
+            if (otherBinding != null) {
+                commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(), commonAtts);
+
+                if (attName == null) {
+                    attName = otherBinding.getId();
+                }
+                if (attValue == null) {
+                    attValue = otherBinding.getValue();
+                }
             }
-            
-            SetAttributeJXPathBinding attBinding =
-                new SetAttributeJXPathBinding(commonAtts, attName, attValue);
-            return attBinding;
+
+            return new SetAttributeJXPathBinding(commonAtts, attName, attValue);
         } catch (BindingException e) {
             throw e;
         } catch (Exception e) {
-            throw new BindingException(
-                    "Error building set-attribute binding defined at " +
+            throw new BindingException("Error building set-attribute binding defined at " +
                     DomHelper.getLocation(bindingElm), e);
         }
     }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBinding.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,8 +19,10 @@
 import java.util.Iterator;
 
 import org.apache.avalon.framework.logger.Logger;
+
 import org.apache.cocoon.forms.formmodel.Repeater;
 import org.apache.cocoon.forms.formmodel.Widget;
+
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.Pointer;
 
@@ -42,11 +44,14 @@
     private final JXPathBindingBase rowBinding;
     private final boolean deleteIfEmpty;
 
-    public SimpleRepeaterJXPathBinding(
-            JXPathBindingBuilderBase.CommonAttributes commonAtts,
-            String repeaterId, String repeaterPath, String rowPath,
-            boolean clearOnLoad, boolean deleteIfEmpty,
-            JXPathBindingBase rowBinding) {
+
+    public SimpleRepeaterJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
+                                       String repeaterId,
+                                       String repeaterPath,
+                                       String rowPath,
+                                       boolean clearOnLoad,
+                                       boolean deleteIfEmpty,
+                                       JXPathBindingBase rowBinding) {
         super(commonAtts);
         this.repeaterId = repeaterId;
         this.repeaterPath = repeaterPath;
@@ -56,7 +61,12 @@
         this.clearOnLoad = clearOnLoad;
         this.deleteIfEmpty = deleteIfEmpty;
     }
-    
+
+    public void enableLogging(Logger logger) {
+        super.enableLogging(logger);
+        this.rowBinding.enableLogging(logger);
+    }
+
     public String getId() { return repeaterId; }
     public String getRepeaterPath() { return repeaterPath; }
     public String getRowPath() { return rowPath; }
@@ -65,7 +75,7 @@
     public JXPathBindingBase[] getChildBindings() { return ((ComposedJXPathBindingBase)rowBinding).getChildBindings(); }
 
     public void doLoad(Widget frmModel, JXPathContext jctx)
-            throws BindingException {
+    throws BindingException {
         // Find the repeater and clear it
         Repeater repeater = (Repeater) selectWidget(frmModel, this.repeaterId);
 
@@ -107,7 +117,7 @@
     }
 
     public void doSave(Widget frmModel, JXPathContext jctx)
-            throws BindingException {
+    throws BindingException {
         // Find the repeater
         Repeater repeater = (Repeater)selectWidget(frmModel, this.repeaterId);
 
@@ -137,10 +147,5 @@
     public String toString() {
         return this.getClass().getName()+ " [widget=" + this.repeaterId +
             ", xpath=" + this.repeaterPath + "]";
-    }
-
-    public void enableLogging(Logger logger) {
-        super.enableLogging(logger);
-        this.rowBinding.enableLogging(logger);
     }
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/SimpleRepeaterJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,6 +17,7 @@
 package org.apache.cocoon.forms.binding;
 
 import org.apache.cocoon.forms.util.DomHelper;
+
 import org.w3c.dom.Element;
 
 /**
@@ -32,11 +33,11 @@
  *
  * @version $Id$
  */
-public class SimpleRepeaterJXPathBindingBuilder
-    extends JXPathBindingBuilderBase {
+public class SimpleRepeaterJXPathBindingBuilder extends JXPathBindingBuilderBase {
 
     public JXPathBindingBase buildBinding(Element bindingElem,
-        JXPathBindingManager.Assistant assistant) throws BindingException {
+                                          JXPathBindingManager.Assistant assistant)
+    throws BindingException {
         try {
             CommonAttributes commonAtts =
                 JXPathBindingBuilderBase.getCommonAttributes(bindingElem);
@@ -51,25 +52,30 @@
                     bindingElem, "delete-parent-if-empty", false);
 
             JXPathBindingBase[] childBindings = null;
-            
+
             // do inheritance
-            SimpleRepeaterJXPathBinding otherBinding = (SimpleRepeaterJXPathBinding)assistant.getContext().getSuperBinding();
-            if(otherBinding!=null) {
-            	childBindings = otherBinding.getChildBindings();
-            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
-            	
-            	if(parentPath==null)
-            		parentPath = otherBinding.getRepeaterPath();
-            	if(repeaterId==null)
-            		repeaterId = otherBinding.getId();
-            	if(rowPath==null)
-            		rowPath = otherBinding.getRowPath();
-            	if(!bindingElem.hasAttribute("clear-before-load"))
-            		clearOnLoad = otherBinding.getClearOnLoad();
-            	if(!bindingElem.hasAttribute("delete-parent-if-empty"))
-            		deleteIfEmpty = otherBinding.getDeleteIfEmpty();
+            SimpleRepeaterJXPathBinding otherBinding = (SimpleRepeaterJXPathBinding) assistant.getContext().getSuperBinding();
+            if (otherBinding != null) {
+                childBindings = otherBinding.getChildBindings();
+                commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(), commonAtts);
+
+                if (parentPath == null) {
+                    parentPath = otherBinding.getRepeaterPath();
+                }
+                if (repeaterId == null) {
+                    repeaterId = otherBinding.getId();
+                }
+                if (rowPath == null) {
+                    rowPath = otherBinding.getRowPath();
+                }
+                if (!bindingElem.hasAttribute("clear-before-load")) {
+                    clearOnLoad = otherBinding.getClearOnLoad();
+                }
+                if (!bindingElem.hasAttribute("delete-parent-if-empty")) {
+                    deleteIfEmpty = otherBinding.getDeleteIfEmpty();
+                }
             }
-            
+
             childBindings = assistant.makeChildBindings(bindingElem, childBindings);
 
             return new SimpleRepeaterJXPathBinding(commonAtts, repeaterId,
@@ -80,8 +86,7 @@
         } catch (BindingException e) {
             throw e;
         } catch (Exception e) {
-            throw new BindingException(
-                    "Error building repeater binding defined at " +
+            throw new BindingException("Error building repeater binding defined at " +
                     DomHelper.getLocation(bindingElem), e);
         }
     }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/StructJXPathBinding.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,14 @@
 
 import org.apache.cocoon.forms.formmodel.Struct;
 import org.apache.cocoon.forms.formmodel.Widget;
+
 import org.apache.commons.jxpath.JXPathContext;
 
 /**
  * StructJXPathBinding provides an implementation of a {@link Binding}
  * that narrows the context towards provided childbindings.
- * <p>
- * NOTES: <ol>
+ * <p>NOTES:
+ * <ol>
  * <li>This Binding assumes that the provided widget-id points to a widget
  * that contains other widgets.</li>
  * </ol>
@@ -41,11 +42,14 @@
      * @param xpath
      * @param childBindings
      */
-    public StructJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String widgetId, String xpath, JXPathBindingBase[] childBindings) {
+    public StructJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
+                               String widgetId,
+                               String xpath,
+                               JXPathBindingBase[] childBindings) {
         super(commonAtts, xpath, childBindings);
         this.widgetId = widgetId;
     }
-    
+
     public String getId() { return widgetId; }
 
     /**
@@ -54,7 +58,7 @@
      * before continuing the binding over the child-bindings.
      */
     public void doLoad(Widget frmModel, JXPathContext jxpc) throws BindingException {
-        Struct structWidget = (Struct)selectWidget(frmModel, this.widgetId);
+        Struct structWidget = (Struct) selectWidget(frmModel, this.widgetId);
         super.doLoad(structWidget, jxpc);
     }
 
@@ -64,7 +68,7 @@
      * before continuing the binding over the child-bindings.
      */
     public void doSave(Widget frmModel, JXPathContext jxpc) throws BindingException {
-        Struct structWidget = (Struct)selectWidget(frmModel, this.widgetId);
+        Struct structWidget = (Struct) selectWidget(frmModel, this.widgetId);
         super.doSave(structWidget, jxpc);
     }
 

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/StructJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/StructJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/StructJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/StructJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -18,6 +18,7 @@
 
 import org.apache.cocoon.forms.util.DomHelper;
 import org.apache.cocoon.util.Deprecation;
+
 import org.w3c.dom.Element;
 
 /**
@@ -62,9 +63,7 @@
 
             childBindings = assistant.makeChildBindings(bindingElm,childBindings);
 
-            StructJXPathBinding structBinding =
-                new StructJXPathBinding(commonAtts, widgetId, xpath, childBindings);
-            return structBinding;
+            return new StructJXPathBinding(commonAtts, widgetId, xpath, childBindings);
         } catch (BindingException e) {
             throw e;
         } catch (Exception e) {

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBinding.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,8 +19,10 @@
 import java.util.Iterator;
 
 import org.apache.avalon.framework.logger.Logger;
+
 import org.apache.cocoon.forms.formmodel.Repeater;
 import org.apache.cocoon.forms.formmodel.Widget;
+
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.Pointer;
 import org.w3c.dom.Document;
@@ -49,12 +51,17 @@
     private final boolean deleteIfEmpty;
     private final boolean virtualRows;
 
-    public TempRepeaterJXPathBinding(
-            JXPathBindingBuilderBase.CommonAttributes commonAtts,
-            String repeaterId, String repeaterPath,
-            String rowPath, String rowPathInsert,
-            boolean virtualRows, boolean clearOnLoad, boolean deleteIfEmpty,
-            JXPathBindingBase rowBinding, JXPathBindingBase insertBinding) {
+
+    public TempRepeaterJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
+                                     String repeaterId,
+                                     String repeaterPath,
+                                     String rowPath,
+                                     String rowPathInsert,
+                                     boolean virtualRows,
+                                     boolean clearOnLoad,
+                                     boolean deleteIfEmpty,
+                                     JXPathBindingBase rowBinding,
+                                     JXPathBindingBase insertBinding) {
         super(commonAtts);
         this.repeaterId = repeaterId;
         this.repeaterPath = repeaterPath;
@@ -68,7 +75,15 @@
         this.clearOnLoad = clearOnLoad;
         this.deleteIfEmpty = deleteIfEmpty;
     }
-    
+
+    public void enableLogging(Logger logger) {
+        super.enableLogging(logger);
+        if (this.insertRowBinding != null) {
+            this.insertRowBinding.enableLogging(logger);
+        }
+        this.rowBinding.enableLogging(logger);
+    }
+
     public String getId() { return repeaterId; }
     public String getRepeaterPath() { return repeaterPath; }
     public String getRowPath() { return rowPath; }
@@ -95,7 +110,7 @@
                 "TempRepeaterJXPathBinding: Repeater \"" + fullId + this.repeaterId +
                 "\" does not exist (" + frmModel.getLocation() + ")");
         }
- 
+
         // Start by clearing the repeater, if necessary.
         if (this.clearOnLoad) {
             repeater.clear();
@@ -107,7 +122,7 @@
         // Check if there is data present.
         //
         // (Otherwise, should we check the leniency config option
-        // to decide whether to be silent or throw an exception?) 
+        // to decide whether to be silent or throw an exception?)
         if (repeaterPointer != null) {
 
             // Narrow to repeater context.
@@ -143,7 +158,7 @@
                 // (This implementation of virtual rows currently only supports DOM
                 // bindings, but could easily be extended to support other bindings.)
 
-                if (virtualRows == true) {
+                if (virtualRows) {
                     Node repeaterNode = (Node)repeaterPointer.getNode();
                     Node virtualNode = repeaterNode.getOwnerDocument().createElementNS(null, "virtual");
                     Node node = (Node)rowPointer.getNode();
@@ -198,13 +213,13 @@
                         JXPathContext rowContext = repeaterContext.getRelativeContext(rowPointer);
 
                         // Variables used for virtual rows.
-                        // They are initialized here just to keep the compiler happy. 
+                        // They are initialized here just to keep the compiler happy.
                         Node rowNode = null;
                         Node virtualNode = null;
 
                         // If virtual rows are requested, create a temporary node and
                         // narrow the context to this initially empty new virtual row.
-                        if (virtualRows == true) {
+                        if (virtualRows) {
                             rowNode = (Node)rowContext.getContextBean();
                             Document document = rowNode.getOwnerDocument();
                             virtualNode = document.createElementNS(null, "virtual");
@@ -222,7 +237,7 @@
 
                         // If virtual rows are requested, finish by appending the
                         // children of the virtual row to the real context node.
-                        if (virtualRows == true) {
+                        if (virtualRows) {
                             NodeList list = virtualNode.getChildNodes();
                             int count = list.getLength();
                             for (int j = 0; j < count; j++) {
@@ -243,13 +258,5 @@
 
     public String toString() {
         return "TempRepeaterJXPathBinding [widget=" + this.repeaterId + ", xpath=" + this.repeaterPath + "]";
-    }
-
-    public void enableLogging(Logger logger) {
-        super.enableLogging(logger);
-        if (this.insertRowBinding != null) {
-            this.insertRowBinding.enableLogging(logger);
-        }
-        this.rowBinding.enableLogging(logger);
     }
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/TempRepeaterJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,6 +17,7 @@
 package org.apache.cocoon.forms.binding;
 
 import org.apache.cocoon.forms.util.DomHelper;
+
 import org.w3c.dom.Element;
 
 /**
@@ -33,8 +34,7 @@
  *
  * @version $Id$
  */
-public class TempRepeaterJXPathBindingBuilder
-    extends JXPathBindingBuilderBase {
+public class TempRepeaterJXPathBindingBuilder extends JXPathBindingBuilderBase {
 
     public JXPathBindingBase buildBinding(Element bindingElem,
         JXPathBindingManager.Assistant assistant) throws BindingException {
@@ -42,54 +42,53 @@
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElem);
 
             String repeaterId = DomHelper.getAttribute(bindingElem, "id", null);
-            String parentPath = DomHelper.getAttribute(bindingElem,
-                    "parent-path", null);
+            String parentPath = DomHelper.getAttribute(bindingElem, "parent-path", null);
             String rowPath = DomHelper.getAttribute(bindingElem, "row-path", null);
-            String rowPathInsert = DomHelper.getAttribute(bindingElem,
-                    "row-path-insert", rowPath);
-            boolean virtualRows = DomHelper.getAttributeAsBoolean(
-                    bindingElem, "virtual-rows", false);
-            boolean clearOnLoad = DomHelper.getAttributeAsBoolean(
-                    bindingElem, "clear-before-load", true);
-            boolean deleteIfEmpty = DomHelper.getAttributeAsBoolean(
-                    bindingElem, "delete-parent-if-empty", false);
+            String rowPathInsert = DomHelper.getAttribute(bindingElem, "row-path-insert", rowPath);
+            boolean virtualRows = DomHelper.getAttributeAsBoolean(bindingElem, "virtual-rows", false);
+            boolean clearOnLoad = DomHelper.getAttributeAsBoolean(bindingElem, "clear-before-load", true);
+            boolean deleteIfEmpty = DomHelper.getAttributeAsBoolean(bindingElem, "delete-parent-if-empty", false);
 
             JXPathBindingBase[] insertBindings = null;
             JXPathBindingBase[] childBindings = null;
-            
+
             // do inheritance
-            TempRepeaterJXPathBinding otherBinding = (TempRepeaterJXPathBinding)assistant.getContext().getSuperBinding();
-            if(otherBinding!=null) {
-            	childBindings = otherBinding.getChildBindings();
-            	insertBindings = otherBinding.getInsertChildBindings();
-            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
-            	
-            	if(parentPath==null)
-            		parentPath = otherBinding.getRepeaterPath();
-            	if(repeaterId==null)
-            		repeaterId = otherBinding.getId();
-            	if(rowPath==null)
-            		rowPath = otherBinding.getRowPath();
-            	if(rowPathInsert==null)
-            		rowPathInsert = otherBinding.getRowPathInsert();
-            	if(!bindingElem.hasAttribute("virtual-rows"))
-            		clearOnLoad = otherBinding.getVirtualRows();
-            	if(!bindingElem.hasAttribute("clear-before-load"))
-            		clearOnLoad = otherBinding.getClearOnLoad();
-            	if(!bindingElem.hasAttribute("delete-parent-if-empty"))
-            		deleteIfEmpty = otherBinding.getDeleteIfEmpty();
+            TempRepeaterJXPathBinding otherBinding = (TempRepeaterJXPathBinding) assistant.getContext().getSuperBinding();
+            if (otherBinding != null) {
+                childBindings = otherBinding.getChildBindings();
+                insertBindings = otherBinding.getInsertChildBindings();
+                commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(), commonAtts);
+
+                if (parentPath == null) {
+                    parentPath = otherBinding.getRepeaterPath();
+                }
+                if (repeaterId == null) {
+                    repeaterId = otherBinding.getId();
+                }
+                if (rowPath == null) {
+                    rowPath = otherBinding.getRowPath();
+                }
+                if (rowPathInsert == null) {
+                    rowPathInsert = otherBinding.getRowPathInsert();
+                }
+                if (!bindingElem.hasAttribute("virtual-rows")) {
+                    clearOnLoad = otherBinding.getVirtualRows();
+                }
+                if (!bindingElem.hasAttribute("clear-before-load")) {
+                    clearOnLoad = otherBinding.getClearOnLoad();
+                }
+                if (!bindingElem.hasAttribute("delete-parent-if-empty")) {
+                    deleteIfEmpty = otherBinding.getDeleteIfEmpty();
+                }
             }
-            
-            Element childWrapElement = DomHelper.getChildElement(
-                    bindingElem, BindingManager.NAMESPACE, "on-bind");
+
+            Element childWrapElement = DomHelper.getChildElement(bindingElem, BindingManager.NAMESPACE, "on-bind");
             childBindings = assistant.makeChildBindings(childWrapElement,childBindings);
 
-            Element insertWrapElement = DomHelper.getChildElement(bindingElem,
-                    BindingManager.NAMESPACE, "on-insert-row");
-            
+            Element insertWrapElement = DomHelper.getChildElement(bindingElem, BindingManager.NAMESPACE, "on-insert-row");
+
             if (insertWrapElement != null) {
-                insertBindings =
-                    assistant.makeChildBindings(insertWrapElement,insertBindings);
+                insertBindings = assistant.makeChildBindings(insertWrapElement,insertBindings);
             }
             return new TempRepeaterJXPathBinding(commonAtts, repeaterId,
                     parentPath, rowPath, rowPathInsert, virtualRows,

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/UnionJXPathBinding.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/UnionJXPathBinding.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/UnionJXPathBinding.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/UnionJXPathBinding.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -18,13 +18,14 @@
 
 import org.apache.cocoon.forms.formmodel.Union;
 import org.apache.cocoon.forms.formmodel.Widget;
+
 import org.apache.commons.jxpath.JXPathContext;
 
 /**
  * UnionJXPathBinding provides an implementation of a {@link Binding}
  * that narrows the context towards provided childbindings.
- * <p>
- * NOTES: <ol>
+ * <p>NOTES:
+ * <ol>
  * <li>This Binding assumes that the provided widget-id points to a
  * union widget.</li>
  * </ol>
@@ -44,12 +45,15 @@
      * @param xpath
      * @param childBindings
      */
-    public UnionJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String widgetId, String xpath, JXPathBindingBase[] childBindings) {
+    public UnionJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
+                              String widgetId,
+                              String xpath,
+                              JXPathBindingBase[] childBindings) {
         super(commonAtts, childBindings);
         this.widgetId = widgetId;
         this.xpath = xpath;
     }
-    
+
     public String getXPath() { return xpath; }
     public String getId() { return widgetId; }
 

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/UnionJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/UnionJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/UnionJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/UnionJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,6 +17,7 @@
 package org.apache.cocoon.forms.binding;
 
 import org.apache.cocoon.forms.util.DomHelper;
+
 import org.w3c.dom.Element;
 
 /**
@@ -36,7 +37,7 @@
 public class UnionJXPathBindingBuilder extends JXPathBindingBuilderBase {
 
     public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
-            throws BindingException {
+    throws BindingException {
         try {
             String widgetId = DomHelper.getAttribute(bindingElm, "id", null);
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
@@ -44,22 +45,23 @@
 
             JXPathBindingBase[] childBindings = new JXPathBindingBase[0];
 
-//          do inheritance
-            UnionJXPathBinding otherBinding = (UnionJXPathBinding)assistant.getContext().getSuperBinding();
-            if(otherBinding!=null) {
-            	childBindings = otherBinding.getChildBindings();
-            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
-            	
-            	if(xpath==null)
-            		xpath = otherBinding.getXPath();
-            	if(widgetId==null)
-            		widgetId = otherBinding.getId();
+            // do inheritance
+            UnionJXPathBinding otherBinding = (UnionJXPathBinding) assistant.getContext().getSuperBinding();
+            if (otherBinding != null) {
+                childBindings = otherBinding.getChildBindings();
+                commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(), commonAtts);
+
+                if (xpath == null) {
+                    xpath = otherBinding.getXPath();
+                }
+                if (widgetId == null) {
+                    widgetId = otherBinding.getId();
+                }
             }
-            
+
             childBindings = assistant.makeChildBindings(bindingElm,childBindings);
-            
-            UnionJXPathBinding unionBinding = new UnionJXPathBinding(commonAtts, widgetId, xpath, childBindings);
-            return unionBinding;
+
+            return new UnionJXPathBinding(commonAtts, widgetId, xpath, childBindings);
         } catch (BindingException e) {
             throw e;
         } catch (Exception e) {

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/ValueJXPathBinding.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/ValueJXPathBinding.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/ValueJXPathBinding.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/ValueJXPathBinding.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,9 +19,11 @@
 import java.util.Locale;
 
 import org.apache.avalon.framework.logger.Logger;
-import org.apache.cocoon.forms.datatype.convertor.Convertor;
+
 import org.apache.cocoon.forms.datatype.convertor.ConversionResult;
+import org.apache.cocoon.forms.datatype.convertor.Convertor;
 import org.apache.cocoon.forms.formmodel.Widget;
+
 import org.apache.commons.jxpath.JXPathContext;
 import org.apache.commons.jxpath.JXPathException;
 
@@ -62,13 +64,18 @@
      */
     private final Locale convertorLocale;
 
+
     /**
      * Constructs FieldJXPathBinding.
      *
      * @param convertor may be null
      */
-    public ValueJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts, String widgetId, String xpath, JXPathBindingBase[] updateBindings,
-                              Convertor convertor, Locale convertorLocale) {
+    public ValueJXPathBinding(JXPathBindingBuilderBase.CommonAttributes commonAtts,
+                              String widgetId,
+                              String xpath,
+                              JXPathBindingBase[] updateBindings,
+                              Convertor convertor,
+                              Locale convertorLocale) {
         super(commonAtts);
         this.fieldId = widgetId;
         this.xpath = xpath;
@@ -76,7 +83,12 @@
         this.convertor = convertor;
         this.convertorLocale = convertorLocale;
     }
-    
+
+    public void enableLogging(Logger logger) {
+        super.enableLogging(logger);
+        this.updateBinding.enableLogging(logger);
+    }
+
     public String getId() { return fieldId; }
     public ComposedJXPathBindingBase getUpdateBinding() { return (ComposedJXPathBindingBase)updateBinding; }
 
@@ -157,11 +169,6 @@
 
     public String toString() {
         return "ValueJXPathBinding [widget=" + this.fieldId + ", xpath=" + this.xpath + "]";
-    }
-
-    public void enableLogging(Logger logger) {
-        super.enableLogging(logger);
-        this.updateBinding.enableLogging(logger);
     }
 
     public String getFieldId() {

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/ValueJXPathBindingBuilder.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/ValueJXPathBindingBuilder.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/ValueJXPathBindingBuilder.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/ValueJXPathBindingBuilder.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,13 +16,14 @@
  */
 package org.apache.cocoon.forms.binding;
 
+import java.util.Locale;
+
 import org.apache.cocoon.forms.FormsConstants;
 import org.apache.cocoon.forms.datatype.convertor.Convertor;
 import org.apache.cocoon.forms.util.DomHelper;
 import org.apache.cocoon.i18n.I18nUtils;
-import org.w3c.dom.Element;
 
-import java.util.Locale;
+import org.w3c.dom.Element;
 
 /**
  * ValueJXPathBindingBuilder provides a helper class for the Factory
@@ -46,7 +47,8 @@
      * Creates an instance of {@link ValueJXPathBinding} based on the attributes
      * and nested configuration of the provided bindingElm.
      */
-    public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant) throws BindingException {
+    public JXPathBindingBase buildBinding(Element bindingElm, JXPathBindingManager.Assistant assistant)
+    throws BindingException {
 
         try {
             CommonAttributes commonAtts = JXPathBindingBuilderBase.getCommonAttributes(bindingElm);
@@ -65,36 +67,38 @@
 
                 convertor = assistant.getDatatypeManager().createConvertor(datatype, convertorEl);
             }
-            
+
             // do inheritance
-            ValueJXPathBinding otherBinding = (ValueJXPathBinding)assistant.getContext().getSuperBinding();
+            ValueJXPathBinding otherBinding = (ValueJXPathBinding) assistant.getContext().getSuperBinding();
             JXPathBindingBase[] existingUpdateBindings = null;
-            if(otherBinding!=null) {
-            	commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(),commonAtts);
-            	
-            	if(xpath==null)
-            		xpath = otherBinding.getXPath();
-            	if(widgetId==null)
-            		widgetId = otherBinding.getId();
-            	if(convertor==null)
-            		convertor = otherBinding.getConvertor();
-            	if(convertorLocale==null)
-            		convertorLocale = otherBinding.getConvertorLocale();
-            	if(convertorLocale==null)
-            		convertorLocale = otherBinding.getConvertorLocale();
-            	
-            	existingUpdateBindings = otherBinding.getUpdateBinding().getChildBindings();
+            if (otherBinding != null) {
+                commonAtts = JXPathBindingBuilderBase.mergeCommonAttributes(otherBinding.getCommonAtts(), commonAtts);
+
+                if (xpath == null) {
+                    xpath = otherBinding.getXPath();
+                }
+                if (widgetId == null) {
+                    widgetId = otherBinding.getId();
+                }
+                if (convertor == null) {
+                    convertor = otherBinding.getConvertor();
+                }
+                if (convertorLocale == null) {
+                    convertorLocale = otherBinding.getConvertorLocale();
+                }
+                if (convertorLocale == null) {
+                    convertorLocale = otherBinding.getConvertorLocale();
+                }
+
+                existingUpdateBindings = otherBinding.getUpdateBinding().getChildBindings();
             }
-            
+
             Element updateWrapElement =
                 DomHelper.getChildElement(bindingElm, BindingManager.NAMESPACE, "on-update");
             JXPathBindingBase[] updateBindings = assistant.makeChildBindings(updateWrapElement,existingUpdateBindings);
 
-            ValueJXPathBinding fieldBinding =
-                    new ValueJXPathBinding(commonAtts,
-                            widgetId, xpath, updateBindings, convertor, convertorLocale);
-
-            return fieldBinding;
+            return new ValueJXPathBinding(commonAtts, widgetId, xpath, updateBindings,
+                    convertor, convertorLocale);
         } catch (BindingException e) {
             throw e;
         } catch (Exception e) {

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/Library.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/Library.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/Library.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/Library.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -22,173 +22,172 @@
 
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
+
 import org.apache.cocoon.forms.binding.Binding;
 import org.apache.cocoon.forms.binding.BindingManager;
 import org.apache.cocoon.forms.binding.JXPathBindingManager;
 import org.apache.cocoon.forms.util.DomHelper;
 import org.apache.cocoon.util.location.LocationAttributes;
+
 import org.apache.commons.lang.StringUtils;
 import org.w3c.dom.Element;
 
 /**
  * @version $Id$
- *
  */
 public class Library {
 
 	public static final String SEPARATOR = ":";
-	
+
 	// own references
-	protected LibraryManager manager = null;
-	
+	protected LibraryManager manager;
+
 	// own instances
 	protected Map definitions = new HashMap();
 	protected Map inclusions = new HashMap();
-	
+
 	// shared object with dependencies
 	protected Object shared = new Object();
-	
-	protected String sourceURI = null;
-	protected JXPathBindingManager.Assistant assistant = null;
-	
-	public Library(ServiceManager sm) throws ServiceException {
-        manager = (LibraryManager)sm.lookup(LibraryManager.ROLE);
+
+	protected String sourceURI;
+	protected JXPathBindingManager.Assistant assistant;
+
+
+    public Library(ServiceManager sm) throws ServiceException {
+        manager = (LibraryManager) sm.lookup(LibraryManager.ROLE);
 	}
-	
+
 	public Library(LibraryManager lm) {
 		manager = lm;
 	}
-	
+
 	public void setAssistant(JXPathBindingManager.Assistant assistant) {
 		this.assistant = assistant;
 	}
-	
+
 	public void setSourceURI(String uri) {
 		sourceURI = uri;
 	}
+
 	public String getSourceURI() {
 		return sourceURI;
 	}
-	
+
 	public boolean dependenciesHaveChanged() throws Exception {
-		
-		Iterator it = this.inclusions.values().iterator();
-		while(it.hasNext()) {
-			Dependency dep = (Dependency)it.next();
-			if(!dep.isValid())
-				return true;
-		}
-		
-		return false;
+        Iterator it = this.inclusions.values().iterator();
+        while (it.hasNext()) {
+            Dependency dep = (Dependency) it.next();
+            if (!dep.isValid()) {
+                return true;
+            }
+        }
+
+        return false;
 	}
-	
+
 	/**
 	 * "Registers" a library to be referenced later under a certain key or prefix.
 	 * Definitions will be accessible locally through prefixing: "prefix:definitionid"
-	 * 
-	 * @param key the key 
-	 * @param librarysource the source of the library to be know as "key"
+	 *
+	 * @param key the key
+	 * @param sourceURI the source of the library to be know as "key"
 	 * @return true if there was no such key used before, false otherwise
 	 */
-	public boolean includeAs(String key, String librarysource)
-		throws LibraryException 
-	{
+	public boolean includeAs(String key, String sourceURI)
+    throws LibraryException {
 		try {
 			// library keys may not contain ":"!
-			if( (!inclusions.containsKey(key) || key.indexOf(SEPARATOR)>-1) 
-					&& manager.getLibrary(librarysource, sourceURI)!=null) {
-				inclusions.put(key,new Dependency(librarysource));
-				return true;
-			}
-			return false;
-		} catch(Exception e) {
-			throw new LibraryException("Could not include library '"+librarysource+"'",e);
-		}
-		
-	}
-	
+            if ((!inclusions.containsKey(key) || key.indexOf(SEPARATOR) > -1)
+                    && manager.getLibrary(sourceURI, this.sourceURI) != null) {
+                inclusions.put(key, new Dependency(sourceURI));
+                return true;
+            }
+            return false;
+        } catch (Exception e) {
+            throw new LibraryException("Could not include library '" + sourceURI + "'", e);
+        }
+    }
+
 	public Binding getBinding(String key) throws LibraryException {
-		
 		String librarykey = null;
 		String definitionkey = key;
-		
-		if(key.indexOf(SEPARATOR)>-1) {
-			String[] parts = StringUtils.split(key,SEPARATOR);
-			librarykey = parts[0];
-			definitionkey = parts[1];
-			for(int i=2; i<parts.length; i++) {
-				definitionkey += SEPARATOR+parts[i];
-			}
-		}
-		
-		if(librarykey!=null) {
-			if(inclusions.containsKey(librarykey)) {
-				try {
-					return manager.getLibrary(((Dependency)inclusions.get(librarykey)).dependencySourceURI, sourceURI).getBinding(definitionkey);
-				} catch(Exception e) {
-					throw new LibraryException("Couldn't get Library key='"+librarykey+"' source='"+inclusions.get(librarykey)+"",e);
-				}
-			} else {
-				throw new LibraryException("Library '"+librarykey+"' does not exist! (lookup: '"+key+"')");
-			}
-		} else {
-			return (Binding)definitions.get(definitionkey);
-		}
-	}
-	
-	public void buildLibrary(Element libraryElement) throws Exception {
-		sourceURI = LocationAttributes.getURI(libraryElement);
-		this.assistant.getContext().setLocalLibrary(this);
+
+        if (key.indexOf(SEPARATOR) > -1) {
+            String[] parts = StringUtils.split(key, SEPARATOR);
+            librarykey = parts[0];
+            definitionkey = parts[1];
+            for (int i = 2; i < parts.length; i++) {
+                definitionkey += SEPARATOR + parts[i];
+            }
+        }
+
+        if (librarykey != null) {
+            if (inclusions.containsKey(librarykey)) {
+                try {
+                    return manager.getLibrary(((Dependency) inclusions.get(librarykey)).dependencySourceURI, sourceURI).getBinding(definitionkey);
+                } catch (Exception e) {
+                    throw new LibraryException("Couldn't get Library key='" + librarykey + "' source='" + inclusions.get(librarykey) + "", e);
+                }
+            } else {
+                throw new LibraryException("Library '" + librarykey + "' does not exist! (lookup: '" + key + "')");
+            }
+        } else {
+            return (Binding) definitions.get(definitionkey);
+        }
+    }
+
+    public void buildLibrary(Element libraryElement) throws Exception {
+        sourceURI = LocationAttributes.getURI(libraryElement);
+        this.assistant.getContext().setLocalLibrary(this);
         Element[] bindingElements = DomHelper.getChildElements(libraryElement, BindingManager.NAMESPACE);
         for (int i = 0; i < bindingElements.length; i++) {
             Element bindingElement = bindingElements[i];
-            Binding  binding = this.assistant.getBindingForConfigurationElement(bindingElement);
+            Binding binding = this.assistant.getBindingForConfigurationElement(bindingElement);
             addBinding(binding);
         }
-	}
-	
-	public void addBinding(Binding binding) throws LibraryException {
-		if(definitions.containsKey(binding.getId()))
-			throw new LibraryException("Library already contains a binding with this ID!");
-		
-		binding.setEnclosingLibrary(this);
-		
-		definitions.put(binding.getId(),binding);
-		manager.debug(this+": Put binding with id: "+binding.getId());
-	}
-	
-	
-	/**
-	 * Encapsulates a uri to designate an import plus a timestamp so previously reloaded 
+    }
+
+    public void addBinding(Binding binding) throws LibraryException {
+        if (definitions.containsKey(binding.getId())) {
+            throw new LibraryException("Library already contains a binding with this ID!");
+        }
+
+        binding.setEnclosingLibrary(this);
+
+        definitions.put(binding.getId(), binding);
+        manager.debug(this + ": Put binding with id: " + binding.getId());
+    }
+
+
+    /**
+	 * Encapsulates a uri to designate an import plus a timestamp so previously reloaded
 	 */
 	public class Dependency {
-		
 		private String dependencySourceURI;
 		private Object shared;
-		
+
 		public Dependency(String dependencySourceURI) throws Exception {
 			this.dependencySourceURI = dependencySourceURI;
-			
+
 			Library lib = manager.getLibrary(this.dependencySourceURI,sourceURI);
 			this.shared = lib.shared;
 		}
-		
+
 		public boolean isValid() throws LibraryException {
-			try {
-				
-				if(manager.libraryInCache(dependencySourceURI,sourceURI)) {
-					Library lib = manager.getLibrary(dependencySourceURI,sourceURI);
-					
-					if(this.shared == lib.shared)
-						return true;
-				}
-				
-				return false;
-			} catch(Exception forward) {
-				throw new LibraryException("Exception occured while checking dependency validity!",forward);
-			}
-			
-		}
+            try {
+                if (manager.libraryInCache(dependencySourceURI, sourceURI)) {
+                    Library lib = manager.getLibrary(dependencySourceURI, sourceURI);
+
+                    if (this.shared == lib.shared) {
+                        return true;
+                    }
+                }
+
+                return false;
+            } catch (Exception forward) {
+                throw new LibraryException("Exception occured while checking dependency validity!", forward);
+            }
+        }
 	}
-	
+
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryException.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryException.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryException.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryException.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,9 +20,8 @@
 
 /**
  * This exception is thrown when something specific to the library system goes wrong.
- * 
+ *
  * @version $Id$
- * 
  */
 public class LibraryException extends CascadingException {
     public LibraryException(String message) {

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryManager.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryManager.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryManager.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -16,26 +16,23 @@
  */
 package org.apache.cocoon.forms.binding.library;
 
-
-
 /**
  * The work interface for the LibraryManager, the class that
  * manages all used library definitions so they can be shared between
  * forms.
- * 
- * @version $Id$
  *
+ * @version $Id$
  */
 public interface LibraryManager {
 
 	String ROLE = LibraryManager.class.getName();
-	
+
 	Library getLibrary(String librarysource) throws Exception;
 	Library getLibrary(String librarysource, String relative) throws Exception;
 	Library getNewLibrary();
-	
+
 	boolean libraryInCache(String librarysource) throws Exception;
 	boolean libraryInCache(String librarysource, String relative) throws Exception;
-	
+
 	void debug(String msg);
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryManagerImpl.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryManagerImpl.java?view=diff&rev=450255&r1=450254&r2=450255
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryManagerImpl.java (original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/binding/library/LibraryManagerImpl.java Tue Sep 26 16:48:43 2006
@@ -5,9 +5,9 @@
  * The ASF licenses this file to You under the Apache License, Version 2.0
  * (the "License"); you may not use this file except in compliance with
  * the License.  You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -19,6 +19,7 @@
 import org.apache.avalon.framework.CascadingException;
 import org.apache.avalon.framework.activity.Disposable;
 import org.apache.avalon.framework.activity.Initializable;
+import org.apache.avalon.framework.component.Component;
 import org.apache.avalon.framework.configuration.Configurable;
 import org.apache.avalon.framework.configuration.Configuration;
 import org.apache.avalon.framework.configuration.ConfigurationException;
@@ -27,29 +28,32 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+
 import org.apache.cocoon.forms.CacheManager;
 import org.apache.cocoon.forms.binding.JXPathBindingManager;
 import org.apache.cocoon.forms.util.DomHelper;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
+
 import org.w3c.dom.Document;
 import org.xml.sax.InputSource;
 
 /**
  * @version $Id$
- *
  */
-public class LibraryManagerImpl extends AbstractLogEnabled implements LibraryManager, ThreadSafe, Serviceable,
-Configurable, Initializable, Disposable {
+public class LibraryManagerImpl extends AbstractLogEnabled
+                                implements LibraryManager, Serviceable, Configurable,
+                                           Initializable, Disposable, ThreadSafe, Component {
 
 	protected static final String PREFIX = "CocoonFormBindingLibrary:";
-	
+
 	private ServiceManager serviceManager;
     private Configuration configuration;
     private CacheManager cacheManager;
-    
+
     private JXPathBindingManager bindingManager;
 
+
     public void configure(Configuration configuration) throws ConfigurationException {
         this.configuration = configuration;
         getLogger().debug("Gotten a config: top level element: "+this.configuration);
@@ -59,36 +63,35 @@
         this.serviceManager = serviceManager;
         this.cacheManager = (CacheManager)serviceManager.lookup(CacheManager.ROLE);
     }
-    
+
     public void setBindingManager(JXPathBindingManager bindingManager) {
     	this.bindingManager = bindingManager;
     }
-    
+
     public void initialize() throws Exception {
-    	
         // read config to "preload" libraries
     }
-    
+
     public boolean libraryInCache(String librarysource) throws Exception {
     	return libraryInCache(librarysource,null);
     }
-    
+
     public boolean libraryInCache(String librarysource, String relative) throws Exception {
     	SourceResolver sourceResolver = null;
         Source source = null;
-        
-        if(getLogger().isDebugEnabled())
+
+        if (getLogger().isDebugEnabled())
         	getLogger().debug("Checking if library is in cache: '"+librarysource+"' relative to '"+relative+"'");
 
         Library lib = null;
         boolean result = false;
-        
+
         try {
             sourceResolver = (SourceResolver)serviceManager.lookup(SourceResolver.ROLE);
             source = sourceResolver.resolveURI(librarysource, relative, null);
-            
+
             lib = (Library)this.cacheManager.get(source, PREFIX);
-            
+
             if( lib != null && lib.dependenciesHaveChanged() ) {
             	result = false;
             	this.cacheManager.set(null,source,PREFIX); //evict?
@@ -114,51 +117,51 @@
         	else
         		getLogger().debug("Library IS NOT in cache : '"+librarysource+"' relative to '"+relative+"'");
         }
-        
+
         return result;
     }
-    
+
     public Library getLibrary(String librarysource) throws Exception {
     	return getLibrary(librarysource,null);
     }
-    
+
 	public Library getLibrary(String librarysource, String relative) throws Exception {
 		SourceResolver sourceResolver = null;
         Source source = null;
         Document libraryDocument = null;
 
         Library lib = null;
-        
+
         if(getLogger().isDebugEnabled())
         	getLogger().debug("Getting library instance: '"+librarysource+"' relative to '"+relative+"'");
-        
+
         try {
             sourceResolver = (SourceResolver)serviceManager.lookup(SourceResolver.ROLE);
             source = sourceResolver.resolveURI(librarysource, relative, null);
-            
+
             lib = (Library)this.cacheManager.get(source, PREFIX);
-            
+
             if( lib != null && lib.dependenciesHaveChanged() ) {
             	if(getLogger().isDebugEnabled())
                 	getLogger().debug("Library dependencies changed, invalidating!");
-            	
+
             	lib = null;
             }
-            
+
             if( lib == null ) {
             	if(getLogger().isDebugEnabled())
                 	getLogger().debug("Library not in cache, creating!");
-            	
+
             	try {
                     InputSource inputSource = new InputSource(source.getInputStream());
                     inputSource.setSystemId(source.getURI());
                     libraryDocument = DomHelper.parse(inputSource, this.serviceManager);
-                    
+
                     lib = getNewLibrary();
                     lib.buildLibrary(libraryDocument.getDocumentElement());
-                    
+
                     this.cacheManager.set(lib,source,PREFIX);
-                    
+
                 } catch (Exception e) {
                     throw new CascadingException("Could not parse form definition from " +
                                                  source.getURI(), e);
@@ -173,14 +176,14 @@
 
         return lib;
 	}
-	
+
 	public Library getNewLibrary() {
 		Library lib = new Library(this);
 		lib.setAssistant(this.bindingManager.getBuilderAssistant());
-        
+
         if(getLogger().isDebugEnabled())
         	getLogger().debug("Created new library! "+lib);
-        
+
         return lib;
 	}
 
@@ -189,11 +192,10 @@
 	    this.cacheManager = null;
 	    this.serviceManager = null;
 	}
-	
+
 	public void debug(String msg) {
 		if(getLogger().isDebugEnabled()) {
 			getLogger().debug(msg);
 		}
 	}
-	
 }



Mime
View raw message