001package org.apache.turbine.services.assemblerbroker;
002
003
004/*
005 * Licensed to the Apache Software Foundation (ASF) under one
006 * or more contributor license agreements.  See the NOTICE file
007 * distributed with this work for additional information
008 * regarding copyright ownership.  The ASF licenses this file
009 * to you under the Apache License, Version 2.0 (the
010 * "License"); you may not use this file except in compliance
011 * with the License.  You may obtain a copy of the License at
012 *
013 *   http://www.apache.org/licenses/LICENSE-2.0
014 *
015 * Unless required by applicable law or agreed to in writing,
016 * software distributed under the License is distributed on an
017 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
018 * KIND, either express or implied.  See the License for the
019 * specific language governing permissions and limitations
020 * under the License.
021 */
022
023
024import org.apache.turbine.modules.Assembler;
025import org.apache.turbine.modules.Loader;
026import org.apache.turbine.services.Service;
027import org.apache.turbine.services.assemblerbroker.util.AssemblerFactory;
028import org.apache.turbine.util.TurbineException;
029
030/**
031 * An interface the Turbine Assembler service.
032 * See TurbineAssemblerBrokerService for more info.
033 *
034 * @author <a href="mailto:leon@opticode.co.za">Leon Messerschmidt</a>
035 * @author <a href="mailto:hps@intermeta.de">Henning P. Schmiedehausen</a>
036 * @version $Id$
037 */
038public interface AssemblerBrokerService
039        extends Service
040{
041    /** Name of the Service */
042    String SERVICE_NAME = "AssemblerBrokerService";
043
044    /**
045     * Register an AssemblerFactory class
046     *
047     * @param factory The factory object
048     *
049     * @param <T> the type of the assembler
050     *
051     */
052    <T extends Assembler> void registerFactory(AssemblerFactory<T> factory);
053
054    /**
055     * Attempts to load an Assembler of a type with a given name
056     *
057     * @param type The Type of the Assembler
058     * @param name The Name of the Assembler
059     *
060     * @param <T> the type of the assembler
061     *
062     * @return An Assembler object for the requested name and type
063     *
064     * @throws TurbineException Something went wrong while looking for the Assembler
065     */
066    <T extends Assembler> T getAssembler(Class<T> type, String name) throws TurbineException;
067
068    /**
069     * Get a Loader for the given assembler type
070     *
071     * @param type The Type of the Assembler
072     *
073     * @param <T> the type of the assembler
074     *
075     * @return A Loader instance for the requested type
076     */
077    <T extends Assembler> Loader<T> getLoader(Class<T> type);
078}