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.plugins.main.saveload;
005    
006    import graphlab.platform.core.BlackBoard;
007    import graphlab.platform.extension.ExtensionLoader;
008    import graphlab.platform.plugin.PluginInterface;
009    import graphlab.plugins.main.saveload.core.extension.GraphIOExtensionHandler;
010    import graphlab.ui.UI;
011    import org.xml.sax.SAXException;
012    
013    import java.io.IOException;
014    
015    /**
016     * @author Reza Mohammadi
017     */
018    public class Init implements PluginInterface {
019        static {
020            ExtensionLoader.registerExtensionHandler(new GraphIOExtensionHandler(true));
021            ExtensionLoader.registerExtensionHandler(new GraphIOExtensionHandler(false));
022        }
023    
024        public void init(BlackBoard blackboard) {
025            UI ui = (UI) blackboard.getData(UI.name);
026    
027            try {
028                ui.addXML("/graphlab/plugins/main/saveload/config.xml", getClass());
029            } catch (IOException e) {
030                e.printStackTrace();
031                System.out.println("xml file was not found , or IO error");
032            } catch (SAXException e) {
033                e.printStackTrace();
034            }
035        }
036    }