001: package org.apache.turbine.services.intake;
002:
003: /*
004: * Copyright 2001-2005 The Apache Software Foundation.
005: *
006: * Licensed under the Apache License, Version 2.0 (the "License")
007: * you may not use this file except in compliance with the License.
008: * You may obtain a copy of the License at
009: *
010: * http://www.apache.org/licenses/LICENSE-2.0
011: *
012: * Unless required by applicable law or agreed to in writing, software
013: * distributed under the License is distributed on an "AS IS" BASIS,
014: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015: * See the License for the specific language governing permissions and
016: * limitations under the License.
017: */
018:
019: import java.beans.IntrospectionException;
020:
021: import java.lang.reflect.Method;
022:
023: import org.apache.turbine.services.intake.model.Group;
024:
025: /**
026: * This service provides access to input processing objects based
027: * on an XML specification.
028: *
029: * <p>Localization of Intake's error messages can be accomplished
030: * using Turbine's <code>LocalizationTool</code> from a Velocity template
031: * as follows:
032: * <blockquote><code></pre>
033: * $l10n.get($intake.SomeGroup.SomeField.Message)
034: * </pre></code></blockquote>
035: * </p>
036: *
037: * @author <a href="mailto:jmcnally@collab.net">John McNally</a>
038: * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
039: * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a>
040: * @version $Id: IntakeService.java 264148 2005-08-29 14:21:04Z henning $
041: */
042: public interface IntakeService {
043: /**
044: * The key under which this service is stored in TurbineServices.
045: */
046: String SERVICE_NAME = "IntakeService";
047:
048: /**
049: * The property specifying the location of the xml specification.
050: */
051: String XML_PATH = "xml.path";
052:
053: /**
054: * The default location of the xml specification.
055: */
056: String XML_PATH_DEFAULT = "WEB-INF/conf/intake.xml";
057:
058: /**
059: * The property specifying the location where a serialized version of
060: * the xml specification can be written for faster restarts..
061: */
062: String SERIAL_XML = "serialize.path";
063:
064: /**
065: * The default location where a serialized version of
066: * the xml specification can be written for faster restarts..
067: */
068: String SERIAL_XML_DEFAULT = "WEB-INF/appData.ser";
069:
070: /**
071: * The default pool capacity.
072: */
073: int DEFAULT_POOL_CAPACITY = 1024;
074:
075: /**
076: * Gets an instance of a named group either from the pool
077: * or by calling the Factory Service if the pool is empty.
078: *
079: * @param groupName the name of the group.
080: * @return a Group instance.
081: * @throws IntakeException if recycling fails.
082: */
083: Group getGroup(String groupName) throws IntakeException;
084:
085: /**
086: * Puts a group back to the pool.
087: * @param instance the object instance to recycle.
088: *
089: * @throws IntakeException The passed group name does not exist.
090: */
091: void releaseGroup(Group instance) throws IntakeException;
092:
093: /**
094: * Gets the current size of the pool for a named group.
095: *
096: * @param groupName the name of the group.
097: *
098: * @throws IntakeException The passed group name does not exist.
099: */
100: int getSize(String groupName) throws IntakeException;
101:
102: /**
103: * Names of all the defined groups.
104: *
105: * @return array of names.
106: */
107: String[] getGroupNames();
108:
109: /**
110: * Gets the key (usually a short identifier) for a group.
111: *
112: * @param groupName the name of the group.
113: * @return the key.
114: */
115: String getGroupKey(String groupName);
116:
117: /**
118: * Gets the group name given its key.
119: *
120: * @param groupKey the key.
121: * @return groupName the name of the group.
122: */
123: String getGroupName(String groupKey);
124:
125: /**
126: * Gets the Method that can be used to set a property.
127: *
128: * @param className the name of the object.
129: * @param propName the name of the property.
130: * @return the setter.
131: * @throws ClassNotFoundException
132: * @throws IntrospectionException
133: */
134: Method getFieldSetter(String className, String propName)
135: throws ClassNotFoundException, IntrospectionException;
136:
137: /**
138: * Gets the Method that can be used to get a property value.
139: *
140: * @param className the name of the object.
141: * @param propName the name of the property.
142: * @return the getter.
143: * @throws ClassNotFoundException
144: * @throws IntrospectionException
145: */
146: Method getFieldGetter(String className, String propName)
147: throws ClassNotFoundException, IntrospectionException;
148: }
|