1 package org.apache.turbine.services.intake;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import java.beans.IntrospectionException;
20
21 import java.lang.reflect.Method;
22
23 import org.apache.turbine.services.intake.model.Group;
24
25 /***
26 * This service provides access to input processing objects based
27 * on an XML specification.
28 *
29 * <p>Localization of Intake's error messages can be accomplished
30 * using Turbine's <code>LocalizationTool</code> from a Velocity template
31 * as follows:
32 * <blockquote><code></pre>
33 * $l10n.get($intake.SomeGroup.SomeField.Message)
34 * </pre></code></blockquote>
35 * </p>
36 *
37 * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
38 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
39 * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
40 * @version $Id: IntakeService.java 264148 2005-08-29 14:21:04Z henning $
41 */
42 public interface IntakeService
43 {
44 /***
45 * The key under which this service is stored in TurbineServices.
46 */
47 String SERVICE_NAME = "IntakeService";
48
49 /***
50 * The property specifying the location of the xml specification.
51 */
52 String XML_PATH = "xml.path";
53
54 /***
55 * The default location of the xml specification.
56 */
57 String XML_PATH_DEFAULT = "WEB-INF/conf/intake.xml";
58
59 /***
60 * The property specifying the location where a serialized version of
61 * the xml specification can be written for faster restarts..
62 */
63 String SERIAL_XML = "serialize.path";
64
65 /***
66 * The default location where a serialized version of
67 * the xml specification can be written for faster restarts..
68 */
69 String SERIAL_XML_DEFAULT = "WEB-INF/appData.ser";
70
71 /***
72 * The default pool capacity.
73 */
74 int DEFAULT_POOL_CAPACITY = 1024;
75
76 /***
77 * Gets an instance of a named group either from the pool
78 * or by calling the Factory Service if the pool is empty.
79 *
80 * @param groupName the name of the group.
81 * @return a Group instance.
82 * @throws IntakeException if recycling fails.
83 */
84 Group getGroup(String groupName)
85 throws IntakeException;
86
87 /***
88 * Puts a group back to the pool.
89 * @param instance the object instance to recycle.
90 *
91 * @throws IntakeException The passed group name does not exist.
92 */
93 void releaseGroup(Group instance)
94 throws IntakeException;
95
96 /***
97 * Gets the current size of the pool for a named group.
98 *
99 * @param groupName the name of the group.
100 *
101 * @throws IntakeException The passed group name does not exist.
102 */
103 int getSize(String groupName)
104 throws IntakeException;
105
106 /***
107 * Names of all the defined groups.
108 *
109 * @return array of names.
110 */
111 String[] getGroupNames();
112
113 /***
114 * Gets the key (usually a short identifier) for a group.
115 *
116 * @param groupName the name of the group.
117 * @return the key.
118 */
119 String getGroupKey(String groupName);
120
121 /***
122 * Gets the group name given its key.
123 *
124 * @param groupKey the key.
125 * @return groupName the name of the group.
126 */
127 String getGroupName(String groupKey);
128
129 /***
130 * Gets the Method that can be used to set a property.
131 *
132 * @param className the name of the object.
133 * @param propName the name of the property.
134 * @return the setter.
135 * @throws ClassNotFoundException
136 * @throws IntrospectionException
137 */
138 Method getFieldSetter(String className, String propName)
139 throws ClassNotFoundException, IntrospectionException;
140
141 /***
142 * Gets the Method that can be used to get a property value.
143 *
144 * @param className the name of the object.
145 * @param propName the name of the property.
146 * @return the getter.
147 * @throws ClassNotFoundException
148 * @throws IntrospectionException
149 */
150 Method getFieldGetter(String className, String propName)
151 throws ClassNotFoundException, IntrospectionException;
152 }
153
154
155
156
157