2 * Copyright (C) 2016 - 2024 Free Software Foundation
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 package org.mxchange.jcore.manager.application;
19 import org.mxchange.jcore.application.Application;
20 import org.mxchange.jcore.exceptions.MenuInitializationException;
21 import org.mxchange.jcore.facade.BaseFacade;
26 * @author Roland Häder<roland@mxchange.org>
28 public class ApplicationManager extends BaseFacade implements ManageableApplication {
31 * Self instance of this manager
33 private static ManageableApplication selfInstance;
36 * Getter for a singleton application manager
38 * @param application An instance of a Application class
40 * @return Get a managable application
42 public static ManageableApplication getSingeltonManager (final Application application) {
43 // Application instance must be set
44 if (null == application) {
46 throw new NullPointerException("application is null"); //NOI18N
49 // Is own instance set?
50 if (null == selfInstance) {
52 selfInstance = new ApplicationManager(application);
60 * Constructor for this manager
62 * @param application An instance of an Application class
64 private ApplicationManager (final Application application) {
65 // Invoke super constructor
70 public void doShutdown () {
71 // Shutdown this manager, for now nothing
72 // TODO Maybe add something here?
76 public void start () throws MenuInitializationException {
77 // Bootstrap application
78 this.getApplication().doBootstrap();
81 this.getApplication().doMainLoop();