All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openbase.jul.iface.Launchable Maven / Gradle / Ivy

package org.openbase.jul.iface;

import org.openbase.jul.exception.CouldNotPerformException;

/*
 * #%L
 * JUL Interface
 * %%
 * Copyright (C) 2015 - 2022 openbase.org
 * %%
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Lesser Public License for more details.
 * 
 * You should have received a copy of the GNU General Lesser Public
 * License along with this program.  If not, see
 * .
 * #L%
 *
 *
 * @author Divine Threepwood
 *
 * This interface can be implemented by any applications which should be launchable by a Launcher instance.
 * @param  the configuration type of this launchable.
 *
 */
public interface Launchable extends Manageable, DefaultInitializableImpl {

    /**
     * Method starts the referred application.
     *
     * @return returns true if the application was successfully started in case the application was started with restrictions false will be returned.
     * @throws CouldNotPerformException Is thrown in case any error occurs during the startup phase.
     * @throws InterruptedException is thrown in case the thread was externally interrupted.
     */
    default boolean launch() throws CouldNotPerformException, InterruptedException {
        try {
            init();
            activate();
        } catch (CouldNotPerformException ex) {
            throw new CouldNotPerformException("Could not launch " + this, ex);
        }
        return true;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy