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 005 package graphlab.plugins.main.extension; 006 007 import graphlab.platform.core.AbstractAction; 008 import graphlab.platform.core.BlackBoard; 009 import graphlab.platform.extension.ExtensionHandler; 010 011 /** 012 * the plug in handler for GraphModel generators, this class loads classes that are implementing 013 * GraphGeneratorExtension interface,... 014 * 015 * @author azin azadi 016 017 */ 018 public class GraphActionExtensionHandler implements ExtensionHandler { 019 AbstractAction a = null; 020 021 /** 022 * @param b 023 * @param ext 024 * @return null if clazz doesn't implements GraphGeneratorExtension 025 */ 026 public AbstractAction handle(BlackBoard b, Object ext) { 027 a = null; 028 if (ext instanceof GraphActionExtension) { 029 try { 030 GraphActionExtension ga = (GraphActionExtension) ext; 031 a = new GraphActionExtensionAction(b, ga); 032 } catch (Exception e) { 033 e.printStackTrace(); 034 } 035 } 036 return a; 037 } 038 039 }