Skip to content
Snippets Groups Projects
Select Git revision
  • master default protected
  • react
2 results

Server.java

Blame
  • Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    Server.java 6.32 KiB
    /*
     * Copyright (C) 2020 by Savoir-faire Linux
     * Authors: William Enright <william.enright@savoirfairelinux.com>
     *          Ndeye Anna Ndiaye <anna.ndiaye@savoirfairelinux.com>
     *          Johnny Flores <johnny.flores@savoirfairelinux.com>
     *          Mohammed Raza <mohammed.raza@savoirfairelinux.com>
     *          Felix Sidokhine <felix.sidokhine@savoirfairelinux.com>
     *
     *
     * This program is free software; you can redistribute it and/or modify
     * it under the terms of the GNU 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 Public License for more details.
     *
     * You should have received a copy of the GNU General Public License
     * along with this program.  If not, see <https://www.gnu.org/licenses/>.
     */
    package net.jami.jams.server;
    
    import com.jsoniter.JsonIterator;
    import lombok.extern.slf4j.Slf4j;
    import net.jami.datastore.main.DataStore;
    import net.jami.jams.common.authentication.AuthenticationSourceType;
    import net.jami.jams.common.authentication.local.LocalAuthSettings;
    import net.jami.jams.common.authmodule.AuthenticationModule;
    import net.jami.jams.common.cryptoengineapi.CertificateAuthority;
    import net.jami.jams.common.jami.NameServer;
    import net.jami.jams.common.serialization.JsoniterRegistry;
    import net.jami.jams.common.server.ServerSettings;
    import net.jami.jams.common.updater.AppUpdater;
    import net.jami.jams.common.utils.LibraryLoader;
    import net.jami.jams.nameserver.LocalNameServer;
    import net.jami.jams.nameserver.PublicNameServer;
    import net.jami.jams.server.core.TomcatLauncher;
    import net.jami.jams.server.licensing.LicenseService;
    import net.jami.jams.server.startup.AuthModuleLoader;
    import net.jami.jams.server.startup.CryptoEngineLoader;
    
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import java.util.concurrent.atomic.AtomicBoolean;
    
    @Slf4j
    //In order to make this "stoppable" to simply, I turned the server itself into a thread.
    //The reasoning: the main two problems
    public class Server {
    
        public final static AtomicBoolean isInstalled = new AtomicBoolean(false);
        public final static AtomicBoolean activated = new AtomicBoolean(false);
    
        static {
            JsoniterRegistry.initCodecs();
        }
    
        public static DataStore dataStore;
        //This one gets loaded via JAR, to make it more flexible.
        public static CertificateAuthority certificateAuthority;
        public static AuthenticationModule userAuthenticationModule;
        public static NameServer nameServer;
        public static TomcatLauncher tomcatLauncher = null;
        public static LicenseService licenseService = new LicenseService();
        public static AppUpdater appUpdater;
    
        public Server(AppUpdater appUpdater) {