%line | %branch | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
org.apache.turbine.services.intake.TurbineIntake |
|
|
1 | package org.apache.turbine.services.intake; |
|
2 | ||
3 | /* |
|
4 | * Copyright 2001-2005 The Apache Software Foundation. |
|
5 | * |
|
6 | * Licensed under the Apache License, Version 2.0 (the "License") |
|
7 | * you may not use this file except in compliance with the License. |
|
8 | * You may obtain a copy of the License at |
|
9 | * |
|
10 | * http://www.apache.org/licenses/LICENSE-2.0 |
|
11 | * |
|
12 | * Unless required by applicable law or agreed to in writing, software |
|
13 | * distributed under the License is distributed on an "AS IS" BASIS, |
|
14 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
15 | * See the License for the specific language governing permissions and |
|
16 | * limitations under the License. |
|
17 | */ |
|
18 | ||
19 | import java.beans.IntrospectionException; |
|
20 | ||
21 | import java.lang.reflect.Method; |
|
22 | ||
23 | import org.apache.turbine.services.TurbineServices; |
|
24 | import org.apache.turbine.services.intake.model.Group; |
|
25 | ||
26 | /** |
|
27 | * This is a Facade class for IntakeService. |
|
28 | * |
|
29 | * This class provides static methods that call related methods of the |
|
30 | * implementation of the IntakeService used by the System, according to |
|
31 | * the settings in TurbineResources. |
|
32 | * |
|
33 | * @author <a href="mailto:jmcnally@collab.net">John McNally</a> |
|
34 | * @author <a href="mailto:quintonm@bellsouth.net">Quinton McCombs</a> |
|
35 | * @version $Id: TurbineIntake.java 264148 2005-08-29 14:21:04Z henning $ |
|
36 | */ |
|
37 | 0 | public abstract class TurbineIntake |
38 | { |
|
39 | /** |
|
40 | * Gets an instance of a named group either from the pool |
|
41 | * or by calling the Factory Service if the pool is empty. |
|
42 | * |
|
43 | * @param groupName the name of the group. |
|
44 | * @return a Group instance. |
|
45 | * @throws IntakeException if recycling fails. |
|
46 | */ |
|
47 | public static Group getGroup(String groupName) |
|
48 | throws IntakeException |
|
49 | { |
|
50 | 0 | if (groupName == null) |
51 | { |
|
52 | 0 | throw new IntakeException( |
53 | "TurbineIntake.getGroup(groupName) is null"); |
|
54 | } |
|
55 | 0 | return getService().getGroup(groupName); |
56 | } |
|
57 | ||
58 | /** |
|
59 | * Puts a group back to the pool. |
|
60 | * @param instance the object instance to recycle. |
|
61 | * @throws IntakeException A non existant group was passed |
|
62 | */ |
|
63 | public static void releaseGroup(Group instance) |
|
64 | throws IntakeException |
|
65 | { |
|
66 | 0 | getService().releaseGroup(instance); |
67 | 0 | } |
68 | ||
69 | /** |
|
70 | * Gets the current size of the pool for a named group. |
|
71 | * |
|
72 | * @param groupName the name of the group. |
|
73 | * @return the current pool size |
|
74 | * @throws IntakeException A non existant group was passed |
|
75 | */ |
|
76 | public static int getSize(String groupName) |
|
77 | throws IntakeException |
|
78 | { |
|
79 | 0 | return getService().getSize(groupName); |
80 | } |
|
81 | ||
82 | /** |
|
83 | * Names of all the defined groups. |
|
84 | * |
|
85 | * @return array of names. |
|
86 | */ |
|
87 | public static String[] getGroupNames() |
|
88 | { |
|
89 | 0 | return getService().getGroupNames(); |
90 | } |
|
91 | ||
92 | /** |
|
93 | * Gets the key (usually a short identifier) for a group. |
|
94 | * |
|
95 | * @param groupName the name of the group. |
|
96 | * @return the the key. |
|
97 | */ |
|
98 | public static String getGroupKey(String groupName) |
|
99 | { |
|
100 | 0 | return getService().getGroupKey(groupName); |
101 | } |
|
102 | ||
103 | /** |
|
104 | * Gets the group name given its key. |
|
105 | * |
|
106 | * @param groupKey the key. |
|
107 | * @return groupName the name of the group. |
|
108 | */ |
|
109 | public static String getGroupName(String groupKey) |
|
110 | { |
|
111 | 0 | return getService().getGroupName(groupKey); |
112 | } |
|
113 | ||
114 | /** |
|
115 | * Gets the Method that can be used to set a property. |
|
116 | * |
|
117 | * @param className the name of the object. |
|
118 | * @param propName the name of the property. |
|
119 | * @return the setter. |
|
120 | * @throws ClassNotFoundException |
|
121 | * @throws IntrospectionException |
|
122 | */ |
|
123 | public static Method getFieldSetter(String className, String propName) |
|
124 | throws IntrospectionException, ClassNotFoundException |
|
125 | { |
|
126 | 0 | return getService().getFieldSetter(className, propName); |
127 | } |
|
128 | ||
129 | /** |
|
130 | * Gets the Method that can be used to get a property value. |
|
131 | * |
|
132 | * @param className the name of the object. |
|
133 | * @param propName the name of the property. |
|
134 | * @return the getter. |
|
135 | * @throws ClassNotFoundException |
|
136 | * @throws IntrospectionException |
|
137 | */ |
|
138 | public static Method getFieldGetter(String className, String propName) |
|
139 | throws IntrospectionException, ClassNotFoundException |
|
140 | { |
|
141 | 0 | return getService().getFieldGetter(className, propName); |
142 | } |
|
143 | ||
144 | /** |
|
145 | * Utility method for accessing the service |
|
146 | * implementation |
|
147 | * |
|
148 | * @return a IntakeService implementation instance |
|
149 | */ |
|
150 | private static IntakeService getService() |
|
151 | { |
|
152 | 0 | return (IntakeService) TurbineServices |
153 | .getInstance().getService(IntakeService.SERVICE_NAME); |
|
154 | } |
|
155 | ||
156 | } |
|
157 | ||
158 | ||
159 | ||
160 | ||
161 | ||
162 | ||
163 | ||
164 | ||
165 | ||
166 |
This report is generated by jcoverage, Maven and Maven JCoverage Plugin. |