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

net.scattersphere.server.Main Maven / Gradle / Ivy

The newest version!
/*
 * Scattersphere
 * Copyright 2014-2015, Scattersphere Project.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package net.scattersphere.server;

import java.util.Properties;

/**
 * Main entrypoint for the Scattersphere server.
 *
 * Created by kenji on 11/16/14.
 */
public class Main {

    public static final Properties serverProperties = new Properties();

    public static final int VERSION_MAJOR = 0;
    public static final int VERSION_MINOR = 0;
    public static final int VERSION_RELEASE = 4;

    public static void main(String args[]) throws Exception {
        System.err.println("*** Scattersphere Server v" + Main.getRelease());
        System.err.println("*** Released under the Apache v2.0 License");

        try {
            serverProperties.load(Main.class.getResourceAsStream("/server.properties"));
        } catch(Exception ex) {
            System.err.println("*** Warning: unable to load server.properties.  Falling back to defaults.");
        }

        new Server(args);
        new StreamServer(args);

        // Since the Server code starts and runs asynchronously in the main thread, this is a way to keep the server from
        // exiting.

        synchronized(Main.class) {
            while(true) {
                Main.class.wait();
            }
        }
    }

    public static String getRelease() {
        return "" + VERSION_MAJOR + "." + VERSION_MINOR + "." + VERSION_RELEASE;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy