    001package org.apache.turbine.services.assemblerbroker.util.python;
    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.Loader;
    025import org.apache.turbine.modules.Screen;
    026import org.apache.turbine.modules.ScreenLoader;
    027
    028/**
    029 * A screen factory that attempts to load a python class in the
    030 * JPython interpreter and execute it as a Turbine screen.
    031 * The JPython script should inherit from Turbine Screen or one
    032 * of its subclasses.
    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: PythonScreenFactory.java 1199089 2011-11-08 03:14:28Z tv $
    037 */
    038public class PythonScreenFactory
    039        extends PythonBaseFactory<Screen>
    040{
    041    /**
    042     * Get an Assembler.
    043     *
    044     * @param name name of the requested Assembler
    045     * @return an Assembler
    046     * @throws Exception generic exception
    047     */
    048    public Screen getAssembler(String name)
    049        throws Exception
    050    {
    051        return getAssembler(Screen.PREFIX, name);
    052    }
    053
    054    /**
    055     * Get the loader for this type of assembler
    056     *
    057     * @return a Loader
    058     */
    059    @Override
    060    public Loader<Screen> getLoader()
    061    {
    062        return ScreenLoader.getInstance();
    063    }
    064
    065    /**
    066     * Get the class of this assembler
    067     *
    068     * @return a class
    069     */
    070    public Class<Screen> getManagedClass()
    071    {
    072        return Screen.class;
    073    }
    074}