001 package org.apache.fulcrum.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.fulcrum.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 757801 2009-03-24 13:46:25Z tv $ 044 */ 045 public interface IntakeService 046 { 047 /** Avalon role - used to id the component within the manager */ 048 String ROLE = IntakeService.class.getName(); 049 050 /** 051 * The configuration property specifying the location of the xml specification. 052 */ 053 String XML_PATHS = "xmlPaths"; 054 055 /** 056 * The default location of the xml specification. 057 */ 058 String XML_PATH_DEFAULT = "WEB-INF/conf/intake.xml"; 059 060 /** 061 * The configuration property specifying the location where a serialized version of the 062 * xml specification can be written for faster restarts.. 063 */ 064 String SERIAL_XML = "serialDataPath"; 065 066 /** 067 * The default location where a serialized version of 068 * the xml specification can be written for faster restarts.. 069 */ 070 String SERIAL_XML_DEFAULT = "WEB-INF/appData.ser"; 071 072 /** 073 * The default pool capacity. 074 */ 075 int DEFAULT_POOL_CAPACITY = 1024; 076 077 /** 078 * Gets an instance of a named group either from the pool 079 * or by calling the Factory Service if the pool is empty. 080 * 081 * @param groupName the name of the group. 082 * @return a Group instance. 083 * @throws IntakeException if recycling fails. 084 */ 085 Group getGroup(String groupName) 086 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) 095 throws IntakeException; 096 097 /** 098 * Gets the current size of the pool for a named group. 099 * 100 * @param groupName the name of the group. 101 * 102 * @throws IntakeException The passed group name does not exist. 103 */ 104 int getSize(String groupName) 105 throws IntakeException; 106 107 /** 108 * Names of all the defined groups. 109 * 110 * @return array of names. 111 */ 112 String[] getGroupNames(); 113 114 /** 115 * Gets the key (usually a short identifier) for a group. 116 * 117 * @param groupName the name of the group. 118 * @return the key. 119 */ 120 String getGroupKey(String groupName); 121 122 /** 123 * Gets the group name given its key. 124 * 125 * @param groupKey the key. 126 * @return groupName the name of the group. 127 */ 128 String getGroupName(String groupKey); 129 130 /** 131 * Gets the Method that can be used to set a property. 132 * 133 * @param className the name of the object. 134 * @param propName the name of the property. 135 * @return the setter. 136 * @throws ClassNotFoundException 137 * @throws IntrospectionException 138 */ 139 Method getFieldSetter(String className, String propName) 140 throws ClassNotFoundException, IntrospectionException; 141 142 /** 143 * Gets the Method that can be used to get a property value. 144 * 145 * @param className the name of the object. 146 * @param propName the name of the property. 147 * @return the getter. 148 * @throws ClassNotFoundException 149 * @throws IntrospectionException 150 */ 151 Method getFieldGetter(String className, String propName) 152 throws ClassNotFoundException, IntrospectionException; 153 } 154 155 156 157 158