01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one or more
03: * contributor license agreements. See the NOTICE file distributed with
04: * this work for additional information regarding copyright ownership.
05: * The ASF licenses this file to You under the Apache License, Version 2.0
06: * (the "License"); you may not use this file except in compliance with
07: * the License. You may obtain a copy of the License at
08: *
09: * http://www.apache.org/licenses/LICENSE-2.0
10: *
11: * Unless required by applicable law or agreed to in writing, software
12: * distributed under the License is distributed on an "AS IS" BASIS,
13: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: * See the License for the specific language governing permissions and
15: * limitations under the License.
16: */
17: package org.apache.cocoon.forms;
18:
19: import org.apache.cocoon.forms.formmodel.Form;
20: import org.apache.cocoon.forms.formmodel.FormDefinition;
21: import org.apache.excalibur.source.Source;
22: import org.w3c.dom.Element;
23:
24: /**
25: * Work interface for the component that can create {@link Form}s.
26: *
27: * @version $Id: FormManager.java 449149 2006-09-23 03:58:05Z crossley $
28: */
29: public interface FormManager {
30:
31: String ROLE = FormManager.class.getName();
32:
33: /**
34: * Creates a form instance based on the XML form definition
35: * that can be retrieved from the specified URI.
36: *
37: * <p>The form definition will be cached, so that future form instances
38: * can be created quickly.
39: */
40: Form createForm(String uri) throws Exception;
41:
42: /**
43: * Creates a form instance based on the XML form definition
44: * that can be read from the specified source.
45: *
46: * <p>To avoid having to resolve the Source object yourself,
47: * use the {@link #createForm(String)} method.
48: *
49: * <p>The form definition will be cached, so that future form instances
50: * can be created quickly.
51: */
52: Form createForm(Source source) throws Exception;
53:
54: /**
55: * Creates a form instance based on the XML form definition that is
56: * supplied as a DOM tree.
57: *
58: * <p>The specified element must be a fd:form element.
59: *
60: * <p>The Form Definition will <b>not</b> be cached.
61: */
62: Form createForm(Element formElement) throws Exception;
63:
64: /**
65: * Creates a form definition based on the XML form definition
66: * that can be retrieved from the specified URI.
67: *
68: * <p>The root element must be a <fd:form> element.
69: *
70: * <p>The form definition will be cached, so that future form instances
71: * can be created quickly.
72: */
73: FormDefinition createFormDefinition(String uri) throws Exception;
74:
75: /**
76: * Creates a form definition based on the XML form definition
77: * that can be retrieved from the specified source.
78: *
79: * <p>To avoid having to resolve the Source object yourself,
80: * use the {@link #createFormDefinition(String)} method.
81: *
82: * <p>The root element must be a <fd:form> element.
83: *
84: * <p>The form definition will be cached, so that future form instances
85: * can be created quickly.
86: */
87: FormDefinition createFormDefinition(Source source) throws Exception;
88:
89: /**
90: * Creates a form definition based on the XML form definition that is
91: * supplied as a DOM tree.
92: *
93: * <p>The specified element must be a <fd:form> element.
94: *
95: * <p>The Form Definition will <b>not</b> be cached.
96: */
97: FormDefinition createFormDefinition(Element formElement)
98: throws Exception;
99: }
|