1 package org.apache.turbine.services;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 import org.apache.commons.configuration.Configuration;
20
21 /***
22 * Classes that implement this interface can act as a broker for
23 * <code>Service</code> classes.
24 *
25 * Functionality that <code>ServiceBroker</code> provides in addition
26 * to <code>InitableBroker</code> functionality includes:
27 *
28 * <ul>
29 *
30 * <li>Maintaining service name to class name mapping, allowing
31 * plugable service implementations.</li>
32 *
33 * <li>Providing <code>Services</code> with <code>Properties</code>
34 * based on a system wide configuration mechanism.</li>
35 *
36 * </ul>
37 *
38 * @author <a href="mailto:burton@apache.org">Kevin Burton</a>
39 * @author <a href="mailto:krzewski@e-point.pl">Rafal Krzewski</a>
40 * @author <a href="mailto:dlr@collab.net">Daniel Rall</a>
41 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
42 * @version $Id: ServiceBroker.java 264148 2005-08-29 14:21:04Z henning $
43 */
44 public interface ServiceBroker
45 {
46 /***
47 * Determines whether a service is registered in the configured
48 * <code>TurbineResources.properties</code>.
49 *
50 * @param serviceName The name of the service whose existance to check.
51 * @return Registration predicate for the desired services.
52 */
53 boolean isRegistered(String serviceName);
54
55 /***
56 * Performs early initialization of the specified service.
57 *
58 * @param name The name of the service.
59 * @exception InitializationException if the service is unknown
60 * or can't be initialized.
61 */
62 void initService(String name) throws InitializationException;
63
64 /***
65 * Shutdowns a Service.
66 *
67 * This method is used to release resources allocated by a
68 * Service, and return it to initial (uninitailized) state.
69 *
70 * @param name The name of the Service to be uninitialized.
71 */
72 void shutdownService(String name);
73
74 /***
75 * Shutdowns all Services.
76 *
77 * This method is used to release resources allocated by
78 * Services, and return them to initial (uninitialized) state.
79 */
80 void shutdownServices();
81
82 /***
83 * Returns an instance of requested Service.
84 *
85 * @param name The name of the Service requested.
86 * @return An instance of requested Service.
87 * @exception InstantiationException if the service is unknown or
88 * can't be initialized.
89 */
90 Service getService(String name) throws InstantiationException;
91
92 /***
93 * Returns the configuration of a specific service. Services
94 * use this method to retrieve their configuration.
95 *
96 * @param name The name of the service.
97 * @return Configuration of the requested service.
98 */
99 Configuration getConfiguration(String name);
100 }