1 /* 2 * Copyright 1999-2004 The Apache Software Foundation. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package org.apache.cocoon.forms; 17 18 import org.apache.cocoon.forms.formmodel.Form; 19 import org.apache.cocoon.forms.formmodel.FormDefinition; 20 import org.apache.excalibur.source.Source; 21 import org.w3c.dom.Element; 22 23 /** 24 * Work interface for the component that can create {@link Form}s. 25 * 26 * @version $Id: FormManager.java 56582 2004-11-04 10:16:22Z sylvain $ 27 */ 28 public interface FormManager { 29 30 String ROLE = FormManager.class.getName(); 31 32 /** 33 * Creates a form instance based on the XML form definition 34 * that can be read from the specified source. 35 * 36 * <p>To avoid having to resolve the Source object yourself, 37 * use the {@link #createForm(java.lang.String)} method. 38 * 39 * <p>The form definition will be cached, so that future form instances 40 * can be creted quickly. 41 */ 42 Form createForm(Source source) throws Exception; 43 44 /** 45 * Creates a form instance based on the XML form definition 46 * that can be retrieved from the specified URI. 47 * 48 * <p>The form definition will be cached, so that future form instances 49 * can be creted quickly. 50 */ 51 Form createForm(String uri) throws Exception; 52 53 /** 54 * Creates a form instance based on the XML form definition that is 55 * supplied as a DOM tree. 56 * 57 * <p>The specified element must be a fd:form element. 58 * 59 * <p>The Form Definition will not be cached. 60 */ 61 Form createForm(Element formElement) throws Exception; 62 63 /** 64 * Creates a form definition based on the XML form definition that is 65 * supplied as a DOM tree. 66 * 67 * <p>The specified element must be a fd:form element. 68 69 * <p>The Form Definition will not be cached. 70 */ 71 FormDefinition createFormDefinition(Element formElement) throws Exception; 72 73 /** 74 * Creates a form definition based on the XML form definition 75 * that can be retrieved from the specified URI. 76 * 77 * <p>The specified element must be a fd:form element. 78 79 * <p>The Form Definition will not be cached. 80 */ 81 FormDefinition createFormDefinition(String uri) throws Exception; 82 } 83