001    // GraphLab Project: http://graphlab.sharif.edu
002    // Copyright (C) 2008 Mathematical Science Department of Sharif University of Technology
003    // Distributed under the terms of the GNU General Public License (GPL): http://www.gnu.org/licenses/
004    package graphlab.platform.extension;
005    
006    import graphlab.platform.core.AbstractAction;
007    import graphlab.platform.core.BlackBoard;
008    
009    /**
010     * The base class to create new types of extensions. It can be done by this:
011     * <pre>
012     * class MyExtensionHandler implements ExtensionHandler{
013     *   ...
014     * }
015     *
016     * and in you plugin Init file:
017     *
018     * public class Init{
019     *      static{
020     *          ExtensionLoader.registerExtensionHandler(new MyExtensionHandler());
021     *      }
022     * }
023     * @author azin azadi
024     */
025    public interface ExtensionHandler {
026        /**
027         * tries to handle the given Object as a known Extension,...
028         * normally, Extensions are interfaces that can be sandwiched in an AbstractAction Automatically,
029         * there is options for generating menus automatically after loading it (By returning AbstractExtensionAction) .
030         *
031         * @param b         the blackboard as the environment...
032         * @param extension the extension which we want to create the AbstractAction from
033         * @return not null if it was a valid case and the operation was successfull, null if it was not a valid case or it
034         *         is done without creating any actions(in some cases)
035         * @see graphlab.ui.AbstractExtensionAction
036         */
037        public AbstractAction handle(BlackBoard b, Object extension);
038    }