KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > fulcrum > intake > IntakeService


1 package org.apache.fulcrum.intake;
2
3 /* ====================================================================
4  * The Apache Software License, Version 1.1
5  *
6  * Copyright (c) 2001 The Apache Software Foundation. All rights
7  * reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in
18  * the documentation and/or other materials provided with the
19  * distribution.
20  *
21  * 3. The end-user documentation included with the redistribution,
22  * if any, must include the following acknowledgment:
23  * "This product includes software developed by the
24  * Apache Software Foundation (http://www.apache.org/)."
25  * Alternately, this acknowledgment may appear in the software itself,
26  * if and wherever such third-party acknowledgments normally appear.
27  *
28  * 4. The names "Apache" and "Apache Software Foundation" and
29  * "Apache Turbine" must not be used to endorse or promote products
30  * derived from this software without prior written permission. For
31  * written permission, please contact apache@apache.org.
32  *
33  * 5. Products derived from this software may not be called "Apache",
34  * "Apache Turbine", nor may "Apache" appear in their name, without
35  * prior written permission of the Apache Software Foundation.
36  *
37  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40  * DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
41  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48  * SUCH DAMAGE.
49  * ====================================================================
50  *
51  * This software consists of voluntary contributions made by many
52  * individuals on behalf of the Apache Software Foundation. For more
53  * information on the Apache Software Foundation, please see
54  * <http://www.apache.org/>.
55  */

56
57 import java.lang.reflect.Method JavaDoc;
58
59 import org.apache.fulcrum.ServiceException;
60 import org.apache.fulcrum.intake.model.Group;
61
62 /**
63  * This service provides access to input processing objects based
64  * on an XML specification.
65  *
66  * <p>Localization of Intake's error messages can be accomplished
67  * using Turbine's <code>LocalizationTool</code> from a Velocity template
68  * as follows:
69  * <blockquote><code></pre>
70  * $l10n.get($intake.SomeGroup.SomeField.Message)
71  * </pre></code></blockquote>
72  * </p>
73  *
74  * @author <a HREF="mailto:jmcnally@collab.net">John McNally</a>
75  * @version $Id: IntakeService.java,v 1.1 2004/11/12 10:25:56 epugh Exp $
76  */

77 public interface IntakeService
78 {
79     /**
80      * The key under which this service is stored in TurbineServices.
81      */

82     public static final String JavaDoc SERVICE_NAME = "IntakeService";
83
84     /**
85      * The property specifying the location of the xml specification.
86      */

87     public static final String JavaDoc XML_PATH = "xml.path";
88
89     /**
90      * The default location of the xml specification.
91      */

92     public static final String JavaDoc XML_PATH_DEFAULT = "WEB-INF/conf/intake.xml";
93
94     /**
95      * The property specifying the location where a serialized version of
96      * the xml specification can be written for faster restarts..
97      */

98     public static final String JavaDoc SERIAL_XML = "serialize.path";
99
100     /**
101      * The default location where a serialized version of
102      * the xml specification can be written for faster restarts..
103      */

104     public static final String JavaDoc SERIAL_XML_DEFAULT = "WEB-INF/appData.ser";
105
106     /**
107      * The default pool capacity.
108      */

109     public static final int DEFAULT_POOL_CAPACITY = 1024;
110
111     /**
112      * Gets an instance of a named group either from the pool
113      * or by calling the Factory Service if the pool is empty.
114      *
115      * @param groupName the name of the group.
116      * @return a Group instance.
117      * @throws ServiceException if recycling fails.
118      */

119     public Group getGroup(String JavaDoc groupName)
120         throws ServiceException;
121
122     /**
123      * Gets an instance of a named group either from the pool
124      * or by calling the Factory Service if the pool is empty and
125      * then initialize it using the ValueParser looking for
126      * a NEW id.
127      *
128      * @param groupName the name of the group.
129      * @param pp the request parameters that may contain matching keys
130      * @return a Group instance.
131      * @throws ServiceException if recycling fails.
132      * /
133     public Group getGroup(String groupName, ValueParser pp)
134         throws Exception;
135
136     /**
137      * Gets an instance of a named group either from the pool
138      * or by calling the Factory Service if the pool is empty and
139      * then initialize it using the ValueParser looking for id.
140      *
141      * @param groupName the name of the group.
142      * @param pp the request parameters that may contain matching keys
143      * @return a Group instance.
144      * @throws ServiceException if recycling fails.
145      * /
146     public Group getGroup(String groupName, ValueParser pp, String id)
147         throws Exception;
148     */

149
150     /**
151      * Puts a group back to the pool.
152      * @param instance the object instance to recycle.
153      * @return true if the instance was accepted.
154      */

155     public void releaseGroup(Group instance);
156
157     /**
158      * Gets the current size of the pool for a named group.
159      *
160      * @param groupName the name of the group.
161      */

162     public int getSize(String JavaDoc groupName);
163
164     /**
165      * Names of all the defined groups.
166      *
167      * @return array of names.
168      */

169     public String JavaDoc[] getGroupNames();
170
171     /**
172      * Gets the key (usually a short identifier) for a group.
173      *
174      * @param groupName the name of the group.
175      * @return the key.
176      */

177     public String JavaDoc getGroupKey(String JavaDoc groupName);
178
179     /**
180      * Gets the group name given its key.
181      *
182      * @param the the key.
183      * @return groupName the name of the group.
184      */

185     public String JavaDoc getGroupName(String JavaDoc groupKey);
186
187     /**
188      * Gets the Method that can be used to set a property.
189      *
190      * @param className the name of the object.
191      * @param propName the name of the property.
192      * @return the setter.
193      */

194     public Method JavaDoc getFieldSetter(String JavaDoc className, String JavaDoc propName);
195
196     /**
197      * Gets the Method that can be used to get a property value.
198      *
199      * @param className the name of the object.
200      * @param propName the name of the property.
201      * @return the getter.
202      */

203     public Method JavaDoc getFieldGetter(String JavaDoc className, String JavaDoc propName);
204
205 }
206
207
208
209
210
211
Popular Tags