/**
   * start RMI-server and multicast service.
   *
   * @return True if successful, false if failed.
   */
  private boolean startupProcedure() {
    // Start RMI-server
    networkinterface.startRMIServer();
    boolean RMIRunning = networkinterface.bindRMIServer(nodeManager, "NodeServer");

    // Start multicastservice
    if (networkinterface.setupMulticastservice()) {
      networkinterface.runMulticastservice();
    } else {
      return false;
    }
    return RMIRunning;
  }
  /**
   * Creates the Server Object.
   *
   * @throws RemoteException
   */
  public Server(
      boolean enableTerminal,
      String networkIP,
      int tcpPort,
      int rmiPort,
      String multicastIP,
      int multicastPort)
      throws RemoteException {
    this.serverIP = networkIP;

    // setup terminal
    terminal = new Terminal(this);

    printTerminal(
        "SystemY 2014 Server "
            + version
            + " - Created by: Thomas Huybrechts, Quinten Van Hasselt, Arthur Janssens, Dries Blontrock");
    printTerminalInfo("Server starting...");

    nodeManager = new NodeManager();
    fileManager = new FileSystemManager();
    failureManager = new FailureManager(this);

    // setup networkinterface
    networkinterface =
        new Networkinterface(networkIP, rmiPort, tcpPort, tcpPort, multicastIP, multicastPort);

    // setup node lifecycle services
    discoveryManager = new DiscoveryManager(networkinterface.getMulticastObserver(), this);

    // start networkinterface
    if (startupProcedure()) {
      printTerminalInfo("Server ready.");
    } else {
      printTerminalError("Server not fully operational, resolve the issue and reboot the server.");
    }

    if (enableTerminal) {
      activateTerminal();
    }
  }