cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vgritse...@apache.org
Subject svn commit: r446950 - in /cocoon: branches/BRANCH_2_1_X/ trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/
Date Sat, 16 Sep 2006 20:43:52 GMT
Author: vgritsenko
Date: Sat Sep 16 13:43:50 2006
New Revision: 446950

URL: http://svn.apache.org/viewvc?view=rev&rev=446950
Log:
Add CacheManager.remove() method.
Cleanup.

<action dev="VG" type="update">
  CForms: FormManager now caches form definitions created from Source or URI.
</action>


Modified:
    cocoon/branches/BRANCH_2_1_X/status.xml
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/CacheManager.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/DefaultCacheManager.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/DefaultFormManager.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/FormManager.java
    cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/FormsRuntimeException.java

Modified: cocoon/branches/BRANCH_2_1_X/status.xml
URL: http://svn.apache.org/viewvc/cocoon/branches/BRANCH_2_1_X/status.xml?view=diff&rev=446950&r1=446949&r2=446950
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/status.xml (original)
+++ cocoon/branches/BRANCH_2_1_X/status.xml Sat Sep 16 13:43:50 2006
@@ -184,6 +184,9 @@
   <release version="@version@" date="@date@">
 -->
   <release version="2.1.10" date="TBD">
+    <action dev="VG" type="update">
+      CForms: FormManager now caches form definitions created from Source or URI.
+    </action>
     <action dev="AN" type="fix">
       Core: Off-by-1 bug in WildcardMatcher found pattern matches which were not there.
     </action>

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/CacheManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/CacheManager.java?view=diff&rev=446950&r1=446949&r2=446950
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/CacheManager.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/CacheManager.java
Sat Sep 16 13:43:50 2006
@@ -1,12 +1,12 @@
 /*
  * 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.
@@ -20,11 +20,11 @@
 
 /**
  * Work interface for the component that caches objects for Cocoon Forms.
- * 
+ *
  * @version $Id$
  */
 public interface CacheManager {
-    
+
     String ROLE = CacheManager.class.getName();
 
     /**
@@ -36,4 +36,9 @@
      * Saves an object in the cache.
      */
     void set(Object object, Source source, String prefix) throws IOException;
+
+    /**
+     * Removes an object from the cache.
+     */
+    void remove(Source source, String prefix) throws IOException;
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/DefaultCacheManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/DefaultCacheManager.java?view=diff&rev=446950&r1=446949&r2=446950
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/DefaultCacheManager.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/DefaultCacheManager.java
Sat Sep 16 13:43:50 2006
@@ -15,52 +15,37 @@
  */
 package org.apache.cocoon.forms;
 
+import java.io.IOException;
+import java.util.Map;
+
 import org.apache.avalon.framework.activity.Disposable;
 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;
 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.avalon.framework.thread.ThreadSafe;
-
-import org.apache.commons.collections.FastHashMap;
 import org.apache.excalibur.source.Source;
 import org.apache.excalibur.source.SourceValidity;
 
-import java.io.IOException;
-import java.util.Map;
+import org.apache.commons.collections.FastHashMap;
 
 /**
  * Component implementing the {@link CacheManager} role.
  *
  * @version $Id$
  */
-public class DefaultCacheManager
-        extends AbstractLogEnabled
-        implements CacheManager, ThreadSafe, Serviceable, Disposable,
-                   Configurable, Component {
-// FIXME: Component is there to allow this block to also run in the 2.1 branch
+public class DefaultCacheManager extends AbstractLogEnabled
+                                 implements CacheManager, Disposable, ThreadSafe, Component
{
+    // NOTE: Component is there to allow this block to also run in the 2.1 branch
 
-    protected ServiceManager manager;
-    protected Configuration configuration;
+    // FIXME Unbounded map - the road to OOME
     protected Map cache;
 
+
     public DefaultCacheManager() {
         this.cache = new FastHashMap();
     }
 
-    public void service(ServiceManager serviceManager) throws ServiceException {
-        this.manager = serviceManager;
-    }
-
-    /**
-     * Configurable
-     */
-    public void configure(Configuration configuration) throws ConfigurationException {
-        this.configuration = configuration;
+    public void dispose() {
+        this.cache = null;
     }
 
     public Object get(Source source, String prefix) {
@@ -92,19 +77,15 @@
     }
 
     public void set(Object object, Source source, String prefix) throws IOException {
-        final String key = prefix + source.getURI();
         final SourceValidity validity = source.getValidity();
         if (validity != null) {
-            Object[] objectAndValidity = {object,  validity};
-            this.cache.put(key, objectAndValidity);
+            final String key = prefix + source.getURI();
+            this.cache.put(key, new Object[]{ object, validity });
         }
     }
 
-    /**
-     * Disposable
-     */
-    public void dispose() {
-        this.manager = null;
-        this.cache = null;
+    public void remove(Source source, String prefix) throws IOException {
+        final String key = prefix + source.getURI();
+        this.cache.remove(key);
     }
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/DefaultFormManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/DefaultFormManager.java?view=diff&rev=446950&r1=446949&r2=446950
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/DefaultFormManager.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/DefaultFormManager.java
Sat Sep 16 13:43:50 2006
@@ -26,11 +26,14 @@
 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.logger.Logger;
 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.excalibur.source.Source;
+import org.apache.excalibur.source.SourceResolver;
+
 import org.apache.cocoon.forms.formmodel.Form;
 import org.apache.cocoon.forms.formmodel.FormDefinition;
 import org.apache.cocoon.forms.formmodel.FormDefinitionBuilder;
@@ -39,8 +42,7 @@
 import org.apache.cocoon.forms.formmodel.library.LibraryManagerImpl;
 import org.apache.cocoon.forms.util.DomHelper;
 import org.apache.cocoon.forms.util.SimpleServiceSelector;
-import org.apache.excalibur.source.Source;
-import org.apache.excalibur.source.SourceResolver;
+
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.InputSource;
@@ -50,23 +52,38 @@
  *
  * @version $Id$
  */
-public class DefaultFormManager
-  extends AbstractLogEnabled
-  implements FormManager, Contextualizable, ThreadSafe, Serviceable, Disposable, Configurable,
Component, Initializable {
-// FIXME: Component is there to allow this block to also run in the 2.1 branch
+public class DefaultFormManager extends AbstractLogEnabled
+                                implements FormManager, Contextualizable, Serviceable, Configurable,
+                                           Initializable, Disposable, ThreadSafe, Component
{
+    // NOTE: Component is there to allow this block to run in the 2.1 branch
 
     protected static final String PREFIX = "CocoonForm:";
+
+    private Context avalonContext;
     protected ServiceManager manager;
-    protected Configuration configuration;
     protected SimpleServiceSelector widgetDefinitionBuilderSelector;
     protected CacheManager cacheManager;
-    
+
     protected LibraryManagerImpl libraryManager;
 
-    private Context avalonContext;
+    //
+    // Lifecycle
+    //
+
+    public DefaultFormManager() {
+        libraryManager = new LibraryManagerImpl();
+        widgetDefinitionBuilderSelector = new SimpleServiceSelector("widget", WidgetDefinitionBuilder.class);
+    }
+
+    public void enableLogging(Logger logger) {
+        super.enableLogging(logger);
+        libraryManager.enableLogging(getLogger().getChildLogger("library"));
+    }
+
     public void contextualize(Context context) throws ContextException {
-		this.avalonContext = context;
-	}
+        this.avalonContext = context;
+        widgetDefinitionBuilderSelector.contextualize(avalonContext);
+    }
 
     /** Temporary internal method, don't rely on it's existence! Needed to access the context
from flowscript. */
     // FIXME (SW). Extending the FOM is needed.
@@ -77,51 +94,76 @@
     public void service(ServiceManager manager) throws ServiceException {
         this.manager = manager;
         this.cacheManager = (CacheManager)manager.lookup(CacheManager.ROLE);
+        libraryManager.service(new FormServiceManager());
+        widgetDefinitionBuilderSelector.service(new FormServiceManager());
     }
 
-    /**
-     * Configurable
-     */
     public void configure(Configuration configuration) throws ConfigurationException {
-        this.configuration = configuration;
+        libraryManager.configure(configuration.getChild("libraries"));
+        widgetDefinitionBuilderSelector.configure(configuration.getChild("widgets"));
     }
 
     public void initialize() throws Exception {
-
-        libraryManager = new LibraryManagerImpl();
-        libraryManager.enableLogging(getLogger().getChildLogger("library"));
-        libraryManager.service(new FormServiceManager());
-        libraryManager.configure(configuration.getChild("libraries"));
-        
-        widgetDefinitionBuilderSelector = new SimpleServiceSelector("widget", WidgetDefinitionBuilder.class);
-        widgetDefinitionBuilderSelector.contextualize(avalonContext);
-        widgetDefinitionBuilderSelector.service(new FormServiceManager());
-        widgetDefinitionBuilderSelector.configure(configuration.getChild("widgets"));
-        
         libraryManager.initialize();
     }
-    
-    public ServiceSelector getWidgetDefinitionBuilderSelector() {
-    	return this.widgetDefinitionBuilderSelector;
+
+    public void dispose() {
+        if (this.widgetDefinitionBuilderSelector != null) {
+            this.widgetDefinitionBuilderSelector.dispose();
+            this.widgetDefinitionBuilderSelector = null;
+        }
+        if(this.libraryManager != null) {
+            this.libraryManager.dispose();
+            this.libraryManager = null;
+        }
+        if (this.cacheManager != null) {
+            this.manager.release(this.cacheManager);
+            this.cacheManager = null;
+        }
+        this.manager = null;
+    }
+
+    //
+    // Business Methods
+    //
+
+    public Form createForm(String uri) throws Exception {
+        SourceResolver resolver = null;
+        Source source = null;
+        try {
+            resolver = (SourceResolver) manager.lookup(SourceResolver.ROLE);
+            source = resolver.resolveURI(uri);
+            return createForm(source);
+        } finally {
+            if (source != null) {
+                resolver.release(source);
+            }
+            if (resolver != null) {
+                manager.release(resolver);
+            }
+        }
     }
 
     public Form createForm(Source source) throws Exception {
-        FormDefinition formDefinition = getFormDefinition(source);
-        Form form = (Form)formDefinition.createInstance();
+        FormDefinition formDefinition = createFormDefinition(source);
+        Form form = (Form) formDefinition.createInstance();
         form.initialize();
         return form;
     }
 
-    public Form createForm(String uri) throws Exception {
+    public Form createForm(Element formElement) throws Exception {
+        Form form = (Form) createFormDefinition(formElement).createInstance();
+        form.initialize();
+        return form;
+    }
+
+    public FormDefinition createFormDefinition(String uri) throws Exception {
         SourceResolver sourceResolver = null;
         Source source = null;
-
         try {
             sourceResolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);
-
             source = sourceResolver.resolveURI(uri);
-            Form form = createForm(source);
-            return form;
+            return createFormDefinition(source);
         } finally {
             if (source != null) {
                 sourceResolver.release(source);
@@ -132,27 +174,17 @@
         }
     }
 
-    public Form createForm(Element formElement) throws Exception {
-        Form form = (Form)getFormDefinition(formElement).createInstance();
-        form.initialize();
-        return form;
-    }
-
-    public FormDefinition createFormDefinition(Element formElement) throws Exception {
-        return getFormDefinition(formElement);
-    }
+    public FormDefinition createFormDefinition(Source source) throws Exception {
+        FormDefinition formDefinition = (FormDefinition) this.cacheManager.get(source, PREFIX);
+        if (formDefinition != null && formDefinition.getLocalLibrary().dependenciesHaveChanged())
{
+            formDefinition = null; // invalidate
+        }
 
-    public FormDefinition getFormDefinition(Source source) throws Exception {
-        FormDefinition formDefinition = (FormDefinition)this.cacheManager.get(source, PREFIX);
-        
-        if(formDefinition != null && formDefinition.getLocalLibrary().dependenciesHaveChanged())
-        	formDefinition = null; // invalidate
-        
         if (formDefinition == null) {
-        	
-        	if(getLogger().isDebugEnabled())
-        		getLogger().debug("Building Form: "+source.getURI());
-        	
+            if (getLogger().isDebugEnabled()) {
+                getLogger().debug("Building Form: " + source.getURI());
+            }
+
             Document formDocument;
             try {
                 InputSource inputSource = new InputSource(source.getInputStream());
@@ -164,94 +196,51 @@
             }
 
             Element formElement = formDocument.getDocumentElement();
-            formDefinition = getFormDefinition(formElement);
+            formDefinition = createFormDefinition(formElement);
             this.cacheManager.set(formDefinition, source, PREFIX);
         }
         return formDefinition;
     }
 
-    public FormDefinition getFormDefinition(Element formElement) throws Exception {
+    public FormDefinition createFormDefinition(Element formElement) throws Exception {
         // check that the root element is a fd:form element
-        if (!(formElement.getLocalName().equals("form") || FormsConstants.DEFINITION_NS.equals(formElement.getNamespaceURI())))
+        if (!FormsConstants.DEFINITION_NS.equals(formElement.getNamespaceURI()) || !formElement.getLocalName().equals("form"))
{
             throw new Exception("Expected a Cocoon Forms form element at " + DomHelper.getLocation(formElement));
-
-        FormDefinitionBuilder formDefinitionBuilder = (FormDefinitionBuilder)widgetDefinitionBuilderSelector.select("form");
-        return (FormDefinition)formDefinitionBuilder.buildWidgetDefinition(formElement);
-    }
-
-    public FormDefinition createFormDefinition(String uri) throws Exception {
-        SourceResolver sourceResolver = null;
-        Source source = null;
-        Document formDocument = null;
-
-        try {
-            sourceResolver = (SourceResolver)manager.lookup(SourceResolver.ROLE);
-            source = sourceResolver.resolveURI(uri);
-
-            try {
-                InputSource inputSource = new InputSource(source.getInputStream());
-                inputSource.setSystemId(source.getURI());
-                formDocument = DomHelper.parse(inputSource, this.manager);
-            } 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)
-                manager.release(sourceResolver);
         }
 
-        Element formElement = formDocument.getDocumentElement();
-        return getFormDefinition(formElement);
+        FormDefinitionBuilder builder = (FormDefinitionBuilder) widgetDefinitionBuilderSelector.select("form");
+        return (FormDefinition) builder.buildWidgetDefinition(formElement);
     }
 
-    /**
-     * Disposable
-     */
-    public void dispose() {
-        if (this.widgetDefinitionBuilderSelector != null) {
-            this.widgetDefinitionBuilderSelector.dispose();
-            this.widgetDefinitionBuilderSelector = null;
-        }
-        if(this.libraryManager != null) {
-        	this.libraryManager.dispose();
-        	this.libraryManager = null;
-        }
-        this.manager.release(this.cacheManager);
-        this.cacheManager = null;
-        this.manager = null;
-    }
-    
-    
-    public class FormServiceManager implements ServiceManager {
+
+    private class FormServiceManager implements ServiceManager {
         final String WIDGET_DEFINITION_BUILDER_SELECTOR_ROLE = WidgetDefinitionBuilder.class.getName()
+ "Selector";
         final String LIBRARY_MANAGER_ROLE = LibraryManager.ROLE;
 
         public Object lookup(String name) throws ServiceException {
-            if (WIDGET_DEFINITION_BUILDER_SELECTOR_ROLE.equals(name))
+            if (WIDGET_DEFINITION_BUILDER_SELECTOR_ROLE.equals(name)) {
                 return widgetDefinitionBuilderSelector;
-            else if(LIBRARY_MANAGER_ROLE.equals(name))
-            	return libraryManager;
-            else
+            } else if(LIBRARY_MANAGER_ROLE.equals(name)) {
+                return libraryManager;
+            } else {
                 return manager.lookup(name);
+            }
         }
 
         public boolean hasService(String name) {
-            if (WIDGET_DEFINITION_BUILDER_SELECTOR_ROLE.equals(name))
+            if (WIDGET_DEFINITION_BUILDER_SELECTOR_ROLE.equals(name)) {
                 return true;
-            else if(LIBRARY_MANAGER_ROLE.equals(name))
-            	return true;
-            else
+            } else if(LIBRARY_MANAGER_ROLE.equals(name)) {
+                return true;
+            } else {
                 return manager.hasService(name);
+            }
         }
 
         public void release(Object service) {
-            if (service != widgetDefinitionBuilderSelector
-            		&& service != libraryManager)
+            if (service != widgetDefinitionBuilderSelector && service != libraryManager)
{
                 manager.release(service);
+            }
         }
     }
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/FormManager.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/FormManager.java?view=diff&rev=446950&r1=446949&r2=446950
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/FormManager.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/FormManager.java
Sat Sep 16 13:43:50 2006
@@ -1,12 +1,12 @@
 /*
  * 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.
@@ -22,33 +22,33 @@
 
 /**
  * Work interface for the component that can create {@link Form}s.
- * 
+ *
  * @version $Id$
  */
 public interface FormManager {
-    
+
     String ROLE = FormManager.class.getName();
 
     /**
      * Creates a form instance based on the XML form definition
-     * that can be read from the specified source.
-     *
-     * <p>To avoid having to resolve the Source object yourself,
-     * use the {@link #createForm(java.lang.String)} method.
+     * that can be retrieved from the specified URI.
      *
      * <p>The form definition will be cached, so that future form instances
-     * can be creted quickly.
+     * can be created quickly.
      */
-    Form createForm(Source source) throws Exception;
+    Form createForm(String uri) throws Exception;
 
     /**
      * Creates a form instance based on the XML form definition
-     * that can be retrieved from the specified URI.
+     * that can be read from the specified source.
+     *
+     * <p>To avoid having to resolve the Source object yourself,
+     * use the {@link #createForm(String)} method.
      *
      * <p>The form definition will be cached, so that future form instances
-     * can be creted quickly.
+     * can be created quickly.
      */
-    Form createForm(String uri) throws Exception;
+    Form createForm(Source source) throws Exception;
 
     /**
      * Creates a form instance based on the XML form definition that is
@@ -56,27 +56,42 @@
      *
      * <p>The specified element must be a fd:form element.
      *
-     * <p>The Form Definition will not be cached.
+     * <p>The Form Definition will <b>not</b> be cached.
      */
     Form createForm(Element formElement) throws Exception;
 
     /**
-     * Creates a form definition based on the XML form definition that is
-     * supplied as a DOM tree.
+     * Creates a form definition based on the XML form definition
+     * that can be retrieved from the specified URI.
      *
-     * <p>The specified element must be a fd:form element.
-
-     * <p>The Form Definition will not be cached.
+     * <p>The root element must be a &lt;fd:form&gt; element.
+     *
+     * <p>The form definition will be cached, so that future form instances
+     * can be created quickly.
      */
-    FormDefinition createFormDefinition(Element formElement) throws Exception;
+    FormDefinition createFormDefinition(String uri) throws Exception;
 
     /**
      * Creates a form definition based on the XML form definition
-     * that can be retrieved from the specified URI.
+     * that can be retrieved from the specified source.
      *
-     * <p>The specified element must be a fd:form element.
+     * <p>To avoid having to resolve the Source object yourself,
+     * use the {@link #createFormDefinition(String)} method.
+     *
+     * <p>The root element must be a &lt;fd:form&gt; element.
+     *
+     * <p>The form definition will be cached, so that future form instances
+     * can be created quickly.
+     */
+    FormDefinition createFormDefinition(Source source) throws Exception;
 
-     * <p>The Form Definition will not be cached.
+    /**
+     * Creates a form definition based on the XML form definition that is
+     * supplied as a DOM tree.
+     *
+     * <p>The specified element must be a &lt;fd:form&gt; element.
+     *
+     * <p>The Form Definition will <b>not</b> be cached.
      */
-    FormDefinition createFormDefinition(String uri) throws Exception;
+    FormDefinition createFormDefinition(Element formElement) throws Exception;
 }

Modified: cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/FormsRuntimeException.java
URL: http://svn.apache.org/viewvc/cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/FormsRuntimeException.java?view=diff&rev=446950&r1=446949&r2=446950
==============================================================================
--- cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/FormsRuntimeException.java
(original)
+++ cocoon/trunk/blocks/cocoon-forms/cocoon-forms-impl/src/main/java/org/apache/cocoon/forms/FormsRuntimeException.java
Sat Sep 16 13:43:50 2006
@@ -1,12 +1,12 @@
 /*
  * Copyright 1999-200( 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.
@@ -21,24 +21,26 @@
 /**
  * An exception raised when some runtime error occurs in form handling. This is a
  * located exception, which points to the relevant element declaration.
- * 
+ *
  * @version $Id$
  */
 public class FormsRuntimeException extends LocatedRuntimeException {
 
-    public FormsRuntimeException(String message, Location location) {
-        super(message, location);
+    public FormsRuntimeException(String message) {
+        super(message);
     }
 
-    public FormsRuntimeException(String message, Throwable cause, Location location) throws
LocatedRuntimeException {
-        super(message, cause, location);
+    public FormsRuntimeException(String message, Throwable cause)
+    throws LocatedRuntimeException {
+        super(message, cause);
     }
 
-    public FormsRuntimeException(String message, Throwable cause) throws LocatedRuntimeException
{
-        super(message, cause);
+    public FormsRuntimeException(String message, Location location) {
+        super(message, location);
     }
 
-    public FormsRuntimeException(String message) {
-        super(message);
+    public FormsRuntimeException(String message, Throwable cause, Location location)
+    throws LocatedRuntimeException {
+        super(message, cause, location);
     }
 }



Mime
View raw message