You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by jh...@apache.org on 2005/11/03 15:00:48 UTC

svn commit: r330548 [99/132] - in /cocoon/whiteboard/maven2/cocoon-flat-layout: ./ cocoon-ajax-block/ cocoon-ajax-block/api/ cocoon-ajax-block/api/src/ cocoon-ajax-block/api/src/main/ cocoon-ajax-block/api/src/main/java/ cocoon-ajax-block/api/src/main/...

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,101 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import org.apache.cocoon.util.location.Locatable;
+import org.apache.cocoon.util.location.Location;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+/**
+ * A WidgetDefinition holds all the static information about a Widget. It's
+ * function is a lot like that of the class in Java. Users of the Cocoon Forms framework
+ * usually won't have to bother with the WidgetDefinition's, but will rather use
+ * the Widget's themselves.
+ *
+ * @version $Id: WidgetDefinition.java 289538 2005-09-16 13:46:22Z sylvain $
+ */
+public interface WidgetDefinition extends Locatable {
+
+	/**
+	 * Initializes this definition with values from the given other definition
+	 */
+	void initializeFrom(WidgetDefinition definition) throws Exception;
+	
+    /**
+     * Gets the {@link FormDefinition}.
+     */
+    FormDefinition getFormDefinition();
+
+    /**
+     * Sets the parent of this definition.
+     */
+    void setParent(WidgetDefinition definition);
+
+    /**
+     * Gets source location of this widget definition.
+     */
+    Location getLocation();
+
+    /**
+     * Gets id of this widget definition.
+     */
+    String getId();
+
+    /**
+     * Gets an attribute that has been defined on the widget's definition.
+     *
+     * @param name the attribute name
+     * @return the attribute value, or null if it doesn't exist
+     */
+    Object getAttribute(String name);
+
+    /**
+     * Validate a widget using the validators that were defined in its definition. If validation
+     * fails, the validator has set a validation error on the widget or one of its children.
+     *
+     * @param widget the widget
+     * @return <code>true</code> if validation was successful.
+     */
+    boolean validate(Widget widget);
+
+    /**
+     * Checks whether this definition is complete since we are allowed to have partial
+     * definitions in libraries. Definitions need to be complete _before_ a call to
+     * createInstance() though.
+     */
+    void checkCompleteness() throws IncompletenessException;
+    
+    /**
+     * Creates and returns a widget based on this widget definition.
+     */
+    Widget createInstance();
+
+    /**
+     * Generates SAX events for named display data.
+     */
+    void generateDisplayData(String name, ContentHandler contentHandler) throws SAXException;
+
+    /**
+     * Generates SAX events for display data.
+     */
+    void generateDisplayData(ContentHandler contentHandler) throws SAXException;
+
+    /**
+     * Generates SAX events for the label of this widget.
+     */
+    void generateLabel(ContentHandler contentHandler) throws SAXException;
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinition.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,36 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import org.w3c.dom.Element;
+
+/**
+ * Interface for classes that can build widgets from an XML description.
+ *
+ * <p>These builder classes should be thread safe, only a single instance of them
+ * will be created.
+ *
+ * <p>Implementations may implement Avalon's Serviceable interface to gain access
+ * to other components.
+ *
+ * @version $Id: WidgetDefinitionBuilder.java 289538 2005-09-16 13:46:22Z sylvain $
+ */
+public interface WidgetDefinitionBuilder {
+
+    WidgetDefinition buildWidgetDefinition(Element widgetElement) throws Exception;
+
+    WidgetDefinition buildWidgetDefinition(Element widgetElement, WidgetDefinitionBuilderContext context) throws Exception;
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilder.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilderContext.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilderContext.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilderContext.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilderContext.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,54 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import org.apache.cocoon.forms.formmodel.library.Library;
+
+/**
+ * Holds context information for the building phase.
+ * 
+ * @version $Id: WidgetDefinitionBuilderContext.java 289538 2005-09-16 13:46:22Z sylvain $
+ */
+public class WidgetDefinitionBuilderContext {
+
+	protected WidgetDefinition superDefinition = null;
+	protected Library localLibrary = null;
+	
+	public WidgetDefinitionBuilderContext() {
+		this.superDefinition = null;
+		this.localLibrary = null;
+	}
+	
+	public WidgetDefinitionBuilderContext(WidgetDefinitionBuilderContext other) {
+		this.superDefinition = other.superDefinition;
+		this.localLibrary = other.localLibrary;
+	}
+	
+	public WidgetDefinition getSuperDefinition() {
+		return superDefinition;
+	}
+	public void setSuperDefinition(WidgetDefinition def) {
+		superDefinition = def;
+	}
+	
+	public Library getLocalLibrary() {
+		return localLibrary;
+	}
+	public void setLocalLibrary(Library lib) {
+		localLibrary = lib;
+	}
+	
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionBuilderContext.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,162 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Map;
+
+import org.apache.cocoon.util.location.Location;
+
+// TODO: Refine and i18n the exception messages.
+/**
+ * Helper class for the Definition implementation of widgets containing
+ * other widgets.
+ *
+ * @version $Id: WidgetDefinitionList.java 289538 2005-09-16 13:46:22Z sylvain $
+ */
+public class WidgetDefinitionList {
+
+    private List widgetDefinitions = new ArrayList();
+    private Map widgetDefinitionsById = new HashMap();
+    private WidgetDefinition containerDefinition;
+    private boolean wasHere;
+    private ListIterator definitionsIt = widgetDefinitions.listIterator();
+
+    /**
+     * @param definition the widget definition to which this container delegate belongs
+     */
+    public WidgetDefinitionList(WidgetDefinition definition) {
+        this.containerDefinition = definition;
+        wasHere = false;
+    }
+    
+    public int size() {
+    	return widgetDefinitions.size();
+    }
+
+    public void addWidgetDefinition(WidgetDefinition widgetDefinition) throws DuplicateIdException {
+        String id = widgetDefinition.getId();
+        // Do not add NewDefinition id's hash.
+        if (!(widgetDefinition instanceof NewDefinition)) {
+            if (widgetDefinitionsById.containsKey(id)) {
+                Location duplicateLocation = widgetDefinition.getLocation();
+                Location containerLocation = containerDefinition.getLocation();
+                Location firstLocation = getWidgetDefinition(id).getLocation();
+                throw new DuplicateIdException(
+                    "Duplicate widget id \"" + id + "\" detected at " + duplicateLocation + ".\n" +
+                    "Container widget \"" + containerDefinition.getId() + "\" at " + containerLocation + "\n" +
+                    "already contains a widget with id \"" + id + "\" at " + firstLocation + ".");
+            }
+            widgetDefinitionsById.put(widgetDefinition.getId(), widgetDefinition);
+        }
+        this.definitionsIt.add(widgetDefinition);
+    }
+
+    public List getWidgetDefinitions() {
+        return widgetDefinitions;
+    }
+
+    public boolean hasWidget(String id) {
+        return widgetDefinitionsById.containsKey(id);
+    }
+
+    public WidgetDefinition getWidgetDefinition(String id) {
+        return (WidgetDefinition)widgetDefinitionsById.get(id);
+    }
+
+    public void resolve(List parents, WidgetDefinition parent) throws Exception {
+        if (!wasHere) {
+            wasHere = true;
+            this.definitionsIt = widgetDefinitions.listIterator();
+            parents.add(containerDefinition);
+            while (this.definitionsIt.hasNext()) {
+                WidgetDefinition widgetDefinition = (WidgetDefinition)this.definitionsIt.next();
+                // ClassDefinition's get resolved by NewDefinition rather than here.
+                if (!(widgetDefinition instanceof ClassDefinition)) {
+                    if (widgetDefinition instanceof NewDefinition) {
+                        // Remove NewDefinition in preparation for its referenced class of widget definitions to be added.
+                        this.definitionsIt.remove();
+                        ((NewDefinition)widgetDefinition).resolve(parents, containerDefinition);
+                    } else {
+                        if (widgetDefinition instanceof ContainerDefinition)
+                            ((ContainerDefinition)widgetDefinition).resolve(parents, containerDefinition);
+                    }
+                }
+            }
+            parents.remove(parents.size()-1);
+            wasHere = false;
+        } else {
+            // Non-terminating recursion detection
+            // Search up parent list in hopes of finding a "Union" or "Repeater" before finding previous "New" for this "Class".
+            ListIterator parentsIt = parents.listIterator(parents.size());
+            while(parentsIt.hasPrevious()) {
+                WidgetDefinition widgetDefinition = (WidgetDefinition)parentsIt.previous();
+                if (widgetDefinition instanceof UnionDefinition) break;
+                if (widgetDefinition instanceof RepeaterDefinition) break;
+                if (widgetDefinition == containerDefinition) {
+                    Location location = containerDefinition.getLocation();
+                    if (parent instanceof FormDefinition) {
+                        throw new Exception("Container: Non-terminating recursion detected in form definition (" + location + ")");
+                    } 
+                    throw new Exception("Container: Non-terminating recursion detected in widget definition: "
+                        + parent.getId() + " (" + location + ")");
+                }
+            }
+        }
+    }
+ 
+    public void createWidget(Widget parent, String id) {
+        WidgetDefinition widgetDefinition = (WidgetDefinition)widgetDefinitionsById.get(id);
+        if (widgetDefinition == null) {
+            throw new RuntimeException(containerDefinition.getId() + ": WidgetDefinition \"" + id +
+                    "\" does not exist (" + containerDefinition.getLocation() + ")");
+        }
+        Widget widget = widgetDefinition.createInstance();
+        if (widget != null)
+            ((ContainerWidget)parent).addChild(widget);
+    }
+
+    public void createWidgets(Widget parent) {
+        Iterator definitionsIt = widgetDefinitions.iterator();
+        while (definitionsIt.hasNext()) {
+            WidgetDefinition widgetDefinition = (WidgetDefinition)definitionsIt.next();
+            Widget widget = widgetDefinition.createInstance();
+            if (widget != null)
+                ((ContainerWidget)parent).addChild(widget);
+        }
+    }
+
+    public void checkCompleteness() throws IncompletenessException {
+        if (!wasHere) {
+            wasHere = true;
+// FIXME: is it legal to have no widgets in a container? There are some cases of this in Swan
+//            if(size() == 0)
+//                throw new IncompletenessException(this.containerDefinition.getClass().getName() + 
+//                        " requires at least one child widget!", this.containerDefinition);
+            
+            // now check children's completeness
+            Iterator it = widgetDefinitions.iterator();
+            while(it.hasNext()) {
+                ((WidgetDefinition)it.next()).checkCompleteness();
+            }
+            wasHere = false;
+        }
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetDefinitionList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetList.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetList.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetList.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetList.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,186 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ *
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+import org.apache.cocoon.forms.FormsConstants;
+import org.apache.cocoon.forms.FormContext;
+import org.apache.cocoon.xml.XMLUtils;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.SAXException;
+
+/**
+ * Helper class for the implementation of widgets containing other widgets.
+ * This implements a type-aware List of Widgets that automatically can distribute
+ * the common Widget operations over the contained Widgets.
+ *
+ * @version $Id: WidgetList.java 326838 2005-10-20 06:26:53Z sylvain $
+ */
+public class WidgetList {
+
+    private static final String WIDGETS_EL = "widgets";
+    
+    /** 
+     * List of the contained widgets.
+     * This maintains the original order of the widgets to garantee order of
+     * validation and generation of SAXFragments
+     */
+    private List widgets;
+    
+    /** 
+     * Map of the contained widgets using its id as the lookup key.
+     */
+    private Map widgetsById;
+
+
+    /**
+     * Constructs ContainerDelegate to store and jointly manage a list of 
+     * contained widgets.
+     */
+    public WidgetList() {
+        widgets = new ArrayList();
+        widgetsById = new HashMap();
+    }
+
+    /**
+     * Get the (unmodifiable) list of widgets
+     * 
+     * @return the widget list
+     */
+    public List getWidgetList() {
+        return Collections.unmodifiableList(this.widgets);
+    }
+    
+    /**
+     * Get the (unmodifiable) map of widgets
+     * 
+     * @return the widget map
+     */
+    public Map getWidgetMap() {
+        return Collections.unmodifiableMap(this.widgetsById);
+    }
+
+    /** 
+     * Adds a widget to the list of contained {@link Widget}'s
+     * 
+     * @param widget
+     */
+    public void addWidget(Widget widget) {
+        widgets.add(widget);
+        widgetsById.put(widget.getId(), widget);
+    }
+    
+
+    /**
+     * Performs the {@link Widget#readFromRequest(FormContext)} on all the 
+     * contained widgets.
+     * 
+     * @param formContext to pass to the {@link Widget#readFromRequest(FormContext)}
+     * 
+     * @see Widget#readFromRequest(FormContext)
+     */
+    public void readFromRequest(FormContext formContext) {
+        Iterator widgetIt = iterator();
+        while (widgetIt.hasNext()) {
+            Widget widget = (Widget)widgetIt.next();
+            widget.readFromRequest(formContext);
+        }
+    }
+
+    /** 
+     * Validates all contained widgets and returns the combined result.
+     * 
+     * @return <code>false</code> if at least one of the contained widgets is not valid.
+     * 
+     * @see Widget#validate()
+     */
+    public boolean validate() {
+        boolean valid = true;
+        Iterator widgetIt = iterator();
+        while (widgetIt.hasNext()) {
+            Widget widget = (Widget)widgetIt.next();
+            valid = valid & widget.validate();
+        }
+        return valid;
+    }
+
+    /**
+     * Checks if a widget with the provided id is contained in the list.
+     *
+     * @param id of the widget to look for.
+     * @return true if the widget was found
+     */
+    public boolean hasWidget(String id) {
+        return widgetsById.containsKey(id);
+    }
+
+    /** 
+     * Looks for a widget in this list by using the provided id as a lookup key.
+     * 
+     * @param id of the widget to look for
+     * @return the found widget or <code>null</code> if it could not be found.
+     */
+    public Widget getWidget(String id) {
+        return (Widget)widgetsById.get(id);
+    }
+
+    /** 
+     * @return an iterator over the contained {@link Widget}'s
+     */
+    public Iterator iterator() {
+        return widgets.iterator();
+    }
+
+    /**
+     * @return <code>false</code> if at least one of the contained widgets has no value.
+     */
+    public boolean widgetsHaveValues() {
+        Iterator widgetsIt = iterator();
+        while(widgetsIt.hasNext()) {
+            Widget widget = (Widget)widgetsIt.next();
+            if (widget.getValue() == null)
+                return false;
+        }
+        return true;
+    }
+
+    /**
+     * Generates the SAXfragments of the contained widgets
+     * 
+     * @param contentHandler
+     * @param locale
+     * @throws SAXException
+     * 
+     * @see Widget#generateSaxFragment(ContentHandler, Locale)
+     */
+    public void generateSaxFragment(ContentHandler contentHandler, Locale locale) throws SAXException {
+        contentHandler.startElement(FormsConstants.INSTANCE_NS, WIDGETS_EL, FormsConstants.INSTANCE_PREFIX_COLON + WIDGETS_EL, XMLUtils.EMPTY_ATTRIBUTES);
+        Iterator widgetIt = widgets.iterator();
+        while (widgetIt.hasNext()) {
+            Widget widget = (Widget)widgetIt.next();
+            widget.generateSaxFragment(contentHandler, locale);
+        }
+        contentHandler.endElement(FormsConstants.INSTANCE_NS, WIDGETS_EL, FormsConstants.INSTANCE_PREFIX_COLON + WIDGETS_EL);
+    }
+}
+

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetList.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetState.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetState.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetState.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetState.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,148 @@
+/*
+ * Copyright 1999-2004 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel;
+
+import org.apache.commons.lang.enums.ValuedEnum;
+
+/**
+ * The state of a widget. States are ordered from the most featured ("active")
+ * to the most constrained ("invisible"), so that state combinations can be
+ * computed: a widget's combined state is the strictest between the widget's own
+ * state and its parent state.
+ * 
+ * @version $Id: WidgetState.java 155211 2005-02-24 17:05:51Z sylvain $
+ */
+public class WidgetState extends ValuedEnum {
+
+    private static final int ACTIVE_VALUE = 4;
+    
+    private static final int DISABLED_VALUE = 3;
+
+    private static final int OUTPUT_VALUE = 2;
+
+    private static final int INVISIBLE_VALUE = 1;
+
+    /**
+     * Active state. This is the default state, where widgets read their values
+     * from the request and display them.
+     */
+    public static final WidgetState ACTIVE = new WidgetState("active", ACTIVE_VALUE);
+
+    /**
+     * Disabled state, value is displayed but user input is ignored. The widget should be
+     * rendered in a manner that indicates that this widget could be active, but is currently not.
+     */
+    public static final WidgetState DISABLED = new WidgetState("disabled", DISABLED_VALUE);
+    
+    /**
+     * Output state, value is displayed but user input is ignored. The widget should be rendered
+     * as plain text, giving no indication that it could be input.
+     */
+    public static final WidgetState OUTPUT = new WidgetState("output", OUTPUT_VALUE);
+
+    /**
+     * Invisible state. Values are not displayed and user input is ignored.
+     */
+    public static final WidgetState INVISIBLE = new WidgetState("invisible", INVISIBLE_VALUE);
+
+    /**
+     * Private constructor
+     */
+    private WidgetState(String name, int value) {
+        super(name, value);
+    }
+
+    /**
+     * Get a state given its name. Valid names are "active", "disabled",
+     * "invisible".
+     * 
+     * @param name the state name
+     * @return the state, or <code>null</code> if <code>name</code> doesn't
+     *         denote a known state name
+     */
+    public static WidgetState stateForName(String name) {
+        return (WidgetState) getEnum(WidgetState.class, name);
+    }
+
+    /**
+     * Determine the strictest of two states. "invisible" is stricter than
+     * "disabled" which is stricter than "active"
+     * 
+     * @param one a state
+     * @param two another state
+     * @return the strictes of <code>one</code> and <code>two</code>
+     */
+    public static WidgetState strictest(WidgetState one, WidgetState two) {
+        return (one.getValue() < two.getValue()) ? one : two;
+    }
+
+    /**
+     * Test if the current state is stricter than another one.
+     * 
+     * @param other a state
+     * @return <code>true</code> if <code>this</code> is stricter
+     *         than <code>other</code>
+     */
+    public boolean stricterThan(WidgetState other) {
+        return this.getValue() < other.getValue();
+    }
+
+    /**
+     * Does this state accept user inputs?
+     * 
+     * @return <code>true</code> if this state accepts user inputs.
+     */
+    public boolean isAcceptingInputs() {
+        return this.getValue() == ACTIVE_VALUE;
+    }
+
+    /**
+     * Does this state display widget values?
+     * 
+     * @return <code>true</code> if this state displays widget values.
+     */
+    public boolean isDisplayingValues() {
+        return this.getValue() > INVISIBLE_VALUE;
+    }
+
+    /**
+     * Does this state validate widget values?
+     * 
+     * @return <code>true</code> if this state validates widget values.
+     */
+    public boolean isValidatingValues() {
+        return this.getValue() == ACTIVE_VALUE;
+    }
+
+// Potential features provided by ValuedEnum that don't seem to be needed now
+//
+//    public static WidgetState stateForValue(int stateValue) {
+//        return (WidgetState) getEnum(WidgetState.class, stateValue);
+//    }
+//
+//    public static Map getEnumMap() {
+//        return getEnumMap(WidgetState.class);
+//    }
+//
+//    public static List getStateList() {
+//        return getEnumList(WidgetState.class);
+//    }
+//
+//    public static Iterator iterator() {
+//        return iterator(WidgetState.class);
+//    }
+
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/WidgetState.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/Library.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/Library.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/Library.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/Library.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,222 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel.library;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.apache.avalon.framework.CascadingException;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.cocoon.forms.FormsConstants;
+import org.apache.cocoon.forms.formmodel.WidgetDefinition;
+import org.apache.cocoon.forms.formmodel.WidgetDefinitionBuilder;
+import org.apache.cocoon.forms.formmodel.WidgetDefinitionBuilderContext;
+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: Library.java 327169 2005-10-21 13:04:31Z sylvain $
+ */
+public class Library {
+
+	public static final String SEPARATOR = ":";
+	
+	
+	// managed instances
+	protected ServiceSelector widgetDefinitionBuilderSelector;
+	
+	// own references
+	protected LibraryManager manager = null;
+	
+	// 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 WidgetDefinitionBuilderContext context;
+	
+	public Library(LibraryManager lm) {
+		manager = lm;
+		context = new WidgetDefinitionBuilderContext();
+		context.setLocalLibrary(this);
+	}
+	
+	public void setSourceURI(String uri) {
+		sourceURI = uri;
+	}
+	public String getSourceURI() {
+		return sourceURI;
+	}
+	
+	public void setWidgetDefinitionBuilderSelector(ServiceSelector selector) {
+		this.widgetDefinitionBuilderSelector = selector;
+	}
+	
+	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;
+	}
+	
+	/**
+	 * "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"
+	 * @return true if there was no such key used before, false otherwise
+	 */
+	public boolean includeAs(String key, String librarysource)
+		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);
+		}
+		
+	}
+	
+	public WidgetDefinition getDefinition(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).getDefinition(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 (WidgetDefinition)definitions.get(definitionkey);
+		}
+	}
+	
+	public void buildLibrary(Element libraryElement) throws Exception {
+		sourceURI = LocationAttributes.getURI(libraryElement);
+		Element widgetsElement = DomHelper.getChildElement(libraryElement, FormsConstants.DEFINITION_NS, "widgets", true);
+        // All child elements of the widgets element are widgets
+        Element[] widgetElements = DomHelper.getChildElements(widgetsElement, FormsConstants.DEFINITION_NS);
+        for (int i = 0; i < widgetElements.length; i++) {
+            Element widgetElement = widgetElements[i];
+            WidgetDefinition widgetDefinition = buildWidgetDefinition(widgetElement);
+            addDefinition(widgetDefinition);
+        }
+	}
+	
+	public void addDefinition(WidgetDefinition definition) throws LibraryException {
+		if(definition == null)
+			return;
+		
+		if(definitions.containsKey(definition.getId()))
+			throw new LibraryException("Library already contains a widget with this ID!");
+		
+		definitions.put(definition.getId(),definition);
+		manager.debug(this+": Put definition with id: "+definition.getId());
+	}
+	
+	protected WidgetDefinition buildWidgetDefinition(Element widgetDefinition) throws Exception {
+        String widgetName = widgetDefinition.getLocalName();
+        WidgetDefinitionBuilder builder = null;
+        try {
+            builder = (WidgetDefinitionBuilder)widgetDefinitionBuilderSelector.select(widgetName);
+        } catch (ServiceException e) {
+            throw new CascadingException("Unknown kind of widget '" + widgetName + "' at " +
+                                         DomHelper.getLocation(widgetDefinition), e);
+        }
+        
+        context.setSuperDefinition(null);
+        String extend = DomHelper.getAttribute(widgetDefinition, "extends", null);
+        
+        if (extend != null)
+            context.setSuperDefinition(getDefinition(extend));
+        
+        
+        return builder.buildWidgetDefinition(widgetDefinition,context);
+    }
+	
+	
+	/**
+	 * Encapsulates a uri to designate an import plus a timestamp so previously reloaded 
+	 * 
+	 * @author Max Pfingsthorn (mpfingsthorn@hippo.nl)
+	 *
+	 */
+	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);
+			}
+			
+		}
+	}
+	
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/Library.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryException.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryException.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryException.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryException.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel.library;
+
+import org.apache.avalon.framework.CascadingException;
+
+/**
+ * This exception is thrown when something specific to the library system goes wrong.
+ * 
+ * @version $Id: LibraryException.java 289538 2005-09-16 13:46:22Z sylvain $
+ */
+public class LibraryException extends CascadingException {
+    public LibraryException(String message) {
+        super(message);
+    }
+
+    public LibraryException(String message, Exception e) {
+        super(message, e);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryManager.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryManager.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryManager.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryManager.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,40 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel.library;
+
+
+
+/**
+ * The work interface for the LibraryManager, the class that
+ * manages all used library definitions so they can be shared between
+ * forms.
+ * 
+ * @version $Id: LibraryManager.java 289538 2005-09-16 13:46:22Z sylvain $
+ *
+ */
+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);
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryManagerImpl.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryManagerImpl.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryManagerImpl.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryManagerImpl.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,196 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel.library;
+
+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.configuration.Configurable;
+import org.apache.avalon.framework.configuration.Configuration;
+import org.apache.avalon.framework.configuration.ConfigurationException;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.ServiceSelector;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.avalon.framework.thread.ThreadSafe;
+import org.apache.cocoon.forms.CacheManager;
+import org.apache.cocoon.forms.formmodel.WidgetDefinitionBuilder;
+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: LibraryManagerImpl.java 289538 2005-09-16 13:46:22Z sylvain $
+ *
+ */
+public class LibraryManagerImpl extends AbstractLogEnabled implements LibraryManager, ThreadSafe, Serviceable,
+Configurable, Initializable, Disposable {
+
+	protected static final String PREFIX = "CocoonFormLibrary:";
+	
+	private ServiceManager serviceManager;
+    private Configuration configuration;
+    private CacheManager cacheManager;
+    
+    private ServiceSelector widgetDefinitionBuilderSelector;
+
+    public void configure(Configuration configuration) throws ConfigurationException {
+        this.configuration = configuration;
+        getLogger().debug("Gotten a config: top level element: "+this.configuration);
+    }
+
+    public void service(ServiceManager serviceManager) throws ServiceException {
+        this.serviceManager = serviceManager;
+        this.cacheManager = (CacheManager)serviceManager.lookup(CacheManager.ROLE);
+    }
+    
+    public void initialize() throws Exception {
+    	this.widgetDefinitionBuilderSelector = (ServiceSelector) serviceManager.lookup(WidgetDefinitionBuilder.class.getName() + "Selector");
+    	
+        // 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())
+        	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?
+            }
+            else if( lib == null )
+            	result = false;
+            else
+            	result = true;
+        } catch(Exception e) {
+        	if(getLogger().isErrorEnabled())
+            	getLogger().error("Problem getting library '"+librarysource+"' relative to '"+relative+"'!",e);
+        	throw e;
+        } finally {
+            if (source != null)
+                sourceResolver.release(source);
+            if (sourceResolver != null)
+            	serviceManager.release(sourceResolver);
+        }
+
+        if(getLogger().isDebugEnabled()) {
+        	if(result)
+        		getLogger().debug("Library IS in cache : '"+librarysource+"' relative to '"+relative+"'");
+        	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);
+                }
+            }
+        } finally {
+            if (source != null)
+                sourceResolver.release(source);
+            if (sourceResolver != null)
+            	serviceManager.release(sourceResolver);
+        }
+
+        return lib;
+	}
+	
+	public Library getNewLibrary() {
+		Library lib = new Library(this);
+        lib.setWidgetDefinitionBuilderSelector(this.widgetDefinitionBuilderSelector);
+        
+        if(getLogger().isDebugEnabled())
+        	getLogger().debug("Created new library! "+lib);
+        
+        return lib;
+	}
+
+	public void dispose() {
+		this.serviceManager.release(this.cacheManager);
+	    this.cacheManager = null;
+	    this.serviceManager = null;
+	}
+	
+	public void debug(String msg) {
+		if(getLogger().isDebugEnabled()) {
+			getLogger().debug(msg);
+		}
+	}
+	
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/library/LibraryManagerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/DefaultTreeModel.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/DefaultTreeModel.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/DefaultTreeModel.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/DefaultTreeModel.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,179 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel.tree;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+/**
+ * A default tree model, implemented with {@link org.apache.cocoon.forms.formmodel.tree.DefaultTreeModel.TreeNode}s.
+ * 
+ * @version $Id: DefaultTreeModel.java 190962 2005-06-16 17:17:00Z sylvain $
+ */
+public class DefaultTreeModel implements TreeModel {
+    
+    /**
+     * Default model that is used by a Tree when no model has been specified.
+     */
+    public static final TreeModel UNSPECIFIED_MODEL = buildUnspecifiedModel();
+    
+    private TreeModelHelper helper = new TreeModelHelper(this);
+    
+    TreeNode root;
+
+    public interface TreeNode {
+        Collection getChildren();
+
+        boolean isLeaf();
+
+        String getChildKey(Object child);
+
+        Object getChild(String key);
+    }
+    
+    public static class DefaultTreeNode implements TreeNode {
+        
+        private Object data;
+        private Map children;
+
+        public DefaultTreeNode(Object data) {
+            this.data = data;
+        }
+        
+        public DefaultTreeNode(Object data, Map children) {
+            this.data = data;
+            this.children = children;
+        }
+        
+        public Object getData() {
+            return this.data;
+        }
+        
+        public void add(String key, TreeNode node) {
+            if (this.children == null) {
+                this.children = new HashMap();
+            }
+            children.put(key, node);
+        }
+
+        public Collection getChildren() {
+            if (this.children == null) {
+                return null;
+            }
+            
+            return this.children.values();
+        }
+
+        public boolean isLeaf() {
+            return this.children == null;
+        }
+
+        public String getChildKey(Object child) {
+            Iterator iter = this.children.entrySet().iterator();
+            while(iter.hasNext()) {
+                Map.Entry entry = (Map.Entry)iter.next();
+                if (child.equals(entry.getValue())) {
+                    return (String)entry.getKey();
+                }
+            }
+            return null;
+        }
+
+        public Object getChild(String key) {
+            return this.children.get(key);
+        }
+    }
+
+    public DefaultTreeModel(TreeNode root) {
+        this.root = root;
+    }
+
+    public Object getRoot() {
+        return this.root;
+    }
+
+    public Collection getChildren(Object parent) {
+        return ((TreeNode)parent).getChildren();
+    }
+
+    public boolean isLeaf(Object node) {
+        return ((TreeNode)node).isLeaf();
+    }
+
+    public String getChildKey(Object parent, Object child) {
+        return ((TreeNode)parent).getChildKey(child);
+    }
+
+    public Object getChild(Object parent, String key) {
+        return ((TreeNode)parent).getChild(key);
+    }
+
+    public Object getNode(TreePath path) {
+        return helper.getNode(path);
+    }
+
+    public void addTreeModelListener(TreeModelListener l) {
+        helper.addTreeModelListener(l);
+    }
+
+    public void removeTreeModelListener(TreeModelListener l) {
+        helper.removeTreeModelListener(l);
+    }
+
+    private static TreeModel buildUnspecifiedModel() {
+        DefaultTreeNode root = new DefaultTreeNode("This tree has no model.");
+        DefaultTreeNode parent = new DefaultTreeNode("Tree model should be defined...");
+        root.add("explanation", parent);
+        parent.add("1", new DefaultTreeNode("in the form definition using <fd:tree-model>"));
+        parent.add("2", new DefaultTreeNode("by the application using flowscript, event listeners, etc."));
+        return new DefaultTreeModel(root);
+    }
+
+    /**
+     * The classical Swing sample tree model, that can be used for demonstration purposes.
+     */
+    public static class Sample extends DefaultTreeModel {
+        public Sample() {
+            super(new DefaultTreeNode("root"));
+            DefaultTreeNode root = (DefaultTreeNode)getRoot();
+
+            DefaultTreeNode      parent;
+            
+            parent = new DefaultTreeNode("Colors");
+            root.add("colors", parent);
+            parent.add("blue", new DefaultTreeNode("Blue"));
+            parent.add("violet", new DefaultTreeNode("Violet"));
+            parent.add("red", new DefaultTreeNode("Red"));
+            parent.add("yellow", new DefaultTreeNode("Yellow"));
+    
+            parent = new DefaultTreeNode("Sports");
+            root.add("sports", parent);
+            parent.add("basketball", new DefaultTreeNode("Basketball"));
+            parent.add("soccer", new DefaultTreeNode("Soccer"));
+            parent.add("football", new DefaultTreeNode("Football"));
+            parent.add("hockey", new DefaultTreeNode("Hockey"));
+    
+            parent = new DefaultTreeNode("Food");
+            root.add("food", parent);
+            parent.add("hotdogs", new DefaultTreeNode("Hot Dogs"));
+            parent.add("pizza", new DefaultTreeNode("Pizza"));
+            parent.add("ravioli", new DefaultTreeNode("Ravioli"));
+            parent.add("bananas", new DefaultTreeNode("Bananas"));
+        }
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/DefaultTreeModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/JavaTreeModelDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/JavaTreeModelDefinition.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/JavaTreeModelDefinition.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/JavaTreeModelDefinition.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,65 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel.tree;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.avalon.framework.context.Context;
+import org.apache.avalon.framework.context.ContextException;
+import org.apache.avalon.framework.context.Contextualizable;
+import org.apache.avalon.framework.logger.AbstractLogEnabled;
+import org.apache.avalon.framework.service.ServiceException;
+import org.apache.avalon.framework.service.ServiceManager;
+import org.apache.avalon.framework.service.Serviceable;
+import org.apache.cocoon.components.LifecycleHelper;
+
+/**
+ * A {@link org.apache.cocoon.forms.formmodel.tree.TreeModelDefinition} based on an Java class
+ * implementing {@link org.apache.cocoon.forms.formmodel.tree.TreeModel}.
+ * 
+ * @version $Id: JavaTreeModelDefinition.java 190962 2005-06-16 17:17:00Z sylvain $
+ */
+public class JavaTreeModelDefinition extends AbstractLogEnabled
+    implements TreeModelDefinition, Contextualizable, Serviceable {
+    
+    private Class modelClass;
+
+    Context ctx;
+    ServiceManager manager;
+    
+    public void contextualize(Context context) throws ContextException {
+        this.ctx = context;
+    }
+
+    public void service(ServiceManager manager) throws ServiceException {
+        this.manager = manager;
+    }
+
+    public void setModelClass(Class clazz) {
+        this.modelClass = clazz;
+    }
+
+    public TreeModel createInstance() {
+        TreeModel model;
+        try {
+            model = (TreeModel)modelClass.newInstance();
+            LifecycleHelper.setupComponent(model, getLogger(), ctx, manager, null);
+        } catch (Exception e) {
+            throw new CascadingRuntimeException("Cannot instanciate class " + modelClass.getName(), e);
+        }
+        
+        return model;
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/JavaTreeModelDefinition.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/SourceTreeModel.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/SourceTreeModel.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/SourceTreeModel.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/SourceTreeModel.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,192 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel.tree;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.avalon.framework.CascadingRuntimeException;
+import org.apache.cocoon.matching.helpers.WildcardHelper;
+import org.apache.excalibur.source.SourceException;
+import org.apache.excalibur.source.SourceResolver;
+import org.apache.excalibur.source.TraversableSource;
+
+/**
+ * A {@link TreeModel} that builds a hierarchy of <code>TraversableSource</code>s.
+ * 
+ * @version $Id: SourceTreeModel.java 290436 2005-09-20 12:42:36Z sylvain $
+ */
+public class SourceTreeModel implements TreeModel {
+    
+    private TreeModelHelper helper = new TreeModelHelper(this);
+    
+    private int[][] fileIncludePatterns = SourceTreeModelDefinition.NO_PATTERNS;
+    private int[][] fileExcludePatterns = SourceTreeModelDefinition.NO_PATTERNS;
+    private int[][] dirIncludePatterns = SourceTreeModelDefinition.NO_PATTERNS;
+    private int[][] dirExcludePatterns = SourceTreeModelDefinition.NO_PATTERNS;
+    
+    /** optimization hint: don't filter child collections if there are no patterns */
+    private boolean hasPatterns = false;
+
+    private TraversableSource rootSource;
+
+    private String rootURL;
+    private SourceResolver resolver;
+
+    public SourceTreeModel(SourceResolver resolver, String rootURL) {
+        this.resolver = resolver;
+        this.rootURL = rootURL;
+    }
+
+    public SourceTreeModel(SourceTreeModelDefinition definition) {
+        this.rootURL = definition.getRootURL();
+        this.resolver = definition.getResolver();
+        this.fileIncludePatterns = definition.getFileIncludePatterns();
+        this.fileExcludePatterns = definition.getFileExcludePatterns();
+        this.dirIncludePatterns =  definition.getDirectoryIncludePatterns();
+        this.dirExcludePatterns =  definition.getDirectoryExcludePatterns();
+        
+        this.hasPatterns = this.fileIncludePatterns != null || this.fileExcludePatterns != null ||
+            this.dirIncludePatterns != null || this.dirExcludePatterns != null;
+    }
+
+    public Object getRoot() {
+        if (this.rootSource == null) {
+            try {
+                this.rootSource = (TraversableSource) this.resolver.resolveURI(this.rootURL);
+            } catch (Exception e) {
+                throw new CascadingRuntimeException("Cannot resolve " + this.rootURL, e);
+            }
+        }
+        return this.rootSource;
+    }
+
+    public Collection getChildren(Object parent) {
+        if (parent instanceof TraversableSource) {
+            TraversableSource dir = (TraversableSource)parent;
+            try {
+                // Return children if it's a collection, null otherwise
+                return dir.isCollection() ? filterChildren(dir.getChildren()) : null;
+            } catch (SourceException e) {
+                throw new CascadingRuntimeException("getChildren", e);
+            }
+        } else {
+            return null;
+        }
+    }
+    
+    private Collection filterChildren(Collection coll) {
+        if (!this.hasPatterns) {
+            return coll;
+        }
+        
+        ArrayList result = new ArrayList();
+        Iterator iter = coll.iterator();
+        while(iter.hasNext()) {
+            TraversableSource src = (TraversableSource)iter.next();
+
+            // Does it match the patterns?
+            boolean matches = true;
+            if (src.isCollection()) {
+                matches = matches(src, this.dirIncludePatterns, this.dirExcludePatterns);
+            } else {
+                matches = matches(src, this.fileIncludePatterns, this.fileExcludePatterns);
+            }
+
+            if (matches) {
+                result.add(src);
+            }
+        }
+        
+        return result;
+    }
+    
+    private boolean matches(TraversableSource src, int[][]include, int[][]exclude) {
+        boolean matches = true;
+        String name = src.getName();
+        
+        //FIXME: match allowed a null Map very recently. Replace it by null once 2.1.8 is out,
+        // we will gain a few cycles.
+        HashMap junk = new HashMap();
+        
+        // check include patterns
+        if (include != null && include.length > 0) {
+            matches = false;
+            check: for (int i = 0; i < include.length; i++) {
+                if (WildcardHelper.match(junk, name, include[i])) {
+                    matches = true;
+                    break check;
+                }
+            }
+        }
+        
+        // check exclude patterns
+        if (matches && exclude != null && exclude.length > 0) {
+            check: for (int i = 0; i < exclude.length; i++) {
+                if (WildcardHelper.match(junk, name, exclude[i])) {
+                    matches = false;
+                    break check;
+                }
+            }
+        }
+        return matches;
+    }
+    
+    public boolean isLeaf(Object obj) {
+        return !(obj instanceof TraversableSource) || !((TraversableSource)obj).isCollection();
+    }
+
+    public String getChildKey(Object parent, Object child) {
+        return ((TraversableSource)child).getName();
+    }
+
+    public Object getChild(Object parent, String key) {
+        try {
+            return ((TraversableSource)parent).getChild(key);
+        } catch (SourceException e) {
+            throw new CascadingRuntimeException("getChild", e);
+        }
+    }
+    
+    public void setRootURL(String url) {
+        if (this.rootSource != null) {
+            this.resolver.release(this.rootSource);
+            this.rootSource = null;
+        }
+        this.rootURL = url;
+        helper.fireTreeStructureChanged(TreePath.ROOT_PATH);
+    }
+
+    public void setRootSource(TraversableSource src) {
+        this.rootSource = src;
+        helper.fireTreeStructureChanged(TreePath.ROOT_PATH);
+    }
+
+    public void addTreeModelListener(TreeModelListener l) {
+        helper.addTreeModelListener(l);
+    }
+
+    public void removeTreeModelListener(TreeModelListener l) {
+        helper.addTreeModelListener(l);
+    }
+
+    public Object getNode(TreePath path) {
+        // FIXME: can be heavily optimized by building a new URL from the path elements.
+        return helper.getNode(path);
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/SourceTreeModel.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/SourceTreeModelDefinition.java
URL: http://svn.apache.org/viewcvs/cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/SourceTreeModelDefinition.java?rev=330548&view=auto
==============================================================================
--- cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/SourceTreeModelDefinition.java (added)
+++ cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/SourceTreeModelDefinition.java Thu Nov  3 05:41:06 2005
@@ -0,0 +1,80 @@
+/*
+ * Copyright 1999-2005 The Apache Software Foundation.
+ * 
+ * Licensed 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.cocoon.forms.formmodel.tree;
+
+import org.apache.excalibur.source.SourceResolver;
+
+/**
+ * Definition for {@link SourceTreeModel}
+ * 
+ * @version $Id: SourceTreeModelDefinition.java 190962 2005-06-16 17:17:00Z sylvain $
+ */
+public class SourceTreeModelDefinition implements TreeModelDefinition {
+
+    public static final int[][] NO_PATTERNS = new int[0][];
+    private String url;
+    private int[][] fileIncludePatterns = NO_PATTERNS;
+    private int[][] fileExcludePatterns = NO_PATTERNS;
+    private int[][] dirIncludePatterns = NO_PATTERNS;
+    private int[][] dirExcludePatterns = NO_PATTERNS;
+    private SourceResolver resolver;
+
+    public void setURL(String url) {
+        this.url = url;
+    }
+
+    public void setFilePatterns(int[][] include, int[][] exclude) {
+        this.fileIncludePatterns = include;
+        this.fileExcludePatterns = exclude;
+    }
+
+    public void setDirectoryPatterns(int[][] include, int[][] exclude) {
+        this.dirIncludePatterns = include;
+        this.dirExcludePatterns = exclude;
+    }
+    
+    public TreeModel createInstance() {
+        return new SourceTreeModel(this);
+    }
+
+    public int[][] getDirectoryExcludePatterns() {
+        return dirExcludePatterns;
+    }
+
+    public int[][] getDirectoryIncludePatterns() {
+        return dirIncludePatterns;
+    }
+
+    public int[][] getFileExcludePatterns() {
+        return fileExcludePatterns;
+    }
+
+    public int[][] getFileIncludePatterns() {
+        return fileIncludePatterns;
+    }
+
+    public void setSourceResolver(SourceResolver resolver) {
+        this.resolver = resolver;
+    }
+
+    public String getRootURL() {
+        return this.url;
+    }
+    
+    public SourceResolver getResolver() {
+        return this.resolver;
+    }
+}

Propchange: cocoon/whiteboard/maven2/cocoon-flat-layout/cocoon-forms-block/impl/src/main/java/org/apache/cocoon/forms/formmodel/tree/SourceTreeModelDefinition.java
------------------------------------------------------------------------------
    svn:eol-style = native