001/*
002 * Copyright 2010-2015 Institut Pasteur.
003 * 
004 * This file is part of Icy.
005 * 
006 * Icy is free software: you can redistribute it and/or modify
007 * it under the terms of the GNU General Public License as published by
008 * the Free Software Foundation, either version 3 of the License, or
009 * (at your option) any later version.
010 * 
011 * Icy is distributed in the hope that it will be useful,
012 * but WITHOUT ANY WARRANTY; without even the implied warranty of
013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
014 * GNU General Public License for more details.
015 * 
016 * You should have received a copy of the GNU General Public License
017 * along with Icy. If not, see <http://www.gnu.org/licenses/>.
018 */
019package icy.plugin.interface_;
020
021/**
022 * Plugin Daemon interface.<br>
023 * Daemon plugin are automatically loaded when the application is started.<br>
024 * Icy will always execute them in a separate thread for safety so the interface extends
025 * PluginThreaded.<br>
026 * They can be enabled / disabled from the Icy preferences window.
027 * 
028 * @author Stephane
029 */
030public interface PluginDaemon extends PluginThreaded
031{
032    /**
033     * Called by Icy to initialize the daemon plugin (init singleton, register listeners...)<br>
034     * This method is synchronous and should not consume too much time.
035     */
036    public void init();
037
038    /**
039     * Called by Icy to execute the daemon plugin.<br>
040     * This method is executed in a separate thread and should not return until <code>stop()</code>
041     * is called.
042     */
043    @Override
044    public void run();
045
046    /**
047     * Called by Icy to stop the daemon plugin.<br>
048     * After this method has been called, the <code>run()</code> should terminate.<br>
049     * The method is also used to "uninitialize" plugin (unregister listeners).<br>
050     * This method is synchronous and should not consume too much time.
051     */
052    public void stop();
053}