
package de.ivu.elect.util;

import java.io.Serializable;
import java.lang.management.ManagementFactory;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class EnvironmentVariables implements Serializable {

  private static final long serialVersionUID = 1L;

  private static final Logger LOG = LoggerFactory.getLogger(EnvironmentVariables.class);

  public String getServerName() {
    try {
      return InetAddress.getLocalHost().getHostName();
    } catch (UnknownHostException e) {
      // HINT: Thrown to indicate that the IP address of a host could not be determined.
      LOG.warn(e.getMessage(), e);
      return "???";
    }
  }

  public Date getStartzeit() {
    return new Date(ManagementFactory.getRuntimeMXBean().getUptime());
  }
}
