01: package org.apache.turbine.services.assemblerbroker;
02:
03: /*
04: * Copyright 2001-2005 The Apache Software Foundation.
05: *
06: * Licensed under the Apache License, Version 2.0 (the "License")
07: * you may not use this file except in compliance with the License.
08: * You may obtain a copy of the License at
09: *
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 org.apache.turbine.modules.Assembler;
20: import org.apache.turbine.services.TurbineServices;
21: import org.apache.turbine.services.assemblerbroker.util.AssemblerFactory;
22: import org.apache.turbine.util.TurbineException;
23:
24: /**
25: * An interface the Turbine Assembler service.
26: * See TurbineAssemblerBrokerService for more info.
27: *
28: * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
29: * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
30: * @version $Id: TurbineAssemblerBroker.java 264148 2005-08-29 14:21:04Z henning $
31: */
32: public abstract class TurbineAssemblerBroker {
33: /**
34: * Utility method for accessing the service
35: * implementation
36: *
37: * @return An AssemblerBroker implementation instance
38: */
39: public static AssemblerBrokerService getService() {
40: return (AssemblerBrokerService) TurbineServices.getInstance()
41: .getService(AssemblerBrokerService.SERVICE_NAME);
42: }
43:
44: /**
45: * Register a new Assembler factory with this service.
46: *
47: * @param type The type of Assembler Factory
48: * @param factory The actual Factory Object
49: */
50: public static void registerFactory(String type,
51: AssemblerFactory factory) {
52: getService().registerFactory(type, factory);
53: }
54:
55: /**
56: * Return an Assembler for a given type and object name.
57: *
58: * @param type The Type of Assember we want
59: * @param name The name of the Assembler
60: *
61: * @return An Assembler Object.
62: *
63: * @throws TurbineException If a problem locating the Assember occured.
64: */
65: public static Assembler getAssembler(String type, String name)
66: throws TurbineException {
67: return getService().getAssembler(type, name);
68: }
69: }
|