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