| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| TurbineAssemblerBroker |
|
| 1.0;1 |
| 1 | package org.apache.turbine.services.assemblerbroker; | |
| 2 | ||
| 3 | ||
| 4 | /* | |
| 5 | * Licensed to the Apache Software Foundation (ASF) under one | |
| 6 | * or more contributor license agreements. See the NOTICE file | |
| 7 | * distributed with this work for additional information | |
| 8 | * regarding copyright ownership. The ASF licenses this file | |
| 9 | * to you under the Apache License, Version 2.0 (the | |
| 10 | * "License"); you may not use this file except in compliance | |
| 11 | * with the License. You may obtain a copy of the License at | |
| 12 | * | |
| 13 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 14 | * | |
| 15 | * Unless required by applicable law or agreed to in writing, | |
| 16 | * software distributed under the License is distributed on an | |
| 17 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| 18 | * KIND, either express or implied. See the License for the | |
| 19 | * specific language governing permissions and limitations | |
| 20 | * under the License. | |
| 21 | */ | |
| 22 | ||
| 23 | ||
| 24 | import org.apache.turbine.modules.Assembler; | |
| 25 | import org.apache.turbine.modules.Loader; | |
| 26 | import org.apache.turbine.services.TurbineServices; | |
| 27 | import org.apache.turbine.services.assemblerbroker.util.AssemblerFactory; | |
| 28 | import org.apache.turbine.util.TurbineException; | |
| 29 | ||
| 30 | /** | |
| 31 | * An interface the Turbine Assembler service. | |
| 32 | * See TurbineAssemblerBrokerService for more info. | |
| 33 | * | |
| 34 | * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a> | |
| 35 | * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a> | |
| 36 | * @version $Id: TurbineAssemblerBroker.java 743071 2009-02-10 19:37:33Z tv $ | |
| 37 | */ | |
| 38 | 0 | public abstract class TurbineAssemblerBroker |
| 39 | { | |
| 40 | /** | |
| 41 | * Utility method for accessing the service | |
| 42 | * implementation | |
| 43 | * | |
| 44 | * @return An AssemblerBroker implementation instance | |
| 45 | */ | |
| 46 | public static AssemblerBrokerService getService() | |
| 47 | { | |
| 48 | 732 | return (AssemblerBrokerService) TurbineServices.getInstance() |
| 49 | .getService(AssemblerBrokerService.SERVICE_NAME); | |
| 50 | } | |
| 51 | ||
| 52 | /** | |
| 53 | * Register a new Assembler factory with this service. | |
| 54 | * | |
| 55 | * @param type The type of Assembler Factory | |
| 56 | * @param factory The actual Factory Object | |
| 57 | */ | |
| 58 | public static void registerFactory(String type, AssemblerFactory factory) | |
| 59 | { | |
| 60 | 0 | getService().registerFactory(type, factory); |
| 61 | 0 | } |
| 62 | ||
| 63 | /** | |
| 64 | * Return an Assembler for a given type and object name. | |
| 65 | * | |
| 66 | * @param type The Type of Assember we want | |
| 67 | * @param name The name of the Assembler | |
| 68 | * | |
| 69 | * @return An Assembler Object. | |
| 70 | * | |
| 71 | * @throws TurbineException If a problem locating the Assember occured. | |
| 72 | */ | |
| 73 | public static Assembler getAssembler(String type, String name) | |
| 74 | throws TurbineException | |
| 75 | { | |
| 76 | 0 | return getService().getAssembler(type, name); |
| 77 | } | |
| 78 | ||
| 79 | /** | |
| 80 | * Get a Loader for the given assembler type | |
| 81 | * | |
| 82 | * @param type The Type of the Assembler | |
| 83 | * @return A Loader instance for the requested type | |
| 84 | */ | |
| 85 | public static Loader getLoader(String type) | |
| 86 | { | |
| 87 | 442 | return getService().getLoader(type); |
| 88 | } | |
| 89 | } |